Files

271 lines
652 KiB
JavaScript

(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function i(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(l){if(l.ep)return;l.ep=!0;const c=i(l);fetch(l.href,c)}})();var td={exports:{}},$r={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Gy;function XS(){if(Gy)return $r;Gy=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(a,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),"key"in l){c={};for(var d in l)d!=="key"&&(c[d]=l[d])}else c=l;return l=c.ref,{$$typeof:n,type:a,key:u,ref:l!==void 0?l:null,props:c}}return $r.Fragment=e,$r.jsx=i,$r.jsxs=i,$r}var Ky;function JS(){return Ky||(Ky=1,td.exports=XS()),td.exports}var g=JS(),nd={exports:{}},be={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Yy;function QS(){if(Yy)return be;Yy=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function _(A){return A===null||typeof A!="object"?null:(A=x&&A[x]||A["@@iterator"],typeof A=="function"?A:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,j={};function k(A,q,J){this.props=A,this.context=q,this.refs=j,this.updater=J||S}k.prototype.isReactComponent={},k.prototype.setState=function(A,q){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,q,"setState")},k.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function M(){}M.prototype=k.prototype;function C(A,q,J){this.props=A,this.context=q,this.refs=j,this.updater=J||S}var P=C.prototype=new M;P.constructor=C,T(P,k.prototype),P.isPureReactComponent=!0;var K=Array.isArray;function G(){}var H={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function Z(A,q,J){var ne=J.ref;return{$$typeof:n,type:A,key:q,ref:ne!==void 0?ne:null,props:J}}function se(A,q){return Z(A.type,q,A.props)}function me(A){return typeof A=="object"&&A!==null&&A.$$typeof===n}function ye(A){var q={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(J){return q[J]})}var Ae=/\/+/g;function Ne(A,q){return typeof A=="object"&&A!==null&&A.key!=null?ye(""+A.key):q.toString(36)}function Be(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(G,G):(A.status="pending",A.then(function(q){A.status==="pending"&&(A.status="fulfilled",A.value=q)},function(q){A.status==="pending"&&(A.status="rejected",A.reason=q)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function L(A,q,J,ne,de){var ge=typeof A;(ge==="undefined"||ge==="boolean")&&(A=null);var we=!1;if(A===null)we=!0;else switch(ge){case"bigint":case"string":case"number":we=!0;break;case"object":switch(A.$$typeof){case n:case e:we=!0;break;case y:return we=A._init,L(we(A._payload),q,J,ne,de)}}if(we)return de=de(A),we=ne===""?"."+Ne(A,0):ne,K(de)?(J="",we!=null&&(J=we.replace(Ae,"$&/")+"/"),L(de,q,J,"",function(at){return at})):de!=null&&(me(de)&&(de=se(de,J+(de.key==null||A&&A.key===de.key?"":(""+de.key).replace(Ae,"$&/")+"/")+we)),q.push(de)),1;we=0;var ke=ne===""?".":ne+":";if(K(A))for(var qe=0;qe<A.length;qe++)ne=A[qe],ge=ke+Ne(ne,qe),we+=L(ne,q,J,ge,de);else if(qe=_(A),typeof qe=="function")for(A=qe.call(A),qe=0;!(ne=A.next()).done;)ne=ne.value,ge=ke+Ne(ne,qe++),we+=L(ne,q,J,ge,de);else if(ge==="object"){if(typeof A.then=="function")return L(Be(A),q,J,ne,de);throw q=String(A),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return we}function W(A,q,J){if(A==null)return A;var ne=[],de=0;return L(A,ne,"","",function(ge){return q.call(J,ge,de++)}),ne}function Q(A){if(A._status===-1){var q=A._result;q=q(),q.then(function(J){(A._status===0||A._status===-1)&&(A._status=1,A._result=J)},function(J){(A._status===0||A._status===-1)&&(A._status=2,A._result=J)}),A._status===-1&&(A._status=0,A._result=q)}if(A._status===1)return A._result.default;throw A._result}var le=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},ue={map:W,forEach:function(A,q,J){W(A,function(){q.apply(this,arguments)},J)},count:function(A){var q=0;return W(A,function(){q++}),q},toArray:function(A){return W(A,function(q){return q})||[]},only:function(A){if(!me(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return be.Activity=v,be.Children=ue,be.Component=k,be.Fragment=i,be.Profiler=l,be.PureComponent=C,be.StrictMode=a,be.Suspense=m,be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,be.__COMPILER_RUNTIME={__proto__:null,c:function(A){return H.H.useMemoCache(A)}},be.cache=function(A){return function(){return A.apply(null,arguments)}},be.cacheSignal=function(){return null},be.cloneElement=function(A,q,J){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var ne=T({},A.props),de=A.key;if(q!=null)for(ge in q.key!==void 0&&(de=""+q.key),q)!Y.call(q,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&q.ref===void 0||(ne[ge]=q[ge]);var ge=arguments.length-2;if(ge===1)ne.children=J;else if(1<ge){for(var we=Array(ge),ke=0;ke<ge;ke++)we[ke]=arguments[ke+2];ne.children=we}return Z(A.type,de,ne)},be.createContext=function(A){return A={$$typeof:u,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:c,_context:A},A},be.createElement=function(A,q,J){var ne,de={},ge=null;if(q!=null)for(ne in q.key!==void 0&&(ge=""+q.key),q)Y.call(q,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(de[ne]=q[ne]);var we=arguments.length-2;if(we===1)de.children=J;else if(1<we){for(var ke=Array(we),qe=0;qe<we;qe++)ke[qe]=arguments[qe+2];de.children=ke}if(A&&A.defaultProps)for(ne in we=A.defaultProps,we)de[ne]===void 0&&(de[ne]=we[ne]);return Z(A,ge,de)},be.createRef=function(){return{current:null}},be.forwardRef=function(A){return{$$typeof:d,render:A}},be.isValidElement=me,be.lazy=function(A){return{$$typeof:y,_payload:{_status:-1,_result:A},_init:Q}},be.memo=function(A,q){return{$$typeof:p,type:A,compare:q===void 0?null:q}},be.startTransition=function(A){var q=H.T,J={};H.T=J;try{var ne=A(),de=H.S;de!==null&&de(J,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(G,le)}catch(ge){le(ge)}finally{q!==null&&J.types!==null&&(q.types=J.types),H.T=q}},be.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},be.use=function(A){return H.H.use(A)},be.useActionState=function(A,q,J){return H.H.useActionState(A,q,J)},be.useCallback=function(A,q){return H.H.useCallback(A,q)},be.useContext=function(A){return H.H.useContext(A)},be.useDebugValue=function(){},be.useDeferredValue=function(A,q){return H.H.useDeferredValue(A,q)},be.useEffect=function(A,q){return H.H.useEffect(A,q)},be.useEffectEvent=function(A){return H.H.useEffectEvent(A)},be.useId=function(){return H.H.useId()},be.useImperativeHandle=function(A,q,J){return H.H.useImperativeHandle(A,q,J)},be.useInsertionEffect=function(A,q){return H.H.useInsertionEffect(A,q)},be.useLayoutEffect=function(A,q){return H.H.useLayoutEffect(A,q)},be.useMemo=function(A,q){return H.H.useMemo(A,q)},be.useOptimistic=function(A,q){return H.H.useOptimistic(A,q)},be.useReducer=function(A,q,J){return H.H.useReducer(A,q,J)},be.useRef=function(A){return H.H.useRef(A)},be.useState=function(A){return H.H.useState(A)},be.useSyncExternalStore=function(A,q,J){return H.H.useSyncExternalStore(A,q,J)},be.useTransition=function(){return H.H.useTransition()},be.version="19.2.7",be}var Xy;function Sf(){return Xy||(Xy=1,nd.exports=QS()),nd.exports}var D=Sf(),sd={exports:{}},qr={},id={exports:{}},ad={};/**
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Jy;function ZS(){return Jy||(Jy=1,(function(n){function e(L,W){var Q=L.length;L.push(W);e:for(;0<Q;){var le=Q-1>>>1,ue=L[le];if(0<l(ue,W))L[le]=W,L[Q]=ue,Q=le;else break e}}function i(L){return L.length===0?null:L[0]}function a(L){if(L.length===0)return null;var W=L[0],Q=L.pop();if(Q!==W){L[0]=Q;e:for(var le=0,ue=L.length,A=ue>>>1;le<A;){var q=2*(le+1)-1,J=L[q],ne=q+1,de=L[ne];if(0>l(J,Q))ne<ue&&0>l(de,J)?(L[le]=de,L[ne]=Q,le=ne):(L[le]=J,L[q]=Q,le=q);else if(ne<ue&&0>l(de,Q))L[le]=de,L[ne]=Q,le=ne;else break e}}return W}function l(L,W){var Q=L.sortIndex-W.sortIndex;return Q!==0?Q:L.id-W.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();n.unstable_now=function(){return u.now()-d}}var m=[],p=[],y=1,v=null,x=3,_=!1,S=!1,T=!1,j=!1,k=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function P(L){for(var W=i(p);W!==null;){if(W.callback===null)a(p);else if(W.startTime<=L)a(p),W.sortIndex=W.expirationTime,e(m,W);else break;W=i(p)}}function K(L){if(T=!1,P(L),!S)if(i(m)!==null)S=!0,G||(G=!0,ye());else{var W=i(p);W!==null&&Be(K,W.startTime-L)}}var G=!1,H=-1,Y=5,Z=-1;function se(){return j?!0:!(n.unstable_now()-Z<Y)}function me(){if(j=!1,G){var L=n.unstable_now();Z=L;var W=!0;try{e:{S=!1,T&&(T=!1,M(H),H=-1),_=!0;var Q=x;try{t:{for(P(L),v=i(m);v!==null&&!(v.expirationTime>L&&se());){var le=v.callback;if(typeof le=="function"){v.callback=null,x=v.priorityLevel;var ue=le(v.expirationTime<=L);if(L=n.unstable_now(),typeof ue=="function"){v.callback=ue,P(L),W=!0;break t}v===i(m)&&a(m),P(L)}else a(m);v=i(m)}if(v!==null)W=!0;else{var A=i(p);A!==null&&Be(K,A.startTime-L),W=!1}}break e}finally{v=null,x=Q,_=!1}W=void 0}}finally{W?ye():G=!1}}}var ye;if(typeof C=="function")ye=function(){C(me)};else if(typeof MessageChannel<"u"){var Ae=new MessageChannel,Ne=Ae.port2;Ae.port1.onmessage=me,ye=function(){Ne.postMessage(null)}}else ye=function(){k(me,0)};function Be(L,W){H=k(function(){L(n.unstable_now())},W)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(L){L.callback=null},n.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<L?Math.floor(1e3/L):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(L){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var Q=x;x=W;try{return L()}finally{x=Q}},n.unstable_requestPaint=function(){j=!0},n.unstable_runWithPriority=function(L,W){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var Q=x;x=L;try{return W()}finally{x=Q}},n.unstable_scheduleCallback=function(L,W,Q){var le=n.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?le+Q:le):Q=le,L){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=Q+ue,L={id:y++,callback:W,priorityLevel:L,startTime:Q,expirationTime:ue,sortIndex:-1},Q>le?(L.sortIndex=Q,e(p,L),i(m)===null&&L===i(p)&&(T?(M(H),H=-1):T=!0,Be(K,Q-le))):(L.sortIndex=ue,e(m,L),S||_||(S=!0,G||(G=!0,ye()))),L},n.unstable_shouldYield=se,n.unstable_wrapCallback=function(L){var W=x;return function(){var Q=x;x=W;try{return L.apply(this,arguments)}finally{x=Q}}}})(ad)),ad}var Qy;function WS(){return Qy||(Qy=1,id.exports=ZS()),id.exports}var rd={exports:{}},zt={};/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Zy;function e1(){if(Zy)return zt;Zy=1;var n=Sf();function e(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var a={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(m,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,children:m,containerInfo:p,implementation:y}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,zt.createPortal=function(m,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(e(299));return c(m,p,null,y)},zt.flushSync=function(m){var p=u.T,y=a.p;try{if(u.T=null,a.p=2,m)return m()}finally{u.T=p,a.p=y,a.d.f()}},zt.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(m,p))},zt.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},zt.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var y=p.as,v=d(y,p.crossOrigin),x=typeof p.integrity=="string"?p.integrity:void 0,_=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?a.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:_}):y==="script"&&a.d.X(m,{crossOrigin:v,integrity:x,fetchPriority:_,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},zt.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=d(p.as,p.crossOrigin);a.d.M(m,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(m)},zt.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=d(y,p.crossOrigin);a.d.L(m,y,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},zt.preloadModule=function(m,p){if(typeof m=="string")if(p){var y=d(p.as,p.crossOrigin);a.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(m)},zt.requestFormReset=function(m){a.d.r(m)},zt.unstable_batchedUpdates=function(m,p){return m(p)},zt.useFormState=function(m,p,y){return u.H.useFormState(m,p,y)},zt.useFormStatus=function(){return u.H.useHostTransitionStatus()},zt.version="19.2.7",zt}var Wy;function t1(){if(Wy)return rd.exports;Wy=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),rd.exports=e1(),rd.exports}/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var e0;function n1(){if(e0)return qr;e0=1;var n=WS(),e=Sf(),i=t1();function a(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var s=t,r=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(r=s.return),t=s.return;while(t)}return s.tag===3?r:null}function u(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function d(t){if(t.tag===31){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function m(t){if(c(t)!==t)throw Error(a(188))}function p(t){var s=t.alternate;if(!s){if(s=c(t),s===null)throw Error(a(188));return s!==t?null:t}for(var r=t,o=s;;){var h=r.return;if(h===null)break;var f=h.alternate;if(f===null){if(o=h.return,o!==null){r=o;continue}break}if(h.child===f.child){for(f=h.child;f;){if(f===r)return m(h),t;if(f===o)return m(h),s;f=f.sibling}throw Error(a(188))}if(r.return!==o.return)r=h,o=f;else{for(var b=!1,w=h.child;w;){if(w===r){b=!0,r=h,o=f;break}if(w===o){b=!0,o=h,r=f;break}w=w.sibling}if(!b){for(w=f.child;w;){if(w===r){b=!0,r=f,o=h;break}if(w===o){b=!0,o=f,r=h;break}w=w.sibling}if(!b)throw Error(a(189))}}if(r.alternate!==o)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?t:s}function y(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=y(t),s!==null)return s;t=t.sibling}return null}var v=Object.assign,x=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),C=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),se=Symbol.for("react.memo_cache_sentinel"),me=Symbol.iterator;function ye(t){return t===null||typeof t!="object"?null:(t=me&&t[me]||t["@@iterator"],typeof t=="function"?t:null)}var Ae=Symbol.for("react.client.reference");function Ne(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Ae?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case T:return"Fragment";case k:return"Profiler";case j:return"StrictMode";case K:return"Suspense";case G:return"SuspenseList";case Z:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case C:return t.displayName||"Context";case M:return(t._context.displayName||"Context")+".Consumer";case P:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case H:return s=t.displayName||null,s!==null?s:Ne(t.type)||"Memo";case Y:s=t._payload,t=t._init;try{return Ne(t(s))}catch{}}return null}var Be=Array.isArray,L=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},le=[],ue=-1;function A(t){return{current:t}}function q(t){0>ue||(t.current=le[ue],le[ue]=null,ue--)}function J(t,s){ue++,le[ue]=t.current,t.current=s}var ne=A(null),de=A(null),ge=A(null),we=A(null);function ke(t,s){switch(J(ge,s),J(de,t),J(ne,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?py(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=py(s),t=gy(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}q(ne),J(ne,t)}function qe(){q(ne),q(de),q(ge)}function at(t){t.memoizedState!==null&&J(we,t);var s=ne.current,r=gy(s,t.type);s!==r&&(J(de,t),J(ne,r))}function jn(t){de.current===t&&(q(ne),q(de)),we.current===t&&(q(we),zr._currentValue=Q)}var Nn,as;function ee(t){if(Nn===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Nn=s&&s[1]||"",as=-1<r.stack.indexOf(`
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Nn+t+as}var Ce=!1;function ze(t,s){if(!t||Ce)return"";Ce=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(s){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(V){var z=V}Reflect.construct(t,[],I)}else{try{I.call()}catch(V){z=V}t.call(I.prototype)}}else{try{throw Error()}catch(V){z=V}(I=t())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(V){if(V&&z&&typeof V.stack=="string")return[V.stack,z.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=o.DetermineComponentFrameRoot(),b=f[0],w=f[1];if(b&&w){var E=b.split(`
`),U=w.split(`
`);for(h=o=0;o<E.length&&!E[o].includes("DetermineComponentFrameRoot");)o++;for(;h<U.length&&!U[h].includes("DetermineComponentFrameRoot");)h++;if(o===E.length||h===U.length)for(o=E.length-1,h=U.length-1;1<=o&&0<=h&&E[o]!==U[h];)h--;for(;1<=o&&0<=h;o--,h--)if(E[o]!==U[h]){if(o!==1||h!==1)do if(o--,h--,0>h||E[o]!==U[h]){var $=`
`+E[o].replace(" at new "," at ");return t.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",t.displayName)),$}while(1<=o&&0<=h);break}}}finally{Ce=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?ee(r):""}function Re(t,s){switch(t.tag){case 26:case 27:case 5:return ee(t.type);case 16:return ee("Lazy");case 13:return t.child!==s&&s!==null?ee("Suspense Fallback"):ee("Suspense");case 19:return ee("SuspenseList");case 0:case 15:return ze(t.type,!1);case 11:return ze(t.type.render,!1);case 1:return ze(t.type,!0);case 31:return ee("Activity");default:return""}}function rt(t){try{var s="",r=null;do s+=Re(t,r),r=t,t=t.return;while(t);return s}catch(o){return`
Error generating stack: `+o.message+`
`+o.stack}}var st=Object.prototype.hasOwnProperty,ht=n.unstable_scheduleCallback,it=n.unstable_cancelCallback,Qt=n.unstable_shouldYield,$n=n.unstable_requestPaint,Ze=n.unstable_now,ci=n.unstable_getCurrentPriorityLevel,gt=n.unstable_ImmediatePriority,jt=n.unstable_UserBlockingPriority,qn=n.unstable_NormalPriority,Rn=n.unstable_LowPriority,Cs=n.unstable_IdlePriority,$i=n.log,ui=n.unstable_setDisableYieldValue,rs=null,yt=null;function cn(t){if(typeof $i=="function"&&ui(t),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(rs,t)}catch{}}var Vt=Math.clz32?Math.clz32:Ao,Ct=Math.log,Eo=Math.LN2;function Ao(t){return t>>>=0,t===0?32:31-(Ct(t)/Eo|0)|0}var hi=256,Fn=262144,di=4194304;function os(t){var s=t&42;if(s!==0)return s;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function qi(t,s,r){var o=t.pendingLanes;if(o===0)return 0;var h=0,f=t.suspendedLanes,b=t.pingedLanes;t=t.warmLanes;var w=o&134217727;return w!==0?(o=w&~f,o!==0?h=os(o):(b&=w,b!==0?h=os(b):r||(r=w&~t,r!==0&&(h=os(r))))):(w=o&~f,w!==0?h=os(w):b!==0?h=os(b):r||(r=o&~t,r!==0&&(h=os(r)))),h===0?0:s!==0&&s!==h&&(s&f)===0&&(f=h&-h,r=s&-s,f>=r||f===32&&(r&4194048)!==0)?s:h}function fi(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function Gc(t,s){switch(t){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 jo(){var t=di;return di<<=1,(di&62914560)===0&&(di=4194304),t}function Qa(t){for(var s=[],r=0;31>r;r++)s.push(t);return s}function Os(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Kc(t,s,r,o,h,f){var b=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var w=t.entanglements,E=t.expirationTimes,U=t.hiddenUpdates;for(r=b&~r;0<r;){var $=31-Vt(r),I=1<<$;w[$]=0,E[$]=-1;var z=U[$];if(z!==null)for(U[$]=null,$=0;$<z.length;$++){var V=z[$];V!==null&&(V.lane&=-536870913)}r&=~I}o!==0&&No(t,o,0),f!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=f&~(b&~s))}function No(t,s,r){t.pendingLanes|=s,t.suspendedLanes&=~s;var o=31-Vt(s);t.entangledLanes|=s,t.entanglements[o]=t.entanglements[o]|1073741824|r&261930}function Za(t,s){var r=t.entangledLanes|=s;for(t=t.entanglements;r;){var o=31-Vt(r),h=1<<o;h&s|t[o]&s&&(t[o]|=s),r&=~h}}function Ro(t,s){var r=s&-s;return r=(r&42)!==0?1:Wa(r),(r&(t.suspendedLanes|s))!==0?0:r}function Wa(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function er(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ko(){var t=W.p;return t!==0?t:(t=window.event,t===void 0?32:Py(t.type))}function Co(t,s){var r=W.p;try{return W.p=t,s()}finally{W.p=r}}var In=Math.random().toString(36).slice(2),R="__reactFiber$"+In,X="__reactProps$"+In,ae="__reactContainer$"+In,un="__reactEvents$"+In,hn="__reactListeners$"+In,dt="__reactHandles$"+In,dn="__reactResources$"+In,Je="__reactMarker$"+In;function tt(t){delete t[R],delete t[X],delete t[un],delete t[hn],delete t[dt]}function kn(t){var s=t[R];if(s)return s;for(var r=t.parentNode;r;){if(s=r[ae]||r[R]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(t=Sy(t);t!==null;){if(r=t[R])return r;t=Sy(t)}return s}t=r,r=t.parentNode}return null}function Pe(t){if(t=t[R]||t[ae]){var s=t.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return t}return null}function Nt(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(a(33))}function Ue(t){var s=t[dn];return s||(s=t[dn]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ve(t){t[Je]=!0}var sm=new Set,im={};function mi(t,s){Fi(t,s),Fi(t+"Capture",s)}function Fi(t,s){for(im[t]=s,t=0;t<s.length;t++)sm.add(s[t])}var Vw=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]*$"),am={},rm={};function Hw(t){return st.call(rm,t)?!0:st.call(am,t)?!1:Vw.test(t)?rm[t]=!0:(am[t]=!0,!1)}function Oo(t,s,r){if(Hw(s))if(r===null)t.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var o=s.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+r)}}function Do(t,s,r){if(r===null)t.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+r)}}function ls(t,s,r,o){if(o===null)t.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttributeNS(s,r,""+o)}}function fn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function om(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function $w(t,s,r){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,s);if(!t.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,f=o.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return h.call(this)},set:function(b){r=""+b,f.call(this,b)}}),Object.defineProperty(t,s,{enumerable:o.enumerable}),{getValue:function(){return r},setValue:function(b){r=""+b},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Yc(t){if(!t._valueTracker){var s=om(t)?"checked":"value";t._valueTracker=$w(t,s,""+t[s])}}function lm(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var r=s.getValue(),o="";return t&&(o=om(t)?t.checked?"true":"false":t.value),t=o,t!==r?(s.setValue(t),!0):!1}function Mo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var qw=/[\n"\\]/g;function mn(t){return t.replace(qw,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Xc(t,s,r,o,h,f,b,w){t.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?t.type=b:t.removeAttribute("type"),s!=null?b==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+fn(s)):t.value!==""+fn(s)&&(t.value=""+fn(s)):b!=="submit"&&b!=="reset"||t.removeAttribute("value"),s!=null?Jc(t,b,fn(s)):r!=null?Jc(t,b,fn(r)):o!=null&&t.removeAttribute("value"),h==null&&f!=null&&(t.defaultChecked=!!f),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.name=""+fn(w):t.removeAttribute("name")}function cm(t,s,r,o,h,f,b,w){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(t.type=f),s!=null||r!=null){if(!(f!=="submit"&&f!=="reset"||s!=null)){Yc(t);return}r=r!=null?""+fn(r):"",s=s!=null?""+fn(s):r,w||s===t.value||(t.value=s),t.defaultValue=s}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=w?t.checked:!!o,t.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(t.name=b),Yc(t)}function Jc(t,s,r){s==="number"&&Mo(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function Ii(t,s,r,o){if(t=t.options,s){s={};for(var h=0;h<r.length;h++)s["$"+r[h]]=!0;for(r=0;r<t.length;r++)h=s.hasOwnProperty("$"+t[r].value),t[r].selected!==h&&(t[r].selected=h),h&&o&&(t[r].defaultSelected=!0)}else{for(r=""+fn(r),s=null,h=0;h<t.length;h++){if(t[h].value===r){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}s!==null||t[h].disabled||(s=t[h])}s!==null&&(s.selected=!0)}}function um(t,s,r){if(s!=null&&(s=""+fn(s),s!==t.value&&(t.value=s),r==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=r!=null?""+fn(r):""}function hm(t,s,r,o){if(s==null){if(o!=null){if(r!=null)throw Error(a(92));if(Be(o)){if(1<o.length)throw Error(a(93));o=o[0]}r=o}r==null&&(r=""),s=r}r=fn(s),t.defaultValue=r,o=t.textContent,o===r&&o!==""&&o!==null&&(t.value=o),Yc(t)}function Gi(t,s){if(s){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=s;return}}t.textContent=s}var Fw=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(t,s,r){var o=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?o?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":o?t.setProperty(s,r):typeof r!="number"||r===0||Fw.has(s)?s==="float"?t.cssFloat=r:t[s]=(""+r).trim():t[s]=r+"px"}function fm(t,s,r){if(s!=null&&typeof s!="object")throw Error(a(62));if(t=t.style,r!=null){for(var o in r)!r.hasOwnProperty(o)||s!=null&&s.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in s)o=s[h],s.hasOwnProperty(h)&&r[h]!==o&&dm(t,h,o)}else for(var f in s)s.hasOwnProperty(f)&&dm(t,f,s[f])}function Qc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 Iw=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"]]),Gw=/^[\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 Bo(t){return Gw.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function cs(){}var Zc=null;function Wc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ki=null,Yi=null;function mm(t){var s=Pe(t);if(s&&(t=s.stateNode)){var r=t[X]||null;e:switch(t=s.stateNode,s.type){case"input":if(Xc(t,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+mn(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var o=r[s];if(o!==t&&o.form===t.form){var h=o[X]||null;if(!h)throw Error(a(90));Xc(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(s=0;s<r.length;s++)o=r[s],o.form===t.form&&lm(o)}break e;case"textarea":um(t,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Ii(t,!!r.multiple,s,!1)}}}var eu=!1;function pm(t,s,r){if(eu)return t(s,r);eu=!0;try{var o=t(s);return o}finally{if(eu=!1,(Ki!==null||Yi!==null)&&(_l(),Ki&&(s=Ki,t=Yi,Yi=Ki=null,mm(s),t)))for(s=0;s<t.length;s++)mm(t[s])}}function tr(t,s){var r=t.stateNode;if(r===null)return null;var o=r[X]||null;if(o===null)return null;r=o[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":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(a(231,s,typeof r));return r}var us=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tu=!1;if(us)try{var nr={};Object.defineProperty(nr,"passive",{get:function(){tu=!0}}),window.addEventListener("test",nr,nr),window.removeEventListener("test",nr,nr)}catch{tu=!1}var Ds=null,nu=null,Uo=null;function gm(){if(Uo)return Uo;var t,s=nu,r=s.length,o,h="value"in Ds?Ds.value:Ds.textContent,f=h.length;for(t=0;t<r&&s[t]===h[t];t++);var b=r-t;for(o=1;o<=b&&s[r-o]===h[f-o];o++);return Uo=h.slice(t,1<o?1-o:void 0)}function Lo(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function zo(){return!0}function ym(){return!1}function Ft(t){function s(r,o,h,f,b){this._reactName=r,this._targetInst=h,this.type=o,this.nativeEvent=f,this.target=b,this.currentTarget=null;for(var w in t)t.hasOwnProperty(w)&&(r=t[w],this[w]=r?r(f):f[w]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?zo:ym,this.isPropagationStopped=ym,this}return v(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=zo)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=zo)},persist:function(){},isPersistent:zo}),s}var pi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Po=Ft(pi),sr=v({},pi,{view:0,detail:0}),Kw=Ft(sr),su,iu,ir,Vo=v({},sr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ru,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ir&&(ir&&t.type==="mousemove"?(su=t.screenX-ir.screenX,iu=t.screenY-ir.screenY):iu=su=0,ir=t),su)},movementY:function(t){return"movementY"in t?t.movementY:iu}}),bm=Ft(Vo),Yw=v({},Vo,{dataTransfer:0}),Xw=Ft(Yw),Jw=v({},sr,{relatedTarget:0}),au=Ft(Jw),Qw=v({},pi,{animationName:0,elapsedTime:0,pseudoElement:0}),Zw=Ft(Qw),Ww=v({},pi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),e_=Ft(Ww),t_=v({},pi,{data:0}),vm=Ft(t_),n_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},s_={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"},i_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function a_(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=i_[t])?!!s[t]:!1}function ru(){return a_}var r_=v({},sr,{key:function(t){if(t.key){var s=n_[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Lo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?s_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ru,charCode:function(t){return t.type==="keypress"?Lo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Lo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),o_=Ft(r_),l_=v({},Vo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xm=Ft(l_),c_=v({},sr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ru}),u_=Ft(c_),h_=v({},pi,{propertyName:0,elapsedTime:0,pseudoElement:0}),d_=Ft(h_),f_=v({},Vo,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),m_=Ft(f_),p_=v({},pi,{newState:0,oldState:0}),g_=Ft(p_),y_=[9,13,27,32],ou=us&&"CompositionEvent"in window,ar=null;us&&"documentMode"in document&&(ar=document.documentMode);var b_=us&&"TextEvent"in window&&!ar,wm=us&&(!ou||ar&&8<ar&&11>=ar),_m=" ",Sm=!1;function Tm(t,s){switch(t){case"keyup":return y_.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Em(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xi=!1;function v_(t,s){switch(t){case"compositionend":return Em(s);case"keypress":return s.which!==32?null:(Sm=!0,_m);case"textInput":return t=s.data,t===_m&&Sm?null:t;default:return null}}function x_(t,s){if(Xi)return t==="compositionend"||!ou&&Tm(t,s)?(t=gm(),Uo=nu=Ds=null,Xi=!1,t):null;switch(t){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 wm&&s.locale!=="ko"?null:s.data;default:return null}}var w_={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 Am(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!w_[t.type]:s==="textarea"}function jm(t,s,r,o){Ki?Yi?Yi.push(o):Yi=[o]:Ki=o,s=Rl(s,"onChange"),0<s.length&&(r=new Po("onChange","change",null,r,o),t.push({event:r,listeners:s}))}var rr=null,or=null;function __(t){cy(t,0)}function Ho(t){var s=Nt(t);if(lm(s))return t}function Nm(t,s){if(t==="change")return s}var Rm=!1;if(us){var lu;if(us){var cu="oninput"in document;if(!cu){var km=document.createElement("div");km.setAttribute("oninput","return;"),cu=typeof km.oninput=="function"}lu=cu}else lu=!1;Rm=lu&&(!document.documentMode||9<document.documentMode)}function Cm(){rr&&(rr.detachEvent("onpropertychange",Om),or=rr=null)}function Om(t){if(t.propertyName==="value"&&Ho(or)){var s=[];jm(s,or,t,Wc(t)),pm(__,s)}}function S_(t,s,r){t==="focusin"?(Cm(),rr=s,or=r,rr.attachEvent("onpropertychange",Om)):t==="focusout"&&Cm()}function T_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ho(or)}function E_(t,s){if(t==="click")return Ho(s)}function A_(t,s){if(t==="input"||t==="change")return Ho(s)}function j_(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Zt=typeof Object.is=="function"?Object.is:j_;function lr(t,s){if(Zt(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var r=Object.keys(t),o=Object.keys(s);if(r.length!==o.length)return!1;for(o=0;o<r.length;o++){var h=r[o];if(!st.call(s,h)||!Zt(t[h],s[h]))return!1}return!0}function Dm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Mm(t,s){var r=Dm(t);t=0;for(var o;r;){if(r.nodeType===3){if(o=t+r.textContent.length,t<=s&&o>=s)return{node:r,offset:s-t};t=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Dm(r)}}function Bm(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Bm(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Um(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=Mo(t.document);s instanceof t.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)t=s.contentWindow;else break;s=Mo(t.document)}return s}function uu(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var N_=us&&"documentMode"in document&&11>=document.documentMode,Ji=null,hu=null,cr=null,du=!1;function Lm(t,s,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;du||Ji==null||Ji!==Mo(o)||(o=Ji,"selectionStart"in o&&uu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),cr&&lr(cr,o)||(cr=o,o=Rl(hu,"onSelect"),0<o.length&&(s=new Po("onSelect","select",null,s,r),t.push({event:s,listeners:o}),s.target=Ji)))}function gi(t,s){var r={};return r[t.toLowerCase()]=s.toLowerCase(),r["Webkit"+t]="webkit"+s,r["Moz"+t]="moz"+s,r}var Qi={animationend:gi("Animation","AnimationEnd"),animationiteration:gi("Animation","AnimationIteration"),animationstart:gi("Animation","AnimationStart"),transitionrun:gi("Transition","TransitionRun"),transitionstart:gi("Transition","TransitionStart"),transitioncancel:gi("Transition","TransitionCancel"),transitionend:gi("Transition","TransitionEnd")},fu={},zm={};us&&(zm=document.createElement("div").style,"AnimationEvent"in window||(delete Qi.animationend.animation,delete Qi.animationiteration.animation,delete Qi.animationstart.animation),"TransitionEvent"in window||delete Qi.transitionend.transition);function yi(t){if(fu[t])return fu[t];if(!Qi[t])return t;var s=Qi[t],r;for(r in s)if(s.hasOwnProperty(r)&&r in zm)return fu[t]=s[r];return t}var Pm=yi("animationend"),Vm=yi("animationiteration"),Hm=yi("animationstart"),R_=yi("transitionrun"),k_=yi("transitionstart"),C_=yi("transitioncancel"),$m=yi("transitionend"),qm=new Map,mu="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(" ");mu.push("scrollEnd");function Cn(t,s){qm.set(t,s),mi(s,[t])}var $o=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},pn=[],Zi=0,pu=0;function qo(){for(var t=Zi,s=pu=Zi=0;s<t;){var r=pn[s];pn[s++]=null;var o=pn[s];pn[s++]=null;var h=pn[s];pn[s++]=null;var f=pn[s];if(pn[s++]=null,o!==null&&h!==null){var b=o.pending;b===null?h.next=h:(h.next=b.next,b.next=h),o.pending=h}f!==0&&Fm(r,h,f)}}function Fo(t,s,r,o){pn[Zi++]=t,pn[Zi++]=s,pn[Zi++]=r,pn[Zi++]=o,pu|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function gu(t,s,r,o){return Fo(t,s,r,o),Io(t)}function bi(t,s){return Fo(t,null,null,s),Io(t)}function Fm(t,s,r){t.lanes|=r;var o=t.alternate;o!==null&&(o.lanes|=r);for(var h=!1,f=t.return;f!==null;)f.childLanes|=r,o=f.alternate,o!==null&&(o.childLanes|=r),f.tag===22&&(t=f.stateNode,t===null||t._visibility&1||(h=!0)),t=f,f=f.return;return t.tag===3?(f=t.stateNode,h&&s!==null&&(h=31-Vt(r),t=f.hiddenUpdates,o=t[h],o===null?t[h]=[s]:o.push(s),s.lane=r|536870912),f):null}function Io(t){if(50<Cr)throw Cr=0,Eh=null,Error(a(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var Wi={};function O_(t,s,r,o){this.tag=t,this.key=r,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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wt(t,s,r,o){return new O_(t,s,r,o)}function yu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function hs(t,s){var r=t.alternate;return r===null?(r=Wt(t.tag,s,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=s,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&65011712,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,s=t.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r.refCleanup=t.refCleanup,r}function Im(t,s){t.flags&=65011714;var r=t.alternate;return r===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=r.childLanes,t.lanes=r.lanes,t.child=r.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=r.memoizedProps,t.memoizedState=r.memoizedState,t.updateQueue=r.updateQueue,t.type=r.type,s=r.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function Go(t,s,r,o,h,f){var b=0;if(o=t,typeof t=="function")yu(t)&&(b=1);else if(typeof t=="string")b=LS(t,r,ne.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Z:return t=Wt(31,r,s,h),t.elementType=Z,t.lanes=f,t;case T:return vi(r.children,h,f,s);case j:b=8,h|=24;break;case k:return t=Wt(12,r,s,h|2),t.elementType=k,t.lanes=f,t;case K:return t=Wt(13,r,s,h),t.elementType=K,t.lanes=f,t;case G:return t=Wt(19,r,s,h),t.elementType=G,t.lanes=f,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case C:b=10;break e;case M:b=9;break e;case P:b=11;break e;case H:b=14;break e;case Y:b=16,o=null;break e}b=29,r=Error(a(130,t===null?"null":typeof t,"")),o=null}return s=Wt(b,r,s,h),s.elementType=t,s.type=o,s.lanes=f,s}function vi(t,s,r,o){return t=Wt(7,t,o,s),t.lanes=r,t}function bu(t,s,r){return t=Wt(6,t,null,s),t.lanes=r,t}function Gm(t){var s=Wt(18,null,null,0);return s.stateNode=t,s}function vu(t,s,r){return s=Wt(4,t.children!==null?t.children:[],t.key,s),s.lanes=r,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var Km=new WeakMap;function gn(t,s){if(typeof t=="object"&&t!==null){var r=Km.get(t);return r!==void 0?r:(s={value:t,source:s,stack:rt(s)},Km.set(t,s),s)}return{value:t,source:s,stack:rt(s)}}var ea=[],ta=0,Ko=null,ur=0,yn=[],bn=0,Ms=null,Gn=1,Kn="";function ds(t,s){ea[ta++]=ur,ea[ta++]=Ko,Ko=t,ur=s}function Ym(t,s,r){yn[bn++]=Gn,yn[bn++]=Kn,yn[bn++]=Ms,Ms=t;var o=Gn;t=Kn;var h=32-Vt(o)-1;o&=~(1<<h),r+=1;var f=32-Vt(s)+h;if(30<f){var b=h-h%5;f=(o&(1<<b)-1).toString(32),o>>=b,h-=b,Gn=1<<32-Vt(s)+h|r<<h|o,Kn=f+t}else Gn=1<<f|r<<h|o,Kn=t}function xu(t){t.return!==null&&(ds(t,1),Ym(t,1,0))}function wu(t){for(;t===Ko;)Ko=ea[--ta],ea[ta]=null,ur=ea[--ta],ea[ta]=null;for(;t===Ms;)Ms=yn[--bn],yn[bn]=null,Kn=yn[--bn],yn[bn]=null,Gn=yn[--bn],yn[bn]=null}function Xm(t,s){yn[bn++]=Gn,yn[bn++]=Kn,yn[bn++]=Ms,Gn=s.id,Kn=s.overflow,Ms=t}var Ot=null,We=null,je=!1,Bs=null,vn=!1,_u=Error(a(519));function Us(t){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw hr(gn(s,t)),_u}function Jm(t){var s=t.stateNode,r=t.type,o=t.memoizedProps;switch(s[R]=t,s[X]=o,r){case"dialog":Se("cancel",s),Se("close",s);break;case"iframe":case"object":case"embed":Se("load",s);break;case"video":case"audio":for(r=0;r<Dr.length;r++)Se(Dr[r],s);break;case"source":Se("error",s);break;case"img":case"image":case"link":Se("error",s),Se("load",s);break;case"details":Se("toggle",s);break;case"input":Se("invalid",s),cm(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Se("invalid",s);break;case"textarea":Se("invalid",s),hm(s,o.value,o.defaultValue,o.children)}r=o.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||o.suppressHydrationWarning===!0||fy(s.textContent,r)?(o.popover!=null&&(Se("beforetoggle",s),Se("toggle",s)),o.onScroll!=null&&Se("scroll",s),o.onScrollEnd!=null&&Se("scrollend",s),o.onClick!=null&&(s.onclick=cs),s=!0):s=!1,s||Us(t,!0)}function Qm(t){for(Ot=t.return;Ot;)switch(Ot.tag){case 5:case 31:case 13:vn=!1;return;case 27:case 3:vn=!0;return;default:Ot=Ot.return}}function na(t){if(t!==Ot)return!1;if(!je)return Qm(t),je=!0,!1;var s=t.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=t.type,r=!(r!=="form"&&r!=="button")||Vh(t.type,t.memoizedProps)),r=!r),r&&We&&Us(t),Qm(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));We=_y(t)}else if(s===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));We=_y(t)}else s===27?(s=We,Js(t.type)?(t=Ih,Ih=null,We=t):We=s):We=Ot?wn(t.stateNode.nextSibling):null;return!0}function xi(){We=Ot=null,je=!1}function Su(){var t=Bs;return t!==null&&(Yt===null?Yt=t:Yt.push.apply(Yt,t),Bs=null),t}function hr(t){Bs===null?Bs=[t]:Bs.push(t)}var Tu=A(null),wi=null,fs=null;function Ls(t,s,r){J(Tu,s._currentValue),s._currentValue=r}function ms(t){t._currentValue=Tu.current,q(Tu)}function Eu(t,s,r){for(;t!==null;){var o=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),t===r)break;t=t.return}}function Au(t,s,r,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var f=h.dependencies;if(f!==null){var b=h.child;f=f.firstContext;e:for(;f!==null;){var w=f;f=h;for(var E=0;E<s.length;E++)if(w.context===s[E]){f.lanes|=r,w=f.alternate,w!==null&&(w.lanes|=r),Eu(f.return,r,t),o||(b=null);break e}f=w.next}}else if(h.tag===18){if(b=h.return,b===null)throw Error(a(341));b.lanes|=r,f=b.alternate,f!==null&&(f.lanes|=r),Eu(b,r,t),b=null}else b=h.child;if(b!==null)b.return=h;else for(b=h;b!==null;){if(b===t){b=null;break}if(h=b.sibling,h!==null){h.return=b.return,b=h;break}b=b.return}h=b}}function sa(t,s,r,o){t=null;for(var h=s,f=!1;h!==null;){if(!f){if((h.flags&524288)!==0)f=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var b=h.alternate;if(b===null)throw Error(a(387));if(b=b.memoizedProps,b!==null){var w=h.type;Zt(h.pendingProps.value,b.value)||(t!==null?t.push(w):t=[w])}}else if(h===we.current){if(b=h.alternate,b===null)throw Error(a(387));b.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(zr):t=[zr])}h=h.return}t!==null&&Au(s,t,r,o),s.flags|=262144}function Yo(t){for(t=t.firstContext;t!==null;){if(!Zt(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function _i(t){wi=t,fs=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Dt(t){return Zm(wi,t)}function Xo(t,s){return wi===null&&_i(t),Zm(t,s)}function Zm(t,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},fs===null){if(t===null)throw Error(a(308));fs=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else fs=fs.next=s;return r}var D_=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(r,o){t.push(o)}};this.abort=function(){s.aborted=!0,t.forEach(function(r){return r()})}},M_=n.unstable_scheduleCallback,B_=n.unstable_NormalPriority,bt={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ju(){return{controller:new D_,data:new Map,refCount:0}}function dr(t){t.refCount--,t.refCount===0&&M_(B_,function(){t.controller.abort()})}var fr=null,Nu=0,ia=0,aa=null;function U_(t,s){if(fr===null){var r=fr=[];Nu=0,ia=Ch(),aa={status:"pending",value:void 0,then:function(o){r.push(o)}}}return Nu++,s.then(Wm,Wm),s}function Wm(){if(--Nu===0&&fr!==null){aa!==null&&(aa.status="fulfilled");var t=fr;fr=null,ia=0,aa=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function L_(t,s){var r=[],o={status:"pending",value:null,reason:null,then:function(h){r.push(h)}};return t.then(function(){o.status="fulfilled",o.value=s;for(var h=0;h<r.length;h++)(0,r[h])(s)},function(h){for(o.status="rejected",o.reason=h,h=0;h<r.length;h++)(0,r[h])(void 0)}),o}var ep=L.S;L.S=function(t,s){Lg=Ze(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&U_(t,s),ep!==null&&ep(t,s)};var Si=A(null);function Ru(){var t=Si.current;return t!==null?t:Ke.pooledCache}function Jo(t,s){s===null?J(Si,Si.current):J(Si,s.pool)}function tp(){var t=Ru();return t===null?null:{parent:bt._currentValue,pool:t}}var ra=Error(a(460)),ku=Error(a(474)),Qo=Error(a(542)),Zo={then:function(){}};function np(t){return t=t.status,t==="fulfilled"||t==="rejected"}function sp(t,s,r){switch(r=t[r],r===void 0?t.push(s):r!==s&&(s.then(cs,cs),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,ap(t),t;default:if(typeof s.status=="string")s.then(cs,cs);else{if(t=Ke,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=s,t.status="pending",t.then(function(o){if(s.status==="pending"){var h=s;h.status="fulfilled",h.value=o}},function(o){if(s.status==="pending"){var h=s;h.status="rejected",h.reason=o}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,ap(t),t}throw Ei=s,ra}}function Ti(t){try{var s=t._init;return s(t._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Ei=r,ra):r}}var Ei=null;function ip(){if(Ei===null)throw Error(a(459));var t=Ei;return Ei=null,t}function ap(t){if(t===ra||t===Qo)throw Error(a(483))}var oa=null,mr=0;function Wo(t){var s=mr;return mr+=1,oa===null&&(oa=[]),sp(oa,t,s)}function pr(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function el(t,s){throw s.$$typeof===x?Error(a(525)):(t=Object.prototype.toString.call(s),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function rp(t){function s(O,N){if(t){var B=O.deletions;B===null?(O.deletions=[N],O.flags|=16):B.push(N)}}function r(O,N){if(!t)return null;for(;N!==null;)s(O,N),N=N.sibling;return null}function o(O){for(var N=new Map;O!==null;)O.key!==null?N.set(O.key,O):N.set(O.index,O),O=O.sibling;return N}function h(O,N){return O=hs(O,N),O.index=0,O.sibling=null,O}function f(O,N,B){return O.index=B,t?(B=O.alternate,B!==null?(B=B.index,B<N?(O.flags|=67108866,N):B):(O.flags|=67108866,N)):(O.flags|=1048576,N)}function b(O){return t&&O.alternate===null&&(O.flags|=67108866),O}function w(O,N,B,F){return N===null||N.tag!==6?(N=bu(B,O.mode,F),N.return=O,N):(N=h(N,B),N.return=O,N)}function E(O,N,B,F){var he=B.type;return he===T?$(O,N,B.props.children,F,B.key):N!==null&&(N.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===Y&&Ti(he)===N.type)?(N=h(N,B.props),pr(N,B),N.return=O,N):(N=Go(B.type,B.key,B.props,null,O.mode,F),pr(N,B),N.return=O,N)}function U(O,N,B,F){return N===null||N.tag!==4||N.stateNode.containerInfo!==B.containerInfo||N.stateNode.implementation!==B.implementation?(N=vu(B,O.mode,F),N.return=O,N):(N=h(N,B.children||[]),N.return=O,N)}function $(O,N,B,F,he){return N===null||N.tag!==7?(N=vi(B,O.mode,F,he),N.return=O,N):(N=h(N,B),N.return=O,N)}function I(O,N,B){if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return N=bu(""+N,O.mode,B),N.return=O,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case _:return B=Go(N.type,N.key,N.props,null,O.mode,B),pr(B,N),B.return=O,B;case S:return N=vu(N,O.mode,B),N.return=O,N;case Y:return N=Ti(N),I(O,N,B)}if(Be(N)||ye(N))return N=vi(N,O.mode,B,null),N.return=O,N;if(typeof N.then=="function")return I(O,Wo(N),B);if(N.$$typeof===C)return I(O,Xo(O,N),B);el(O,N)}return null}function z(O,N,B,F){var he=N!==null?N.key:null;if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return he!==null?null:w(O,N,""+B,F);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case _:return B.key===he?E(O,N,B,F):null;case S:return B.key===he?U(O,N,B,F):null;case Y:return B=Ti(B),z(O,N,B,F)}if(Be(B)||ye(B))return he!==null?null:$(O,N,B,F,null);if(typeof B.then=="function")return z(O,N,Wo(B),F);if(B.$$typeof===C)return z(O,N,Xo(O,B),F);el(O,B)}return null}function V(O,N,B,F,he){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return O=O.get(B)||null,w(N,O,""+F,he);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case _:return O=O.get(F.key===null?B:F.key)||null,E(N,O,F,he);case S:return O=O.get(F.key===null?B:F.key)||null,U(N,O,F,he);case Y:return F=Ti(F),V(O,N,B,F,he)}if(Be(F)||ye(F))return O=O.get(B)||null,$(N,O,F,he,null);if(typeof F.then=="function")return V(O,N,B,Wo(F),he);if(F.$$typeof===C)return V(O,N,B,Xo(N,F),he);el(N,F)}return null}function ie(O,N,B,F){for(var he=null,Oe=null,ce=N,xe=N=0,Ee=null;ce!==null&&xe<B.length;xe++){ce.index>xe?(Ee=ce,ce=null):Ee=ce.sibling;var De=z(O,ce,B[xe],F);if(De===null){ce===null&&(ce=Ee);break}t&&ce&&De.alternate===null&&s(O,ce),N=f(De,N,xe),Oe===null?he=De:Oe.sibling=De,Oe=De,ce=Ee}if(xe===B.length)return r(O,ce),je&&ds(O,xe),he;if(ce===null){for(;xe<B.length;xe++)ce=I(O,B[xe],F),ce!==null&&(N=f(ce,N,xe),Oe===null?he=ce:Oe.sibling=ce,Oe=ce);return je&&ds(O,xe),he}for(ce=o(ce);xe<B.length;xe++)Ee=V(ce,O,xe,B[xe],F),Ee!==null&&(t&&Ee.alternate!==null&&ce.delete(Ee.key===null?xe:Ee.key),N=f(Ee,N,xe),Oe===null?he=Ee:Oe.sibling=Ee,Oe=Ee);return t&&ce.forEach(function(ti){return s(O,ti)}),je&&ds(O,xe),he}function pe(O,N,B,F){if(B==null)throw Error(a(151));for(var he=null,Oe=null,ce=N,xe=N=0,Ee=null,De=B.next();ce!==null&&!De.done;xe++,De=B.next()){ce.index>xe?(Ee=ce,ce=null):Ee=ce.sibling;var ti=z(O,ce,De.value,F);if(ti===null){ce===null&&(ce=Ee);break}t&&ce&&ti.alternate===null&&s(O,ce),N=f(ti,N,xe),Oe===null?he=ti:Oe.sibling=ti,Oe=ti,ce=Ee}if(De.done)return r(O,ce),je&&ds(O,xe),he;if(ce===null){for(;!De.done;xe++,De=B.next())De=I(O,De.value,F),De!==null&&(N=f(De,N,xe),Oe===null?he=De:Oe.sibling=De,Oe=De);return je&&ds(O,xe),he}for(ce=o(ce);!De.done;xe++,De=B.next())De=V(ce,O,xe,De.value,F),De!==null&&(t&&De.alternate!==null&&ce.delete(De.key===null?xe:De.key),N=f(De,N,xe),Oe===null?he=De:Oe.sibling=De,Oe=De);return t&&ce.forEach(function(YS){return s(O,YS)}),je&&ds(O,xe),he}function Ge(O,N,B,F){if(typeof B=="object"&&B!==null&&B.type===T&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case _:e:{for(var he=B.key;N!==null;){if(N.key===he){if(he=B.type,he===T){if(N.tag===7){r(O,N.sibling),F=h(N,B.props.children),F.return=O,O=F;break e}}else if(N.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===Y&&Ti(he)===N.type){r(O,N.sibling),F=h(N,B.props),pr(F,B),F.return=O,O=F;break e}r(O,N);break}else s(O,N);N=N.sibling}B.type===T?(F=vi(B.props.children,O.mode,F,B.key),F.return=O,O=F):(F=Go(B.type,B.key,B.props,null,O.mode,F),pr(F,B),F.return=O,O=F)}return b(O);case S:e:{for(he=B.key;N!==null;){if(N.key===he)if(N.tag===4&&N.stateNode.containerInfo===B.containerInfo&&N.stateNode.implementation===B.implementation){r(O,N.sibling),F=h(N,B.children||[]),F.return=O,O=F;break e}else{r(O,N);break}else s(O,N);N=N.sibling}F=vu(B,O.mode,F),F.return=O,O=F}return b(O);case Y:return B=Ti(B),Ge(O,N,B,F)}if(Be(B))return ie(O,N,B,F);if(ye(B)){if(he=ye(B),typeof he!="function")throw Error(a(150));return B=he.call(B),pe(O,N,B,F)}if(typeof B.then=="function")return Ge(O,N,Wo(B),F);if(B.$$typeof===C)return Ge(O,N,Xo(O,B),F);el(O,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,N!==null&&N.tag===6?(r(O,N.sibling),F=h(N,B),F.return=O,O=F):(r(O,N),F=bu(B,O.mode,F),F.return=O,O=F),b(O)):r(O,N)}return function(O,N,B,F){try{mr=0;var he=Ge(O,N,B,F);return oa=null,he}catch(ce){if(ce===ra||ce===Qo)throw ce;var Oe=Wt(29,ce,null,O.mode);return Oe.lanes=F,Oe.return=O,Oe}finally{}}}var Ai=rp(!0),op=rp(!1),zs=!1;function Cu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ou(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ps(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Vs(t,s,r){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(Le&2)!==0){var h=o.pending;return h===null?s.next=s:(s.next=h.next,h.next=s),o.pending=s,s=Io(t),Fm(t,null,r),s}return Fo(t,o,s,r),Io(t)}function gr(t,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var o=s.lanes;o&=t.pendingLanes,r|=o,s.lanes=r,Za(t,r)}}function Du(t,s){var r=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var h=null,f=null;if(r=r.firstBaseUpdate,r!==null){do{var b={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};f===null?h=f=b:f=f.next=b,r=r.next}while(r!==null);f===null?h=f=s:f=f.next=s}else h=f=s;r={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=s:t.next=s,r.lastBaseUpdate=s}var Mu=!1;function yr(){if(Mu){var t=aa;if(t!==null)throw t}}function br(t,s,r,o){Mu=!1;var h=t.updateQueue;zs=!1;var f=h.firstBaseUpdate,b=h.lastBaseUpdate,w=h.shared.pending;if(w!==null){h.shared.pending=null;var E=w,U=E.next;E.next=null,b===null?f=U:b.next=U,b=E;var $=t.alternate;$!==null&&($=$.updateQueue,w=$.lastBaseUpdate,w!==b&&(w===null?$.firstBaseUpdate=U:w.next=U,$.lastBaseUpdate=E))}if(f!==null){var I=h.baseState;b=0,$=U=E=null,w=f;do{var z=w.lane&-536870913,V=z!==w.lane;if(V?(Te&z)===z:(o&z)===z){z!==0&&z===ia&&(Mu=!0),$!==null&&($=$.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ie=t,pe=w;z=s;var Ge=r;switch(pe.tag){case 1:if(ie=pe.payload,typeof ie=="function"){I=ie.call(Ge,I,z);break e}I=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=pe.payload,z=typeof ie=="function"?ie.call(Ge,I,z):ie,z==null)break e;I=v({},I,z);break e;case 2:zs=!0}}z=w.callback,z!==null&&(t.flags|=64,V&&(t.flags|=8192),V=h.callbacks,V===null?h.callbacks=[z]:V.push(z))}else V={lane:z,tag:w.tag,payload:w.payload,callback:w.callback,next:null},$===null?(U=$=V,E=I):$=$.next=V,b|=z;if(w=w.next,w===null){if(w=h.shared.pending,w===null)break;V=w,w=V.next,V.next=null,h.lastBaseUpdate=V,h.shared.pending=null}}while(!0);$===null&&(E=I),h.baseState=E,h.firstBaseUpdate=U,h.lastBaseUpdate=$,f===null&&(h.shared.lanes=0),Is|=b,t.lanes=b,t.memoizedState=I}}function lp(t,s){if(typeof t!="function")throw Error(a(191,t));t.call(s)}function cp(t,s){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;t<r.length;t++)lp(r[t],s)}var la=A(null),tl=A(0);function up(t,s){t=Ss,J(tl,t),J(la,s),Ss=t|s.baseLanes}function Bu(){J(tl,Ss),J(la,la.current)}function Uu(){Ss=tl.current,q(la),q(tl)}var en=A(null),xn=null;function Hs(t){var s=t.alternate;J(ft,ft.current&1),J(en,t),xn===null&&(s===null||la.current!==null||s.memoizedState!==null)&&(xn=t)}function Lu(t){J(ft,ft.current),J(en,t),xn===null&&(xn=t)}function hp(t){t.tag===22?(J(ft,ft.current),J(en,t),xn===null&&(xn=t)):$s()}function $s(){J(ft,ft.current),J(en,en.current)}function tn(t){q(en),xn===t&&(xn=null),q(ft)}var ft=A(0);function nl(t){for(var s=t;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||qh(r)||Fh(r)))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===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var ps=0,ve=null,Fe=null,vt=null,sl=!1,ca=!1,ji=!1,il=0,vr=0,ua=null,z_=0;function ot(){throw Error(a(321))}function zu(t,s){if(s===null)return!1;for(var r=0;r<s.length&&r<t.length;r++)if(!Zt(t[r],s[r]))return!1;return!0}function Pu(t,s,r,o,h,f){return ps=f,ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,L.H=t===null||t.memoizedState===null?Yp:eh,ji=!1,f=r(o,h),ji=!1,ca&&(f=fp(s,r,o,h)),dp(t),f}function dp(t){L.H=_r;var s=Fe!==null&&Fe.next!==null;if(ps=0,vt=Fe=ve=null,sl=!1,vr=0,ua=null,s)throw Error(a(300));t===null||xt||(t=t.dependencies,t!==null&&Yo(t)&&(xt=!0))}function fp(t,s,r,o){ve=t;var h=0;do{if(ca&&(ua=null),vr=0,ca=!1,25<=h)throw Error(a(301));if(h+=1,vt=Fe=null,t.updateQueue!=null){var f=t.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}L.H=Xp,f=s(r,o)}while(ca);return f}function P_(){var t=L.H,s=t.useState()[0];return s=typeof s.then=="function"?xr(s):s,t=t.useState()[0],(Fe!==null?Fe.memoizedState:null)!==t&&(ve.flags|=1024),s}function Vu(){var t=il!==0;return il=0,t}function Hu(t,s,r){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~r}function $u(t){if(sl){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}sl=!1}ps=0,vt=Fe=ve=null,ca=!1,vr=il=0,ua=null}function Ht(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?ve.memoizedState=vt=t:vt=vt.next=t,vt}function mt(){if(Fe===null){var t=ve.alternate;t=t!==null?t.memoizedState:null}else t=Fe.next;var s=vt===null?ve.memoizedState:vt.next;if(s!==null)vt=s,Fe=t;else{if(t===null)throw ve.alternate===null?Error(a(467)):Error(a(310));Fe=t,t={memoizedState:Fe.memoizedState,baseState:Fe.baseState,baseQueue:Fe.baseQueue,queue:Fe.queue,next:null},vt===null?ve.memoizedState=vt=t:vt=vt.next=t}return vt}function al(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xr(t){var s=vr;return vr+=1,ua===null&&(ua=[]),t=sp(ua,t,s),s=ve,(vt===null?s.memoizedState:vt.next)===null&&(s=s.alternate,L.H=s===null||s.memoizedState===null?Yp:eh),t}function rl(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return xr(t);if(t.$$typeof===C)return Dt(t)}throw Error(a(438,String(t)))}function qu(t){var s=null,r=ve.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var o=ve.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(s={data:o.data.map(function(h){return h.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=al(),ve.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(t),o=0;o<t;o++)r[o]=se;return s.index++,r}function gs(t,s){return typeof s=="function"?s(t):s}function ol(t){var s=mt();return Fu(s,Fe,t)}function Fu(t,s,r){var o=t.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=r;var h=t.baseQueue,f=o.pending;if(f!==null){if(h!==null){var b=h.next;h.next=f.next,f.next=b}s.baseQueue=h=f,o.pending=null}if(f=t.baseState,h===null)t.memoizedState=f;else{s=h.next;var w=b=null,E=null,U=s,$=!1;do{var I=U.lane&-536870913;if(I!==U.lane?(Te&I)===I:(ps&I)===I){var z=U.revertLane;if(z===0)E!==null&&(E=E.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),I===ia&&($=!0);else if((ps&z)===z){U=U.next,z===ia&&($=!0);continue}else I={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},E===null?(w=E=I,b=f):E=E.next=I,ve.lanes|=z,Is|=z;I=U.action,ji&&r(f,I),f=U.hasEagerState?U.eagerState:r(f,I)}else z={lane:I,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},E===null?(w=E=z,b=f):E=E.next=z,ve.lanes|=I,Is|=I;U=U.next}while(U!==null&&U!==s);if(E===null?b=f:E.next=w,!Zt(f,t.memoizedState)&&(xt=!0,$&&(r=aa,r!==null)))throw r;t.memoizedState=f,t.baseState=b,t.baseQueue=E,o.lastRenderedState=f}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Iu(t){var s=mt(),r=s.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=t;var o=r.dispatch,h=r.pending,f=s.memoizedState;if(h!==null){r.pending=null;var b=h=h.next;do f=t(f,b.action),b=b.next;while(b!==h);Zt(f,s.memoizedState)||(xt=!0),s.memoizedState=f,s.baseQueue===null&&(s.baseState=f),r.lastRenderedState=f}return[f,o]}function mp(t,s,r){var o=ve,h=mt(),f=je;if(f){if(r===void 0)throw Error(a(407));r=r()}else r=s();var b=!Zt((Fe||h).memoizedState,r);if(b&&(h.memoizedState=r,xt=!0),h=h.queue,Yu(yp.bind(null,o,h,t),[t]),h.getSnapshot!==s||b||vt!==null&&vt.memoizedState.tag&1){if(o.flags|=2048,ha(9,{destroy:void 0},gp.bind(null,o,h,r,s),null),Ke===null)throw Error(a(349));f||(ps&127)!==0||pp(o,s,r)}return r}function pp(t,s,r){t.flags|=16384,t={getSnapshot:s,value:r},s=ve.updateQueue,s===null?(s=al(),ve.updateQueue=s,s.stores=[t]):(r=s.stores,r===null?s.stores=[t]:r.push(t))}function gp(t,s,r,o){s.value=r,s.getSnapshot=o,bp(s)&&vp(t)}function yp(t,s,r){return r(function(){bp(s)&&vp(t)})}function bp(t){var s=t.getSnapshot;t=t.value;try{var r=s();return!Zt(t,r)}catch{return!0}}function vp(t){var s=bi(t,2);s!==null&&Xt(s,t,2)}function Gu(t){var s=Ht();if(typeof t=="function"){var r=t;if(t=r(),ji){cn(!0);try{r()}finally{cn(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:t},s}function xp(t,s,r,o){return t.baseState=r,Fu(t,Fe,typeof o=="function"?o:gs)}function V_(t,s,r,o,h){if(ul(t))throw Error(a(485));if(t=s.action,t!==null){var f={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){f.listeners.push(b)}};L.T!==null?r(!0):f.isTransition=!1,o(f),r=s.pending,r===null?(f.next=s.pending=f,wp(s,f)):(f.next=r.next,s.pending=r.next=f)}}function wp(t,s){var r=s.action,o=s.payload,h=t.state;if(s.isTransition){var f=L.T,b={};L.T=b;try{var w=r(h,o),E=L.S;E!==null&&E(b,w),_p(t,s,w)}catch(U){Ku(t,s,U)}finally{f!==null&&b.types!==null&&(f.types=b.types),L.T=f}}else try{f=r(h,o),_p(t,s,f)}catch(U){Ku(t,s,U)}}function _p(t,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(o){Sp(t,s,o)},function(o){return Ku(t,s,o)}):Sp(t,s,r)}function Sp(t,s,r){s.status="fulfilled",s.value=r,Tp(s),t.state=r,s=t.pending,s!==null&&(r=s.next,r===s?t.pending=null:(r=r.next,s.next=r,wp(t,r)))}function Ku(t,s,r){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=r,Tp(s),s=s.next;while(s!==o)}t.action=null}function Tp(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Ep(t,s){return s}function Ap(t,s){if(je){var r=Ke.formState;if(r!==null){e:{var o=ve;if(je){if(We){t:{for(var h=We,f=vn;h.nodeType!==8;){if(!f){h=null;break t}if(h=wn(h.nextSibling),h===null){h=null;break t}}f=h.data,h=f==="F!"||f==="F"?h:null}if(h){We=wn(h.nextSibling),o=h.data==="F!";break e}}Us(o)}o=!1}o&&(s=r[0])}}return r=Ht(),r.memoizedState=r.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ep,lastRenderedState:s},r.queue=o,r=Ip.bind(null,ve,o),o.dispatch=r,o=Gu(!1),f=Wu.bind(null,ve,!1,o.queue),o=Ht(),h={state:s,dispatch:null,action:t,pending:null},o.queue=h,r=V_.bind(null,ve,h,f,r),h.dispatch=r,o.memoizedState=t,[s,r,!1]}function jp(t){var s=mt();return Np(s,Fe,t)}function Np(t,s,r){if(s=Fu(t,s,Ep)[0],t=ol(gs)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=xr(s)}catch(b){throw b===ra?Qo:b}else o=s;s=mt();var h=s.queue,f=h.dispatch;return r!==s.memoizedState&&(ve.flags|=2048,ha(9,{destroy:void 0},H_.bind(null,h,r),null)),[o,f,t]}function H_(t,s){t.action=s}function Rp(t){var s=mt(),r=Fe;if(r!==null)return Np(s,r,t);mt(),s=s.memoizedState,r=mt();var o=r.queue.dispatch;return r.memoizedState=t,[s,o,!1]}function ha(t,s,r,o){return t={tag:t,create:r,deps:o,inst:s,next:null},s=ve.updateQueue,s===null&&(s=al(),ve.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=t.next=t:(o=r.next,r.next=t,t.next=o,s.lastEffect=t),t}function kp(){return mt().memoizedState}function ll(t,s,r,o){var h=Ht();ve.flags|=t,h.memoizedState=ha(1|s,{destroy:void 0},r,o===void 0?null:o)}function cl(t,s,r,o){var h=mt();o=o===void 0?null:o;var f=h.memoizedState.inst;Fe!==null&&o!==null&&zu(o,Fe.memoizedState.deps)?h.memoizedState=ha(s,f,r,o):(ve.flags|=t,h.memoizedState=ha(1|s,f,r,o))}function Cp(t,s){ll(8390656,8,t,s)}function Yu(t,s){cl(2048,8,t,s)}function $_(t){ve.flags|=4;var s=ve.updateQueue;if(s===null)s=al(),ve.updateQueue=s,s.events=[t];else{var r=s.events;r===null?s.events=[t]:r.push(t)}}function Op(t){var s=mt().memoizedState;return $_({ref:s,nextImpl:t}),function(){if((Le&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function Dp(t,s){return cl(4,2,t,s)}function Mp(t,s){return cl(4,4,t,s)}function Bp(t,s){if(typeof s=="function"){t=t();var r=s(t);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Up(t,s,r){r=r!=null?r.concat([t]):null,cl(4,4,Bp.bind(null,s,t),r)}function Xu(){}function Lp(t,s){var r=mt();s=s===void 0?null:s;var o=r.memoizedState;return s!==null&&zu(s,o[1])?o[0]:(r.memoizedState=[t,s],t)}function zp(t,s){var r=mt();s=s===void 0?null:s;var o=r.memoizedState;if(s!==null&&zu(s,o[1]))return o[0];if(o=t(),ji){cn(!0);try{t()}finally{cn(!1)}}return r.memoizedState=[o,s],o}function Ju(t,s,r){return r===void 0||(ps&1073741824)!==0&&(Te&261930)===0?t.memoizedState=s:(t.memoizedState=r,t=Pg(),ve.lanes|=t,Is|=t,r)}function Pp(t,s,r,o){return Zt(r,s)?r:la.current!==null?(t=Ju(t,r,o),Zt(t,s)||(xt=!0),t):(ps&42)===0||(ps&1073741824)!==0&&(Te&261930)===0?(xt=!0,t.memoizedState=r):(t=Pg(),ve.lanes|=t,Is|=t,s)}function Vp(t,s,r,o,h){var f=W.p;W.p=f!==0&&8>f?f:8;var b=L.T,w={};L.T=w,Wu(t,!1,s,r);try{var E=h(),U=L.S;if(U!==null&&U(w,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var $=L_(E,o);wr(t,s,$,an(t))}else wr(t,s,o,an(t))}catch(I){wr(t,s,{then:function(){},status:"rejected",reason:I},an())}finally{W.p=f,b!==null&&w.types!==null&&(b.types=w.types),L.T=b}}function q_(){}function Qu(t,s,r,o){if(t.tag!==5)throw Error(a(476));var h=Hp(t).queue;Vp(t,h,s,Q,r===null?q_:function(){return $p(t),r(o)})}function Hp(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:Q},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:r},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function $p(t){var s=Hp(t);s.next===null&&(s=t.alternate.memoizedState),wr(t,s.next.queue,{},an())}function Zu(){return Dt(zr)}function qp(){return mt().memoizedState}function Fp(){return mt().memoizedState}function F_(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var r=an();t=Ps(r);var o=Vs(s,t,r);o!==null&&(Xt(o,s,r),gr(o,s,r)),s={cache:ju()},t.payload=s;return}s=s.return}}function I_(t,s,r){var o=an();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ul(t)?Gp(s,r):(r=gu(t,s,r,o),r!==null&&(Xt(r,t,o),Kp(r,s,o)))}function Ip(t,s,r){var o=an();wr(t,s,r,o)}function wr(t,s,r,o){var h={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(ul(t))Gp(s,h);else{var f=t.alternate;if(t.lanes===0&&(f===null||f.lanes===0)&&(f=s.lastRenderedReducer,f!==null))try{var b=s.lastRenderedState,w=f(b,r);if(h.hasEagerState=!0,h.eagerState=w,Zt(w,b))return Fo(t,s,h,0),Ke===null&&qo(),!1}catch{}finally{}if(r=gu(t,s,h,o),r!==null)return Xt(r,t,o),Kp(r,s,o),!0}return!1}function Wu(t,s,r,o){if(o={lane:2,revertLane:Ch(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},ul(t)){if(s)throw Error(a(479))}else s=gu(t,r,o,2),s!==null&&Xt(s,t,2)}function ul(t){var s=t.alternate;return t===ve||s!==null&&s===ve}function Gp(t,s){ca=sl=!0;var r=t.pending;r===null?s.next=s:(s.next=r.next,r.next=s),t.pending=s}function Kp(t,s,r){if((r&4194048)!==0){var o=s.lanes;o&=t.pendingLanes,r|=o,s.lanes=r,Za(t,r)}}var _r={readContext:Dt,use:rl,useCallback:ot,useContext:ot,useEffect:ot,useImperativeHandle:ot,useLayoutEffect:ot,useInsertionEffect:ot,useMemo:ot,useReducer:ot,useRef:ot,useState:ot,useDebugValue:ot,useDeferredValue:ot,useTransition:ot,useSyncExternalStore:ot,useId:ot,useHostTransitionStatus:ot,useFormState:ot,useActionState:ot,useOptimistic:ot,useMemoCache:ot,useCacheRefresh:ot};_r.useEffectEvent=ot;var Yp={readContext:Dt,use:rl,useCallback:function(t,s){return Ht().memoizedState=[t,s===void 0?null:s],t},useContext:Dt,useEffect:Cp,useImperativeHandle:function(t,s,r){r=r!=null?r.concat([t]):null,ll(4194308,4,Bp.bind(null,s,t),r)},useLayoutEffect:function(t,s){return ll(4194308,4,t,s)},useInsertionEffect:function(t,s){ll(4,2,t,s)},useMemo:function(t,s){var r=Ht();s=s===void 0?null:s;var o=t();if(ji){cn(!0);try{t()}finally{cn(!1)}}return r.memoizedState=[o,s],o},useReducer:function(t,s,r){var o=Ht();if(r!==void 0){var h=r(s);if(ji){cn(!0);try{r(s)}finally{cn(!1)}}}else h=s;return o.memoizedState=o.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},o.queue=t,t=t.dispatch=I_.bind(null,ve,t),[o.memoizedState,t]},useRef:function(t){var s=Ht();return t={current:t},s.memoizedState=t},useState:function(t){t=Gu(t);var s=t.queue,r=Ip.bind(null,ve,s);return s.dispatch=r,[t.memoizedState,r]},useDebugValue:Xu,useDeferredValue:function(t,s){var r=Ht();return Ju(r,t,s)},useTransition:function(){var t=Gu(!1);return t=Vp.bind(null,ve,t.queue,!0,!1),Ht().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,r){var o=ve,h=Ht();if(je){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),Ke===null)throw Error(a(349));(Te&127)!==0||pp(o,s,r)}h.memoizedState=r;var f={value:r,getSnapshot:s};return h.queue=f,Cp(yp.bind(null,o,f,t),[t]),o.flags|=2048,ha(9,{destroy:void 0},gp.bind(null,o,f,r,s),null),r},useId:function(){var t=Ht(),s=Ke.identifierPrefix;if(je){var r=Kn,o=Gn;r=(o&~(1<<32-Vt(o)-1)).toString(32)+r,s="_"+s+"R_"+r,r=il++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=z_++,s="_"+s+"r_"+r.toString(32)+"_";return t.memoizedState=s},useHostTransitionStatus:Zu,useFormState:Ap,useActionState:Ap,useOptimistic:function(t){var s=Ht();s.memoizedState=s.baseState=t;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Wu.bind(null,ve,!0,r),r.dispatch=s,[t,s]},useMemoCache:qu,useCacheRefresh:function(){return Ht().memoizedState=F_.bind(null,ve)},useEffectEvent:function(t){var s=Ht(),r={impl:t};return s.memoizedState=r,function(){if((Le&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},eh={readContext:Dt,use:rl,useCallback:Lp,useContext:Dt,useEffect:Yu,useImperativeHandle:Up,useInsertionEffect:Dp,useLayoutEffect:Mp,useMemo:zp,useReducer:ol,useRef:kp,useState:function(){return ol(gs)},useDebugValue:Xu,useDeferredValue:function(t,s){var r=mt();return Pp(r,Fe.memoizedState,t,s)},useTransition:function(){var t=ol(gs)[0],s=mt().memoizedState;return[typeof t=="boolean"?t:xr(t),s]},useSyncExternalStore:mp,useId:qp,useHostTransitionStatus:Zu,useFormState:jp,useActionState:jp,useOptimistic:function(t,s){var r=mt();return xp(r,Fe,t,s)},useMemoCache:qu,useCacheRefresh:Fp};eh.useEffectEvent=Op;var Xp={readContext:Dt,use:rl,useCallback:Lp,useContext:Dt,useEffect:Yu,useImperativeHandle:Up,useInsertionEffect:Dp,useLayoutEffect:Mp,useMemo:zp,useReducer:Iu,useRef:kp,useState:function(){return Iu(gs)},useDebugValue:Xu,useDeferredValue:function(t,s){var r=mt();return Fe===null?Ju(r,t,s):Pp(r,Fe.memoizedState,t,s)},useTransition:function(){var t=Iu(gs)[0],s=mt().memoizedState;return[typeof t=="boolean"?t:xr(t),s]},useSyncExternalStore:mp,useId:qp,useHostTransitionStatus:Zu,useFormState:Rp,useActionState:Rp,useOptimistic:function(t,s){var r=mt();return Fe!==null?xp(r,Fe,t,s):(r.baseState=t,[t,r.queue.dispatch])},useMemoCache:qu,useCacheRefresh:Fp};Xp.useEffectEvent=Op;function th(t,s,r,o){s=t.memoizedState,r=r(o,s),r=r==null?s:v({},s,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var nh={enqueueSetState:function(t,s,r){t=t._reactInternals;var o=an(),h=Ps(o);h.payload=s,r!=null&&(h.callback=r),s=Vs(t,h,o),s!==null&&(Xt(s,t,o),gr(s,t,o))},enqueueReplaceState:function(t,s,r){t=t._reactInternals;var o=an(),h=Ps(o);h.tag=1,h.payload=s,r!=null&&(h.callback=r),s=Vs(t,h,o),s!==null&&(Xt(s,t,o),gr(s,t,o))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var r=an(),o=Ps(r);o.tag=2,s!=null&&(o.callback=s),s=Vs(t,o,r),s!==null&&(Xt(s,t,r),gr(s,t,r))}};function Jp(t,s,r,o,h,f,b){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,f,b):s.prototype&&s.prototype.isPureReactComponent?!lr(r,o)||!lr(h,f):!0}function Qp(t,s,r,o){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,o),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,o),s.state!==t&&nh.enqueueReplaceState(s,s.state,null)}function Ni(t,s){var r=s;if("ref"in s){r={};for(var o in s)o!=="ref"&&(r[o]=s[o])}if(t=t.defaultProps){r===s&&(r=v({},r));for(var h in t)r[h]===void 0&&(r[h]=t[h])}return r}function Zp(t){$o(t)}function Wp(t){console.error(t)}function eg(t){$o(t)}function hl(t,s){try{var r=t.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(o){setTimeout(function(){throw o})}}function tg(t,s,r){try{var o=t.onCaughtError;o(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function sh(t,s,r){return r=Ps(r),r.tag=3,r.payload={element:null},r.callback=function(){hl(t,s)},r}function ng(t){return t=Ps(t),t.tag=3,t}function sg(t,s,r,o){var h=r.type.getDerivedStateFromError;if(typeof h=="function"){var f=o.value;t.payload=function(){return h(f)},t.callback=function(){tg(s,r,o)}}var b=r.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(t.callback=function(){tg(s,r,o),typeof h!="function"&&(Gs===null?Gs=new Set([this]):Gs.add(this));var w=o.stack;this.componentDidCatch(o.value,{componentStack:w!==null?w:""})})}function G_(t,s,r,o,h){if(r.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(s=r.alternate,s!==null&&sa(s,r,h,!0),r=en.current,r!==null){switch(r.tag){case 31:case 13:return xn===null?Sl():r.alternate===null&&lt===0&&(lt=3),r.flags&=-257,r.flags|=65536,r.lanes=h,o===Zo?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([o]):s.add(o),Nh(t,o,h)),!1;case 22:return r.flags|=65536,o===Zo?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([o])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([o]):r.add(o)),Nh(t,o,h)),!1}throw Error(a(435,r.tag))}return Nh(t,o,h),Sl(),!1}if(je)return s=en.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=h,o!==_u&&(t=Error(a(422),{cause:o}),hr(gn(t,r)))):(o!==_u&&(s=Error(a(423),{cause:o}),hr(gn(s,r))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=gn(o,r),h=sh(t.stateNode,o,h),Du(t,h),lt!==4&&(lt=2)),!1;var f=Error(a(520),{cause:o});if(f=gn(f,r),kr===null?kr=[f]:kr.push(f),lt!==4&&(lt=2),s===null)return!0;o=gn(o,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,t=h&-h,r.lanes|=t,t=sh(r.stateNode,o,t),Du(r,t),!1;case 1:if(s=r.type,f=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Gs===null||!Gs.has(f))))return r.flags|=65536,h&=-h,r.lanes|=h,h=ng(h),sg(h,t,r,o),Du(r,h),!1}r=r.return}while(r!==null);return!1}var ih=Error(a(461)),xt=!1;function Mt(t,s,r,o){s.child=t===null?op(s,null,r,o):Ai(s,t.child,r,o)}function ig(t,s,r,o,h){r=r.render;var f=s.ref;if("ref"in o){var b={};for(var w in o)w!=="ref"&&(b[w]=o[w])}else b=o;return _i(s),o=Pu(t,s,r,b,f,h),w=Vu(),t!==null&&!xt?(Hu(t,s,h),ys(t,s,h)):(je&&w&&xu(s),s.flags|=1,Mt(t,s,o,h),s.child)}function ag(t,s,r,o,h){if(t===null){var f=r.type;return typeof f=="function"&&!yu(f)&&f.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=f,rg(t,s,f,o,h)):(t=Go(r.type,null,o,s,s.mode,h),t.ref=s.ref,t.return=s,s.child=t)}if(f=t.child,!dh(t,h)){var b=f.memoizedProps;if(r=r.compare,r=r!==null?r:lr,r(b,o)&&t.ref===s.ref)return ys(t,s,h)}return s.flags|=1,t=hs(f,o),t.ref=s.ref,t.return=s,s.child=t}function rg(t,s,r,o,h){if(t!==null){var f=t.memoizedProps;if(lr(f,o)&&t.ref===s.ref)if(xt=!1,s.pendingProps=o=f,dh(t,h))(t.flags&131072)!==0&&(xt=!0);else return s.lanes=t.lanes,ys(t,s,h)}return ah(t,s,r,o,h)}function og(t,s,r,o){var h=o.children,f=t!==null?t.memoizedState:null;if(t===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((s.flags&128)!==0){if(f=f!==null?f.baseLanes|r:r,t!==null){for(o=s.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~f}else o=0,s.child=null;return lg(t,s,f,r,o)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&Jo(s,f!==null?f.cachePool:null),f!==null?up(s,f):Bu(),hp(s);else return o=s.lanes=536870912,lg(t,s,f!==null?f.baseLanes|r:r,r,o)}else f!==null?(Jo(s,f.cachePool),up(s,f),$s(),s.memoizedState=null):(t!==null&&Jo(s,null),Bu(),$s());return Mt(t,s,h,r),s.child}function Sr(t,s){return t!==null&&t.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function lg(t,s,r,o,h){var f=Ru();return f=f===null?null:{parent:bt._currentValue,pool:f},s.memoizedState={baseLanes:r,cachePool:f},t!==null&&Jo(s,null),Bu(),hp(s),t!==null&&sa(t,s,o,!0),s.childLanes=h,null}function dl(t,s){return s=ml({mode:s.mode,children:s.children},t.mode),s.ref=t.ref,t.child=s,s.return=t,s}function cg(t,s,r){return Ai(s,t.child,null,r),t=dl(s,s.pendingProps),t.flags|=2,tn(s),s.memoizedState=null,t}function K_(t,s,r){var o=s.pendingProps,h=(s.flags&128)!==0;if(s.flags&=-129,t===null){if(je){if(o.mode==="hidden")return t=dl(s,o),s.lanes=536870912,Sr(null,t);if(Lu(s),(t=We)?(t=wy(t,vn),t=t!==null&&t.data==="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ms!==null?{id:Gn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},r=Gm(t),r.return=s,s.child=r,Ot=s,We=null)):t=null,t===null)throw Us(s);return s.lanes=536870912,null}return dl(s,o)}var f=t.memoizedState;if(f!==null){var b=f.dehydrated;if(Lu(s),h)if(s.flags&256)s.flags&=-257,s=cg(t,s,r);else if(s.memoizedState!==null)s.child=t.child,s.flags|=128,s=null;else throw Error(a(558));else if(xt||sa(t,s,r,!1),h=(r&t.childLanes)!==0,xt||h){if(o=Ke,o!==null&&(b=Ro(o,r),b!==0&&b!==f.retryLane))throw f.retryLane=b,bi(t,b),Xt(o,t,b),ih;Sl(),s=cg(t,s,r)}else t=f.treeContext,We=wn(b.nextSibling),Ot=s,je=!0,Bs=null,vn=!1,t!==null&&Xm(s,t),s=dl(s,o),s.flags|=4096;return s}return t=hs(t.child,{mode:o.mode,children:o.children}),t.ref=s.ref,s.child=t,t.return=s,t}function fl(t,s){var r=s.ref;if(r===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(t===null||t.ref!==r)&&(s.flags|=4194816)}}function ah(t,s,r,o,h){return _i(s),r=Pu(t,s,r,o,void 0,h),o=Vu(),t!==null&&!xt?(Hu(t,s,h),ys(t,s,h)):(je&&o&&xu(s),s.flags|=1,Mt(t,s,r,h),s.child)}function ug(t,s,r,o,h,f){return _i(s),s.updateQueue=null,r=fp(s,o,r,h),dp(t),o=Vu(),t!==null&&!xt?(Hu(t,s,f),ys(t,s,f)):(je&&o&&xu(s),s.flags|=1,Mt(t,s,r,f),s.child)}function hg(t,s,r,o,h){if(_i(s),s.stateNode===null){var f=Wi,b=r.contextType;typeof b=="object"&&b!==null&&(f=Dt(b)),f=new r(o,f),s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=nh,s.stateNode=f,f._reactInternals=s,f=s.stateNode,f.props=o,f.state=s.memoizedState,f.refs={},Cu(s),b=r.contextType,f.context=typeof b=="object"&&b!==null?Dt(b):Wi,f.state=s.memoizedState,b=r.getDerivedStateFromProps,typeof b=="function"&&(th(s,r,b,o),f.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(b=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),b!==f.state&&nh.enqueueReplaceState(f,f.state,null),br(s,o,f,h),yr(),f.state=s.memoizedState),typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!0}else if(t===null){f=s.stateNode;var w=s.memoizedProps,E=Ni(r,w);f.props=E;var U=f.context,$=r.contextType;b=Wi,typeof $=="object"&&$!==null&&(b=Dt($));var I=r.getDerivedStateFromProps;$=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(w||U!==b)&&Qp(s,f,o,b),zs=!1;var z=s.memoizedState;f.state=z,br(s,o,f,h),yr(),U=s.memoizedState,w||z!==U||zs?(typeof I=="function"&&(th(s,r,I,o),U=s.memoizedState),(E=zs||Jp(s,r,E,o,z,U,b))?($||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(s.flags|=4194308)):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=o,s.memoizedState=U),f.props=o,f.state=U,f.context=b,o=E):(typeof f.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{f=s.stateNode,Ou(t,s),b=s.memoizedProps,$=Ni(r,b),f.props=$,I=s.pendingProps,z=f.context,U=r.contextType,E=Wi,typeof U=="object"&&U!==null&&(E=Dt(U)),w=r.getDerivedStateFromProps,(U=typeof w=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b!==I||z!==E)&&Qp(s,f,o,E),zs=!1,z=s.memoizedState,f.state=z,br(s,o,f,h),yr();var V=s.memoizedState;b!==I||z!==V||zs||t!==null&&t.dependencies!==null&&Yo(t.dependencies)?(typeof w=="function"&&(th(s,r,w,o),V=s.memoizedState),($=zs||Jp(s,r,$,o,z,V,E)||t!==null&&t.dependencies!==null&&Yo(t.dependencies))?(U||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(o,V,E),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(o,V,E)),typeof f.componentDidUpdate=="function"&&(s.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof f.componentDidUpdate!="function"||b===t.memoizedProps&&z===t.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===t.memoizedProps&&z===t.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=V),f.props=o,f.state=V,f.context=E,o=$):(typeof f.componentDidUpdate!="function"||b===t.memoizedProps&&z===t.memoizedState||(s.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===t.memoizedProps&&z===t.memoizedState||(s.flags|=1024),o=!1)}return f=o,fl(t,s),o=(s.flags&128)!==0,f||o?(f=s.stateNode,r=o&&typeof r.getDerivedStateFromError!="function"?null:f.render(),s.flags|=1,t!==null&&o?(s.child=Ai(s,t.child,null,h),s.child=Ai(s,null,r,h)):Mt(t,s,r,h),s.memoizedState=f.state,t=s.child):t=ys(t,s,h),t}function dg(t,s,r,o){return xi(),s.flags|=256,Mt(t,s,r,o),s.child}var rh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function oh(t){return{baseLanes:t,cachePool:tp()}}function lh(t,s,r){return t=t!==null?t.childLanes&~r:0,s&&(t|=sn),t}function fg(t,s,r){var o=s.pendingProps,h=!1,f=(s.flags&128)!==0,b;if((b=f)||(b=t!==null&&t.memoizedState===null?!1:(ft.current&2)!==0),b&&(h=!0,s.flags&=-129),b=(s.flags&32)!==0,s.flags&=-33,t===null){if(je){if(h?Hs(s):$s(),(t=We)?(t=wy(t,vn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ms!==null?{id:Gn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},r=Gm(t),r.return=s,s.child=r,Ot=s,We=null)):t=null,t===null)throw Us(s);return Fh(t)?s.lanes=32:s.lanes=536870912,null}var w=o.children;return o=o.fallback,h?($s(),h=s.mode,w=ml({mode:"hidden",children:w},h),o=vi(o,h,r,null),w.return=s,o.return=s,w.sibling=o,s.child=w,o=s.child,o.memoizedState=oh(r),o.childLanes=lh(t,b,r),s.memoizedState=rh,Sr(null,o)):(Hs(s),ch(s,w))}var E=t.memoizedState;if(E!==null&&(w=E.dehydrated,w!==null)){if(f)s.flags&256?(Hs(s),s.flags&=-257,s=uh(t,s,r)):s.memoizedState!==null?($s(),s.child=t.child,s.flags|=128,s=null):($s(),w=o.fallback,h=s.mode,o=ml({mode:"visible",children:o.children},h),w=vi(w,h,r,null),w.flags|=2,o.return=s,w.return=s,o.sibling=w,s.child=o,Ai(s,t.child,null,r),o=s.child,o.memoizedState=oh(r),o.childLanes=lh(t,b,r),s.memoizedState=rh,s=Sr(null,o));else if(Hs(s),Fh(w)){if(b=w.nextSibling&&w.nextSibling.dataset,b)var U=b.dgst;b=U,o=Error(a(419)),o.stack="",o.digest=b,hr({value:o,source:null,stack:null}),s=uh(t,s,r)}else if(xt||sa(t,s,r,!1),b=(r&t.childLanes)!==0,xt||b){if(b=Ke,b!==null&&(o=Ro(b,r),o!==0&&o!==E.retryLane))throw E.retryLane=o,bi(t,o),Xt(b,t,o),ih;qh(w)||Sl(),s=uh(t,s,r)}else qh(w)?(s.flags|=192,s.child=t.child,s=null):(t=E.treeContext,We=wn(w.nextSibling),Ot=s,je=!0,Bs=null,vn=!1,t!==null&&Xm(s,t),s=ch(s,o.children),s.flags|=4096);return s}return h?($s(),w=o.fallback,h=s.mode,E=t.child,U=E.sibling,o=hs(E,{mode:"hidden",children:o.children}),o.subtreeFlags=E.subtreeFlags&65011712,U!==null?w=hs(U,w):(w=vi(w,h,r,null),w.flags|=2),w.return=s,o.return=s,o.sibling=w,s.child=o,Sr(null,o),o=s.child,w=t.child.memoizedState,w===null?w=oh(r):(h=w.cachePool,h!==null?(E=bt._currentValue,h=h.parent!==E?{parent:E,pool:E}:h):h=tp(),w={baseLanes:w.baseLanes|r,cachePool:h}),o.memoizedState=w,o.childLanes=lh(t,b,r),s.memoizedState=rh,Sr(t.child,o)):(Hs(s),r=t.child,t=r.sibling,r=hs(r,{mode:"visible",children:o.children}),r.return=s,r.sibling=null,t!==null&&(b=s.deletions,b===null?(s.deletions=[t],s.flags|=16):b.push(t)),s.child=r,s.memoizedState=null,r)}function ch(t,s){return s=ml({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function ml(t,s){return t=Wt(22,t,null,s),t.lanes=0,t}function uh(t,s,r){return Ai(s,t.child,null,r),t=ch(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function mg(t,s,r){t.lanes|=s;var o=t.alternate;o!==null&&(o.lanes|=s),Eu(t.return,s,r)}function hh(t,s,r,o,h,f){var b=t.memoizedState;b===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:r,tailMode:h,treeForkCount:f}:(b.isBackwards=s,b.rendering=null,b.renderingStartTime=0,b.last=o,b.tail=r,b.tailMode=h,b.treeForkCount=f)}function pg(t,s,r){var o=s.pendingProps,h=o.revealOrder,f=o.tail;o=o.children;var b=ft.current,w=(b&2)!==0;if(w?(b=b&1|2,s.flags|=128):b&=1,J(ft,b),Mt(t,s,o,r),o=je?ur:0,!w&&t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&mg(t,r,s);else if(t.tag===19)mg(t,r,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(r=s.child,h=null;r!==null;)t=r.alternate,t!==null&&nl(t)===null&&(h=r),r=r.sibling;r=h,r===null?(h=s.child,s.child=null):(h=r.sibling,r.sibling=null),hh(s,!1,h,r,f,o);break;case"backwards":case"unstable_legacy-backwards":for(r=null,h=s.child,s.child=null;h!==null;){if(t=h.alternate,t!==null&&nl(t)===null){s.child=h;break}t=h.sibling,h.sibling=r,r=h,h=t}hh(s,!0,r,null,f,o);break;case"together":hh(s,!1,null,null,void 0,o);break;default:s.memoizedState=null}return s.child}function ys(t,s,r){if(t!==null&&(s.dependencies=t.dependencies),Is|=s.lanes,(r&s.childLanes)===0)if(t!==null){if(sa(t,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(a(153));if(s.child!==null){for(t=s.child,r=hs(t,t.pendingProps),s.child=r,r.return=s;t.sibling!==null;)t=t.sibling,r=r.sibling=hs(t,t.pendingProps),r.return=s;r.sibling=null}return s.child}function dh(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&Yo(t)))}function Y_(t,s,r){switch(s.tag){case 3:ke(s,s.stateNode.containerInfo),Ls(s,bt,t.memoizedState.cache),xi();break;case 27:case 5:at(s);break;case 4:ke(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,Lu(s),null;break;case 13:var o=s.memoizedState;if(o!==null)return o.dehydrated!==null?(Hs(s),s.flags|=128,null):(r&s.child.childLanes)!==0?fg(t,s,r):(Hs(s),t=ys(t,s,r),t!==null?t.sibling:null);Hs(s);break;case 19:var h=(t.flags&128)!==0;if(o=(r&s.childLanes)!==0,o||(sa(t,s,r,!1),o=(r&s.childLanes)!==0),h){if(o)return pg(t,s,r);s.flags|=128}if(h=s.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),J(ft,ft.current),o)break;return null;case 22:return s.lanes=0,og(t,s,r,s.pendingProps);case 24:Ls(s,bt,t.memoizedState.cache)}return ys(t,s,r)}function gg(t,s,r){if(t!==null)if(t.memoizedProps!==s.pendingProps)xt=!0;else{if(!dh(t,r)&&(s.flags&128)===0)return xt=!1,Y_(t,s,r);xt=(t.flags&131072)!==0}else xt=!1,je&&(s.flags&1048576)!==0&&Ym(s,ur,s.index);switch(s.lanes=0,s.tag){case 16:e:{var o=s.pendingProps;if(t=Ti(s.elementType),s.type=t,typeof t=="function")yu(t)?(o=Ni(t,o),s.tag=1,s=hg(null,s,t,o,r)):(s.tag=0,s=ah(null,s,t,o,r));else{if(t!=null){var h=t.$$typeof;if(h===P){s.tag=11,s=ig(null,s,t,o,r);break e}else if(h===H){s.tag=14,s=ag(null,s,t,o,r);break e}}throw s=Ne(t)||t,Error(a(306,s,""))}}return s;case 0:return ah(t,s,s.type,s.pendingProps,r);case 1:return o=s.type,h=Ni(o,s.pendingProps),hg(t,s,o,h,r);case 3:e:{if(ke(s,s.stateNode.containerInfo),t===null)throw Error(a(387));o=s.pendingProps;var f=s.memoizedState;h=f.element,Ou(t,s),br(s,o,null,r);var b=s.memoizedState;if(o=b.cache,Ls(s,bt,o),o!==f.cache&&Au(s,[bt],r,!0),yr(),o=b.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:b.cache},s.updateQueue.baseState=f,s.memoizedState=f,s.flags&256){s=dg(t,s,o,r);break e}else if(o!==h){h=gn(Error(a(424)),s),hr(h),s=dg(t,s,o,r);break e}else{switch(t=s.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(We=wn(t.firstChild),Ot=s,je=!0,Bs=null,vn=!0,r=op(s,null,o,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(xi(),o===h){s=ys(t,s,r);break e}Mt(t,s,o,r)}s=s.child}return s;case 26:return fl(t,s),t===null?(r=jy(s.type,null,s.pendingProps,null))?s.memoizedState=r:je||(r=s.type,t=s.pendingProps,o=kl(ge.current).createElement(r),o[R]=s,o[X]=t,Bt(o,r,t),Ve(o),s.stateNode=o):s.memoizedState=jy(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return at(s),t===null&&je&&(o=s.stateNode=Ty(s.type,s.pendingProps,ge.current),Ot=s,vn=!0,h=We,Js(s.type)?(Ih=h,We=wn(o.firstChild)):We=h),Mt(t,s,s.pendingProps.children,r),fl(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&je&&((h=o=We)&&(o=TS(o,s.type,s.pendingProps,vn),o!==null?(s.stateNode=o,Ot=s,We=wn(o.firstChild),vn=!1,h=!0):h=!1),h||Us(s)),at(s),h=s.type,f=s.pendingProps,b=t!==null?t.memoizedProps:null,o=f.children,Vh(h,f)?o=null:b!==null&&Vh(h,b)&&(s.flags|=32),s.memoizedState!==null&&(h=Pu(t,s,P_,null,null,r),zr._currentValue=h),fl(t,s),Mt(t,s,o,r),s.child;case 6:return t===null&&je&&((t=r=We)&&(r=ES(r,s.pendingProps,vn),r!==null?(s.stateNode=r,Ot=s,We=null,t=!0):t=!1),t||Us(s)),null;case 13:return fg(t,s,r);case 4:return ke(s,s.stateNode.containerInfo),o=s.pendingProps,t===null?s.child=Ai(s,null,o,r):Mt(t,s,o,r),s.child;case 11:return ig(t,s,s.type,s.pendingProps,r);case 7:return Mt(t,s,s.pendingProps,r),s.child;case 8:return Mt(t,s,s.pendingProps.children,r),s.child;case 12:return Mt(t,s,s.pendingProps.children,r),s.child;case 10:return o=s.pendingProps,Ls(s,s.type,o.value),Mt(t,s,o.children,r),s.child;case 9:return h=s.type._context,o=s.pendingProps.children,_i(s),h=Dt(h),o=o(h),s.flags|=1,Mt(t,s,o,r),s.child;case 14:return ag(t,s,s.type,s.pendingProps,r);case 15:return rg(t,s,s.type,s.pendingProps,r);case 19:return pg(t,s,r);case 31:return K_(t,s,r);case 22:return og(t,s,r,s.pendingProps);case 24:return _i(s),o=Dt(bt),t===null?(h=Ru(),h===null&&(h=Ke,f=ju(),h.pooledCache=f,f.refCount++,f!==null&&(h.pooledCacheLanes|=r),h=f),s.memoizedState={parent:o,cache:h},Cu(s),Ls(s,bt,h)):((t.lanes&r)!==0&&(Ou(t,s),br(s,null,null,r),yr()),h=t.memoizedState,f=s.memoizedState,h.parent!==o?(h={parent:o,cache:o},s.memoizedState=h,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=h),Ls(s,bt,o)):(o=f.cache,Ls(s,bt,o),o!==h.cache&&Au(s,[bt],r,!0))),Mt(t,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function bs(t){t.flags|=4}function fh(t,s,r,o,h){if((s=(t.mode&32)!==0)&&(s=!1),s){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(qg())t.flags|=8192;else throw Ei=Zo,ku}else t.flags&=-16777217}function yg(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Oy(s))if(qg())t.flags|=8192;else throw Ei=Zo,ku}function pl(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?jo():536870912,t.lanes|=s,pa|=s)}function Tr(t,s){if(!je)switch(t.tailMode){case"hidden":s=t.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function et(t){var s=t.alternate!==null&&t.alternate.child===t.child,r=0,o=0;if(s)for(var h=t.child;h!==null;)r|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)r|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=r,s}function X_(t,s,r){var o=s.pendingProps;switch(wu(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(s),null;case 1:return et(s),null;case 3:return r=s.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ms(bt),qe(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(na(s)?bs(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Su())),et(s),null;case 26:var h=s.type,f=s.memoizedState;return t===null?(bs(s),f!==null?(et(s),yg(s,f)):(et(s),fh(s,h,null,o,r))):f?f!==t.memoizedState?(bs(s),et(s),yg(s,f)):(et(s),s.flags&=-16777217):(t=t.memoizedProps,t!==o&&bs(s),et(s),fh(s,h,t,o,r)),null;case 27:if(jn(s),r=ge.current,h=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==o&&bs(s);else{if(!o){if(s.stateNode===null)throw Error(a(166));return et(s),null}t=ne.current,na(s)?Jm(s):(t=Ty(h,o,r),s.stateNode=t,bs(s))}return et(s),null;case 5:if(jn(s),h=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==o&&bs(s);else{if(!o){if(s.stateNode===null)throw Error(a(166));return et(s),null}if(f=ne.current,na(s))Jm(s);else{var b=kl(ge.current);switch(f){case 1:f=b.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:f=b.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":f=b.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":f=b.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":f=b.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?b.createElement(h,{is:o.is}):b.createElement(h)}}f[R]=s,f[X]=o;e:for(b=s.child;b!==null;){if(b.tag===5||b.tag===6)f.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===s)break e;for(;b.sibling===null;){if(b.return===null||b.return===s)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}s.stateNode=f;e:switch(Bt(f,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&bs(s)}}return et(s),fh(s,s.type,t===null?null:t.memoizedProps,s.pendingProps,r),null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==o&&bs(s);else{if(typeof o!="string"&&s.stateNode===null)throw Error(a(166));if(t=ge.current,na(s)){if(t=s.stateNode,r=s.memoizedProps,o=null,h=Ot,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[R]=s,t=!!(t.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||fy(t.nodeValue,r)),t||Us(s,!0)}else t=kl(t).createTextNode(o),t[R]=s,s.stateNode=t}return et(s),null;case 31:if(r=s.memoizedState,t===null||t.memoizedState!==null){if(o=na(s),r!==null){if(t===null){if(!o)throw Error(a(318));if(t=s.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[R]=s}else xi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;et(s),t=!1}else r=Su(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return s.flags&256?(tn(s),s):(tn(s),null);if((s.flags&128)!==0)throw Error(a(558))}return et(s),null;case 13:if(o=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=na(s),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(a(318));if(h=s.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[R]=s}else xi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;et(s),h=!1}else h=Su(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return s.flags&256?(tn(s),s):(tn(s),null)}return tn(s),(s.flags&128)!==0?(s.lanes=r,s):(r=o!==null,t=t!==null&&t.memoizedState!==null,r&&(o=s.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==h&&(o.flags|=2048)),r!==t&&r&&(s.child.flags|=8192),pl(s,s.updateQueue),et(s),null);case 4:return qe(),t===null&&Bh(s.stateNode.containerInfo),et(s),null;case 10:return ms(s.type),et(s),null;case 19:if(q(ft),o=s.memoizedState,o===null)return et(s),null;if(h=(s.flags&128)!==0,f=o.rendering,f===null)if(h)Tr(o,!1);else{if(lt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(f=nl(t),f!==null){for(s.flags|=128,Tr(o,!1),t=f.updateQueue,s.updateQueue=t,pl(s,t),s.subtreeFlags=0,t=r,r=s.child;r!==null;)Im(r,t),r=r.sibling;return J(ft,ft.current&1|2),je&&ds(s,o.treeForkCount),s.child}t=t.sibling}o.tail!==null&&Ze()>xl&&(s.flags|=128,h=!0,Tr(o,!1),s.lanes=4194304)}else{if(!h)if(t=nl(f),t!==null){if(s.flags|=128,h=!0,t=t.updateQueue,s.updateQueue=t,pl(s,t),Tr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!f.alternate&&!je)return et(s),null}else 2*Ze()-o.renderingStartTime>xl&&r!==536870912&&(s.flags|=128,h=!0,Tr(o,!1),s.lanes=4194304);o.isBackwards?(f.sibling=s.child,s.child=f):(t=o.last,t!==null?t.sibling=f:s.child=f,o.last=f)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ze(),t.sibling=null,r=ft.current,J(ft,h?r&1|2:r&1),je&&ds(s,o.treeForkCount),t):(et(s),null);case 22:case 23:return tn(s),Uu(),o=s.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(s.flags|=8192):o&&(s.flags|=8192),o?(r&536870912)!==0&&(s.flags&128)===0&&(et(s),s.subtreeFlags&6&&(s.flags|=8192)):et(s),r=s.updateQueue,r!==null&&pl(s,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==r&&(s.flags|=2048),t!==null&&q(Si),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),ms(bt),et(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function J_(t,s){switch(wu(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return ms(bt),qe(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return jn(s),null;case 31:if(s.memoizedState!==null){if(tn(s),s.alternate===null)throw Error(a(340));xi()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 13:if(tn(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(a(340));xi()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return q(ft),null;case 4:return qe(),null;case 10:return ms(s.type),null;case 22:case 23:return tn(s),Uu(),t!==null&&q(Si),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return ms(bt),null;case 25:return null;default:return null}}function bg(t,s){switch(wu(s),s.tag){case 3:ms(bt),qe();break;case 26:case 27:case 5:jn(s);break;case 4:qe();break;case 31:s.memoizedState!==null&&tn(s);break;case 13:tn(s);break;case 19:q(ft);break;case 10:ms(s.type);break;case 22:case 23:tn(s),Uu(),t!==null&&q(Si);break;case 24:ms(bt)}}function Er(t,s){try{var r=s.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var h=o.next;r=h;do{if((r.tag&t)===t){o=void 0;var f=r.create,b=r.inst;o=f(),b.destroy=o}r=r.next}while(r!==h)}}catch(w){$e(s,s.return,w)}}function qs(t,s,r){try{var o=s.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var f=h.next;o=f;do{if((o.tag&t)===t){var b=o.inst,w=b.destroy;if(w!==void 0){b.destroy=void 0,h=s;var E=r,U=w;try{U()}catch($){$e(h,E,$)}}}o=o.next}while(o!==f)}}catch($){$e(s,s.return,$)}}function vg(t){var s=t.updateQueue;if(s!==null){var r=t.stateNode;try{cp(s,r)}catch(o){$e(t,t.return,o)}}}function xg(t,s,r){r.props=Ni(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(o){$e(t,s,o)}}function Ar(t,s){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof r=="function"?t.refCleanup=r(o):r.current=o}}catch(h){$e(t,s,h)}}function Yn(t,s){var r=t.ref,o=t.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(h){$e(t,s,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(h){$e(t,s,h)}else r.current=null}function wg(t){var s=t.type,r=t.memoizedProps,o=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(h){$e(t,t.return,h)}}function mh(t,s,r){try{var o=t.stateNode;bS(o,t.type,r,s),o[X]=s}catch(h){$e(t,t.return,h)}}function _g(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Js(t.type)||t.tag===4}function ph(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||_g(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Js(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function gh(t,s,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(t),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=cs));else if(o!==4&&(o===27&&Js(t.type)&&(r=t.stateNode,s=null),t=t.child,t!==null))for(gh(t,s,r),t=t.sibling;t!==null;)gh(t,s,r),t=t.sibling}function gl(t,s,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,s?r.insertBefore(t,s):r.appendChild(t);else if(o!==4&&(o===27&&Js(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(gl(t,s,r),t=t.sibling;t!==null;)gl(t,s,r),t=t.sibling}function Sg(t){var s=t.stateNode,r=t.memoizedProps;try{for(var o=t.type,h=s.attributes;h.length;)s.removeAttributeNode(h[0]);Bt(s,o,r),s[R]=t,s[X]=r}catch(f){$e(t,t.return,f)}}var vs=!1,wt=!1,yh=!1,Tg=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function Q_(t,s){if(t=t.containerInfo,zh=Ll,t=Um(t),uu(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var h=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{r.nodeType,f.nodeType}catch{r=null;break e}var b=0,w=-1,E=-1,U=0,$=0,I=t,z=null;t:for(;;){for(var V;I!==r||h!==0&&I.nodeType!==3||(w=b+h),I!==f||o!==0&&I.nodeType!==3||(E=b+o),I.nodeType===3&&(b+=I.nodeValue.length),(V=I.firstChild)!==null;)z=I,I=V;for(;;){if(I===t)break t;if(z===r&&++U===h&&(w=b),z===f&&++$===o&&(E=b),(V=I.nextSibling)!==null)break;I=z,z=I.parentNode}I=V}r=w===-1||E===-1?null:{start:w,end:E}}else r=null}r=r||{start:0,end:0}}else r=null;for(Ph={focusedElem:t,selectionRange:r},Ll=!1,Rt=s;Rt!==null;)if(s=Rt,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Rt=t;else for(;Rt!==null;){switch(s=Rt,f=s.alternate,t=s.flags,s.tag){case 0:if((t&4)!==0&&(t=s.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r<t.length;r++)h=t[r],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&f!==null){t=void 0,r=s,h=f.memoizedProps,f=f.memoizedState,o=r.stateNode;try{var ie=Ni(r.type,h);t=o.getSnapshotBeforeUpdate(ie,f),o.__reactInternalSnapshotBeforeUpdate=t}catch(pe){$e(r,r.return,pe)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,r=t.nodeType,r===9)$h(t);else if(r===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":$h(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=s.sibling,t!==null){t.return=s.return,Rt=t;break}Rt=s.return}}function Eg(t,s,r){var o=r.flags;switch(r.tag){case 0:case 11:case 15:ws(t,r),o&4&&Er(5,r);break;case 1:if(ws(t,r),o&4)if(t=r.stateNode,s===null)try{t.componentDidMount()}catch(b){$e(r,r.return,b)}else{var h=Ni(r.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(h,s,t.__reactInternalSnapshotBeforeUpdate)}catch(b){$e(r,r.return,b)}}o&64&&vg(r),o&512&&Ar(r,r.return);break;case 3:if(ws(t,r),o&64&&(t=r.updateQueue,t!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{cp(t,s)}catch(b){$e(r,r.return,b)}}break;case 27:s===null&&o&4&&Sg(r);case 26:case 5:ws(t,r),s===null&&o&4&&wg(r),o&512&&Ar(r,r.return);break;case 12:ws(t,r);break;case 31:ws(t,r),o&4&&Ng(t,r);break;case 13:ws(t,r),o&4&&Rg(t,r),o&64&&(t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(r=rS.bind(null,r),AS(t,r))));break;case 22:if(o=r.memoizedState!==null||vs,!o){s=s!==null&&s.memoizedState!==null||wt,h=vs;var f=wt;vs=o,(wt=s)&&!f?_s(t,r,(r.subtreeFlags&8772)!==0):ws(t,r),vs=h,wt=f}break;case 30:break;default:ws(t,r)}}function Ag(t){var s=t.alternate;s!==null&&(t.alternate=null,Ag(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&tt(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var nt=null,It=!1;function xs(t,s,r){for(r=r.child;r!==null;)jg(t,s,r),r=r.sibling}function jg(t,s,r){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(rs,r)}catch{}switch(r.tag){case 26:wt||Yn(r,s),xs(t,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:wt||Yn(r,s);var o=nt,h=It;Js(r.type)&&(nt=r.stateNode,It=!1),xs(t,s,r),Br(r.stateNode),nt=o,It=h;break;case 5:wt||Yn(r,s);case 6:if(o=nt,h=It,nt=null,xs(t,s,r),nt=o,It=h,nt!==null)if(It)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(r.stateNode)}catch(f){$e(r,s,f)}else try{nt.removeChild(r.stateNode)}catch(f){$e(r,s,f)}break;case 18:nt!==null&&(It?(t=nt,vy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,r.stateNode),Sa(t)):vy(nt,r.stateNode));break;case 4:o=nt,h=It,nt=r.stateNode.containerInfo,It=!0,xs(t,s,r),nt=o,It=h;break;case 0:case 11:case 14:case 15:qs(2,r,s),wt||qs(4,r,s),xs(t,s,r);break;case 1:wt||(Yn(r,s),o=r.stateNode,typeof o.componentWillUnmount=="function"&&xg(r,s,o)),xs(t,s,r);break;case 21:xs(t,s,r);break;case 22:wt=(o=wt)||r.memoizedState!==null,xs(t,s,r),wt=o;break;default:xs(t,s,r)}}function Ng(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Sa(t)}catch(r){$e(s,s.return,r)}}}function Rg(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Sa(t)}catch(r){$e(s,s.return,r)}}function Z_(t){switch(t.tag){case 31:case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new Tg),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new Tg),s;default:throw Error(a(435,t.tag))}}function yl(t,s){var r=Z_(t);s.forEach(function(o){if(!r.has(o)){r.add(o);var h=oS.bind(null,t,o);o.then(h,h)}})}function Gt(t,s){var r=s.deletions;if(r!==null)for(var o=0;o<r.length;o++){var h=r[o],f=t,b=s,w=b;e:for(;w!==null;){switch(w.tag){case 27:if(Js(w.type)){nt=w.stateNode,It=!1;break e}break;case 5:nt=w.stateNode,It=!1;break e;case 3:case 4:nt=w.stateNode.containerInfo,It=!0;break e}w=w.return}if(nt===null)throw Error(a(160));jg(f,b,h),nt=null,It=!1,f=h.alternate,f!==null&&(f.return=null),h.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)kg(s,t),s=s.sibling}var On=null;function kg(t,s){var r=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Gt(s,t),Kt(t),o&4&&(qs(3,t,t.return),Er(3,t),qs(5,t,t.return));break;case 1:Gt(s,t),Kt(t),o&512&&(wt||r===null||Yn(r,r.return)),o&64&&vs&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(r=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=r===null?o:r.concat(o))));break;case 26:var h=On;if(Gt(s,t),Kt(t),o&512&&(wt||r===null||Yn(r,r.return)),o&4){var f=r!==null?r.memoizedState:null;if(o=t.memoizedState,r===null)if(o===null)if(t.stateNode===null){e:{o=t.type,r=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":f=h.getElementsByTagName("title")[0],(!f||f[Je]||f[R]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=h.createElement(o),h.head.insertBefore(f,h.querySelector("head > title"))),Bt(f,o,r),f[R]=t,Ve(f),o=f;break e;case"link":var b=ky("link","href",h).get(o+(r.href||""));if(b){for(var w=0;w<b.length;w++)if(f=b[w],f.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&f.getAttribute("rel")===(r.rel==null?null:r.rel)&&f.getAttribute("title")===(r.title==null?null:r.title)&&f.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){b.splice(w,1);break t}}f=h.createElement(o),Bt(f,o,r),h.head.appendChild(f);break;case"meta":if(b=ky("meta","content",h).get(o+(r.content||""))){for(w=0;w<b.length;w++)if(f=b[w],f.getAttribute("content")===(r.content==null?null:""+r.content)&&f.getAttribute("name")===(r.name==null?null:r.name)&&f.getAttribute("property")===(r.property==null?null:r.property)&&f.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&f.getAttribute("charset")===(r.charSet==null?null:r.charSet)){b.splice(w,1);break t}}f=h.createElement(o),Bt(f,o,r),h.head.appendChild(f);break;default:throw Error(a(468,o))}f[R]=t,Ve(f),o=f}t.stateNode=o}else Cy(h,t.type,t.stateNode);else t.stateNode=Ry(h,o,t.memoizedProps);else f!==o?(f===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):f.count--,o===null?Cy(h,t.type,t.stateNode):Ry(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&mh(t,t.memoizedProps,r.memoizedProps)}break;case 27:Gt(s,t),Kt(t),o&512&&(wt||r===null||Yn(r,r.return)),r!==null&&o&4&&mh(t,t.memoizedProps,r.memoizedProps);break;case 5:if(Gt(s,t),Kt(t),o&512&&(wt||r===null||Yn(r,r.return)),t.flags&32){h=t.stateNode;try{Gi(h,"")}catch(ie){$e(t,t.return,ie)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,mh(t,h,r!==null?r.memoizedProps:h)),o&1024&&(yh=!0);break;case 6:if(Gt(s,t),Kt(t),o&4){if(t.stateNode===null)throw Error(a(162));o=t.memoizedProps,r=t.stateNode;try{r.nodeValue=o}catch(ie){$e(t,t.return,ie)}}break;case 3:if(Dl=null,h=On,On=Cl(s.containerInfo),Gt(s,t),On=h,Kt(t),o&4&&r!==null&&r.memoizedState.isDehydrated)try{Sa(s.containerInfo)}catch(ie){$e(t,t.return,ie)}yh&&(yh=!1,Cg(t));break;case 4:o=On,On=Cl(t.stateNode.containerInfo),Gt(s,t),Kt(t),On=o;break;case 12:Gt(s,t),Kt(t);break;case 31:Gt(s,t),Kt(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,yl(t,o)));break;case 13:Gt(s,t),Kt(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(vl=Ze()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,yl(t,o)));break;case 22:h=t.memoizedState!==null;var E=r!==null&&r.memoizedState!==null,U=vs,$=wt;if(vs=U||h,wt=$||E,Gt(s,t),wt=$,vs=U,Kt(t),o&8192)e:for(s=t.stateNode,s._visibility=h?s._visibility&-2:s._visibility|1,h&&(r===null||E||vs||wt||Ri(t)),r=null,s=t;;){if(s.tag===5||s.tag===26){if(r===null){E=r=s;try{if(f=E.stateNode,h)b=f.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{w=E.stateNode;var I=E.memoizedProps.style,z=I!=null&&I.hasOwnProperty("display")?I.display:null;w.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ie){$e(E,E.return,ie)}}}else if(s.tag===6){if(r===null){E=s;try{E.stateNode.nodeValue=h?"":E.memoizedProps}catch(ie){$e(E,E.return,ie)}}}else if(s.tag===18){if(r===null){E=s;try{var V=E.stateNode;h?xy(V,!0):xy(E.stateNode,!1)}catch(ie){$e(E,E.return,ie)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}o&4&&(o=t.updateQueue,o!==null&&(r=o.retryQueue,r!==null&&(o.retryQueue=null,yl(t,r))));break;case 19:Gt(s,t),Kt(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,yl(t,o)));break;case 30:break;case 21:break;default:Gt(s,t),Kt(t)}}function Kt(t){var s=t.flags;if(s&2){try{for(var r,o=t.return;o!==null;){if(_g(o)){r=o;break}o=o.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var h=r.stateNode,f=ph(t);gl(t,f,h);break;case 5:var b=r.stateNode;r.flags&32&&(Gi(b,""),r.flags&=-33);var w=ph(t);gl(t,w,b);break;case 3:case 4:var E=r.stateNode.containerInfo,U=ph(t);gh(t,U,E);break;default:throw Error(a(161))}}catch($){$e(t,t.return,$)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Cg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;Cg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function ws(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Eg(t,s.alternate,s),s=s.sibling}function Ri(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:qs(4,s,s.return),Ri(s);break;case 1:Yn(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&xg(s,s.return,r),Ri(s);break;case 27:Br(s.stateNode);case 26:case 5:Yn(s,s.return),Ri(s);break;case 22:s.memoizedState===null&&Ri(s);break;case 30:Ri(s);break;default:Ri(s)}t=t.sibling}}function _s(t,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var o=s.alternate,h=t,f=s,b=f.flags;switch(f.tag){case 0:case 11:case 15:_s(h,f,r),Er(4,f);break;case 1:if(_s(h,f,r),o=f,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(U){$e(o,o.return,U)}if(o=f,h=o.updateQueue,h!==null){var w=o.stateNode;try{var E=h.shared.hiddenCallbacks;if(E!==null)for(h.shared.hiddenCallbacks=null,h=0;h<E.length;h++)lp(E[h],w)}catch(U){$e(o,o.return,U)}}r&&b&64&&vg(f),Ar(f,f.return);break;case 27:Sg(f);case 26:case 5:_s(h,f,r),r&&o===null&&b&4&&wg(f),Ar(f,f.return);break;case 12:_s(h,f,r);break;case 31:_s(h,f,r),r&&b&4&&Ng(h,f);break;case 13:_s(h,f,r),r&&b&4&&Rg(h,f);break;case 22:f.memoizedState===null&&_s(h,f,r),Ar(f,f.return);break;case 30:break;default:_s(h,f,r)}s=s.sibling}}function bh(t,s){var r=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==r&&(t!=null&&t.refCount++,r!=null&&dr(r))}function vh(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&dr(t))}function Dn(t,s,r,o){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Og(t,s,r,o),s=s.sibling}function Og(t,s,r,o){var h=s.flags;switch(s.tag){case 0:case 11:case 15:Dn(t,s,r,o),h&2048&&Er(9,s);break;case 1:Dn(t,s,r,o);break;case 3:Dn(t,s,r,o),h&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&dr(t)));break;case 12:if(h&2048){Dn(t,s,r,o),t=s.stateNode;try{var f=s.memoizedProps,b=f.id,w=f.onPostCommit;typeof w=="function"&&w(b,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(E){$e(s,s.return,E)}}else Dn(t,s,r,o);break;case 31:Dn(t,s,r,o);break;case 13:Dn(t,s,r,o);break;case 23:break;case 22:f=s.stateNode,b=s.alternate,s.memoizedState!==null?f._visibility&2?Dn(t,s,r,o):jr(t,s):f._visibility&2?Dn(t,s,r,o):(f._visibility|=2,da(t,s,r,o,(s.subtreeFlags&10256)!==0||!1)),h&2048&&bh(b,s);break;case 24:Dn(t,s,r,o),h&2048&&vh(s.alternate,s);break;default:Dn(t,s,r,o)}}function da(t,s,r,o,h){for(h=h&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var f=t,b=s,w=r,E=o,U=b.flags;switch(b.tag){case 0:case 11:case 15:da(f,b,w,E,h),Er(8,b);break;case 23:break;case 22:var $=b.stateNode;b.memoizedState!==null?$._visibility&2?da(f,b,w,E,h):jr(f,b):($._visibility|=2,da(f,b,w,E,h)),h&&U&2048&&bh(b.alternate,b);break;case 24:da(f,b,w,E,h),h&&U&2048&&vh(b.alternate,b);break;default:da(f,b,w,E,h)}s=s.sibling}}function jr(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=t,o=s,h=o.flags;switch(o.tag){case 22:jr(r,o),h&2048&&bh(o.alternate,o);break;case 24:jr(r,o),h&2048&&vh(o.alternate,o);break;default:jr(r,o)}s=s.sibling}}var Nr=8192;function fa(t,s,r){if(t.subtreeFlags&Nr)for(t=t.child;t!==null;)Dg(t,s,r),t=t.sibling}function Dg(t,s,r){switch(t.tag){case 26:fa(t,s,r),t.flags&Nr&&t.memoizedState!==null&&zS(r,On,t.memoizedState,t.memoizedProps);break;case 5:fa(t,s,r);break;case 3:case 4:var o=On;On=Cl(t.stateNode.containerInfo),fa(t,s,r),On=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Nr,Nr=16777216,fa(t,s,r),Nr=o):fa(t,s,r));break;default:fa(t,s,r)}}function Mg(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function Rr(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var o=s[r];Rt=o,Ug(o,t)}Mg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Bg(t),t=t.sibling}function Bg(t){switch(t.tag){case 0:case 11:case 15:Rr(t),t.flags&2048&&qs(9,t,t.return);break;case 3:Rr(t);break;case 12:Rr(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,bl(t)):Rr(t);break;default:Rr(t)}}function bl(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var o=s[r];Rt=o,Ug(o,t)}Mg(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:qs(8,s,s.return),bl(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,bl(s));break;default:bl(s)}t=t.sibling}}function Ug(t,s){for(;Rt!==null;){var r=Rt;switch(r.tag){case 0:case 11:case 15:qs(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var o=r.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:dr(r.memoizedState.cache)}if(o=r.child,o!==null)o.return=r,Rt=o;else e:for(r=t;Rt!==null;){o=Rt;var h=o.sibling,f=o.return;if(Ag(o),o===r){Rt=null;break e}if(h!==null){h.return=f,Rt=h;break e}Rt=f}}}var W_={getCacheForType:function(t){var s=Dt(bt),r=s.data.get(t);return r===void 0&&(r=t(),s.data.set(t,r)),r},cacheSignal:function(){return Dt(bt).controller.signal}},eS=typeof WeakMap=="function"?WeakMap:Map,Le=0,Ke=null,_e=null,Te=0,He=0,nn=null,Fs=!1,ma=!1,xh=!1,Ss=0,lt=0,Is=0,ki=0,wh=0,sn=0,pa=0,kr=null,Yt=null,_h=!1,vl=0,Lg=0,xl=1/0,wl=null,Gs=null,Tt=0,Ks=null,ga=null,Ts=0,Sh=0,Th=null,zg=null,Cr=0,Eh=null;function an(){return(Le&2)!==0&&Te!==0?Te&-Te:L.T!==null?Ch():ko()}function Pg(){if(sn===0)if((Te&536870912)===0||je){var t=Fn;Fn<<=1,(Fn&3932160)===0&&(Fn=262144),sn=t}else sn=536870912;return t=en.current,t!==null&&(t.flags|=32),sn}function Xt(t,s,r){(t===Ke&&(He===2||He===9)||t.cancelPendingCommit!==null)&&(ya(t,0),Ys(t,Te,sn,!1)),Os(t,r),((Le&2)===0||t!==Ke)&&(t===Ke&&((Le&2)===0&&(ki|=r),lt===4&&Ys(t,Te,sn,!1)),Xn(t))}function Vg(t,s,r){if((Le&6)!==0)throw Error(a(327));var o=!r&&(s&127)===0&&(s&t.expiredLanes)===0||fi(t,s),h=o?sS(t,s):jh(t,s,!0),f=o;do{if(h===0){ma&&!o&&Ys(t,s,0,!1);break}else{if(r=t.current.alternate,f&&!tS(r)){h=jh(t,s,!1),f=!1;continue}if(h===2){if(f=s,t.errorRecoveryDisabledLanes&f)var b=0;else b=t.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){s=b;e:{var w=t;h=kr;var E=w.current.memoizedState.isDehydrated;if(E&&(ya(w,b).flags|=256),b=jh(w,b,!1),b!==2){if(xh&&!E){w.errorRecoveryDisabledLanes|=f,ki|=f,h=4;break e}f=Yt,Yt=h,f!==null&&(Yt===null?Yt=f:Yt.push.apply(Yt,f))}h=b}if(f=!1,h!==2)continue}}if(h===1){ya(t,0),Ys(t,s,0,!0);break}e:{switch(o=t,f=h,f){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Ys(o,s,sn,!Fs);break e;case 2:Yt=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(h=vl+300-Ze(),10<h)){if(Ys(o,s,sn,!Fs),qi(o,0,!0)!==0)break e;Ts=s,o.timeoutHandle=yy(Hg.bind(null,o,r,Yt,wl,_h,s,sn,ki,pa,Fs,f,"Throttled",-0,0),h);break e}Hg(o,r,Yt,wl,_h,s,sn,ki,pa,Fs,f,null,-0,0)}}break}while(!0);Xn(t)}function Hg(t,s,r,o,h,f,b,w,E,U,$,I,z,V){if(t.timeoutHandle=-1,I=s.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:cs},Dg(s,f,I);var ie=(f&62914560)===f?vl-Ze():(f&4194048)===f?Lg-Ze():0;if(ie=PS(I,ie),ie!==null){Ts=f,t.cancelPendingCommit=ie(Xg.bind(null,t,s,f,r,o,h,b,w,E,$,I,null,z,V)),Ys(t,f,b,!U);return}}Xg(t,s,f,r,o,h,b,w,E)}function tS(t){for(var s=t;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var o=0;o<r.length;o++){var h=r[o],f=h.getSnapshot;h=h.value;try{if(!Zt(f(),h))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Ys(t,s,r,o){s&=~wh,s&=~ki,t.suspendedLanes|=s,t.pingedLanes&=~s,o&&(t.warmLanes|=s),o=t.expirationTimes;for(var h=s;0<h;){var f=31-Vt(h),b=1<<f;o[f]=-1,h&=~b}r!==0&&No(t,r,s)}function _l(){return(Le&6)===0?(Or(0),!1):!0}function Ah(){if(_e!==null){if(He===0)var t=_e.return;else t=_e,fs=wi=null,$u(t),oa=null,mr=0,t=_e;for(;t!==null;)bg(t.alternate,t),t=t.return;_e=null}}function ya(t,s){var r=t.timeoutHandle;r!==-1&&(t.timeoutHandle=-1,wS(r)),r=t.cancelPendingCommit,r!==null&&(t.cancelPendingCommit=null,r()),Ts=0,Ah(),Ke=t,_e=r=hs(t.current,null),Te=s,He=0,nn=null,Fs=!1,ma=fi(t,s),xh=!1,pa=sn=wh=ki=Is=lt=0,Yt=kr=null,_h=!1,(s&8)!==0&&(s|=s&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=s;0<o;){var h=31-Vt(o),f=1<<h;s|=t[h],o&=~f}return Ss=s,qo(),r}function $g(t,s){ve=null,L.H=_r,s===ra||s===Qo?(s=ip(),He=3):s===ku?(s=ip(),He=4):He=s===ih?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,nn=s,_e===null&&(lt=1,hl(t,gn(s,t.current)))}function qg(){var t=en.current;return t===null?!0:(Te&4194048)===Te?xn===null:(Te&62914560)===Te||(Te&536870912)!==0?t===xn:!1}function Fg(){var t=L.H;return L.H=_r,t===null?_r:t}function Ig(){var t=L.A;return L.A=W_,t}function Sl(){lt=4,Fs||(Te&4194048)!==Te&&en.current!==null||(ma=!0),(Is&134217727)===0&&(ki&134217727)===0||Ke===null||Ys(Ke,Te,sn,!1)}function jh(t,s,r){var o=Le;Le|=2;var h=Fg(),f=Ig();(Ke!==t||Te!==s)&&(wl=null,ya(t,s)),s=!1;var b=lt;e:do try{if(He!==0&&_e!==null){var w=_e,E=nn;switch(He){case 8:Ah(),b=6;break e;case 3:case 2:case 9:case 6:en.current===null&&(s=!0);var U=He;if(He=0,nn=null,ba(t,w,E,U),r&&ma){b=0;break e}break;default:U=He,He=0,nn=null,ba(t,w,E,U)}}nS(),b=lt;break}catch($){$g(t,$)}while(!0);return s&&t.shellSuspendCounter++,fs=wi=null,Le=o,L.H=h,L.A=f,_e===null&&(Ke=null,Te=0,qo()),b}function nS(){for(;_e!==null;)Gg(_e)}function sS(t,s){var r=Le;Le|=2;var o=Fg(),h=Ig();Ke!==t||Te!==s?(wl=null,xl=Ze()+500,ya(t,s)):ma=fi(t,s);e:do try{if(He!==0&&_e!==null){s=_e;var f=nn;t:switch(He){case 1:He=0,nn=null,ba(t,s,f,1);break;case 2:case 9:if(np(f)){He=0,nn=null,Kg(s);break}s=function(){He!==2&&He!==9||Ke!==t||(He=7),Xn(t)},f.then(s,s);break e;case 3:He=7;break e;case 4:He=5;break e;case 7:np(f)?(He=0,nn=null,Kg(s)):(He=0,nn=null,ba(t,s,f,7));break;case 5:var b=null;switch(_e.tag){case 26:b=_e.memoizedState;case 5:case 27:var w=_e;if(b?Oy(b):w.stateNode.complete){He=0,nn=null;var E=w.sibling;if(E!==null)_e=E;else{var U=w.return;U!==null?(_e=U,Tl(U)):_e=null}break t}}He=0,nn=null,ba(t,s,f,5);break;case 6:He=0,nn=null,ba(t,s,f,6);break;case 8:Ah(),lt=6;break e;default:throw Error(a(462))}}iS();break}catch($){$g(t,$)}while(!0);return fs=wi=null,L.H=o,L.A=h,Le=r,_e!==null?0:(Ke=null,Te=0,qo(),lt)}function iS(){for(;_e!==null&&!Qt();)Gg(_e)}function Gg(t){var s=gg(t.alternate,t,Ss);t.memoizedProps=t.pendingProps,s===null?Tl(t):_e=s}function Kg(t){var s=t,r=s.alternate;switch(s.tag){case 15:case 0:s=ug(r,s,s.pendingProps,s.type,void 0,Te);break;case 11:s=ug(r,s,s.pendingProps,s.type.render,s.ref,Te);break;case 5:$u(s);default:bg(r,s),s=_e=Im(s,Ss),s=gg(r,s,Ss)}t.memoizedProps=t.pendingProps,s===null?Tl(t):_e=s}function ba(t,s,r,o){fs=wi=null,$u(s),oa=null,mr=0;var h=s.return;try{if(G_(t,h,s,r,Te)){lt=1,hl(t,gn(r,t.current)),_e=null;return}}catch(f){if(h!==null)throw _e=h,f;lt=1,hl(t,gn(r,t.current)),_e=null;return}s.flags&32768?(je||o===1?t=!0:ma||(Te&536870912)!==0?t=!1:(Fs=t=!0,(o===2||o===9||o===3||o===6)&&(o=en.current,o!==null&&o.tag===13&&(o.flags|=16384))),Yg(s,t)):Tl(s)}function Tl(t){var s=t;do{if((s.flags&32768)!==0){Yg(s,Fs);return}t=s.return;var r=X_(s.alternate,s,Ss);if(r!==null){_e=r;return}if(s=s.sibling,s!==null){_e=s;return}_e=s=t}while(s!==null);lt===0&&(lt=5)}function Yg(t,s){do{var r=J_(t.alternate,t);if(r!==null){r.flags&=32767,_e=r;return}if(r=t.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(t=t.sibling,t!==null)){_e=t;return}_e=t=r}while(t!==null);lt=6,_e=null}function Xg(t,s,r,o,h,f,b,w,E){t.cancelPendingCommit=null;do El();while(Tt!==0);if((Le&6)!==0)throw Error(a(327));if(s!==null){if(s===t.current)throw Error(a(177));if(f=s.lanes|s.childLanes,f|=pu,Kc(t,r,f,b,w,E),t===Ke&&(_e=Ke=null,Te=0),ga=s,Ks=t,Ts=r,Sh=f,Th=h,zg=o,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,lS(qn,function(){return ey(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=L.T,L.T=null,h=W.p,W.p=2,b=Le,Le|=4;try{Q_(t,s,r)}finally{Le=b,W.p=h,L.T=o}}Tt=1,Jg(),Qg(),Zg()}}function Jg(){if(Tt===1){Tt=0;var t=Ks,s=ga,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=L.T,L.T=null;var o=W.p;W.p=2;var h=Le;Le|=4;try{kg(s,t);var f=Ph,b=Um(t.containerInfo),w=f.focusedElem,E=f.selectionRange;if(b!==w&&w&&w.ownerDocument&&Bm(w.ownerDocument.documentElement,w)){if(E!==null&&uu(w)){var U=E.start,$=E.end;if($===void 0&&($=U),"selectionStart"in w)w.selectionStart=U,w.selectionEnd=Math.min($,w.value.length);else{var I=w.ownerDocument||document,z=I&&I.defaultView||window;if(z.getSelection){var V=z.getSelection(),ie=w.textContent.length,pe=Math.min(E.start,ie),Ge=E.end===void 0?pe:Math.min(E.end,ie);!V.extend&&pe>Ge&&(b=Ge,Ge=pe,pe=b);var O=Mm(w,pe),N=Mm(w,Ge);if(O&&N&&(V.rangeCount!==1||V.anchorNode!==O.node||V.anchorOffset!==O.offset||V.focusNode!==N.node||V.focusOffset!==N.offset)){var B=I.createRange();B.setStart(O.node,O.offset),V.removeAllRanges(),pe>Ge?(V.addRange(B),V.extend(N.node,N.offset)):(B.setEnd(N.node,N.offset),V.addRange(B))}}}}for(I=[],V=w;V=V.parentNode;)V.nodeType===1&&I.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<I.length;w++){var F=I[w];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}Ll=!!zh,Ph=zh=null}finally{Le=h,W.p=o,L.T=r}}t.current=s,Tt=2}}function Qg(){if(Tt===2){Tt=0;var t=Ks,s=ga,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=L.T,L.T=null;var o=W.p;W.p=2;var h=Le;Le|=4;try{Eg(t,s.alternate,s)}finally{Le=h,W.p=o,L.T=r}}Tt=3}}function Zg(){if(Tt===4||Tt===3){Tt=0,$n();var t=Ks,s=ga,r=Ts,o=zg;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Tt=5:(Tt=0,ga=Ks=null,Wg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(Gs=null),er(r),s=s.stateNode,yt&&typeof yt.onCommitFiberRoot=="function")try{yt.onCommitFiberRoot(rs,s,void 0,(s.current.flags&128)===128)}catch{}if(o!==null){s=L.T,h=W.p,W.p=2,L.T=null;try{for(var f=t.onRecoverableError,b=0;b<o.length;b++){var w=o[b];f(w.value,{componentStack:w.stack})}}finally{L.T=s,W.p=h}}(Ts&3)!==0&&El(),Xn(t),h=t.pendingLanes,(r&261930)!==0&&(h&42)!==0?t===Eh?Cr++:(Cr=0,Eh=t):Cr=0,Or(0)}}function Wg(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,dr(s)))}function El(){return Jg(),Qg(),Zg(),ey()}function ey(){if(Tt!==5)return!1;var t=Ks,s=Sh;Sh=0;var r=er(Ts),o=L.T,h=W.p;try{W.p=32>r?32:r,L.T=null,r=Th,Th=null;var f=Ks,b=Ts;if(Tt=0,ga=Ks=null,Ts=0,(Le&6)!==0)throw Error(a(331));var w=Le;if(Le|=4,Bg(f.current),Og(f,f.current,b,r),Le=w,Or(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(rs,f)}catch{}return!0}finally{W.p=h,L.T=o,Wg(t,s)}}function ty(t,s,r){s=gn(r,s),s=sh(t.stateNode,s,2),t=Vs(t,s,2),t!==null&&(Os(t,2),Xn(t))}function $e(t,s,r){if(t.tag===3)ty(t,t,r);else for(;s!==null;){if(s.tag===3){ty(s,t,r);break}else if(s.tag===1){var o=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Gs===null||!Gs.has(o))){t=gn(r,t),r=ng(2),o=Vs(s,r,2),o!==null&&(sg(r,o,s,t),Os(o,2),Xn(o));break}}s=s.return}}function Nh(t,s,r){var o=t.pingCache;if(o===null){o=t.pingCache=new eS;var h=new Set;o.set(s,h)}else h=o.get(s),h===void 0&&(h=new Set,o.set(s,h));h.has(r)||(xh=!0,h.add(r),t=aS.bind(null,t,s,r),s.then(t,t))}function aS(t,s,r){var o=t.pingCache;o!==null&&o.delete(s),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,Ke===t&&(Te&r)===r&&(lt===4||lt===3&&(Te&62914560)===Te&&300>Ze()-vl?(Le&2)===0&&ya(t,0):wh|=r,pa===Te&&(pa=0)),Xn(t)}function ny(t,s){s===0&&(s=jo()),t=bi(t,s),t!==null&&(Os(t,s),Xn(t))}function rS(t){var s=t.memoizedState,r=0;s!==null&&(r=s.retryLane),ny(t,r)}function oS(t,s){var r=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(r=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(s),ny(t,r)}function lS(t,s){return ht(t,s)}var Al=null,va=null,Rh=!1,jl=!1,kh=!1,Xs=0;function Xn(t){t!==va&&t.next===null&&(va===null?Al=va=t:va=va.next=t),jl=!0,Rh||(Rh=!0,uS())}function Or(t,s){if(!kh&&jl){kh=!0;do for(var r=!1,o=Al;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var f=0;else{var b=o.suspendedLanes,w=o.pingedLanes;f=(1<<31-Vt(42|t)+1)-1,f&=h&~(b&~w),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(r=!0,ry(o,f))}else f=Te,f=qi(o,o===Ke?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||fi(o,f)||(r=!0,ry(o,f));o=o.next}while(r);kh=!1}}function cS(){sy()}function sy(){jl=Rh=!1;var t=0;Xs!==0&&xS()&&(t=Xs);for(var s=Ze(),r=null,o=Al;o!==null;){var h=o.next,f=iy(o,s);f===0?(o.next=null,r===null?Al=h:r.next=h,h===null&&(va=r)):(r=o,(t!==0||(f&3)!==0)&&(jl=!0)),o=h}Tt!==0&&Tt!==5||Or(t),Xs!==0&&(Xs=0)}function iy(t,s){for(var r=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,f=t.pendingLanes&-62914561;0<f;){var b=31-Vt(f),w=1<<b,E=h[b];E===-1?((w&r)===0||(w&o)!==0)&&(h[b]=Gc(w,s)):E<=s&&(t.expiredLanes|=w),f&=~w}if(s=Ke,r=Te,r=qi(t,t===s?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,r===0||t===s&&(He===2||He===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&it(o),t.callbackNode=null,t.callbackPriority=0;if((r&3)===0||fi(t,r)){if(s=r&-r,s===t.callbackPriority)return s;switch(o!==null&&it(o),er(r)){case 2:case 8:r=jt;break;case 32:r=qn;break;case 268435456:r=Cs;break;default:r=qn}return o=ay.bind(null,t),r=ht(r,o),t.callbackPriority=s,t.callbackNode=r,s}return o!==null&&o!==null&&it(o),t.callbackPriority=2,t.callbackNode=null,2}function ay(t,s){if(Tt!==0&&Tt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var r=t.callbackNode;if(El()&&t.callbackNode!==r)return null;var o=Te;return o=qi(t,t===Ke?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Vg(t,o,s),iy(t,Ze()),t.callbackNode!=null&&t.callbackNode===r?ay.bind(null,t):null)}function ry(t,s){if(El())return null;Vg(t,s,!0)}function uS(){_S(function(){(Le&6)!==0?ht(gt,cS):sy()})}function Ch(){if(Xs===0){var t=ia;t===0&&(t=hi,hi<<=1,(hi&261888)===0&&(hi=256)),Xs=t}return Xs}function oy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Bo(""+t)}function ly(t,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,t.id&&r.setAttribute("form",t.id),s.parentNode.insertBefore(r,s),t=new FormData(t),r.parentNode.removeChild(r),t}function hS(t,s,r,o,h){if(s==="submit"&&r&&r.stateNode===h){var f=oy((h[X]||null).action),b=o.submitter;b&&(s=(s=b[X]||null)?oy(s.formAction):b.getAttribute("formAction"),s!==null&&(f=s,b=null));var w=new Po("action","action",null,o,h);t.push({event:w,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Xs!==0){var E=b?ly(h,b):new FormData(h);Qu(r,{pending:!0,data:E,method:h.method,action:f},null,E)}}else typeof f=="function"&&(w.preventDefault(),E=b?ly(h,b):new FormData(h),Qu(r,{pending:!0,data:E,method:h.method,action:f},f,E))},currentTarget:h}]})}}for(var Oh=0;Oh<mu.length;Oh++){var Dh=mu[Oh],dS=Dh.toLowerCase(),fS=Dh[0].toUpperCase()+Dh.slice(1);Cn(dS,"on"+fS)}Cn(Pm,"onAnimationEnd"),Cn(Vm,"onAnimationIteration"),Cn(Hm,"onAnimationStart"),Cn("dblclick","onDoubleClick"),Cn("focusin","onFocus"),Cn("focusout","onBlur"),Cn(R_,"onTransitionRun"),Cn(k_,"onTransitionStart"),Cn(C_,"onTransitionCancel"),Cn($m,"onTransitionEnd"),Fi("onMouseEnter",["mouseout","mouseover"]),Fi("onMouseLeave",["mouseout","mouseover"]),Fi("onPointerEnter",["pointerout","pointerover"]),Fi("onPointerLeave",["pointerout","pointerover"]),mi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),mi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),mi("onBeforeInput",["compositionend","keypress","textInput","paste"]),mi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),mi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),mi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dr="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(" "),mS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Dr));function cy(t,s){s=(s&4)!==0;for(var r=0;r<t.length;r++){var o=t[r],h=o.event;o=o.listeners;e:{var f=void 0;if(s)for(var b=o.length-1;0<=b;b--){var w=o[b],E=w.instance,U=w.currentTarget;if(w=w.listener,E!==f&&h.isPropagationStopped())break e;f=w,h.currentTarget=U;try{f(h)}catch($){$o($)}h.currentTarget=null,f=E}else for(b=0;b<o.length;b++){if(w=o[b],E=w.instance,U=w.currentTarget,w=w.listener,E!==f&&h.isPropagationStopped())break e;f=w,h.currentTarget=U;try{f(h)}catch($){$o($)}h.currentTarget=null,f=E}}}}function Se(t,s){var r=s[un];r===void 0&&(r=s[un]=new Set);var o=t+"__bubble";r.has(o)||(uy(s,t,2,!1),r.add(o))}function Mh(t,s,r){var o=0;s&&(o|=4),uy(r,t,o,s)}var Nl="_reactListening"+Math.random().toString(36).slice(2);function Bh(t){if(!t[Nl]){t[Nl]=!0,sm.forEach(function(r){r!=="selectionchange"&&(mS.has(r)||Mh(r,!1,t),Mh(r,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[Nl]||(s[Nl]=!0,Mh("selectionchange",!1,s))}}function uy(t,s,r,o){switch(Py(s)){case 2:var h=$S;break;case 8:h=qS;break;default:h=Jh}r=h.bind(null,s,r,t),h=void 0,!tu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(s,r,{capture:!0,passive:h}):t.addEventListener(s,r,!0):h!==void 0?t.addEventListener(s,r,{passive:h}):t.addEventListener(s,r,!1)}function Uh(t,s,r,o,h){var f=o;if((s&1)===0&&(s&2)===0&&o!==null)e:for(;;){if(o===null)return;var b=o.tag;if(b===3||b===4){var w=o.stateNode.containerInfo;if(w===h)break;if(b===4)for(b=o.return;b!==null;){var E=b.tag;if((E===3||E===4)&&b.stateNode.containerInfo===h)return;b=b.return}for(;w!==null;){if(b=kn(w),b===null)return;if(E=b.tag,E===5||E===6||E===26||E===27){o=f=b;continue e}w=w.parentNode}}o=o.return}pm(function(){var U=f,$=Wc(r),I=[];e:{var z=qm.get(t);if(z!==void 0){var V=Po,ie=t;switch(t){case"keypress":if(Lo(r)===0)break e;case"keydown":case"keyup":V=o_;break;case"focusin":ie="focus",V=au;break;case"focusout":ie="blur",V=au;break;case"beforeblur":case"afterblur":V=au;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":V=bm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=Xw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=u_;break;case Pm:case Vm:case Hm:V=Zw;break;case $m:V=d_;break;case"scroll":case"scrollend":V=Kw;break;case"wheel":V=m_;break;case"copy":case"cut":case"paste":V=e_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=xm;break;case"toggle":case"beforetoggle":V=g_}var pe=(s&4)!==0,Ge=!pe&&(t==="scroll"||t==="scrollend"),O=pe?z!==null?z+"Capture":null:z;pe=[];for(var N=U,B;N!==null;){var F=N;if(B=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||B===null||O===null||(F=tr(N,O),F!=null&&pe.push(Mr(N,F,B))),Ge)break;N=N.return}0<pe.length&&(z=new V(z,ie,null,r,$),I.push({event:z,listeners:pe}))}}if((s&7)===0){e:{if(z=t==="mouseover"||t==="pointerover",V=t==="mouseout"||t==="pointerout",z&&r!==Zc&&(ie=r.relatedTarget||r.fromElement)&&(kn(ie)||ie[ae]))break e;if((V||z)&&(z=$.window===$?$:(z=$.ownerDocument)?z.defaultView||z.parentWindow:window,V?(ie=r.relatedTarget||r.toElement,V=U,ie=ie?kn(ie):null,ie!==null&&(Ge=c(ie),pe=ie.tag,ie!==Ge||pe!==5&&pe!==27&&pe!==6)&&(ie=null)):(V=null,ie=U),V!==ie)){if(pe=bm,F="onMouseLeave",O="onMouseEnter",N="mouse",(t==="pointerout"||t==="pointerover")&&(pe=xm,F="onPointerLeave",O="onPointerEnter",N="pointer"),Ge=V==null?z:Nt(V),B=ie==null?z:Nt(ie),z=new pe(F,N+"leave",V,r,$),z.target=Ge,z.relatedTarget=B,F=null,kn($)===U&&(pe=new pe(O,N+"enter",ie,r,$),pe.target=B,pe.relatedTarget=Ge,F=pe),Ge=F,V&&ie)t:{for(pe=pS,O=V,N=ie,B=0,F=O;F;F=pe(F))B++;F=0;for(var he=N;he;he=pe(he))F++;for(;0<B-F;)O=pe(O),B--;for(;0<F-B;)N=pe(N),F--;for(;B--;){if(O===N||N!==null&&O===N.alternate){pe=O;break t}O=pe(O),N=pe(N)}pe=null}else pe=null;V!==null&&hy(I,z,V,pe,!1),ie!==null&&Ge!==null&&hy(I,Ge,ie,pe,!0)}}e:{if(z=U?Nt(U):window,V=z.nodeName&&z.nodeName.toLowerCase(),V==="select"||V==="input"&&z.type==="file")var Oe=Nm;else if(Am(z))if(Rm)Oe=A_;else{Oe=T_;var ce=S_}else V=z.nodeName,!V||V.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?U&&Qc(U.elementType)&&(Oe=Nm):Oe=E_;if(Oe&&(Oe=Oe(t,U))){jm(I,Oe,r,$);break e}ce&&ce(t,z,U),t==="focusout"&&U&&z.type==="number"&&U.memoizedProps.value!=null&&Jc(z,"number",z.value)}switch(ce=U?Nt(U):window,t){case"focusin":(Am(ce)||ce.contentEditable==="true")&&(Ji=ce,hu=U,cr=null);break;case"focusout":cr=hu=Ji=null;break;case"mousedown":du=!0;break;case"contextmenu":case"mouseup":case"dragend":du=!1,Lm(I,r,$);break;case"selectionchange":if(N_)break;case"keydown":case"keyup":Lm(I,r,$)}var xe;if(ou)e:{switch(t){case"compositionstart":var Ee="onCompositionStart";break e;case"compositionend":Ee="onCompositionEnd";break e;case"compositionupdate":Ee="onCompositionUpdate";break e}Ee=void 0}else Xi?Tm(t,r)&&(Ee="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(Ee="onCompositionStart");Ee&&(wm&&r.locale!=="ko"&&(Xi||Ee!=="onCompositionStart"?Ee==="onCompositionEnd"&&Xi&&(xe=gm()):(Ds=$,nu="value"in Ds?Ds.value:Ds.textContent,Xi=!0)),ce=Rl(U,Ee),0<ce.length&&(Ee=new vm(Ee,t,null,r,$),I.push({event:Ee,listeners:ce}),xe?Ee.data=xe:(xe=Em(r),xe!==null&&(Ee.data=xe)))),(xe=b_?v_(t,r):x_(t,r))&&(Ee=Rl(U,"onBeforeInput"),0<Ee.length&&(ce=new vm("onBeforeInput","beforeinput",null,r,$),I.push({event:ce,listeners:Ee}),ce.data=xe)),hS(I,t,U,r,$)}cy(I,s)})}function Mr(t,s,r){return{instance:t,listener:s,currentTarget:r}}function Rl(t,s){for(var r=s+"Capture",o=[];t!==null;){var h=t,f=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||f===null||(h=tr(t,r),h!=null&&o.unshift(Mr(t,h,f)),h=tr(t,s),h!=null&&o.push(Mr(t,h,f))),t.tag===3)return o;t=t.return}return[]}function pS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function hy(t,s,r,o,h){for(var f=s._reactName,b=[];r!==null&&r!==o;){var w=r,E=w.alternate,U=w.stateNode;if(w=w.tag,E!==null&&E===o)break;w!==5&&w!==26&&w!==27||U===null||(E=U,h?(U=tr(r,f),U!=null&&b.unshift(Mr(r,U,E))):h||(U=tr(r,f),U!=null&&b.push(Mr(r,U,E)))),r=r.return}b.length!==0&&t.push({event:s,listeners:b})}var gS=/\r\n?/g,yS=/\u0000|\uFFFD/g;function dy(t){return(typeof t=="string"?t:""+t).replace(gS,`
`).replace(yS,"")}function fy(t,s){return s=dy(s),dy(t)===s}function Ie(t,s,r,o,h,f){switch(r){case"children":typeof o=="string"?s==="body"||s==="textarea"&&o===""||Gi(t,o):(typeof o=="number"||typeof o=="bigint")&&s!=="body"&&Gi(t,""+o);break;case"className":Do(t,"class",o);break;case"tabIndex":Do(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Do(t,r,o);break;case"style":fm(t,o,f);break;case"data":if(s!=="object"){Do(t,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||r!=="href")){t.removeAttribute(r);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(r);break}o=Bo(""+o),t.setAttribute(r,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(r==="formAction"?(s!=="input"&&Ie(t,s,"name",h.name,h,null),Ie(t,s,"formEncType",h.formEncType,h,null),Ie(t,s,"formMethod",h.formMethod,h,null),Ie(t,s,"formTarget",h.formTarget,h,null)):(Ie(t,s,"encType",h.encType,h,null),Ie(t,s,"method",h.method,h,null),Ie(t,s,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(r);break}o=Bo(""+o),t.setAttribute(r,o);break;case"onClick":o!=null&&(t.onclick=cs);break;case"onScroll":o!=null&&Se("scroll",t);break;case"onScrollEnd":o!=null&&Se("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(r=o.__html,r!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=r}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}r=Bo(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,""+o):t.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,""):t.removeAttribute(r);break;case"capture":case"download":o===!0?t.setAttribute(r,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(r,o):t.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(r,o):t.removeAttribute(r);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(r):t.setAttribute(r,o);break;case"popover":Se("beforetoggle",t),Se("toggle",t),Oo(t,"popover",o);break;case"xlinkActuate":ls(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":ls(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":ls(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":ls(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":ls(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":ls(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":ls(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":ls(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":ls(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Oo(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Iw.get(r)||r,Oo(t,r,o))}}function Lh(t,s,r,o,h,f){switch(r){case"style":fm(t,o,f);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(r=o.__html,r!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=r}}break;case"children":typeof o=="string"?Gi(t,o):(typeof o=="number"||typeof o=="bigint")&&Gi(t,""+o);break;case"onScroll":o!=null&&Se("scroll",t);break;case"onScrollEnd":o!=null&&Se("scrollend",t);break;case"onClick":o!=null&&(t.onclick=cs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!im.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(h=r.endsWith("Capture"),s=r.slice(2,h?r.length-7:void 0),f=t[X]||null,f=f!=null?f[r]:null,typeof f=="function"&&t.removeEventListener(s,f,h),typeof o=="function")){typeof f!="function"&&f!==null&&(r in t?t[r]=null:t.hasAttribute(r)&&t.removeAttribute(r)),t.addEventListener(s,o,h);break e}r in t?t[r]=o:o===!0?t.setAttribute(r,""):Oo(t,r,o)}}}function Bt(t,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Se("error",t),Se("load",t);var o=!1,h=!1,f;for(f in r)if(r.hasOwnProperty(f)){var b=r[f];if(b!=null)switch(f){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Ie(t,s,f,b,r,null)}}h&&Ie(t,s,"srcSet",r.srcSet,r,null),o&&Ie(t,s,"src",r.src,r,null);return;case"input":Se("invalid",t);var w=f=b=h=null,E=null,U=null;for(o in r)if(r.hasOwnProperty(o)){var $=r[o];if($!=null)switch(o){case"name":h=$;break;case"type":b=$;break;case"checked":E=$;break;case"defaultChecked":U=$;break;case"value":f=$;break;case"defaultValue":w=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(a(137,s));break;default:Ie(t,s,o,$,r,null)}}cm(t,f,w,E,U,b,h,!1);return;case"select":Se("invalid",t),o=b=f=null;for(h in r)if(r.hasOwnProperty(h)&&(w=r[h],w!=null))switch(h){case"value":f=w;break;case"defaultValue":b=w;break;case"multiple":o=w;default:Ie(t,s,h,w,r,null)}s=f,r=b,t.multiple=!!o,s!=null?Ii(t,!!o,s,!1):r!=null&&Ii(t,!!o,r,!0);return;case"textarea":Se("invalid",t),f=h=o=null;for(b in r)if(r.hasOwnProperty(b)&&(w=r[b],w!=null))switch(b){case"value":o=w;break;case"defaultValue":h=w;break;case"children":f=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(a(91));break;default:Ie(t,s,b,w,r,null)}hm(t,o,h,f);return;case"option":for(E in r)if(r.hasOwnProperty(E)&&(o=r[E],o!=null))switch(E){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Ie(t,s,E,o,r,null)}return;case"dialog":Se("beforetoggle",t),Se("toggle",t),Se("cancel",t),Se("close",t);break;case"iframe":case"object":Se("load",t);break;case"video":case"audio":for(o=0;o<Dr.length;o++)Se(Dr[o],t);break;case"image":Se("error",t),Se("load",t);break;case"details":Se("toggle",t);break;case"embed":case"source":case"link":Se("error",t),Se("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in r)if(r.hasOwnProperty(U)&&(o=r[U],o!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Ie(t,s,U,o,r,null)}return;default:if(Qc(s)){for($ in r)r.hasOwnProperty($)&&(o=r[$],o!==void 0&&Lh(t,s,$,o,r,void 0));return}}for(w in r)r.hasOwnProperty(w)&&(o=r[w],o!=null&&Ie(t,s,w,o,r,null))}function bS(t,s,r,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,f=null,b=null,w=null,E=null,U=null,$=null;for(V in r){var I=r[V];if(r.hasOwnProperty(V)&&I!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":E=I;default:o.hasOwnProperty(V)||Ie(t,s,V,null,o,I)}}for(var z in o){var V=o[z];if(I=r[z],o.hasOwnProperty(z)&&(V!=null||I!=null))switch(z){case"type":f=V;break;case"name":h=V;break;case"checked":U=V;break;case"defaultChecked":$=V;break;case"value":b=V;break;case"defaultValue":w=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(a(137,s));break;default:V!==I&&Ie(t,s,z,V,o,I)}}Xc(t,b,w,E,U,$,f,h);return;case"select":V=b=w=z=null;for(f in r)if(E=r[f],r.hasOwnProperty(f)&&E!=null)switch(f){case"value":break;case"multiple":V=E;default:o.hasOwnProperty(f)||Ie(t,s,f,null,o,E)}for(h in o)if(f=o[h],E=r[h],o.hasOwnProperty(h)&&(f!=null||E!=null))switch(h){case"value":z=f;break;case"defaultValue":w=f;break;case"multiple":b=f;default:f!==E&&Ie(t,s,h,f,o,E)}s=w,r=b,o=V,z!=null?Ii(t,!!r,z,!1):!!o!=!!r&&(s!=null?Ii(t,!!r,s,!0):Ii(t,!!r,r?[]:"",!1));return;case"textarea":V=z=null;for(w in r)if(h=r[w],r.hasOwnProperty(w)&&h!=null&&!o.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Ie(t,s,w,null,o,h)}for(b in o)if(h=o[b],f=r[b],o.hasOwnProperty(b)&&(h!=null||f!=null))switch(b){case"value":z=h;break;case"defaultValue":V=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==f&&Ie(t,s,b,h,o,f)}um(t,z,V);return;case"option":for(var ie in r)if(z=r[ie],r.hasOwnProperty(ie)&&z!=null&&!o.hasOwnProperty(ie))switch(ie){case"selected":t.selected=!1;break;default:Ie(t,s,ie,null,o,z)}for(E in o)if(z=o[E],V=r[E],o.hasOwnProperty(E)&&z!==V&&(z!=null||V!=null))switch(E){case"selected":t.selected=z&&typeof z!="function"&&typeof z!="symbol";break;default:Ie(t,s,E,z,o,V)}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 pe in r)z=r[pe],r.hasOwnProperty(pe)&&z!=null&&!o.hasOwnProperty(pe)&&Ie(t,s,pe,null,o,z);for(U in o)if(z=o[U],V=r[U],o.hasOwnProperty(U)&&z!==V&&(z!=null||V!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(a(137,s));break;default:Ie(t,s,U,z,o,V)}return;default:if(Qc(s)){for(var Ge in r)z=r[Ge],r.hasOwnProperty(Ge)&&z!==void 0&&!o.hasOwnProperty(Ge)&&Lh(t,s,Ge,void 0,o,z);for($ in o)z=o[$],V=r[$],!o.hasOwnProperty($)||z===V||z===void 0&&V===void 0||Lh(t,s,$,z,o,V);return}}for(var O in r)z=r[O],r.hasOwnProperty(O)&&z!=null&&!o.hasOwnProperty(O)&&Ie(t,s,O,null,o,z);for(I in o)z=o[I],V=r[I],!o.hasOwnProperty(I)||z===V||z==null&&V==null||Ie(t,s,I,z,o,V)}function my(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function vS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,s=0,r=performance.getEntriesByType("resource"),o=0;o<r.length;o++){var h=r[o],f=h.transferSize,b=h.initiatorType,w=h.duration;if(f&&w&&my(b)){for(b=0,w=h.responseEnd,o+=1;o<r.length;o++){var E=r[o],U=E.startTime;if(U>w)break;var $=E.transferSize,I=E.initiatorType;$&&my(I)&&(E=E.responseEnd,b+=$*(E<w?1:(w-U)/(E-U)))}if(--o,s+=8*(f+b)/(h.duration/1e3),t++,10<t)break}}if(0<t)return s/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var zh=null,Ph=null;function kl(t){return t.nodeType===9?t:t.ownerDocument}function py(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function gy(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function Vh(t,s){return t==="textarea"||t==="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 Hh=null;function xS(){var t=window.event;return t&&t.type==="popstate"?t===Hh?!1:(Hh=t,!0):(Hh=null,!1)}var yy=typeof setTimeout=="function"?setTimeout:void 0,wS=typeof clearTimeout=="function"?clearTimeout:void 0,by=typeof Promise=="function"?Promise:void 0,_S=typeof queueMicrotask=="function"?queueMicrotask:typeof by<"u"?function(t){return by.resolve(null).then(t).catch(SS)}:yy;function SS(t){setTimeout(function(){throw t})}function Js(t){return t==="head"}function vy(t,s){var r=s,o=0;do{var h=r.nextSibling;if(t.removeChild(r),h&&h.nodeType===8)if(r=h.data,r==="/$"||r==="/&"){if(o===0){t.removeChild(h),Sa(s);return}o--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")o++;else if(r==="html")Br(t.ownerDocument.documentElement);else if(r==="head"){r=t.ownerDocument.head,Br(r);for(var f=r.firstChild;f;){var b=f.nextSibling,w=f.nodeName;f[Je]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&f.rel.toLowerCase()==="stylesheet"||r.removeChild(f),f=b}}else r==="body"&&Br(t.ownerDocument.body);r=h}while(r);Sa(s)}function xy(t,s){var r=t;t=0;do{var o=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(t===0)break;t--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||t++;r=o}while(r)}function $h(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":$h(r),tt(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}t.removeChild(r)}}function TS(t,s,r,o){for(;t.nodeType===1;){var h=r;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Je])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(f=t.getAttribute("rel"),f==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(f!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(f=t.getAttribute("src"),(f!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&f&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var f=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===f)return t}else return t;if(t=wn(t.nextSibling),t===null)break}return null}function ES(t,s,r){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=wn(t.nextSibling),t===null))return null;return t}function wy(t,s){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=wn(t.nextSibling),t===null))return null;return t}function qh(t){return t.data==="$?"||t.data==="$~"}function Fh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function AS(t,s){var r=t.ownerDocument;if(t.data==="$~")t._reactRetry=s;else if(t.data!=="$?"||r.readyState!=="loading")s();else{var o=function(){s(),r.removeEventListener("DOMContentLoaded",o)};r.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function wn(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return t}var Ih=null;function _y(t){t=t.nextSibling;for(var s=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"||r==="/&"){if(s===0)return wn(t.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}t=t.nextSibling}return null}function Sy(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return t;s--}else r!=="/$"&&r!=="/&"||s++}t=t.previousSibling}return null}function Ty(t,s,r){switch(s=kl(r),t){case"html":if(t=s.documentElement,!t)throw Error(a(452));return t;case"head":if(t=s.head,!t)throw Error(a(453));return t;case"body":if(t=s.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function Br(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);tt(t)}var _n=new Map,Ey=new Set;function Cl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Es=W.d;W.d={f:jS,r:NS,D:RS,C:kS,L:CS,m:OS,X:MS,S:DS,M:BS};function jS(){var t=Es.f(),s=_l();return t||s}function NS(t){var s=Pe(t);s!==null&&s.tag===5&&s.type==="form"?$p(s):Es.r(t)}var xa=typeof document>"u"?null:document;function Ay(t,s,r){var o=xa;if(o&&typeof s=="string"&&s){var h=mn(s);h='link[rel="'+t+'"][href="'+h+'"]',typeof r=="string"&&(h+='[crossorigin="'+r+'"]'),Ey.has(h)||(Ey.add(h),t={rel:t,crossOrigin:r,href:s},o.querySelector(h)===null&&(s=o.createElement("link"),Bt(s,"link",t),Ve(s),o.head.appendChild(s)))}}function RS(t){Es.D(t),Ay("dns-prefetch",t,null)}function kS(t,s){Es.C(t,s),Ay("preconnect",t,s)}function CS(t,s,r){Es.L(t,s,r);var o=xa;if(o&&t&&s){var h='link[rel="preload"][as="'+mn(s)+'"]';s==="image"&&r&&r.imageSrcSet?(h+='[imagesrcset="'+mn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(h+='[imagesizes="'+mn(r.imageSizes)+'"]')):h+='[href="'+mn(t)+'"]';var f=h;switch(s){case"style":f=wa(t);break;case"script":f=_a(t)}_n.has(f)||(t=v({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:t,as:s},r),_n.set(f,t),o.querySelector(h)!==null||s==="style"&&o.querySelector(Ur(f))||s==="script"&&o.querySelector(Lr(f))||(s=o.createElement("link"),Bt(s,"link",t),Ve(s),o.head.appendChild(s)))}}function OS(t,s){Es.m(t,s);var r=xa;if(r&&t){var o=s&&typeof s.as=="string"?s.as:"script",h='link[rel="modulepreload"][as="'+mn(o)+'"][href="'+mn(t)+'"]',f=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=_a(t)}if(!_n.has(f)&&(t=v({rel:"modulepreload",href:t},s),_n.set(f,t),r.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Lr(f)))return}o=r.createElement("link"),Bt(o,"link",t),Ve(o),r.head.appendChild(o)}}}function DS(t,s,r){Es.S(t,s,r);var o=xa;if(o&&t){var h=Ue(o).hoistableStyles,f=wa(t);s=s||"default";var b=h.get(f);if(!b){var w={loading:0,preload:null};if(b=o.querySelector(Ur(f)))w.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":s},r),(r=_n.get(f))&&Gh(t,r);var E=b=o.createElement("link");Ve(E),Bt(E,"link",t),E._p=new Promise(function(U,$){E.onload=U,E.onerror=$}),E.addEventListener("load",function(){w.loading|=1}),E.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Ol(b,s,o)}b={type:"stylesheet",instance:b,count:1,state:w},h.set(f,b)}}}function MS(t,s){Es.X(t,s);var r=xa;if(r&&t){var o=Ue(r).hoistableScripts,h=_a(t),f=o.get(h);f||(f=r.querySelector(Lr(h)),f||(t=v({src:t,async:!0},s),(s=_n.get(h))&&Kh(t,s),f=r.createElement("script"),Ve(f),Bt(f,"link",t),r.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(h,f))}}function BS(t,s){Es.M(t,s);var r=xa;if(r&&t){var o=Ue(r).hoistableScripts,h=_a(t),f=o.get(h);f||(f=r.querySelector(Lr(h)),f||(t=v({src:t,async:!0,type:"module"},s),(s=_n.get(h))&&Kh(t,s),f=r.createElement("script"),Ve(f),Bt(f,"link",t),r.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(h,f))}}function jy(t,s,r,o){var h=(h=ge.current)?Cl(h):null;if(!h)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=wa(r.href),r=Ue(h).hoistableStyles,o=r.get(s),o||(o={type:"style",instance:null,count:0,state:null},r.set(s,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=wa(r.href);var f=Ue(h).hoistableStyles,b=f.get(t);if(b||(h=h.ownerDocument||h,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(t,b),(f=h.querySelector(Ur(t)))&&!f._p&&(b.instance=f,b.state.loading=5),_n.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},_n.set(t,r),f||US(h,t,r,b.state))),s&&o===null)throw Error(a(528,""));return b}if(s&&o!==null)throw Error(a(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=_a(r),r=Ue(h).hoistableScripts,o=r.get(s),o||(o={type:"script",instance:null,count:0,state:null},r.set(s,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function wa(t){return'href="'+mn(t)+'"'}function Ur(t){return'link[rel="stylesheet"]['+t+"]"}function Ny(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function US(t,s,r,o){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?o.loading=1:(s=t.createElement("link"),o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2}),Bt(s,"link",r),Ve(s),t.head.appendChild(s))}function _a(t){return'[src="'+mn(t)+'"]'}function Lr(t){return"script[async]"+t}function Ry(t,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var o=t.querySelector('style[data-href~="'+mn(r.href)+'"]');if(o)return s.instance=o,Ve(o),o;var h=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Ve(o),Bt(o,"style",h),Ol(o,r.precedence,t),s.instance=o;case"stylesheet":h=wa(r.href);var f=t.querySelector(Ur(h));if(f)return s.state.loading|=4,s.instance=f,Ve(f),f;o=Ny(r),(h=_n.get(h))&&Gh(o,h),f=(t.ownerDocument||t).createElement("link"),Ve(f);var b=f;return b._p=new Promise(function(w,E){b.onload=w,b.onerror=E}),Bt(f,"link",o),s.state.loading|=4,Ol(f,r.precedence,t),s.instance=f;case"script":return f=_a(r.src),(h=t.querySelector(Lr(f)))?(s.instance=h,Ve(h),h):(o=r,(h=_n.get(f))&&(o=v({},r),Kh(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),Ve(h),Bt(h,"link",o),t.head.appendChild(h),s.instance=h);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,Ol(o,r.precedence,t));return s.instance}function Ol(t,s,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,f=h,b=0;b<o.length;b++){var w=o[b];if(w.dataset.precedence===s)f=w;else if(f!==h)break}f?f.parentNode.insertBefore(t,f.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(t,s.firstChild))}function Gh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function Kh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var Dl=null;function ky(t,s,r){if(Dl===null){var o=new Map,h=Dl=new Map;h.set(r,o)}else h=Dl,o=h.get(r),o||(o=new Map,h.set(r,o));if(o.has(t))return o;for(o.set(t,null),r=r.getElementsByTagName(t),h=0;h<r.length;h++){var f=r[h];if(!(f[Je]||f[R]||t==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var b=f.getAttribute(s)||"";b=t+b;var w=o.get(b);w?w.push(f):o.set(b,[f])}}return o}function Cy(t,s,r){t=t.ownerDocument||t,t.head.insertBefore(r,s==="title"?t.querySelector("head > title"):null)}function LS(t,s,r){if(r===1||s.itemProp!=null)return!1;switch(t){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;switch(s.rel){case"stylesheet":return t=s.disabled,typeof s.precedence=="string"&&t==null;default:return!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 Oy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function zS(t,s,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var h=wa(o.href),f=s.querySelector(Ur(h));if(f){s=f._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(t.count++,t=Ml.bind(t),s.then(t,t)),r.state.loading|=4,r.instance=f,Ve(f);return}f=s.ownerDocument||s,o=Ny(o),(h=_n.get(h))&&Gh(o,h),f=f.createElement("link"),Ve(f);var b=f;b._p=new Promise(function(w,E){b.onload=w,b.onerror=E}),Bt(f,"link",o),r.instance=f}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Ml.bind(t),s.addEventListener("load",r),s.addEventListener("error",r))}}var Yh=0;function PS(t,s){return t.stylesheets&&t.count===0&&Ul(t,t.stylesheets),0<t.count||0<t.imgCount?function(r){var o=setTimeout(function(){if(t.stylesheets&&Ul(t,t.stylesheets),t.unsuspend){var f=t.unsuspend;t.unsuspend=null,f()}},6e4+s);0<t.imgBytes&&Yh===0&&(Yh=62500*vS());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Ul(t,t.stylesheets),t.unsuspend)){var f=t.unsuspend;t.unsuspend=null,f()}},(t.imgBytes>Yh?50:800)+s);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Ml(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ul(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Bl=null;function Ul(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Bl=new Map,s.forEach(VS,t),Bl=null,Ml.call(t))}function VS(t,s){if(!(s.state.loading&4)){var r=Bl.get(t);if(r)var o=r.get(null);else{r=new Map,Bl.set(t,r);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<h.length;f++){var b=h[f];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(r.set(b.dataset.precedence,b),o=b)}o&&r.set(null,o)}h=s.instance,b=h.getAttribute("data-precedence"),f=r.get(b)||o,f===o&&r.set(null,h),r.set(b,h),this.count++,o=Ml.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),f?f.parentNode.insertBefore(h,f.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),s.state.loading|=4}}var zr={$$typeof:C,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function HS(t,s,r,o,h,f,b,w,E){this.tag=1,this.containerInfo=t,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=Qa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qa(0),this.hiddenUpdates=Qa(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=f,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=E,this.incompleteTransitions=new Map}function Dy(t,s,r,o,h,f,b,w,E,U,$,I){return t=new HS(t,s,r,b,E,U,$,I,w),s=1,f===!0&&(s|=24),f=Wt(3,null,null,s),t.current=f,f.stateNode=t,s=ju(),s.refCount++,t.pooledCache=s,s.refCount++,f.memoizedState={element:o,isDehydrated:r,cache:s},Cu(f),t}function My(t){return t?(t=Wi,t):Wi}function By(t,s,r,o,h,f){h=My(h),o.context===null?o.context=h:o.pendingContext=h,o=Ps(s),o.payload={element:r},f=f===void 0?null:f,f!==null&&(o.callback=f),r=Vs(t,o,s),r!==null&&(Xt(r,t,s),gr(r,t,s))}function Uy(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<s?r:s}}function Xh(t,s){Uy(t,s),(t=t.alternate)&&Uy(t,s)}function Ly(t){if(t.tag===13||t.tag===31){var s=bi(t,67108864);s!==null&&Xt(s,t,67108864),Xh(t,67108864)}}function zy(t){if(t.tag===13||t.tag===31){var s=an();s=Wa(s);var r=bi(t,s);r!==null&&Xt(r,t,s),Xh(t,s)}}var Ll=!0;function $S(t,s,r,o){var h=L.T;L.T=null;var f=W.p;try{W.p=2,Jh(t,s,r,o)}finally{W.p=f,L.T=h}}function qS(t,s,r,o){var h=L.T;L.T=null;var f=W.p;try{W.p=8,Jh(t,s,r,o)}finally{W.p=f,L.T=h}}function Jh(t,s,r,o){if(Ll){var h=Qh(o);if(h===null)Uh(t,s,o,zl,r),Vy(t,o);else if(IS(h,t,s,r,o))o.stopPropagation();else if(Vy(t,o),s&4&&-1<FS.indexOf(t)){for(;h!==null;){var f=Pe(h);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var b=os(f.pendingLanes);if(b!==0){var w=f;for(w.pendingLanes|=2,w.entangledLanes|=2;b;){var E=1<<31-Vt(b);w.entanglements[1]|=E,b&=~E}Xn(f),(Le&6)===0&&(xl=Ze()+500,Or(0))}}break;case 31:case 13:w=bi(f,2),w!==null&&Xt(w,f,2),_l(),Xh(f,2)}if(f=Qh(o),f===null&&Uh(t,s,o,zl,r),f===h)break;h=f}h!==null&&o.stopPropagation()}else Uh(t,s,o,null,r)}}function Qh(t){return t=Wc(t),Zh(t)}var zl=null;function Zh(t){if(zl=null,t=kn(t),t!==null){var s=c(t);if(s===null)t=null;else{var r=s.tag;if(r===13){if(t=u(s),t!==null)return t;t=null}else if(r===31){if(t=d(s),t!==null)return t;t=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return zl=t,null}function Py(t){switch(t){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(ci()){case gt:return 2;case jt:return 8;case qn:case Rn:return 32;case Cs:return 268435456;default:return 32}default:return 32}}var Wh=!1,Qs=null,Zs=null,Ws=null,Pr=new Map,Vr=new Map,ei=[],FS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Vy(t,s){switch(t){case"focusin":case"focusout":Qs=null;break;case"dragenter":case"dragleave":Zs=null;break;case"mouseover":case"mouseout":Ws=null;break;case"pointerover":case"pointerout":Pr.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vr.delete(s.pointerId)}}function Hr(t,s,r,o,h,f){return t===null||t.nativeEvent!==f?(t={blockedOn:s,domEventName:r,eventSystemFlags:o,nativeEvent:f,targetContainers:[h]},s!==null&&(s=Pe(s),s!==null&&Ly(s)),t):(t.eventSystemFlags|=o,s=t.targetContainers,h!==null&&s.indexOf(h)===-1&&s.push(h),t)}function IS(t,s,r,o,h){switch(s){case"focusin":return Qs=Hr(Qs,t,s,r,o,h),!0;case"dragenter":return Zs=Hr(Zs,t,s,r,o,h),!0;case"mouseover":return Ws=Hr(Ws,t,s,r,o,h),!0;case"pointerover":var f=h.pointerId;return Pr.set(f,Hr(Pr.get(f)||null,t,s,r,o,h)),!0;case"gotpointercapture":return f=h.pointerId,Vr.set(f,Hr(Vr.get(f)||null,t,s,r,o,h)),!0}return!1}function Hy(t){var s=kn(t.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=u(r),s!==null){t.blockedOn=s,Co(t.priority,function(){zy(r)});return}}else if(s===31){if(s=d(r),s!==null){t.blockedOn=s,Co(t.priority,function(){zy(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Pl(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var r=Qh(t.nativeEvent);if(r===null){r=t.nativeEvent;var o=new r.constructor(r.type,r);Zc=o,r.target.dispatchEvent(o),Zc=null}else return s=Pe(r),s!==null&&Ly(s),t.blockedOn=r,!1;s.shift()}return!0}function $y(t,s,r){Pl(t)&&r.delete(s)}function GS(){Wh=!1,Qs!==null&&Pl(Qs)&&(Qs=null),Zs!==null&&Pl(Zs)&&(Zs=null),Ws!==null&&Pl(Ws)&&(Ws=null),Pr.forEach($y),Vr.forEach($y)}function Vl(t,s){t.blockedOn===s&&(t.blockedOn=null,Wh||(Wh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,GS)))}var Hl=null;function qy(t){Hl!==t&&(Hl=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Hl===t&&(Hl=null);for(var s=0;s<t.length;s+=3){var r=t[s],o=t[s+1],h=t[s+2];if(typeof o!="function"){if(Zh(o||r)===null)continue;break}var f=Pe(r);f!==null&&(t.splice(s,3),s-=3,Qu(f,{pending:!0,data:h,method:r.method,action:o},o,h))}}))}function Sa(t){function s(E){return Vl(E,t)}Qs!==null&&Vl(Qs,t),Zs!==null&&Vl(Zs,t),Ws!==null&&Vl(Ws,t),Pr.forEach(s),Vr.forEach(s);for(var r=0;r<ei.length;r++){var o=ei[r];o.blockedOn===t&&(o.blockedOn=null)}for(;0<ei.length&&(r=ei[0],r.blockedOn===null);)Hy(r),r.blockedOn===null&&ei.shift();if(r=(t.ownerDocument||t).$$reactFormReplay,r!=null)for(o=0;o<r.length;o+=3){var h=r[o],f=r[o+1],b=h[X]||null;if(typeof f=="function")b||qy(r);else if(b){var w=null;if(f&&f.hasAttribute("formAction")){if(h=f,b=f[X]||null)w=b.formAction;else if(Zh(h)!==null)continue}else w=b.action;typeof w=="function"?r[o+1]=w:(r.splice(o,3),o-=3),qy(r)}}}function Fy(){function t(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(b){return h=b})},focusReset:"manual",scroll:"manual"})}function s(){h!==null&&(h(),h=null),o||setTimeout(r,20)}function r(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),h!==null&&(h(),h=null)}}}function ed(t){this._internalRoot=t}$l.prototype.render=ed.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,o=an();By(r,o,t,s,null,null)},$l.prototype.unmount=ed.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;By(t.current,2,null,t,null,null),_l(),s[ae]=null}};function $l(t){this._internalRoot=t}$l.prototype.unstable_scheduleHydration=function(t){if(t){var s=ko();t={blockedOn:null,target:t,priority:s};for(var r=0;r<ei.length&&s!==0&&s<ei[r].priority;r++);ei.splice(r,0,t),r===0&&Hy(t)}};var Iy=e.version;if(Iy!=="19.2.7")throw Error(a(527,Iy,"19.2.7"));W.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=p(s),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var KS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ql=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ql.isDisabled&&ql.supportsFiber)try{rs=ql.inject(KS),yt=ql}catch{}}return qr.createRoot=function(t,s){if(!l(t))throw Error(a(299));var r=!1,o="",h=Zp,f=Wp,b=eg;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(h=s.onUncaughtError),s.onCaughtError!==void 0&&(f=s.onCaughtError),s.onRecoverableError!==void 0&&(b=s.onRecoverableError)),s=Dy(t,1,!1,null,null,r,o,null,h,f,b,Fy),t[ae]=s.current,Bh(t),new ed(s)},qr.hydrateRoot=function(t,s,r){if(!l(t))throw Error(a(299));var o=!1,h="",f=Zp,b=Wp,w=eg,E=null;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(h=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(b=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError),r.formState!==void 0&&(E=r.formState)),s=Dy(t,1,!0,s,r??null,o,h,E,f,b,w,Fy),s.context=My(null),r=s.current,o=an(),o=Wa(o),h=Ps(o),h.callback=null,Vs(r,h,o),r=o,s.current.lanes=r,Os(s,r),Xn(s),t[ae]=s.current,Bh(t),new $l(s)},qr.version="19.2.7",qr}var t0;function s1(){if(t0)return sd.exports;t0=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),sd.exports=n1(),sd.exports}var i1=s1();const Tf=D.createContext({});function Ef(n){const e=D.useRef(null);return e.current===null&&(e.current=n()),e.current}const a1=typeof window<"u",Af=a1?D.useLayoutEffect:D.useEffect,Uc=D.createContext(null);function jf(n,e){n.indexOf(e)===-1&&n.push(e)}function pc(n,e){const i=n.indexOf(e);i>-1&&n.splice(i,1)}const ns=(n,e,i)=>i>e?e:i<n?n:i;let Nf=()=>{};const ri={},Tv=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),Ev=n=>typeof n=="object"&&n!==null,Av=n=>/^0[^.\s]+$/u.test(n);function jv(n){let e;return()=>(e===void 0&&(e=n()),e)}const An=n=>n,xo=(...n)=>n.reduce((e,i)=>a=>i(e(a))),ro=(n,e,i)=>{const a=e-n;return a?(i-n)/a:1};class Rf{constructor(){this.subscriptions=[]}add(e){return jf(this.subscriptions,e),()=>pc(this.subscriptions,e)}notify(e,i,a){const l=this.subscriptions.length;if(l)if(l===1)this.subscriptions[0](e,i,a);else for(let c=0;c<l;c++){const u=this.subscriptions[c];u&&u(e,i,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ln=n=>n*1e3,En=n=>n/1e3,Nv=(n,e)=>e?n*(1e3/e):0,Rv=(n,e,i)=>(((1-3*i+3*e)*n+(3*i-6*e))*n+3*e)*n,r1=1e-7,o1=12;function l1(n,e,i,a,l){let c,u,d=0;do u=e+(i-e)/2,c=Rv(u,a,l)-n,c>0?i=u:e=u;while(Math.abs(c)>r1&&++d<o1);return u}function wo(n,e,i,a){if(n===e&&i===a)return An;const l=c=>l1(c,0,1,n,i);return c=>c===0||c===1?c:Rv(l(c),e,a)}const kv=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,Cv=n=>e=>1-n(1-e),Ov=wo(.33,1.53,.69,.99),kf=Cv(Ov),Dv=kv(kf),Mv=n=>n>=1?1:(n*=2)<1?.5*kf(n):.5*(2-Math.pow(2,-10*(n-1))),Cf=n=>1-Math.sin(Math.acos(n)),Bv=Cv(Cf),Uv=kv(Cf),c1=wo(.42,0,1,1),u1=wo(0,0,.58,1),Lv=wo(.42,0,.58,1),h1=n=>Array.isArray(n)&&typeof n[0]!="number",zv=n=>Array.isArray(n)&&typeof n[0]=="number",d1={linear:An,easeIn:c1,easeInOut:Lv,easeOut:u1,circIn:Cf,circInOut:Uv,circOut:Bv,backIn:kf,backInOut:Dv,backOut:Ov,anticipate:Mv},f1=n=>typeof n=="string",n0=n=>{if(zv(n)){Nf(n.length===4);const[e,i,a,l]=n;return wo(e,i,a,l)}else if(f1(n))return d1[n];return n},Fl=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function m1(n){let e=new Set,i=new Set,a=!1,l=!1;const c=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(p){c.has(p)&&(m.schedule(p),n()),p(u)}const m={schedule:(p,y=!1,v=!1)=>{const _=v&&a?e:i;return y&&c.add(p),_.add(p),p},cancel:p=>{i.delete(p),c.delete(p)},process:p=>{if(u=p,a){l=!0;return}a=!0;const y=e;e=i,i=y,e.forEach(d),e.clear(),a=!1,l&&(l=!1,m.process(p))}};return m}const p1=40;function Pv(n,e){let i=!1,a=!0;const l={delta:0,timestamp:0,isProcessing:!1},c=()=>i=!0,u=Fl.reduce((C,P)=>(C[P]=m1(c),C),{}),{setup:d,read:m,resolveKeyframes:p,preUpdate:y,update:v,preRender:x,render:_,postRender:S}=u,T=()=>{const C=ri.useManualTiming,P=C?l.timestamp:performance.now();i=!1,C||(l.delta=a?1e3/60:Math.max(Math.min(P-l.timestamp,p1),1)),l.timestamp=P,l.isProcessing=!0,d.process(l),m.process(l),p.process(l),y.process(l),v.process(l),x.process(l),_.process(l),S.process(l),l.isProcessing=!1,i&&e&&(a=!1,n(T))},j=()=>{i=!0,a=!0,l.isProcessing||n(T)};return{schedule:Fl.reduce((C,P)=>{const K=u[P];return C[P]=(G,H=!1,Y=!1)=>(i||j(),K.schedule(G,H,Y)),C},{}),cancel:C=>{for(let P=0;P<Fl.length;P++)u[Fl[P]].cancel(C)},state:l,steps:u}}const{schedule:Xe,cancel:oi,state:Ut,steps:od}=Pv(typeof requestAnimationFrame<"u"?requestAnimationFrame:An,!0);let rc;function g1(){rc=void 0}const $t={now:()=>(rc===void 0&&$t.set(Ut.isProcessing||ri.useManualTiming?Ut.timestamp:performance.now()),rc),set:n=>{rc=n,queueMicrotask(g1)}},Vv=n=>e=>typeof e=="string"&&e.startsWith(n),Hv=Vv("--"),y1=Vv("var(--"),Of=n=>y1(n)?b1.test(n.split("/*")[0].trim()):!1,b1=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function s0(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const Ka={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},oo={...Ka,transform:n=>ns(0,1,n)},Il={...Ka,default:1},Wr=n=>Math.round(n*1e5)/1e5,Df=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function v1(n){return n==null}const x1=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Mf=(n,e)=>i=>!!(typeof i=="string"&&x1.test(i)&&i.startsWith(n)||e&&!v1(i)&&Object.prototype.hasOwnProperty.call(i,e)),$v=(n,e,i)=>a=>{if(typeof a!="string")return a;const[l,c,u,d]=a.match(Df);return{[n]:parseFloat(l),[e]:parseFloat(c),[i]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},w1=n=>ns(0,255,n),ld={...Ka,transform:n=>Math.round(w1(n))},Ui={test:Mf("rgb","red"),parse:$v("red","green","blue"),transform:({red:n,green:e,blue:i,alpha:a=1})=>"rgba("+ld.transform(n)+", "+ld.transform(e)+", "+ld.transform(i)+", "+Wr(oo.transform(a))+")"};function _1(n){let e="",i="",a="",l="";return n.length>5?(e=n.substring(1,3),i=n.substring(3,5),a=n.substring(5,7),l=n.substring(7,9)):(e=n.substring(1,2),i=n.substring(2,3),a=n.substring(3,4),l=n.substring(4,5),e+=e,i+=i,a+=a,l+=l),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(a,16),alpha:l?parseInt(l,16)/255:1}}const Ud={test:Mf("#"),parse:_1,transform:Ui.transform},_o=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),js=_o("deg"),ts=_o("%"),re=_o("px"),S1=_o("vh"),T1=_o("vw"),i0={...ts,parse:n=>ts.parse(n)/100,transform:n=>ts.transform(n*100)},Ua={test:Mf("hsl","hue"),parse:$v("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:i,alpha:a=1})=>"hsla("+Math.round(n)+", "+ts.transform(Wr(e))+", "+ts.transform(Wr(i))+", "+Wr(oo.transform(a))+")"},St={test:n=>Ui.test(n)||Ud.test(n)||Ua.test(n),parse:n=>Ui.test(n)?Ui.parse(n):Ua.test(n)?Ua.parse(n):Ud.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Ui.transform(n):Ua.transform(n),getAnimatableNone:n=>{const e=St.parse(n);return e.alpha=0,St.transform(e)}},E1=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function A1(n){var e,i;return isNaN(n)&&typeof n=="string"&&(((e=n.match(Df))==null?void 0:e.length)||0)+(((i=n.match(E1))==null?void 0:i.length)||0)>0}const qv="number",Fv="color",j1="var",N1="var(",a0="${}",R1=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Fa(n){const e=n.toString(),i=[],a={color:[],number:[],var:[]},l=[];let c=0;const d=e.replace(R1,m=>(St.test(m)?(a.color.push(c),l.push(Fv),i.push(St.parse(m))):m.startsWith(N1)?(a.var.push(c),l.push(j1),i.push(m)):(a.number.push(c),l.push(qv),i.push(parseFloat(m))),++c,a0)).split(a0);return{values:i,split:d,indexes:a,types:l}}function k1(n){return Fa(n).values}function Iv({split:n,types:e}){const i=n.length;return a=>{let l="";for(let c=0;c<i;c++)if(l+=n[c],a[c]!==void 0){const u=e[c];u===qv?l+=Wr(a[c]):u===Fv?l+=St.transform(a[c]):l+=a[c]}return l}}function C1(n){return Iv(Fa(n))}const O1=n=>typeof n=="number"?0:St.test(n)?St.getAnimatableNone(n):n,D1=(n,e)=>typeof n=="number"?e!=null&&e.trim().endsWith("/")?n:0:O1(n);function M1(n){const e=Fa(n);return Iv(e)(e.values.map((a,l)=>D1(a,e.split[l])))}const Hn={test:A1,parse:k1,createTransformer:C1,getAnimatableNone:M1};function cd(n,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?n+(e-n)*6*i:i<1/2?e:i<2/3?n+(e-n)*(2/3-i)*6:n}function B1({hue:n,saturation:e,lightness:i,alpha:a}){n/=360,e/=100,i/=100;let l=0,c=0,u=0;if(!e)l=c=u=i;else{const d=i<.5?i*(1+e):i+e-i*e,m=2*i-d;l=cd(m,d,n+1/3),c=cd(m,d,n),u=cd(m,d,n-1/3)}return{red:Math.round(l*255),green:Math.round(c*255),blue:Math.round(u*255),alpha:a}}function gc(n,e){return i=>i>0?e:n}const Ye=(n,e,i)=>n+(e-n)*i,ud=(n,e,i)=>{const a=n*n,l=i*(e*e-a)+a;return l<0?0:Math.sqrt(l)},U1=[Ud,Ui,Ua],L1=n=>U1.find(e=>e.test(n));function r0(n){const e=L1(n);if(!e)return!1;let i=e.parse(n);return e===Ua&&(i=B1(i)),i}const o0=(n,e)=>{const i=r0(n),a=r0(e);if(!i||!a)return gc(n,e);const l={...i};return c=>(l.red=ud(i.red,a.red,c),l.green=ud(i.green,a.green,c),l.blue=ud(i.blue,a.blue,c),l.alpha=Ye(i.alpha,a.alpha,c),Ui.transform(l))},Ld=new Set(["none","hidden"]);function z1(n,e){return Ld.has(n)?i=>i<=0?n:e:i=>i>=1?e:n}function P1(n,e){return i=>Ye(n,e,i)}function Bf(n){return typeof n=="number"?P1:typeof n=="string"?Of(n)?gc:St.test(n)?o0:$1:Array.isArray(n)?Gv:typeof n=="object"?St.test(n)?o0:V1:gc}function Gv(n,e){const i=[...n],a=i.length,l=n.map((c,u)=>Bf(c)(c,e[u]));return c=>{for(let u=0;u<a;u++)i[u]=l[u](c);return i}}function V1(n,e){const i={...n,...e},a={};for(const l in i)n[l]!==void 0&&e[l]!==void 0&&(a[l]=Bf(n[l])(n[l],e[l]));return l=>{for(const c in a)i[c]=a[c](l);return i}}function H1(n,e){const i=[],a={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const c=e.types[l],u=n.indexes[c][a[c]],d=n.values[u]??0;i[l]=d,a[c]++}return i}const $1=(n,e)=>{const i=Hn.createTransformer(e),a=Fa(n),l=Fa(e);return a.indexes.var.length===l.indexes.var.length&&a.indexes.color.length===l.indexes.color.length&&a.indexes.number.length>=l.indexes.number.length?Ld.has(n)&&!l.values.length||Ld.has(e)&&!a.values.length?z1(n,e):xo(Gv(H1(a,l),l.values),i):gc(n,e)};function Kv(n,e,i){return typeof n=="number"&&typeof e=="number"&&typeof i=="number"?Ye(n,e,i):Bf(n)(n,e)}const q1=n=>{const e=({timestamp:i})=>n(i);return{start:(i=!0)=>Xe.update(e,i),stop:()=>oi(e),now:()=>Ut.isProcessing?Ut.timestamp:$t.now()}},Yv=(n,e,i=10)=>{let a="";const l=Math.max(Math.round(e/i),2);for(let c=0;c<l;c++)a+=Math.round(n(c/(l-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},yc=2e4;function Uf(n){let e=0;const i=50;let a=n.next(e);for(;!a.done&&e<yc;)e+=i,a=n.next(e);return e>=yc?1/0:e}function F1(n,e=100,i){const a=i({...n,keyframes:[0,e]}),l=Math.min(Uf(a),yc);return{type:"keyframes",ease:c=>a.next(l*c).value/e,duration:En(l)}}const ut={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function zd(n,e){return n*Math.sqrt(1-e*e)}const I1=12;function G1(n,e,i){let a=i;for(let l=1;l<I1;l++)a=a-n(a)/e(a);return a}const hd=.001;function K1({duration:n=ut.duration,bounce:e=ut.bounce,velocity:i=ut.velocity,mass:a=ut.mass}){let l,c,u=1-e;u=ns(ut.minDamping,ut.maxDamping,u),n=ns(ut.minDuration,ut.maxDuration,En(n)),u<1?(l=p=>{const y=p*u,v=y*n,x=y-i,_=zd(p,u),S=Math.exp(-v);return hd-x/_*S},c=p=>{const v=p*u*n,x=v*i+i,_=Math.pow(u,2)*Math.pow(p,2)*n,S=Math.exp(-v),T=zd(Math.pow(p,2),u);return(-l(p)+hd>0?-1:1)*((x-_)*S)/T}):(l=p=>{const y=Math.exp(-p*n),v=(p-i)*n+1;return-hd+y*v},c=p=>{const y=Math.exp(-p*n),v=(i-p)*(n*n);return y*v});const d=5/n,m=G1(l,c,d);if(n=ln(n),isNaN(m))return{stiffness:ut.stiffness,damping:ut.damping,duration:n};{const p=Math.pow(m,2)*a;return{stiffness:p,damping:u*2*Math.sqrt(a*p),duration:n}}}const Y1=["duration","bounce"],X1=["stiffness","damping","mass"];function l0(n,e){return e.some(i=>n[i]!==void 0)}function J1(n){let e={velocity:ut.velocity,stiffness:ut.stiffness,damping:ut.damping,mass:ut.mass,isResolvedFromDuration:!1,...n};if(!l0(n,X1)&&l0(n,Y1))if(e.velocity=0,n.visualDuration){const i=n.visualDuration,a=2*Math.PI/(i*1.2),l=a*a,c=2*ns(.05,1,1-(n.bounce||0))*Math.sqrt(l);e={...e,mass:ut.mass,stiffness:l,damping:c}}else{const i=K1({...n,velocity:0});e={...e,...i,mass:ut.mass},e.isResolvedFromDuration=!0}return e}function bc(n=ut.visualDuration,e=ut.bounce){const i=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:e}:n;let{restSpeed:a,restDelta:l}=i;const c=i.keyframes[0],u=i.keyframes[i.keyframes.length-1],d={done:!1,value:c},{stiffness:m,damping:p,mass:y,duration:v,velocity:x,isResolvedFromDuration:_}=J1({...i,velocity:-En(i.velocity||0)}),S=x||0,T=p/(2*Math.sqrt(m*y)),j=u-c,k=En(Math.sqrt(m/y)),M=Math.abs(j)<5;a||(a=M?ut.restSpeed.granular:ut.restSpeed.default),l||(l=M?ut.restDelta.granular:ut.restDelta.default);let C,P,K,G,H,Y;if(T<1)K=zd(k,T),G=(S+T*k*j)/K,C=se=>{const me=Math.exp(-T*k*se);return u-me*(G*Math.sin(K*se)+j*Math.cos(K*se))},H=T*k*G+j*K,Y=T*k*j-G*K,P=se=>Math.exp(-T*k*se)*(H*Math.sin(K*se)+Y*Math.cos(K*se));else if(T===1){C=me=>u-Math.exp(-k*me)*(j+(S+k*j)*me);const se=S+k*j;P=me=>Math.exp(-k*me)*(k*se*me-S)}else{const se=k*Math.sqrt(T*T-1);C=Ne=>{const Be=Math.exp(-T*k*Ne),L=Math.min(se*Ne,300);return u-Be*((S+T*k*j)*Math.sinh(L)+se*j*Math.cosh(L))/se};const me=(S+T*k*j)/se,ye=T*k*me-j*se,Ae=T*k*j-me*se;P=Ne=>{const Be=Math.exp(-T*k*Ne),L=Math.min(se*Ne,300);return Be*(ye*Math.sinh(L)+Ae*Math.cosh(L))}}const Z={calculatedDuration:_&&v||null,velocity:se=>ln(P(se)),next:se=>{if(!_&&T<1){const ye=Math.exp(-T*k*se),Ae=Math.sin(K*se),Ne=Math.cos(K*se),Be=u-ye*(G*Ae+j*Ne),L=ln(ye*(H*Ae+Y*Ne));return d.done=Math.abs(L)<=a&&Math.abs(u-Be)<=l,d.value=d.done?u:Be,d}const me=C(se);if(_)d.done=se>=v;else{const ye=ln(P(se));d.done=Math.abs(ye)<=a&&Math.abs(u-me)<=l}return d.value=d.done?u:me,d},toString:()=>{const se=Math.min(Uf(Z),yc),me=Yv(ye=>Z.next(se*ye).value,se,30);return se+"ms "+me},toTransition:()=>{}};return Z}bc.applyToOptions=n=>{const e=F1(n,100,bc);return n.ease=e.ease,n.duration=ln(e.duration),n.type="keyframes",n};const Q1=5;function Xv(n,e,i){const a=Math.max(e-Q1,0);return Nv(i-n(a),e-a)}function Pd({keyframes:n,velocity:e=0,power:i=.8,timeConstant:a=325,bounceDamping:l=10,bounceStiffness:c=500,modifyTarget:u,min:d,max:m,restDelta:p=.5,restSpeed:y}){const v=n[0],x={done:!1,value:v},_=Y=>d!==void 0&&Y<d||m!==void 0&&Y>m,S=Y=>d===void 0?m:m===void 0||Math.abs(d-Y)<Math.abs(m-Y)?d:m;let T=i*e;const j=v+T,k=u===void 0?j:u(j);k!==j&&(T=k-v);const M=Y=>-T*Math.exp(-Y/a),C=Y=>k+M(Y),P=Y=>{const Z=M(Y),se=C(Y);x.done=Math.abs(Z)<=p,x.value=x.done?k:se};let K,G;const H=Y=>{_(x.value)&&(K=Y,G=bc({keyframes:[x.value,S(x.value)],velocity:Xv(C,Y,x.value),damping:l,stiffness:c,restDelta:p,restSpeed:y}))};return H(0),{calculatedDuration:null,next:Y=>{let Z=!1;return!G&&K===void 0&&(Z=!0,P(Y),H(Y)),K!==void 0&&Y>=K?G.next(Y-K):(!Z&&P(Y),x)}}}function Z1(n,e,i){const a=[],l=i||ri.mix||Kv,c=n.length-1;for(let u=0;u<c;u++){let d=l(n[u],n[u+1]);if(e){const m=Array.isArray(e)?e[u]||An:e;d=xo(m,d)}a.push(d)}return a}function W1(n,e,{clamp:i=!0,ease:a,mixer:l}={}){const c=n.length;if(Nf(c===e.length),c===1)return()=>e[0];if(c===2&&e[0]===e[1])return()=>e[1];const u=n[0]===n[1];n[0]>n[c-1]&&(n=[...n].reverse(),e=[...e].reverse());const d=Z1(e,a,l),m=d.length,p=y=>{if(u&&y<n[0])return e[0];let v=0;if(m>1)for(;v<n.length-2&&!(y<n[v+1]);v++);const x=ro(n[v],n[v+1],y);return d[v](x)};return i?y=>p(ns(n[0],n[c-1],y)):p}function eT(n,e){const i=n[n.length-1];for(let a=1;a<=e;a++){const l=ro(0,e,a);n.push(Ye(i,1,l))}}function tT(n){const e=[0];return eT(e,n.length-1),e}function nT(n,e){return n.map(i=>i*e)}function sT(n,e){return n.map(()=>e||Lv).splice(0,n.length-1)}function eo({duration:n=300,keyframes:e,times:i,ease:a="easeInOut"}){const l=h1(a)?a.map(n0):n0(a),c={done:!1,value:e[0]},u=nT(i&&i.length===e.length?i:tT(e),n),d=W1(u,e,{ease:Array.isArray(l)?l:sT(e,l)});return{calculatedDuration:n,next:m=>(c.value=d(m),c.done=m>=n,c)}}const iT=n=>n!==null;function Lc(n,{repeat:e,repeatType:i="loop"},a,l=1){const c=n.filter(iT),d=l<0||e&&i!=="loop"&&e%2===1?0:c.length-1;return!d||a===void 0?c[d]:a}const aT={decay:Pd,inertia:Pd,tween:eo,keyframes:eo,spring:bc};function Jv(n){typeof n.type=="string"&&(n.type=aT[n.type])}class Lf{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,i){return this.finished.then(e,i)}}const rT=n=>n/100;class vc extends Lf{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var a,l;const{motionValue:i}=this.options;i&&i.updatedAt!==$t.now()&&this.tick($t.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(l=(a=this.options).onStop)==null||l.call(a))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;Jv(e);const{type:i=eo,repeat:a=0,repeatDelay:l=0,repeatType:c,velocity:u=0}=e;let{keyframes:d}=e;const m=i||eo;m!==eo&&typeof d[0]!="number"&&(this.mixKeyframes=xo(rT,Kv(d[0],d[1])),d=[0,100]);const p=m({...e,keyframes:d});c==="mirror"&&(this.mirroredGenerator=m({...e,keyframes:[...d].reverse(),velocity:-u})),p.calculatedDuration===null&&(p.calculatedDuration=Uf(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+l,this.totalDuration=this.resolvedDuration*(a+1)-l,this.generator=p}updateTime(e){const i=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=i}tick(e,i=!1){const{generator:a,totalDuration:l,mixKeyframes:c,mirroredGenerator:u,resolvedDuration:d,calculatedDuration:m}=this;if(this.startTime===null)return a.next(0);const{delay:p=0,keyframes:y,repeat:v,repeatType:x,repeatDelay:_,type:S,onUpdate:T,finalKeyframe:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-l/this.speed,this.startTime)),i?this.currentTime=e:this.updateTime(e);const k=this.currentTime-p*(this.playbackSpeed>=0?1:-1),M=this.playbackSpeed>=0?k<0:k>l;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=l);let C=this.currentTime,P=a;if(v){const Y=Math.min(this.currentTime,l)/d;let Z=Math.floor(Y),se=Y%1;!se&&Y>=1&&(se=1),se===1&&Z--,Z=Math.min(Z,v+1),!!(Z%2)&&(x==="reverse"?(se=1-se,_&&(se-=_/d)):x==="mirror"&&(P=u)),C=ns(0,1,se)*d}let K;M?(this.delayState.value=y[0],K=this.delayState):K=P.next(C),c&&!M&&(K.value=c(K.value));let{done:G}=K;!M&&m!==null&&(G=this.playbackSpeed>=0?this.currentTime>=l:this.currentTime<=0);const H=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&G);return H&&S!==Pd&&(K.value=Lc(y,this.options,j,this.speed)),T&&T(K.value),H&&this.finish(),K}then(e,i){return this.finished.then(e,i)}get duration(){return En(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+En(e)}get time(){return En(this.currentTime)}set time(e){e=ln(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const i=this.generator.next(e).value;return Xv(a=>this.generator.next(a).value,e,i)}get speed(){return this.playbackSpeed}set speed(e){const i=this.playbackSpeed!==e;i&&this.driver&&this.updateTime($t.now()),this.playbackSpeed=e,i&&this.driver&&(this.time=En(this.currentTime))}play(){var l,c;if(this.isStopped)return;const{driver:e=q1,startTime:i}=this.options;this.driver||(this.driver=e(u=>this.tick(u))),(c=(l=this.options).onPlay)==null||c.call(l);const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=i??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime($t.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,i;this.notifyFinished(),this.teardown(),this.state="finished",(i=(e=this.options).onComplete)==null||i.call(e)}cancel(){var e,i;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(i=(e=this.options).onCancel)==null||i.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var i;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(i=this.driver)==null||i.stop(),e.observe(this)}}function oT(n){for(let e=1;e<n.length;e++)n[e]??(n[e]=n[e-1])}const Li=n=>n*180/Math.PI,Vd=n=>{const e=Li(Math.atan2(n[1],n[0]));return Hd(e)},lT={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:Vd,rotateZ:Vd,skewX:n=>Li(Math.atan(n[1])),skewY:n=>Li(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},Hd=n=>(n=n%360,n<0&&(n+=360),n),c0=Vd,u0=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),h0=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),cT={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:u0,scaleY:h0,scale:n=>(u0(n)+h0(n))/2,rotateX:n=>Hd(Li(Math.atan2(n[6],n[5]))),rotateY:n=>Hd(Li(Math.atan2(-n[2],n[0]))),rotateZ:c0,rotate:c0,skewX:n=>Li(Math.atan(n[4])),skewY:n=>Li(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function $d(n){return n.includes("scale")?1:0}function qd(n,e){if(!n||n==="none")return $d(e);const i=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,l;if(i)a=cT,l=i;else{const d=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=lT,l=d}if(!l)return $d(e);const c=a[e],u=l[1].split(",").map(hT);return typeof c=="function"?c(u):u[c]}const uT=(n,e)=>{const{transform:i="none"}=getComputedStyle(n);return qd(i,e)};function hT(n){return parseFloat(n.trim())}const Ya=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xa=new Set([...Ya,"pathRotation"]),d0=n=>n===Ka||n===re,dT=new Set(["x","y","z"]),fT=Ya.filter(n=>!dT.has(n));function mT(n){const e=[];return fT.forEach(i=>{const a=n.getValue(i);a!==void 0&&(e.push([i,a.get()]),a.set(i.startsWith("scale")?1:0))}),e}const ai={width:({x:n},{paddingLeft:e="0",paddingRight:i="0",boxSizing:a})=>{const l=n.max-n.min;return a==="border-box"?l:l-parseFloat(e)-parseFloat(i)},height:({y:n},{paddingTop:e="0",paddingBottom:i="0",boxSizing:a})=>{const l=n.max-n.min;return a==="border-box"?l:l-parseFloat(e)-parseFloat(i)},top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:(n,{transform:e})=>qd(e,"x"),y:(n,{transform:e})=>qd(e,"y")};ai.translateX=ai.x;ai.translateY=ai.y;const Vi=new Set;let Fd=!1,Id=!1,Gd=!1;function Qv(){if(Id){const n=Array.from(Vi).filter(a=>a.needsMeasurement),e=new Set(n.map(a=>a.element)),i=new Map;e.forEach(a=>{const l=mT(a);l.length&&(i.set(a,l),a.render())}),n.forEach(a=>a.measureInitialState()),e.forEach(a=>{a.render();const l=i.get(a);l&&l.forEach(([c,u])=>{var d;(d=a.getValue(c))==null||d.set(u)})}),n.forEach(a=>a.measureEndState()),n.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}Id=!1,Fd=!1,Vi.forEach(n=>n.complete(Gd)),Vi.clear()}function Zv(){Vi.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Id=!0)})}function pT(){Gd=!0,Zv(),Qv(),Gd=!1}class zf{constructor(e,i,a,l,c,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=i,this.name=a,this.motionValue=l,this.element=c,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Vi.add(this),Fd||(Fd=!0,Xe.read(Zv),Xe.resolveKeyframes(Qv))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:i,element:a,motionValue:l}=this;if(e[0]===null){const c=l==null?void 0:l.get(),u=e[e.length-1];if(c!==void 0)e[0]=c;else if(a&&i){const d=a.readValue(i,u);d!=null&&(e[0]=d)}e[0]===void 0&&(e[0]=u),l&&c===void 0&&l.set(e[0])}oT(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Vi.delete(this)}cancel(){this.state==="scheduled"&&(Vi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const gT=n=>n.startsWith("--");function Wv(n,e,i){gT(e)?n.style.setProperty(e,i):n.style[e]=i}const yT={};function ex(n,e){const i=jv(n);return()=>yT[e]??i()}const bT=ex(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),tx=ex(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Yr=([n,e,i,a])=>`cubic-bezier(${n}, ${e}, ${i}, ${a})`,f0={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Yr([0,.65,.55,1]),circOut:Yr([.55,0,1,.45]),backIn:Yr([.31,.01,.66,-.59]),backOut:Yr([.33,1.53,.69,.99])};function nx(n,e){if(n)return typeof n=="function"?tx()?Yv(n,e):"ease-out":zv(n)?Yr(n):Array.isArray(n)?n.map(i=>nx(i,e)||f0.easeOut):f0[n]}function vT(n,e,i,{delay:a=0,duration:l=300,repeat:c=0,repeatType:u="loop",ease:d="easeOut",times:m}={},p=void 0){const y={[e]:i};m&&(y.offset=m);const v=nx(d,l);Array.isArray(v)&&(y.easing=v);const x={delay:a,duration:l,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:c+1,direction:u==="reverse"?"alternate":"normal"};return p&&(x.pseudoElement=p),n.animate(y,x)}function sx(n){return typeof n=="function"&&"applyToOptions"in n}function xT({type:n,...e}){return sx(n)&&tx()?n.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class ix extends Lf{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:i,name:a,keyframes:l,pseudoElement:c,allowFlatten:u=!1,finalKeyframe:d,onComplete:m}=e;this.isPseudoElement=!!c,this.allowFlatten=u,this.options=e,Nf(typeof e.type!="string");const p=xT(e);this.animation=vT(i,a,l,p,c),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const y=Lc(l,this.options,d,this.speed);this.updateMotionValue&&this.updateMotionValue(y),Wv(i,a,y),this.animation.cancel()}m==null||m(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,i;(i=(e=this.animation).finish)==null||i.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var i,a,l;const e=(i=this.options)==null?void 0:i.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((l=(a=this.animation).commitStyles)==null||l.call(a))}get duration(){var i,a;const e=((a=(i=this.animation.effect)==null?void 0:i.getComputedTiming)==null?void 0:a.call(i).duration)||0;return En(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+En(e)}get time(){return En(Number(this.animation.currentTime)||0)}set time(e){const i=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ln(e),i&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:i,rangeEnd:a,observe:l}){var c;return this.allowFlatten&&((c=this.animation.effect)==null||c.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&bT()?(this.animation.timeline=e,i&&(this.animation.rangeStart=i),a&&(this.animation.rangeEnd=a),An):l(this)}}const ax={anticipate:Mv,backInOut:Dv,circInOut:Uv};function wT(n){return n in ax}function _T(n){typeof n.ease=="string"&&wT(n.ease)&&(n.ease=ax[n.ease])}const dd=10;class ST extends ix{constructor(e){_T(e),Jv(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:i,onUpdate:a,onComplete:l,element:c,...u}=this.options;if(!i)return;if(e!==void 0){i.set(e);return}const d=new vc({...u,autoplay:!1}),m=Math.max(dd,$t.now()-this.startTime),p=ns(0,dd,m-dd),y=d.sample(m).value,{name:v}=this.options;c&&v&&Wv(c,v,y),i.setWithVelocity(d.sample(Math.max(0,m-p)).value,y,p),d.stop()}}const m0=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(Hn.test(n)||n==="0")&&!n.startsWith("url("));function TT(n){const e=n[0];if(n.length===1)return!0;for(let i=0;i<n.length;i++)if(n[i]!==e)return!0}function ET(n,e,i,a){const l=n[0];if(l===null)return!1;if(e==="display"||e==="visibility")return!0;const c=n[n.length-1],u=m0(l,e),d=m0(c,e);return!u||!d?!1:TT(n)||(i==="spring"||sx(i))&&a}function Kd(n){n.duration=0,n.type="keyframes"}const rx=new Set(["opacity","clipPath","filter","transform"]),AT=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function jT(n){for(let e=0;e<n.length;e++)if(typeof n[e]=="string"&&AT.test(n[e]))return!0;return!1}const NT=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),RT=jv(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function kT(n){var v;const{motionValue:e,name:i,repeatDelay:a,repeatType:l,damping:c,type:u,keyframes:d}=n;if(!(((v=e==null?void 0:e.owner)==null?void 0:v.current)instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:y}=e.owner.getProps();return RT()&&i&&(rx.has(i)||NT.has(i)&&jT(d))&&(i!=="transform"||!y)&&!p&&!a&&l!=="mirror"&&c!==0&&u!=="inertia"}const CT=40;class OT extends Lf{constructor({autoplay:e=!0,delay:i=0,type:a="keyframes",repeat:l=0,repeatDelay:c=0,repeatType:u="loop",keyframes:d,name:m,motionValue:p,element:y,...v}){var S;super(),this.stop=()=>{var T,j;this._animation&&(this._animation.stop(),(T=this.stopTimeline)==null||T.call(this)),(j=this.keyframeResolver)==null||j.cancel()},this.createdAt=$t.now();const x={autoplay:e,delay:i,type:a,repeat:l,repeatDelay:c,repeatType:u,name:m,motionValue:p,element:y,...v},_=(y==null?void 0:y.KeyframeResolver)||zf;this.keyframeResolver=new _(d,(T,j,k)=>this.onKeyframesResolved(T,j,x,!k),m,p,y),(S=this.keyframeResolver)==null||S.scheduleResolve()}onKeyframesResolved(e,i,a,l){var k,M;this.keyframeResolver=void 0;const{name:c,type:u,velocity:d,delay:m,isHandoff:p,onUpdate:y}=a;this.resolvedAt=$t.now();let v=!0;ET(e,c,u,d)||(v=!1,(ri.instantAnimations||!m)&&(y==null||y(Lc(e,a,i))),e[0]=e[e.length-1],Kd(a),a.repeat=0);const _={startTime:l?this.resolvedAt?this.resolvedAt-this.createdAt>CT?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:i,...a,keyframes:e},S=v&&!p&&kT(_),T=(M=(k=_.motionValue)==null?void 0:k.owner)==null?void 0:M.current;let j;if(S)try{j=new ST({..._,element:T})}catch{j=new vc(_)}else j=new vc(_);j.finished.then(()=>{this.notifyFinished()}).catch(An),this.pendingTimeline&&(this.stopTimeline=j.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=j}get finished(){return this._animation?this.animation.finished:this._finished}then(e,i){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),pT()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function ox(n,e,i,a=0,l=1){const c=Array.from(n).sort((p,y)=>p.sortNodePosition(y)).indexOf(e),u=n.size,d=(u-1)*a;return typeof i=="function"?i(c,u):l===1?c*a:d-c*a}const p0=30,DT=n=>!isNaN(parseFloat(n));class MT{constructor(e,i={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{var c;const l=$t.now();if(this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&((c=this.events.change)==null||c.notify(this.current),this.dependents))for(const u of this.dependents)u.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=i.owner}setCurrent(e){this.current=e,this.updatedAt=$t.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=DT(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,i){this.events[e]||(this.events[e]=new Rf);const a=this.events[e].add(i);return e==="change"?()=>{a(),Xe.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,i){this.passiveEffect=e,this.stopPassiveEffect=i}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,i,a){this.set(i),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-a}jump(e,i=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=$t.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>p0)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,p0);return Nv(parseFloat(this.current)-parseFloat(this.prevFrameValue),i)}start(e){return this.stop(),new Promise(i=>{this.hasAnimated=!0,this.animation=e(i),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,i;(e=this.dependents)==null||e.clear(),(i=this.events.destroy)==null||i.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ia(n,e){return new MT(n,e)}function lx(n,e){if(n!=null&&n.inherit&&e){const{inherit:i,...a}=n;return{...e,...a}}return n}function Pf(n,e){const i=(n==null?void 0:n[e])??(n==null?void 0:n.default)??n;return i!==n?lx(i,n):i}const BT={type:"spring",stiffness:500,damping:25,restSpeed:10},UT=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),LT={type:"keyframes",duration:.8},zT={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},PT=(n,{keyframes:e})=>e.length>2?LT:Xa.has(n)?n.startsWith("scale")?UT(e[1]):BT:zT,VT=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function HT(n){for(const e in n)if(!VT.has(e))return!0;return!1}const Vf=(n,e,i,a={},l,c)=>u=>{const d=Pf(a,n)||{},m=d.delay||a.delay||0;let{elapsed:p=0}=a;p=p-ln(m);const y={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-p,onUpdate:x=>{e.set(x),d.onUpdate&&d.onUpdate(x)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:n,motionValue:e,element:c?void 0:l};HT(d)||Object.assign(y,PT(n,y)),y.duration&&(y.duration=ln(y.duration)),y.repeatDelay&&(y.repeatDelay=ln(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let v=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(Kd(y),y.delay===0&&(v=!0)),(ri.instantAnimations||ri.skipAnimations||l!=null&&l.shouldSkipAnimations||d.skipAnimations)&&(v=!0,Kd(y),y.delay=0),y.allowFlatten=!d.type&&!d.ease,v&&!c&&e.get()!==void 0){const x=Lc(y.keyframes,d);if(x!==void 0){Xe.update(()=>{y.onUpdate(x),y.onComplete()});return}}return d.isSync?new vc(y):new OT(y)},$T=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function qT(n){const e=$T.exec(n);if(!e)return[,];const[,i,a,l]=e;return[`--${i??a}`,l]}function cx(n,e,i=1){const[a,l]=qT(n);if(!a)return;const c=window.getComputedStyle(e).getPropertyValue(a);if(c){const u=c.trim();return Tv(u)?parseFloat(u):u}return Of(l)?cx(l,e,i+1):l}function g0(n){const e=[{},{}];return n==null||n.values.forEach((i,a)=>{e[0][a]=i.get(),e[1][a]=i.getVelocity()}),e}function Hf(n,e,i,a){if(typeof e=="function"){const[l,c]=g0(a);e=e(i!==void 0?i:n.custom,l,c)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[l,c]=g0(a);e=e(i!==void 0?i:n.custom,l,c)}return e}function Hi(n,e,i){const a=n.getProps();return Hf(a,e,i!==void 0?i:a.custom,n)}const ux=new Set(["width","height","top","left","right","bottom",...Ya]),Yd=n=>Array.isArray(n);function FT(n,e,i){n.hasValue(e)?n.getValue(e).set(i):n.addValue(e,Ia(i))}function IT(n){return Yd(n)?n[n.length-1]||0:n}function GT(n,e){const i=Hi(n,e);let{transitionEnd:a={},transition:l={},...c}=i||{};c={...c,...a};for(const u in c){const d=IT(c[u]);FT(n,u,d)}}const Lt=n=>!!(n&&n.getVelocity);function KT(n){return!!(Lt(n)&&n.add)}function Xd(n,e){const i=n.getValue("willChange");if(KT(i))return i.add(e);if(!i&&ri.WillChange){const a=new ri.WillChange("auto");n.addValue("willChange",a),a.add(e)}}function $f(n){return n.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const YT="framerAppearId",hx="data-"+$f(YT);function dx(n){return n.props[hx]}function XT({protectedKeys:n,needsAnimating:e},i){const a=n.hasOwnProperty(i)&&e[i]!==!0;return e[i]=!1,a}function fx(n,e,{delay:i=0,transitionOverride:a,type:l}={}){let{transition:c,transitionEnd:u,...d}=e;const m=n.getDefaultTransition();c=c?lx(c,m):m;const p=c==null?void 0:c.reduceMotion,y=c==null?void 0:c.skipAnimations;a&&(c=a);const v=[],x=l&&n.animationState&&n.animationState.getState()[l],_=c==null?void 0:c.path;_&&_.animateVisualElement(n,d,c,i,v);for(const S in d){const T=n.getValue(S,n.latestValues[S]??null),j=d[S];if(j===void 0||x&&XT(x,S))continue;const k={delay:i,...Pf(c||{},S)};y&&(k.skipAnimations=!0);const M=T.get();if(M!==void 0&&!T.isAnimating()&&!Array.isArray(j)&&j===M&&!k.velocity){Xe.update(()=>T.set(j));continue}let C=!1;if(window.MotionHandoffAnimation){const G=dx(n);if(G){const H=window.MotionHandoffAnimation(G,S,Xe);H!==null&&(k.startTime=H,C=!0)}}Xd(n,S);const P=p??n.shouldReduceMotion;T.start(Vf(S,T,j,P&&ux.has(S)?{type:!1}:k,n,C));const K=T.animation;K&&v.push(K)}if(u){const S=()=>Xe.update(()=>{u&&GT(n,u)});v.length?Promise.all(v).then(S):S()}return v}function Jd(n,e,i={}){var m;const a=Hi(n,e,i.type==="exit"?(m=n.presenceContext)==null?void 0:m.custom:void 0);let{transition:l=n.getDefaultTransition()||{}}=a||{};i.transitionOverride&&(l=i.transitionOverride);const c=a?()=>Promise.all(fx(n,a,i)):()=>Promise.resolve(),u=n.variantChildren&&n.variantChildren.size?(p=0)=>{const{delayChildren:y=0,staggerChildren:v,staggerDirection:x}=l;return JT(n,e,p,y,v,x,i)}:()=>Promise.resolve(),{when:d}=l;if(d){const[p,y]=d==="beforeChildren"?[c,u]:[u,c];return p().then(()=>y())}else return Promise.all([c(),u(i.delay)])}function JT(n,e,i=0,a=0,l=0,c=1,u){const d=[];for(const m of n.variantChildren)m.notify("AnimationStart",e),d.push(Jd(m,e,{...u,delay:i+(typeof a=="function"?0:a)+ox(n.variantChildren,m,a,l,c)}).then(()=>m.notify("AnimationComplete",e)));return Promise.all(d)}function QT(n,e,i={}){n.notify("AnimationStart",e);let a;if(Array.isArray(e)){const l=e.map(c=>Jd(n,c,i));a=Promise.all(l)}else if(typeof e=="string")a=Jd(n,e,i);else{const l=typeof e=="function"?Hi(n,e,i.custom):e;a=Promise.all(fx(n,l,i))}return a.then(()=>{n.notify("AnimationComplete",e)})}const ZT={test:n=>n==="auto",parse:n=>n},mx=n=>e=>e.test(n),px=[Ka,re,ts,js,T1,S1,ZT],y0=n=>px.find(mx(n));function WT(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||Av(n):!0}const eE=new Set(["brightness","contrast","saturate","opacity"]);function tE(n){const[e,i]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[a]=i.match(Df)||[];if(!a)return n;const l=i.replace(a,"");let c=eE.has(e)?1:0;return a!==i&&(c*=100),e+"("+c+l+")"}const nE=/\b([a-z-]*)\(.*?\)/gu,Qd={...Hn,getAnimatableNone:n=>{const e=n.match(nE);return e?e.map(tE).join(" "):n}},Zd={...Hn,getAnimatableNone:n=>{const e=Hn.parse(n);return Hn.createTransformer(n)(e.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},b0={...Ka,transform:Math.round},sE={rotate:js,pathRotation:js,rotateX:js,rotateY:js,rotateZ:js,scale:Il,scaleX:Il,scaleY:Il,scaleZ:Il,skew:js,skewX:js,skewY:js,distance:re,translateX:re,translateY:re,translateZ:re,x:re,y:re,z:re,perspective:re,transformPerspective:re,opacity:oo,originX:i0,originY:i0,originZ:re},xc={borderWidth:re,borderTopWidth:re,borderRightWidth:re,borderBottomWidth:re,borderLeftWidth:re,borderRadius:re,borderTopLeftRadius:re,borderTopRightRadius:re,borderBottomRightRadius:re,borderBottomLeftRadius:re,width:re,maxWidth:re,height:re,maxHeight:re,top:re,right:re,bottom:re,left:re,inset:re,insetBlock:re,insetBlockStart:re,insetBlockEnd:re,insetInline:re,insetInlineStart:re,insetInlineEnd:re,padding:re,paddingTop:re,paddingRight:re,paddingBottom:re,paddingLeft:re,paddingBlock:re,paddingBlockStart:re,paddingBlockEnd:re,paddingInline:re,paddingInlineStart:re,paddingInlineEnd:re,margin:re,marginTop:re,marginRight:re,marginBottom:re,marginLeft:re,marginBlock:re,marginBlockStart:re,marginBlockEnd:re,marginInline:re,marginInlineStart:re,marginInlineEnd:re,fontSize:re,backgroundPositionX:re,backgroundPositionY:re,...sE,zIndex:b0,fillOpacity:oo,strokeOpacity:oo,numOctaves:b0},iE={...xc,color:St,backgroundColor:St,outlineColor:St,fill:St,stroke:St,borderColor:St,borderTopColor:St,borderRightColor:St,borderBottomColor:St,borderLeftColor:St,filter:Qd,WebkitFilter:Qd,mask:Zd,WebkitMask:Zd},gx=n=>iE[n],aE=new Set([Qd,Zd]);function yx(n,e){let i=gx(n);return aE.has(i)||(i=Hn),i.getAnimatableNone?i.getAnimatableNone(e):void 0}const rE=new Set(["auto","none","0"]);function oE(n,e,i){let a=0,l;for(;a<n.length&&!l;){const c=n[a];typeof c=="string"&&!rE.has(c)&&Fa(c).values.length&&(l=n[a]),a++}if(l&&i)for(const c of e)n[c]=yx(i,l)}class lE extends zf{constructor(e,i,a,l,c){super(e,i,a,l,c,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:i,name:a}=this;if(!i||!i.current)return;super.readKeyframes();for(let y=0;y<e.length;y++){let v=e[y];if(typeof v=="string"&&(v=v.trim(),Of(v))){const x=cx(v,i.current);x!==void 0&&(e[y]=x),y===e.length-1&&(this.finalKeyframe=v)}}if(this.resolveNoneKeyframes(),!ux.has(a)||e.length!==2)return;const[l,c]=e,u=y0(l),d=y0(c),m=s0(l),p=s0(c);if(m!==p&&ai[a]){this.needsMeasurement=!0;return}if(u!==d)if(d0(u)&&d0(d))for(let y=0;y<e.length;y++){const v=e[y];typeof v=="string"&&(e[y]=parseFloat(v))}else ai[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:i}=this,a=[];for(let l=0;l<e.length;l++)(e[l]===null||WT(e[l]))&&a.push(l);a.length&&oE(e,a,i)}measureInitialState(){const{element:e,unresolvedKeyframes:i,name:a}=this;if(!e||!e.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ai[a](e.measureViewportBox(),window.getComputedStyle(e.current)),i[0]=this.measuredOrigin;const l=i[i.length-1];l!==void 0&&e.getValue(a,l).jump(l,!1)}measureEndState(){var d;const{element:e,name:i,unresolvedKeyframes:a}=this;if(!e||!e.current)return;const l=e.getValue(i);l&&l.jump(this.measuredOrigin,!1);const c=a.length-1,u=a[c];a[c]=ai[i](e.measureViewportBox(),window.getComputedStyle(e.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),(d=this.removedTransforms)!=null&&d.length&&this.removedTransforms.forEach(([m,p])=>{e.getValue(m).set(p)}),this.resolveNoneKeyframes()}}const qf=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function bx(n,e,i){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){let a=document;const l=(i==null?void 0:i[n])??a.querySelectorAll(n);return l?Array.from(l):[]}return Array.from(n).filter(a=>a!=null)}const Wd=(n,e)=>e&&typeof n=="number"?e.transform(n):n;function oc(n){return Ev(n)&&"offsetHeight"in n&&!("ownerSVGElement"in n)}const{schedule:Ff}=Pv(queueMicrotask,!1),Ln={x:!1,y:!1};function vx(){return Ln.x||Ln.y}function cE(n){return n==="x"||n==="y"?Ln[n]?null:(Ln[n]=!0,()=>{Ln[n]=!1}):Ln.x||Ln.y?null:(Ln.x=Ln.y=!0,()=>{Ln.x=Ln.y=!1})}function xx(n,e){const i=bx(n),a=new AbortController,l={passive:!0,...e,signal:a.signal};return[i,l,()=>a.abort()]}function uE(n){return!(n.pointerType==="touch"||vx())}function hE(n,e,i={}){const[a,l,c]=xx(n,i);return a.forEach(u=>{let d=!1,m=!1,p;const y=()=>{u.removeEventListener("pointerleave",S)},v=j=>{p&&(p(j),p=void 0),y()},x=j=>{d=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),m&&(m=!1,v(j))},_=()=>{d=!0,window.addEventListener("pointerup",x,l),window.addEventListener("pointercancel",x,l)},S=j=>{if(j.pointerType!=="touch"){if(d){m=!0;return}v(j)}},T=j=>{if(!uE(j))return;m=!1;const k=e(u,j);typeof k=="function"&&(p=k,u.addEventListener("pointerleave",S,l))};u.addEventListener("pointerenter",T,l),u.addEventListener("pointerdown",_,l)}),c}const wx=(n,e)=>e?n===e?!0:wx(n,e.parentElement):!1,If=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,dE=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function fE(n){return dE.has(n.tagName)||n.isContentEditable===!0}const mE=new Set(["INPUT","SELECT","TEXTAREA"]);function pE(n){return mE.has(n.tagName)||n.isContentEditable===!0}const lc=new WeakSet;function v0(n){return e=>{e.key==="Enter"&&n(e)}}function fd(n,e){n.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const gE=(n,e)=>{const i=n.currentTarget;if(!i)return;const a=v0(()=>{if(lc.has(i))return;fd(i,"down");const l=v0(()=>{fd(i,"up")}),c=()=>fd(i,"cancel");i.addEventListener("keyup",l,e),i.addEventListener("blur",c,e)});i.addEventListener("keydown",a,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",a),e)};function x0(n){return If(n)&&!vx()}const w0=new WeakSet;function yE(n,e,i={}){const[a,l,c]=xx(n,i),u=d=>{const m=d.currentTarget;if(!x0(d)||w0.has(d))return;lc.add(m),i.stopPropagation&&w0.add(d);const p=e(m,d),y={...l,capture:!0},v=(S,T)=>{window.removeEventListener("pointerup",x,y),window.removeEventListener("pointercancel",_,y),lc.has(m)&&lc.delete(m),x0(S)&&typeof p=="function"&&p(S,{success:T})},x=S=>{v(S,m===window||m===document||i.useGlobalTarget||wx(m,S.target))},_=S=>{v(S,!1)};window.addEventListener("pointerup",x,y),window.addEventListener("pointercancel",_,y)};return a.forEach(d=>{(i.useGlobalTarget?window:d).addEventListener("pointerdown",u,l),oc(d)&&(d.addEventListener("focus",p=>gE(p,l)),!fE(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),c}function Gf(n){return Ev(n)&&"ownerSVGElement"in n}const cc=new WeakMap;let ni;const _x=(n,e,i)=>(a,l)=>l&&l[0]?l[0][n+"Size"]:Gf(a)&&"getBBox"in a?a.getBBox()[e]:a[i],bE=_x("inline","width","offsetWidth"),vE=_x("block","height","offsetHeight");function xE({target:n,borderBoxSize:e}){var i;(i=cc.get(n))==null||i.forEach(a=>{a(n,{get width(){return bE(n,e)},get height(){return vE(n,e)}})})}function wE(n){n.forEach(xE)}function _E(){typeof ResizeObserver>"u"||(ni=new ResizeObserver(wE))}function SE(n,e){ni||_E();const i=bx(n);return i.forEach(a=>{let l=cc.get(a);l||(l=new Set,cc.set(a,l)),l.add(e),ni==null||ni.observe(a)}),()=>{i.forEach(a=>{const l=cc.get(a);l==null||l.delete(e),l!=null&&l.size||ni==null||ni.unobserve(a)})}}const uc=new Set;let La;function TE(){La=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};uc.forEach(e=>e(n))},window.addEventListener("resize",La)}function EE(n){return uc.add(n),La||TE(),()=>{uc.delete(n),!uc.size&&typeof La=="function"&&(window.removeEventListener("resize",La),La=void 0)}}function _0(n,e){return typeof n=="function"?EE(n):SE(n,e)}function AE(n){return Gf(n)&&n.tagName==="svg"}const jE=[...px,St,Hn],NE=n=>jE.find(mx(n)),S0=()=>({translate:0,scale:1,origin:0,originPoint:0}),za=()=>({x:S0(),y:S0()}),T0=()=>({min:0,max:0}),Et=()=>({x:T0(),y:T0()}),RE=new WeakMap;function zc(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function lo(n){return typeof n=="string"||Array.isArray(n)}const Kf=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Yf=["initial",...Kf];function Pc(n){return zc(n.animate)||Yf.some(e=>lo(n[e]))}function Sx(n){return!!(Pc(n)||n.variants)}function kE(n,e,i){for(const a in e){const l=e[a],c=i[a];if(Lt(l))n.addValue(a,l);else if(Lt(c))n.addValue(a,Ia(l,{owner:n}));else if(c!==l)if(n.hasValue(a)){const u=n.getValue(a);u.liveStyle===!0?u.jump(l):u.hasAnimated||u.set(l)}else{const u=n.getStaticValue(a);n.addValue(a,Ia(u!==void 0?u:l,{owner:n}))}}for(const a in i)e[a]===void 0&&n.removeValue(a);return e}const ef={current:null},Tx={current:!1},CE=typeof window<"u";function OE(){if(Tx.current=!0,!!CE)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>ef.current=n.matches;n.addEventListener("change",e),e()}else ef.current=!1}const E0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let wc={};function Ex(n){wc=n}function DE(){return wc}class ME{scrapeMotionValuesFromProps(e,i,a){return{}}constructor({parent:e,props:i,presenceContext:a,reducedMotionConfig:l,skipAnimations:c,blockInitialAnimation:u,visualState:d},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=zf,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const _=$t.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Xe.render(this.render,!1,!0))};const{latestValues:p,renderState:y}=d;this.latestValues=p,this.baseTarget={...p},this.initialValues=i.initial?{...p}:{},this.renderState=y,this.parent=e,this.props=i,this.presenceContext=a,this.depth=e?e.depth+1:0,this.reducedMotionConfig=l,this.skipAnimationsConfig=c,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=Pc(i),this.isVariantNode=Sx(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:v,...x}=this.scrapeMotionValuesFromProps(i,{},this);for(const _ in x){const S=x[_];p[_]!==void 0&&Lt(S)&&S.set(p[_])}}mount(e){var i,a;if(this.hasBeenMounted)for(const l in this.initialValues)(i=this.values.get(l))==null||i.jump(this.initialValues[l]),this.latestValues[l]=this.initialValues[l];this.current=e,RE.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((l,c)=>this.bindToMotionValue(c,l)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Tx.current||OE(),this.shouldReduceMotion=ef.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(a=this.parent)==null||a.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),oi(this.notifyUpdate),oi(this.render),this.valueSubscriptions.forEach(i=>i()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const i in this.events)this.events[i].clear();for(const i in this.features){const a=this.features[i];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,i){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),i.accelerate&&rx.has(e)&&this.current instanceof HTMLElement){const{factory:u,keyframes:d,times:m,ease:p,duration:y}=i.accelerate,v=new ix({element:this.current,name:e,keyframes:d,times:m,ease:p,duration:ln(y)}),x=u(v);this.valueSubscriptions.set(e,()=>{x(),v.cancel()});return}const a=Xa.has(e);a&&this.onBindTransform&&this.onBindTransform();const l=i.on("change",u=>{this.latestValues[e]=u,this.props.onUpdate&&Xe.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let c;typeof window<"u"&&window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,e,i)),this.valueSubscriptions.set(e,()=>{l(),c&&c()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in wc){const i=wc[e];if(!i)continue;const{isEnabled:a,Feature:l}=i;if(!this.features[e]&&l&&a(this.props)&&(this.features[e]=new l(this)),this.features[e]){const c=this.features[e];c.isMounted?c.update():(c.mount(),c.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Et()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,i){this.latestValues[e]=i}update(e,i){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let a=0;a<E0.length;a++){const l=E0[a];this.propEventSubscriptions[l]&&(this.propEventSubscriptions[l](),delete this.propEventSubscriptions[l]);const c="on"+l,u=e[c];u&&(this.propEventSubscriptions[l]=this.on(l,u))}this.prevMotionValues=kE(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(e),()=>i.variantChildren.delete(e)}addValue(e,i){const a=this.values.get(e);i!==a&&(a&&this.removeValue(e),this.bindToMotionValue(e,i),this.values.set(e,i),this.latestValues[e]=i.get())}removeValue(e){this.values.delete(e);const i=this.valueSubscriptions.get(e);i&&(i(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,i){if(this.props.values&&this.props.values[e])return this.props.values[e];let a=this.values.get(e);return a===void 0&&i!==void 0&&(a=Ia(i===null?void 0:i,{owner:this}),this.addValue(e,a)),a}readValue(e,i){let a=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return a!=null&&(typeof a=="string"&&(Tv(a)||Av(a))?a=parseFloat(a):!NE(a)&&Hn.test(i)&&(a=yx(e,i)),this.setBaseTarget(e,Lt(a)?a.get():a)),Lt(a)?a.get():a}setBaseTarget(e,i){this.baseTarget[e]=i}getBaseTarget(e){var c;const{initial:i}=this.props;let a;if(typeof i=="string"||typeof i=="object"){const u=Hf(this.props,i,(c=this.presenceContext)==null?void 0:c.custom);u&&(a=u[e])}if(i&&a!==void 0)return a;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!Lt(l)?l:this.initialValues[e]!==void 0&&a===void 0?void 0:this.baseTarget[e]}on(e,i){return this.events[e]||(this.events[e]=new Rf),this.events[e].add(i)}notify(e,...i){this.events[e]&&this.events[e].notify(...i)}scheduleRenderMicrotask(){Ff.render(this.render)}}class Ax extends ME{constructor(){super(...arguments),this.KeyframeResolver=lE}sortInstanceNodePosition(e,i){return e.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(e,i){const a=e.style;return a?a[i]:void 0}removeValueFromRenderState(e,{vars:i,style:a}){delete i[e],delete a[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Lt(e)&&(this.childSubscription=e.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}class li{constructor(e){this.isMounted=!1,this.node=e}update(){}}function jx({top:n,left:e,right:i,bottom:a}){return{x:{min:e,max:i},y:{min:n,max:a}}}function BE({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function UE(n,e){if(!e)return n;const i=e({x:n.left,y:n.top}),a=e({x:n.right,y:n.bottom});return{top:i.y,left:i.x,bottom:a.y,right:a.x}}function md(n){return n===void 0||n===1}function tf({scale:n,scaleX:e,scaleY:i}){return!md(n)||!md(e)||!md(i)}function Mi(n){return tf(n)||Nx(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function Nx(n){return A0(n.x)||A0(n.y)}function A0(n){return n&&n!=="0%"}function _c(n,e,i){const a=n-i,l=e*a;return i+l}function j0(n,e,i,a,l){return l!==void 0&&(n=_c(n,l,a)),_c(n,i,a)+e}function nf(n,e=0,i=1,a,l){n.min=j0(n.min,e,i,a,l),n.max=j0(n.max,e,i,a,l)}function Rx(n,{x:e,y:i}){nf(n.x,e.translate,e.scale,e.originPoint),nf(n.y,i.translate,i.scale,i.originPoint)}const N0=.999999999999,R0=1.0000000000001;function LE(n,e,i,a=!1){var d;const l=i.length;if(!l)return;e.x=e.y=1;let c,u;for(let m=0;m<l;m++){c=i[m],u=c.projectionDelta;const{visualElement:p}=c.options;p&&p.props.style&&p.props.style.display==="contents"||(a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&(Zn(n.x,-c.scroll.offset.x),Zn(n.y,-c.scroll.offset.y)),u&&(e.x*=u.x.scale,e.y*=u.y.scale,Rx(n,u)),a&&Mi(c.latestValues)&&hc(n,c.latestValues,(d=c.layout)==null?void 0:d.layoutBox))}e.x<R0&&e.x>N0&&(e.x=1),e.y<R0&&e.y>N0&&(e.y=1)}function Zn(n,e){n.min+=e,n.max+=e}function k0(n,e,i,a,l=.5){const c=Ye(n.min,n.max,l);nf(n,e,i,c,a)}function C0(n,e){return typeof n=="string"?parseFloat(n)/100*(e.max-e.min):n}function hc(n,e,i){const a=i??n;k0(n.x,C0(e.x,a.x),e.scaleX,e.scale,e.originX),k0(n.y,C0(e.y,a.y),e.scaleY,e.scale,e.originY)}function kx(n,e){return jx(UE(n.getBoundingClientRect(),e))}function zE(n,e,i){const a=kx(n,i),{scroll:l}=e;return l&&(Zn(a.x,l.offset.x),Zn(a.y,l.offset.y)),a}const PE={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},VE=Ya.length;function HE(n,e,i){let a="",l=!0;for(let u=0;u<VE;u++){const d=Ya[u],m=n[d];if(m===void 0)continue;let p=!0;if(typeof m=="number")p=m===(d.startsWith("scale")?1:0);else{const y=parseFloat(m);p=d.startsWith("scale")?y===1:y===0}if(!p||i){const y=Wd(m,xc[d]);if(!p){l=!1;const v=PE[d]||d;a+=`${v}(${y}) `}i&&(e[d]=y)}}const c=n.pathRotation;return c&&(l=!1,a+=`rotate(${Wd(c,xc.pathRotation)}) `),a=a.trim(),i?a=i(e,l?"":a):l&&(a="none"),a}function Xf(n,e,i){const{style:a,vars:l,transformOrigin:c}=n;let u=!1,d=!1;for(const m in e){const p=e[m];if(Xa.has(m)){u=!0;continue}else if(Hv(m)){l[m]=p;continue}else{const y=Wd(p,xc[m]);m.startsWith("origin")?(d=!0,c[m]=y):a[m]=y}}if(e.transform||(u||i?a.transform=HE(e,n.transform,i):a.transform&&(a.transform="none")),d){const{originX:m="50%",originY:p="50%",originZ:y=0}=c;a.transformOrigin=`${m} ${p} ${y}`}}function Cx(n,{style:e,vars:i},a,l){const c=n.style;let u;for(u in e)c[u]=e[u];l==null||l.applyProjectionStyles(c,a);for(u in i)c.setProperty(u,i[u])}function O0(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Fr={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(re.test(n))n=parseFloat(n);else return n;const i=O0(n,e.target.x),a=O0(n,e.target.y);return`${i}% ${a}%`}},$E={correct:(n,{treeScale:e,projectionDelta:i})=>{const a=n,l=Hn.parse(n);if(l.length>5)return a;const c=Hn.createTransformer(n),u=typeof l[0]!="number"?1:0,d=i.x.scale*e.x,m=i.y.scale*e.y;l[0+u]/=d,l[1+u]/=m;const p=Ye(d,m,.5);return typeof l[2+u]=="number"&&(l[2+u]/=p),typeof l[3+u]=="number"&&(l[3+u]/=p),c(l)}},sf={borderRadius:{...Fr,applyTo:[...qf]},borderTopLeftRadius:Fr,borderTopRightRadius:Fr,borderBottomLeftRadius:Fr,borderBottomRightRadius:Fr,boxShadow:$E};function Ox(n,{layout:e,layoutId:i}){return Xa.has(n)||n.startsWith("origin")||(e||i!==void 0)&&(!!sf[n]||n==="opacity")}function Jf(n,e,i){var u;const a=n.style,l=e==null?void 0:e.style,c={};if(!a)return c;for(const d in a)(Lt(a[d])||l&&Lt(l[d])||Ox(d,n)||((u=i==null?void 0:i.getValue(d))==null?void 0:u.liveStyle)!==void 0)&&(c[d]=a[d]);return c}function qE(n){return window.getComputedStyle(n)}class FE extends Ax{constructor(){super(...arguments),this.type="html",this.renderInstance=Cx}readValueFromInstance(e,i){var a;if(Xa.has(i))return(a=this.projection)!=null&&a.isProjecting?$d(i):uT(e,i);{const l=qE(e),c=(Hv(i)?l.getPropertyValue(i):l[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(e,{transformPagePoint:i}){return kx(e,i)}build(e,i,a){Xf(e,i,a.transformTemplate)}scrapeMotionValuesFromProps(e,i,a){return Jf(e,i,a)}}const IE={offset:"stroke-dashoffset",array:"stroke-dasharray"},GE={offset:"strokeDashoffset",array:"strokeDasharray"};function KE(n,e,i=1,a=0,l=!0){n.pathLength=1;const c=l?IE:GE;n[c.offset]=`${-a}`,n[c.array]=`${e} ${i}`}const YE=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Dx(n,{attrX:e,attrY:i,attrScale:a,pathLength:l,pathSpacing:c=1,pathOffset:u=0,...d},m,p,y){if(Xf(n,d,p),m){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:v,style:x}=n;v.transform&&(x.transform=v.transform,delete v.transform),(x.transform||v.transformOrigin)&&(x.transformOrigin=v.transformOrigin??"50% 50%",delete v.transformOrigin),x.transform&&(x.transformBox=(y==null?void 0:y.transformBox)??"fill-box",delete v.transformBox);for(const _ of YE)v[_]!==void 0&&(x[_]=v[_],delete v[_]);e!==void 0&&(v.x=e),i!==void 0&&(v.y=i),a!==void 0&&(v.scale=a),l!==void 0&&KE(v,l,c,u,!1)}const Mx=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Bx=n=>typeof n=="string"&&n.toLowerCase()==="svg";function XE(n,e,i,a){Cx(n,e,void 0,a);for(const l in e.attrs)n.setAttribute(Mx.has(l)?l:$f(l),e.attrs[l])}function Ux(n,e,i){const a=Jf(n,e,i);for(const l in n)if(Lt(n[l])||Lt(e[l])){const c=Ya.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;a[c]=n[l]}return a}class JE extends Ax{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Et}getBaseTargetFromProps(e,i){return e[i]}readValueFromInstance(e,i){if(Xa.has(i)){const a=gx(i);return a&&a.default||0}return i=Mx.has(i)?i:$f(i),e.getAttribute(i)}scrapeMotionValuesFromProps(e,i,a){return Ux(e,i,a)}build(e,i,a){Dx(e,i,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(e,i,a,l){XE(e,i,a,l)}mount(e){this.isSVGTag=Bx(e.tagName),super.mount(e)}}const QE=Yf.length;function Lx(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?Lx(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const e={};for(let i=0;i<QE;i++){const a=Yf[i],l=n.props[a];(lo(l)||l===!1)&&(e[a]=l)}return e}function zx(n,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==n.length)return!1;for(let a=0;a<i;a++)if(e[a]!==n[a])return!1;return!0}const ZE=[...Kf].reverse(),WE=Kf.length;function eA(n){return e=>Promise.all(e.map(({animation:i,options:a})=>QT(n,i,a)))}function tA(n){let e=eA(n),i=D0(),a=!0,l=!1;const c=p=>(y,v)=>{var _;const x=Hi(n,v,p==="exit"?(_=n.presenceContext)==null?void 0:_.custom:void 0);if(x){const{transition:S,transitionEnd:T,...j}=x;y={...y,...j,...T}}return y};function u(p){e=p(n)}function d(p){const{props:y}=n,v=Lx(n.parent)||{},x=[],_=new Set;let S={},T=1/0;for(let k=0;k<WE;k++){const M=ZE[k],C=i[M],P=y[M]!==void 0?y[M]:v[M],K=lo(P),G=M===p?C.isActive:null;G===!1&&(T=k);let H=P===v[M]&&P!==y[M]&&K;if(H&&(a||l)&&n.manuallyAnimateOnMount&&(H=!1),C.protectedKeys={...S},!C.isActive&&G===null||!P&&!C.prevProp||zc(P)||typeof P=="boolean")continue;if(M==="exit"&&C.isActive&&G!==!0){C.prevResolvedValues&&(S={...S,...C.prevResolvedValues});continue}const Y=nA(C.prevProp,P);let Z=Y||M===p&&C.isActive&&!H&&K||k>T&&K,se=!1;const me=Array.isArray(P)?P:[P];let ye=me.reduce(c(M),{});G===!1&&(ye={});const{prevResolvedValues:Ae={}}=C,Ne={...Ae,...ye},Be=Q=>{Z=!0,_.has(Q)&&(se=!0,_.delete(Q)),C.needsAnimating[Q]=!0;const le=n.getValue(Q);le&&(le.liveStyle=!1)};for(const Q in Ne){const le=ye[Q],ue=Ae[Q];if(S.hasOwnProperty(Q))continue;let A=!1;Yd(le)&&Yd(ue)?A=!zx(le,ue)||Y:A=le!==ue,A?le!=null?Be(Q):_.add(Q):le!==void 0&&_.has(Q)?Be(Q):C.protectedKeys[Q]=!0}C.prevProp=P,C.prevResolvedValues=ye,C.isActive&&(S={...S,...ye}),(a||l)&&n.blockInitialAnimation&&(Z=!1);const L=H&&Y;Z&&(!L||se)&&x.push(...me.map(Q=>{const le={type:M};if(typeof Q=="string"&&(a||l)&&!L&&n.manuallyAnimateOnMount&&n.parent){const{parent:ue}=n,A=Hi(ue,Q);if(ue.enteringChildren&&A){const{delayChildren:q}=A.transition||{};le.delay=ox(ue.enteringChildren,n,q)}}return{animation:Q,options:le}}))}if(_.size){const k={};if(typeof y.initial!="boolean"){const M=Hi(n,Array.isArray(y.initial)?y.initial[0]:y.initial);M&&M.transition&&(k.transition=M.transition)}_.forEach(M=>{const C=n.getBaseTarget(M),P=n.getValue(M);P&&(P.liveStyle=!0),k[M]=C??null}),x.push({animation:k})}let j=!!x.length;return a&&(y.initial===!1||y.initial===y.animate)&&!n.manuallyAnimateOnMount&&(j=!1),a=!1,l=!1,j?e(x):Promise.resolve()}function m(p,y){var x;if(i[p].isActive===y)return Promise.resolve();(x=n.variantChildren)==null||x.forEach(_=>{var S;return(S=_.animationState)==null?void 0:S.setActive(p,y)}),i[p].isActive=y;const v=d(p);for(const _ in i)i[_].protectedKeys={};return v}return{animateChanges:d,setActive:m,setAnimateFunction:u,getState:()=>i,reset:()=>{i=D0(),l=!0}}}function nA(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!zx(e,n):!1}function Ci(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function D0(){return{animate:Ci(!0),whileInView:Ci(),whileHover:Ci(),whileTap:Ci(),whileDrag:Ci(),whileFocus:Ci(),exit:Ci()}}function af(n,e){n.min=e.min,n.max=e.max}function Mn(n,e){af(n.x,e.x),af(n.y,e.y)}function M0(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}const Px=1e-4,sA=1-Px,iA=1+Px,Vx=.01,aA=0-Vx,rA=0+Vx;function qt(n){return n.max-n.min}function oA(n,e,i){return Math.abs(n-e)<=i}function B0(n,e,i,a=.5){n.origin=a,n.originPoint=Ye(e.min,e.max,n.origin),n.scale=qt(i)/qt(e),n.translate=Ye(i.min,i.max,n.origin)-n.originPoint,(n.scale>=sA&&n.scale<=iA||isNaN(n.scale))&&(n.scale=1),(n.translate>=aA&&n.translate<=rA||isNaN(n.translate))&&(n.translate=0)}function to(n,e,i,a){B0(n.x,e.x,i.x,a?a.originX:void 0),B0(n.y,e.y,i.y,a?a.originY:void 0)}function U0(n,e,i,a=0){const l=a?Ye(i.min,i.max,a):i.min;n.min=l+e.min,n.max=n.min+qt(e)}function lA(n,e,i,a){U0(n.x,e.x,i.x,a==null?void 0:a.x),U0(n.y,e.y,i.y,a==null?void 0:a.y)}function L0(n,e,i,a=0){const l=a?Ye(i.min,i.max,a):i.min;n.min=e.min-l,n.max=n.min+qt(e)}function Sc(n,e,i,a){L0(n.x,e.x,i.x,a==null?void 0:a.x),L0(n.y,e.y,i.y,a==null?void 0:a.y)}function z0(n,e,i,a,l){return n-=e,n=_c(n,1/i,a),l!==void 0&&(n=_c(n,1/l,a)),n}function cA(n,e=0,i=1,a=.5,l,c=n,u=n){if(ts.test(e)&&(e=parseFloat(e),e=Ye(u.min,u.max,e/100)-u.min),typeof e!="number")return;let d=Ye(c.min,c.max,a);n===c&&(d-=e),n.min=z0(n.min,e,i,d,l),n.max=z0(n.max,e,i,d,l)}function P0(n,e,[i,a,l],c,u){cA(n,e[i],e[a],e[l],e.scale,c,u)}const uA=["x","scaleX","originX"],hA=["y","scaleY","originY"];function V0(n,e,i,a){P0(n.x,e,uA,i?i.x:void 0,a?a.x:void 0),P0(n.y,e,hA,i?i.y:void 0,a?a.y:void 0)}function H0(n){return n.translate===0&&n.scale===1}function Hx(n){return H0(n.x)&&H0(n.y)}function $0(n,e){return n.min===e.min&&n.max===e.max}function dA(n,e){return $0(n.x,e.x)&&$0(n.y,e.y)}function q0(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function $x(n,e){return q0(n.x,e.x)&&q0(n.y,e.y)}function F0(n){return qt(n.x)/qt(n.y)}function I0(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}function Jn(n){return[n("x"),n("y")]}function fA(n,e,i){let a="";const l=n.x.translate/e.x,c=n.y.translate/e.y,u=(i==null?void 0:i.z)||0;if((l||c||u)&&(a=`translate3d(${l}px, ${c}px, ${u}px) `),(e.x!==1||e.y!==1)&&(a+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:p,rotate:y,pathRotation:v,rotateX:x,rotateY:_,skewX:S,skewY:T}=i;p&&(a=`perspective(${p}px) ${a}`),y&&(a+=`rotate(${y}deg) `),v&&(a+=`rotate(${v}deg) `),x&&(a+=`rotateX(${x}deg) `),_&&(a+=`rotateY(${_}deg) `),S&&(a+=`skewX(${S}deg) `),T&&(a+=`skewY(${T}deg) `)}const d=n.x.scale*e.x,m=n.y.scale*e.y;return(d!==1||m!==1)&&(a+=`scale(${d}, ${m})`),a||"none"}const mA=qf.length,G0=n=>typeof n=="string"?parseFloat(n):n,K0=n=>typeof n=="number"||re.test(n);function pA(n,e,i,a,l,c){l?(n.opacity=Ye(0,i.opacity??1,gA(a)),n.opacityExit=Ye(e.opacity??1,0,yA(a))):c&&(n.opacity=Ye(e.opacity??1,i.opacity??1,a));for(let u=0;u<mA;u++){const d=qf[u];let m=Y0(e,d),p=Y0(i,d);if(m===void 0&&p===void 0)continue;m||(m=0),p||(p=0),m===0||p===0||K0(m)===K0(p)?(n[d]=Math.max(Ye(G0(m),G0(p),a),0),(ts.test(p)||ts.test(m))&&(n[d]+="%")):n[d]=p}(e.rotate||i.rotate)&&(n.rotate=Ye(e.rotate||0,i.rotate||0,a))}function Y0(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const gA=qx(0,.5,Bv),yA=qx(.5,.95,An);function qx(n,e,i){return a=>a<n?0:a>e?1:i(ro(n,e,a))}function bA(n,e,i){const a=Lt(n)?n:Ia(n);return a.start(Vf("",a,e,i)),a.animation}function co(n,e,i,a={passive:!0}){return n.addEventListener(e,i,a),()=>n.removeEventListener(e,i,a)}const vA=(n,e)=>n.depth-e.depth;class xA{constructor(){this.children=[],this.isDirty=!1}add(e){jf(this.children,e),this.isDirty=!0}remove(e){pc(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(vA),this.isDirty=!1,this.children.forEach(e)}}function wA(n,e){const i=$t.now(),a=({timestamp:l})=>{const c=l-i;c>=e&&(oi(a),n(c-e))};return Xe.setup(a,!0),()=>oi(a)}function dc(n){return Lt(n)?n.get():n}class _A{constructor(){this.members=[]}add(e){jf(this.members,e);for(let i=this.members.length-1;i>=0;i--){const a=this.members[i];if(a===e||a===this.lead||a===this.prevLead)continue;const l=a.instance;(!l||l.isConnected===!1)&&!a.snapshot&&(pc(this.members,a),a.unmount())}e.scheduleRender()}remove(e){if(pc(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(e){var i;for(let a=this.members.indexOf(e)-1;a>=0;a--){const l=this.members[a];if(l.isPresent!==!1&&((i=l.instance)==null?void 0:i.isConnected)!==!1)return this.promote(l),!0}return!1}promote(e,i){var l;const a=this.lead;if(e!==a&&(this.prevLead=a,this.lead=e,e.show(),a)){a.updateSnapshot(),e.scheduleRender();const{layoutDependency:c}=a.options,{layoutDependency:u}=e.options;(c===void 0||c!==u)&&(e.resumeFrom=a,i&&(a.preserveOpacity=!0),a.snapshot&&(e.snapshot=a.snapshot,e.snapshot.latestValues=a.animationValues||a.latestValues),(l=e.root)!=null&&l.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var i,a,l,c,u;(a=(i=e.options).onExitComplete)==null||a.call(i),(u=(l=e.resumingFrom)==null?void 0:(c=l.options).onExitComplete)==null||u.call(c)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const fc={hasAnimatedSinceResize:!0,hasEverUpdated:!1},pd=["","X","Y","Z"],SA=1e3;let TA=0;function gd(n,e,i,a){const{latestValues:l}=e;l[n]&&(i[n]=l[n],e.setStaticValue(n,0),a&&(a[n]=0))}function Fx(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const i=dx(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:l,layoutId:c}=n.options;window.MotionCancelOptimisedAnimation(i,"transform",Xe,!(l||c))}const{parent:a}=n;a&&!a.hasCheckedOptimisedAppear&&Fx(a)}function Ix({attachResizeListener:n,defaultParent:e,measureScroll:i,checkIsScrollRoot:a,resetTransform:l}){return class{constructor(u={},d=e==null?void 0:e()){this.id=TA++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(jA),this.nodes.forEach(DA),this.nodes.forEach(MA),this.nodes.forEach(NA)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new xA)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Rf),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const m=this.eventHandlers.get(u);m&&m.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=Gf(u)&&!AE(u),this.instance=u;const{layoutId:d,layout:m,visualElement:p}=this.options;if(p&&!p.current&&p.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||d)&&(this.isLayoutDirty=!0),n){let y,v=0;const x=()=>this.root.updateBlockedByResize=!1;Xe.read(()=>{v=window.innerWidth}),n(u,()=>{const _=window.innerWidth;_!==v&&(v=_,this.root.updateBlockedByResize=!0,y&&y(),y=wA(x,250),fc.hasAnimatedSinceResize&&(fc.hasAnimatedSinceResize=!1,this.nodes.forEach(Q0)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||m)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:v,hasRelativeLayoutChanged:x,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||p.getDefaultTransition()||PA,{onLayoutAnimationStart:T,onLayoutAnimationComplete:j}=p.getProps(),k=!this.targetLayout||!$x(this.targetLayout,_),M=!v&&x;if(this.options.layoutRoot||this.resumeFrom||M||v&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...Pf(S,"layout"),onPlay:T,onComplete:j};(p.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(y,M,C.path)}else v||Q0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),oi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(BA),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Fx(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const v=this.path[y];v.shouldResetTransform=!0,(typeof v.latestValues.x=="string"||typeof v.latestValues.y=="string")&&(v.isLayoutDirty=!0),v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:d,layout:m}=this.options;if(d===void 0&&!m)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(kA),this.nodes.forEach(X0);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(J0);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(CA),this.nodes.forEach(OA),this.nodes.forEach(EA),this.nodes.forEach(AA)):this.nodes.forEach(J0),this.clearAllSnapshots();const d=$t.now();Ut.delta=ns(0,1e3/60,d-Ut.timestamp),Ut.timestamp=d,Ut.isProcessing=!0,od.update.process(Ut),od.preRender.process(Ut),od.render.process(Ut),Ut.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ff.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(RA),this.sharedNodes.forEach(UA)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Xe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Xe.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!qt(this.snapshot.measuredBox.x)&&!qt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Et()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d&&this.instance){const m=a(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!l)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!Hx(this.projectionDelta),m=this.getTransformTemplate(),p=m?m(this.latestValues,""):void 0,y=p!==this.prevTransformTemplateValue;u&&this.instance&&(d||Mi(this.latestValues)||y)&&(l(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let m=this.removeElementScroll(d);return u&&(m=this.removeTransform(m)),VA(m),{animationId:this.root.animationId,measuredBox:d,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var p;const{visualElement:u}=this.options;if(!u)return Et();const d=u.measureViewportBox();if(!(((p=this.scroll)==null?void 0:p.wasRoot)||this.path.some(HA))){const{scroll:y}=this.root;y&&(Zn(d.x,y.offset.x),Zn(d.y,y.offset.y))}return d}removeElementScroll(u){var m;const d=Et();if(Mn(d,u),(m=this.scroll)!=null&&m.wasRoot)return d;for(let p=0;p<this.path.length;p++){const y=this.path[p],{scroll:v,options:x}=y;y!==this.root&&v&&x.layoutScroll&&(v.wasRoot&&Mn(d,u),Zn(d.x,v.offset.x),Zn(d.y,v.offset.y))}return d}applyTransform(u,d=!1,m){var y,v;const p=m||Et();Mn(p,u);for(let x=0;x<this.path.length;x++){const _=this.path[x];!d&&_.options.layoutScroll&&_.scroll&&_!==_.root&&(Zn(p.x,-_.scroll.offset.x),Zn(p.y,-_.scroll.offset.y)),Mi(_.latestValues)&&hc(p,_.latestValues,(y=_.layout)==null?void 0:y.layoutBox)}return Mi(this.latestValues)&&hc(p,this.latestValues,(v=this.layout)==null?void 0:v.layoutBox),p}removeTransform(u){var m;const d=Et();Mn(d,u);for(let p=0;p<this.path.length;p++){const y=this.path[p];if(!Mi(y.latestValues))continue;let v;y.instance&&(tf(y.latestValues)&&y.updateSnapshot(),v=Et(),Mn(v,y.measurePageBox())),V0(d,y.latestValues,(m=y.snapshot)==null?void 0:m.layoutBox,v)}return Mi(this.latestValues)&&V0(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ut.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var _;const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==d;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||(_=this.parent)!=null&&_.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:v}=this.options;if(!this.layout||!(y||v))return;this.resolvedRelativeTargetAt=Ut.timestamp;const x=this.getClosestProjectingParent();x&&this.linkedParentVersion!==x.layoutVersion&&!x.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&x&&x.layout?this.createRelativeTarget(x,this.layout.layoutBox,x.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Et(),this.targetWithTransforms=Et()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),lA(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Mn(this.target,this.layout.layoutBox),Rx(this.target,this.targetDelta)):Mn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?this.createRelativeTarget(x,this.target,x.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||tf(this.parent.latestValues)||Nx(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,d,m){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Et(),this.relativeTargetOrigin=Et(),Sc(this.relativeTargetOrigin,d,m,this.options.layoutAnchor||void 0),Mn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var S;const u=this.getLead(),d=!!this.resumingFrom||this!==u;let m=!0;if((this.isProjectionDirty||(S=this.parent)!=null&&S.isProjectionDirty)&&(m=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===Ut.timestamp&&(m=!1),m)return;const{layout:p,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||y))return;Mn(this.layoutCorrected,this.layout.layoutBox);const v=this.treeScale.x,x=this.treeScale.y;LE(this.layoutCorrected,this.treeScale,this.path,d),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=Et());const{target:_}=u;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(M0(this.prevProjectionDelta.x,this.projectionDelta.x),M0(this.prevProjectionDelta.y,this.projectionDelta.y)),to(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==v||this.treeScale.y!==x||!I0(this.projectionDelta.x,this.prevProjectionDelta.x)||!I0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var d;if((d=this.options.visualElement)==null||d.scheduleRender(),u){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=za(),this.projectionDelta=za(),this.projectionDeltaWithTransform=za()}setAnimationOrigin(u,d=!1,m){const p=this.snapshot,y=p?p.latestValues:{},v={...this.latestValues},x=za();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const _=Et(),S=p?p.source:void 0,T=this.layout?this.layout.source:void 0,j=S!==T,k=this.getStack(),M=!k||k.members.length<=1,C=!!(j&&!M&&this.options.crossfade===!0&&!this.path.some(zA));this.animationProgress=0;let P;const K=m==null?void 0:m.interpolateProjection(u);this.mixTargetDelta=G=>{const H=G/1e3,Y=K==null?void 0:K(H);Y?(x.x.translate=Y.x,x.x.scale=Ye(u.x.scale,1,H),x.x.origin=u.x.origin,x.x.originPoint=u.x.originPoint,x.y.translate=Y.y,x.y.scale=Ye(u.y.scale,1,H),x.y.origin=u.y.origin,x.y.originPoint=u.y.originPoint):(Z0(x.x,u.x,H),Z0(x.y,u.y,H)),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Sc(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),LA(this.relativeTarget,this.relativeTargetOrigin,_,H),P&&dA(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=Et()),Mn(P,this.relativeTarget)),j&&(this.animationValues=v,pA(v,y,this.latestValues,H,C,M)),Y&&Y.rotate!==void 0&&(this.animationValues||(this.animationValues=v),this.animationValues.pathRotation=Y.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=H},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){var d,m,p;this.notifyListeners("animationStart"),(d=this.currentAnimation)==null||d.stop(),(p=(m=this.resumingFrom)==null?void 0:m.currentAnimation)==null||p.stop(),this.pendingAnimation&&(oi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Xe.update(()=>{fc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Ia(0)),this.motionValue.jump(0,!1),this.currentAnimation=bA(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:y=>{this.mixTargetDelta(y),u.onUpdate&&u.onUpdate(y)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(SA),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:m,layout:p,latestValues:y}=u;if(!(!d||!m||!p)){if(this!==u&&this.layout&&p&&Gx(this.options.animationType,this.layout.layoutBox,p.layoutBox)){m=this.target||Et();const v=qt(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+v;const x=qt(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+x}Mn(d,m),hc(d,y),to(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new _A),this.sharedNodes.get(u).add(d);const p=d.options.initialPromotionConfig;d.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var d;const{layoutId:u}=this.options;return u?((d=this.getStack())==null?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:u}=this.options;return u?(d=this.getStack())==null?void 0:d.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:m}={}){const p=this.getStack();p&&p.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(d=!0),!d)return;const p={};m.z&&gd("z",u,p,this.animationValues);for(let y=0;y<pd.length;y++)gd(`rotate${pd[y]}`,u,p,this.animationValues),gd(`skew${pd[y]}`,u,p,this.animationValues);u.render();for(const y in p)u.setStaticValue(y,p[y]),this.animationValues&&(this.animationValues[y]=p[y]);u.scheduleRender()}applyProjectionStyles(u,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=dc(d==null?void 0:d.pointerEvents)||"",u.transform=m?m(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=dc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!Mi(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const y=p.animationValues||p.latestValues;this.applyTransformsToTarget();let v=fA(this.projectionDeltaWithTransform,this.treeScale,y);m&&(v=m(y,v)),u.transform=v;const{x,y:_}=this.projectionDelta;u.transformOrigin=`${x.origin*100}% ${_.origin*100}% 0`,p.animationValues?u.opacity=p===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:u.opacity=p===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const S in sf){if(y[S]===void 0)continue;const{correct:T,applyTo:j,isCSSVariable:k}=sf[S],M=v==="none"?y[S]:T(y[S],p);if(j){const C=j.length;for(let P=0;P<C;P++)u[j[P]]=M}else k?this.options.visualElement.renderState.vars[S]=M:u[S]=M}this.options.layoutId&&(u.pointerEvents=p===this?dc(d==null?void 0:d.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var d;return(d=u.currentAnimation)==null?void 0:d.stop()}),this.root.nodes.forEach(X0),this.root.sharedNodes.clear()}}}function EA(n){n.updateLayout()}function AA(n){var i;const e=((i=n.resumeFrom)==null?void 0:i.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&e&&n.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:l}=n.layout,{animationType:c}=n.options,u=e.source!==n.layout.source;if(c==="size")Jn(v=>{const x=u?e.measuredBox[v]:e.layoutBox[v],_=qt(x);x.min=a[v].min,x.max=x.min+_});else if(c==="x"||c==="y"){const v=c==="x"?"y":"x";af(u?e.measuredBox[v]:e.layoutBox[v],a[v])}else Gx(c,e.layoutBox,a)&&Jn(v=>{const x=u?e.measuredBox[v]:e.layoutBox[v],_=qt(a[v]);x.max=x.min+_,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[v].max=n.relativeTarget[v].min+_)});const d=za();to(d,a,e.layoutBox);const m=za();u?to(m,n.applyTransform(l,!0),e.measuredBox):to(m,a,e.layoutBox);const p=!Hx(d);let y=!1;if(!n.resumeFrom){const v=n.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:x,layout:_}=v;if(x&&_){const S=n.options.layoutAnchor||void 0,T=Et();Sc(T,e.layoutBox,x.layoutBox,S);const j=Et();Sc(j,a,_.layoutBox,S),$x(T,j)||(y=!0),v.options.layoutRoot&&(n.relativeTarget=j,n.relativeTargetOrigin=T,n.relativeParent=v)}}}n.notifyListeners("didUpdate",{layout:a,snapshot:e,delta:m,layoutDelta:d,hasLayoutChanged:p,hasRelativeLayoutChanged:y})}else if(n.isLead()){const{onExitComplete:a}=n.options;a&&a()}n.options.transition=void 0}function jA(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function NA(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function RA(n){n.clearSnapshot()}function X0(n){n.clearMeasurements()}function kA(n){n.isLayoutDirty=!0,n.updateLayout()}function J0(n){n.isLayoutDirty=!1}function CA(n){n.isAnimationBlocked&&n.layout&&!n.isLayoutDirty&&(n.snapshot=n.layout,n.isLayoutDirty=!0)}function OA(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function Q0(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function DA(n){n.resolveTargetDelta()}function MA(n){n.calcProjection()}function BA(n){n.resetSkewAndRotation()}function UA(n){n.removeLeadSnapshot()}function Z0(n,e,i){n.translate=Ye(e.translate,0,i),n.scale=Ye(e.scale,1,i),n.origin=e.origin,n.originPoint=e.originPoint}function W0(n,e,i,a){n.min=Ye(e.min,i.min,a),n.max=Ye(e.max,i.max,a)}function LA(n,e,i,a){W0(n.x,e.x,i.x,a),W0(n.y,e.y,i.y,a)}function zA(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const PA={duration:.45,ease:[.4,0,.1,1]},eb=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),tb=eb("applewebkit/")&&!eb("chrome/")?Math.round:An;function nb(n){n.min=tb(n.min),n.max=tb(n.max)}function VA(n){nb(n.x),nb(n.y)}function Gx(n,e,i){return n==="position"||n==="preserve-aspect"&&!oA(F0(e),F0(i),.2)}function HA(n){var e;return n!==n.root&&((e=n.scroll)==null?void 0:e.wasRoot)}const $A=Ix({attachResizeListener:(n,e)=>co(n,"resize",e),measureScroll:()=>{var n,e;return{x:document.documentElement.scrollLeft||((n=document.body)==null?void 0:n.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),yd={current:void 0},Kx=Ix({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!yd.current){const n=new $A({});n.mount(window),n.setOptions({layoutScroll:!0}),yd.current=n}return yd.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Qf=D.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function sb(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function qA(...n){return e=>{let i=!1;const a=n.map(l=>{const c=sb(l,e);return!i&&typeof c=="function"&&(i=!0),c});if(i)return()=>{for(let l=0;l<a.length;l++){const c=a[l];typeof c=="function"?c():sb(n[l],null)}}}}function FA(...n){return D.useCallback(qA(...n),n)}class IA extends D.Component{getSnapshotBeforeUpdate(e){const i=this.props.childRef.current;if(oc(i)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=i.offsetParent,l=oc(a)&&a.offsetWidth||0,c=oc(a)&&a.offsetHeight||0,u=getComputedStyle(i),d=this.props.sizeRef.current;d.height=parseFloat(u.height),d.width=parseFloat(u.width),d.top=i.offsetTop,d.left=i.offsetLeft,d.right=l-d.width-d.left,d.bottom=c-d.height-d.top,d.direction=u.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function GA({children:n,isPresent:e,anchorX:i,anchorY:a,root:l,pop:c}){var x;const u=D.useId(),d=D.useRef(null),m=D.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:p}=D.useContext(Qf),y=((x=n.props)==null?void 0:x.ref)??(n==null?void 0:n.ref),v=FA(d,y);return D.useInsertionEffect(()=>{const{width:_,height:S,top:T,left:j,right:k,bottom:M,direction:C}=m.current;if(e||c===!1||!d.current||!_||!S)return;const P=C==="rtl",K=i==="left"?P?`right: ${k}`:`left: ${j}`:P?`left: ${j}`:`right: ${k}`,G=a==="bottom"?`bottom: ${M}`:`top: ${T}`;d.current.dataset.motionPopId=u;const H=document.createElement("style");p&&(H.nonce=p);const Y=l??document.head;return Y.appendChild(H),H.sheet&&H.sheet.insertRule(`
[data-motion-pop-id="${u}"] {
position: absolute !important;
width: ${_}px !important;
height: ${S}px !important;
${K}px !important;
${G}px !important;
}
`),()=>{var Z;(Z=d.current)==null||Z.removeAttribute("data-motion-pop-id"),Y.contains(H)&&Y.removeChild(H)}},[e]),g.jsx(IA,{isPresent:e,childRef:d,sizeRef:m,pop:c,children:c===!1?n:D.cloneElement(n,{ref:v})})}const KA=({children:n,initial:e,isPresent:i,onExitComplete:a,custom:l,presenceAffectsLayout:c,mode:u,anchorX:d,anchorY:m,root:p})=>{const y=Ef(YA),v=D.useId(),x=D.useRef(i),_=D.useRef(a);Af(()=>{x.current=i,_.current=a});let S=!0,T=D.useMemo(()=>(S=!1,{id:v,initial:e,isPresent:i,custom:l,onExitComplete:j=>{y.set(j,!0);for(const k of y.values())if(!k)return;a&&a()},register:j=>(y.set(j,!1),()=>{var k;y.delete(j),!x.current&&!y.size&&((k=_.current)==null||k.call(_))})}),[i,y,a]);return c&&S&&(T={...T}),D.useMemo(()=>{y.forEach((j,k)=>y.set(k,!1))},[i]),D.useEffect(()=>{!i&&!y.size&&a&&a()},[i]),n=g.jsx(GA,{pop:u==="popLayout",isPresent:i,anchorX:d,anchorY:m,root:p,children:n}),g.jsx(Uc.Provider,{value:T,children:n})};function YA(){return new Map}function Yx(n=!0){const e=D.useContext(Uc);if(e===null)return[!0,null];const{isPresent:i,onExitComplete:a,register:l}=e,c=D.useId();D.useEffect(()=>{if(n)return l(c)},[n]);const u=D.useCallback(()=>n&&a&&a(c),[c,a,n]);return!i&&a?[!1,u]:[!0]}const Gl=n=>n.key||"";function ib(n){const e=[];return D.Children.forEach(n,i=>{D.isValidElement(i)&&e.push(i)}),e}const zi=({children:n,custom:e,initial:i=!0,onExitComplete:a,presenceAffectsLayout:l=!0,mode:c="sync",propagate:u=!1,anchorX:d="left",anchorY:m="top",root:p})=>{const[y,v]=Yx(u),x=D.useMemo(()=>ib(n),[n]),_=u&&!y?[]:x.map(Gl),S=D.useRef(!0),T=D.useRef(x),j=Ef(()=>new Map),k=D.useRef(new Set),[M,C]=D.useState(x),[P,K]=D.useState(x);Af(()=>{S.current=!1,T.current=x;for(let Y=0;Y<P.length;Y++){const Z=Gl(P[Y]);_.includes(Z)?(j.delete(Z),k.current.delete(Z)):j.get(Z)!==!0&&j.set(Z,!1)}},[P,_.length,_.join("-")]);const G=[];if(x!==M){let Y=[...x];for(let Z=0;Z<P.length;Z++){const se=P[Z],me=Gl(se);_.includes(me)||(Y.splice(Z,0,se),G.push(se))}return c==="wait"&&G.length&&(Y=G),K(ib(Y)),C(x),null}const{forceRender:H}=D.useContext(Tf);return g.jsx(g.Fragment,{children:P.map(Y=>{const Z=Gl(Y),se=u&&!y?!1:x===P||_.includes(Z),me=()=>{if(k.current.has(Z))return;if(j.has(Z))k.current.add(Z),j.set(Z,!0);else return;let ye=!0;j.forEach(Ae=>{Ae||(ye=!1)}),ye&&(H==null||H(),K(T.current),u&&(v==null||v()),a&&a())};return g.jsx(KA,{isPresent:se,initial:!S.current||i?void 0:!1,custom:e,presenceAffectsLayout:l,mode:c,root:p,onExitComplete:se?void 0:me,anchorX:d,anchorY:m,children:Y},Z)})})},Xx=D.createContext({strict:!1}),ab={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let rb=!1;function XA(){if(rb)return;const n={};for(const e in ab)n[e]={isEnabled:i=>ab[e].some(a=>!!i[a])};Ex(n),rb=!0}function Jx(){return XA(),DE()}function JA(n){const e=Jx();for(const i in n)e[i]={...e[i],...n[i]};Ex(e)}const QA=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Tc(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||QA.has(n)}let Qx=n=>!Tc(n);function ZA(n){typeof n=="function"&&(Qx=e=>e.startsWith("on")?!Tc(e):n(e))}try{ZA(require("@emotion/is-prop-valid").default)}catch{}function WA(n,e,i){const a={};for(const l in n)l==="values"&&typeof n.values=="object"||Lt(n[l])||(Qx(l)||i===!0&&Tc(l)||!e&&!Tc(l)||n.draggable&&l.startsWith("onDrag"))&&(a[l]=n[l]);return a}const Vc=D.createContext({});function ej(n,e){if(Pc(n)){const{initial:i,animate:a}=n;return{initial:i===!1||lo(i)?i:void 0,animate:lo(a)?a:void 0}}return n.inherit!==!1?e:{}}function tj(n){const{initial:e,animate:i}=ej(n,D.useContext(Vc));return D.useMemo(()=>({initial:e,animate:i}),[ob(e),ob(i)])}function ob(n){return Array.isArray(n)?n.join(" "):n}const Zf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Zx(n,e,i){for(const a in e)!Lt(e[a])&&!Ox(a,i)&&(n[a]=e[a])}function nj({transformTemplate:n},e){return D.useMemo(()=>{const i=Zf();return Xf(i,e,n),Object.assign({},i.vars,i.style)},[e])}function sj(n,e){const i=n.style||{},a={};return Zx(a,i,n),Object.assign(a,nj(n,e)),a}function ij(n,e){const i={},a=sj(n,e);return n.drag&&n.dragListener!==!1&&(i.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(i.tabIndex=0),i.style=a,i}const Wx=()=>({...Zf(),attrs:{}});function aj(n,e,i,a){const l=D.useMemo(()=>{const c=Wx();return Dx(c,e,Bx(a),n.transformTemplate,n.style),{...c.attrs,style:{...c.style}}},[e]);if(n.style){const c={};Zx(c,n.style,n),l.style={...c,...l.style}}return l}const rj=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Wf(n){return typeof n!="string"||n.includes("-")?!1:!!(rj.indexOf(n)>-1||/[A-Z]/u.test(n))}function oj(n,e,i,{latestValues:a},l,c=!1,u){const m=(u??Wf(n)?aj:ij)(e,a,l,n),p=WA(e,typeof n=="string",c),y=n!==D.Fragment?{...p,...m,ref:i}:{},{children:v}=e,x=D.useMemo(()=>Lt(v)?v.get():v,[v]);return D.createElement(n,{...y,children:x})}function lj({scrapeMotionValuesFromProps:n,createRenderState:e},i,a,l){return{latestValues:cj(i,a,l,n),renderState:e()}}function cj(n,e,i,a){const l={},c=a(n,{});for(const x in c)l[x]=dc(c[x]);let{initial:u,animate:d}=n;const m=Pc(n),p=Sx(n);e&&p&&!m&&n.inherit!==!1&&(u===void 0&&(u=e.initial),d===void 0&&(d=e.animate));let y=i?i.initial===!1:!1;y=y||u===!1;const v=y?d:u;if(v&&typeof v!="boolean"&&!zc(v)){const x=Array.isArray(v)?v:[v];for(let _=0;_<x.length;_++){const S=Hf(n,x[_]);if(S){const{transitionEnd:T,transition:j,...k}=S;for(const M in k){let C=k[M];if(Array.isArray(C)){const P=y?C.length-1:0;C=C[P]}C!==null&&(l[M]=C)}for(const M in T)l[M]=T[M]}}}return l}const ew=n=>(e,i)=>{const a=D.useContext(Vc),l=D.useContext(Uc),c=()=>lj(n,e,a,l);return i?c():Ef(c)},uj=ew({scrapeMotionValuesFromProps:Jf,createRenderState:Zf}),hj=ew({scrapeMotionValuesFromProps:Ux,createRenderState:Wx}),dj=Symbol.for("motionComponentSymbol");function fj(n,e,i){const a=D.useRef(i);D.useInsertionEffect(()=>{a.current=i});const l=D.useRef(null);return D.useCallback(c=>{var d;c&&((d=n.onMount)==null||d.call(n,c)),e&&(c?e.mount(c):e.unmount());const u=a.current;if(typeof u=="function")if(c){const m=u(c);typeof m=="function"&&(l.current=m)}else l.current?(l.current(),l.current=null):u(c);else u&&(u.current=c)},[e])}const tw=D.createContext({});function ka(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function mj(n,e,i,a,l,c){var C,P;const{visualElement:u}=D.useContext(Vc),d=D.useContext(Xx),m=D.useContext(Uc),p=D.useContext(Qf),y=p.reducedMotion,v=p.skipAnimations,x=D.useRef(null),_=D.useRef(!1);a=a||d.renderer,!x.current&&a&&(x.current=a(n,{visualState:e,parent:u,props:i,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:y,skipAnimations:v,isSVG:c}),_.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const S=x.current,T=D.useContext(tw);S&&!S.projection&&l&&(S.type==="html"||S.type==="svg")&&pj(x.current,i,l,T);const j=D.useRef(!1);D.useInsertionEffect(()=>{S&&j.current&&S.update(i,m)});const k=i[hx],M=D.useRef(!!k&&typeof window<"u"&&!((C=window.MotionHandoffIsComplete)!=null&&C.call(window,k))&&((P=window.MotionHasOptimisedAnimation)==null?void 0:P.call(window,k)));return Af(()=>{_.current=!0,S&&(j.current=!0,window.MotionIsMounted=!0,S.updateFeatures(),S.scheduleRenderMicrotask(),M.current&&S.animationState&&S.animationState.animateChanges())}),D.useEffect(()=>{S&&(!M.current&&S.animationState&&S.animationState.animateChanges(),M.current&&(queueMicrotask(()=>{var K;(K=window.MotionHandoffMarkAsComplete)==null||K.call(window,k)}),M.current=!1),S.enteringChildren=void 0)}),S}function pj(n,e,i,a){const{layoutId:l,layout:c,drag:u,dragConstraints:d,layoutScroll:m,layoutRoot:p,layoutAnchor:y,layoutCrossfade:v}=e;n.projection=new i(n.latestValues,e["data-framer-portal-id"]?void 0:nw(n.parent)),n.projection.setOptions({layoutId:l,layout:c,alwaysMeasureLayout:!!u||d&&ka(d),visualElement:n,animationType:typeof c=="string"?c:"both",initialPromotionConfig:a,crossfade:v,layoutScroll:m,layoutRoot:p,layoutAnchor:y})}function nw(n){if(n)return n.options.allowProjection!==!1?n.projection:nw(n.parent)}function bd(n,{forwardMotionProps:e=!1,type:i}={},a,l){a&&JA(a);const c=i?i==="svg":Wf(n),u=c?hj:uj;function d(p,y){let v;const x={...D.useContext(Qf),...p,layoutId:gj(p)},{isStatic:_}=x,S=tj(p),T=u(p,_);if(!_&&typeof window<"u"){yj();const j=bj(x);v=j.MeasureLayout,S.visualElement=mj(n,T,x,l,j.ProjectionNode,c)}return g.jsxs(Vc.Provider,{value:S,children:[v&&S.visualElement?g.jsx(v,{visualElement:S.visualElement,...x}):null,oj(n,p,fj(T,S.visualElement,y),T,_,e,c)]})}d.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const m=D.forwardRef(d);return m[dj]=n,m}function gj({layoutId:n}){const e=D.useContext(Tf).id;return e&&n!==void 0?e+"-"+n:n}function yj(n,e){D.useContext(Xx).strict}function bj(n){const e=Jx(),{drag:i,layout:a}=e;if(!i&&!a)return{};const l={...i,...a};return{MeasureLayout:i!=null&&i.isEnabled(n)||a!=null&&a.isEnabled(n)?l.MeasureLayout:void 0,ProjectionNode:l.ProjectionNode}}function vj(n,e){if(typeof Proxy>"u")return bd;const i=new Map,a=(c,u)=>bd(c,u,n,e),l=(c,u)=>a(c,u);return new Proxy(l,{get:(c,u)=>u==="create"?a:(i.has(u)||i.set(u,bd(u,void 0,n,e)),i.get(u))})}const xj=(n,e)=>e.isSVG??Wf(n)?new JE(e):new FE(e,{allowProjection:n!==D.Fragment});class wj extends li{constructor(e){super(e),e.animationState||(e.animationState=tA(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();zc(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:i}=this.node.prevProps||{};e!==i&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let _j=0;class Sj extends li{constructor(){super(...arguments),this.id=_j++,this.isExitComplete=!1}update(){var c;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:i}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===a)return;if(e&&a===!1){if(this.isExitComplete){const{initial:u,custom:d}=this.node.getProps();if(typeof u=="string"||typeof u=="object"&&u!==null&&!Array.isArray(u)){const m=Hi(this.node,u,d);if(m){const{transition:p,transitionEnd:y,...v}=m;for(const x in v)(c=this.node.getValue(x))==null||c.jump(v[x])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const l=this.node.animationState.setActive("exit",!e);i&&!e&&l.then(()=>{this.isExitComplete=!0,i(this.id)})}mount(){const{register:e,onExitComplete:i}=this.node.presenceContext||{};i&&i(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Tj={animation:{Feature:wj},exit:{Feature:Sj}};function So(n){return{point:{x:n.pageX,y:n.pageY}}}const Ej=n=>e=>If(e)&&n(e,So(e));function no(n,e,i,a){return co(n,e,Ej(i),a)}const sw=({current:n})=>n?n.ownerDocument.defaultView:null,lb=(n,e)=>Math.abs(n-e);function Aj(n,e){const i=lb(n.x,e.x),a=lb(n.y,e.y);return Math.sqrt(i**2+a**2)}const cb=new Set(["auto","scroll"]);class iw{constructor(e,i,{transformPagePoint:a,contextWindow:l=window,dragSnapToOrigin:c=!1,distanceThreshold:u=3,element:d}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=S=>{this.handleScroll(S.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Kl(this.lastRawMoveEventInfo,this.transformPagePoint));const S=vd(this.lastMoveEventInfo,this.history),T=this.startEvent!==null,j=Aj(S.offset,{x:0,y:0})>=this.distanceThreshold;if(!T&&!j)return;const{point:k}=S,{timestamp:M}=Ut;this.history.push({...k,timestamp:M});const{onStart:C,onMove:P}=this.handlers;T||(C&&C(this.lastMoveEvent,S),this.startEvent=this.lastMoveEvent),P&&P(this.lastMoveEvent,S)},this.handlePointerMove=(S,T)=>{this.lastMoveEvent=S,this.lastRawMoveEventInfo=T,this.lastMoveEventInfo=Kl(T,this.transformPagePoint),Xe.update(this.updatePoint,!0)},this.handlePointerUp=(S,T)=>{this.end();const{onEnd:j,onSessionEnd:k,resumeAnimation:M}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&M&&M(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const C=vd(S.type==="pointercancel"?this.lastMoveEventInfo:Kl(T,this.transformPagePoint),this.history);this.startEvent&&j&&j(S,C),k&&k(S,C)},!If(e))return;this.dragSnapToOrigin=c,this.handlers=i,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=l||window;const m=So(e),p=Kl(m,this.transformPagePoint),{point:y}=p,{timestamp:v}=Ut;this.history=[{...y,timestamp:v}];const{onSessionStart:x}=i;x&&x(e,vd(p,this.history));const _={passive:!0,capture:!0};this.removeListeners=xo(no(this.contextWindow,"pointermove",this.handlePointerMove,_),no(this.contextWindow,"pointerup",this.handlePointerUp,_),no(this.contextWindow,"pointercancel",this.handlePointerUp,_)),d&&this.startScrollTracking(d)}startScrollTracking(e){let i=e.parentElement;for(;i;){const a=getComputedStyle(i);(cb.has(a.overflowX)||cb.has(a.overflowY))&&this.scrollPositions.set(i,{x:i.scrollLeft,y:i.scrollTop}),i=i.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const i=this.scrollPositions.get(e);if(!i)return;const a=e===window,l=a?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},c={x:l.x-i.x,y:l.y-i.y};c.x===0&&c.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=c.x,this.lastMoveEventInfo.point.y+=c.y):this.history.length>0&&(this.history[0].x-=c.x,this.history[0].y-=c.y),this.scrollPositions.set(e,l),Xe.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),oi(this.updatePoint)}}function Kl(n,e){return e?{point:e(n.point)}:n}function ub(n,e){return{x:n.x-e.x,y:n.y-e.y}}function vd({point:n},e){return{point:n,delta:ub(n,aw(e)),offset:ub(n,jj(e)),velocity:Nj(e,.1)}}function jj(n){return n[0]}function aw(n){return n[n.length-1]}function Nj(n,e){if(n.length<2)return{x:0,y:0};let i=n.length-1,a=null;const l=aw(n);for(;i>=0&&(a=n[i],!(l.timestamp-a.timestamp>ln(e)));)i--;if(!a)return{x:0,y:0};a===n[0]&&n.length>2&&l.timestamp-a.timestamp>ln(e)*2&&(a=n[1]);const c=En(l.timestamp-a.timestamp);if(c===0)return{x:0,y:0};const u={x:(l.x-a.x)/c,y:(l.y-a.y)/c};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function Rj(n,{min:e,max:i},a){return e!==void 0&&n<e?n=a?Ye(e,n,a.min):Math.max(n,e):i!==void 0&&n>i&&(n=a?Ye(i,n,a.max):Math.min(n,i)),n}function hb(n,e,i){return{min:e!==void 0?n.min+e:void 0,max:i!==void 0?n.max+i-(n.max-n.min):void 0}}function kj(n,{top:e,left:i,bottom:a,right:l}){return{x:hb(n.x,i,l),y:hb(n.y,e,a)}}function db(n,e){let i=e.min-n.min,a=e.max-n.max;return e.max-e.min<n.max-n.min&&([i,a]=[a,i]),{min:i,max:a}}function Cj(n,e){return{x:db(n.x,e.x),y:db(n.y,e.y)}}function Oj(n,e){let i=.5;const a=qt(n),l=qt(e);return l>a?i=ro(e.min,e.max-a,n.min):a>l&&(i=ro(n.min,n.max-l,e.min)),ns(0,1,i)}function Dj(n,e){const i={};return e.min!==void 0&&(i.min=e.min-n.min),e.max!==void 0&&(i.max=e.max-n.min),i}const rf=.35;function Mj(n=rf){return n===!1?n=0:n===!0&&(n=rf),{x:fb(n,"left","right"),y:fb(n,"top","bottom")}}function fb(n,e,i){return{min:mb(n,e),max:mb(n,i)}}function mb(n,e){return typeof n=="number"?n:n[e]||0}const Bj=new WeakMap;class Uj{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Et(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:i=!1,distanceThreshold:a}={}){const{presenceContext:l}=this.visualElement;if(l&&l.isPresent===!1)return;const c=v=>{i&&this.snapToCursor(So(v).point),this.stopAnimation()},u=(v,x)=>{const{drag:_,dragPropagation:S,onDragStart:T}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=cE(_),!this.openDragLock))return;this.latestPointerEvent=v,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Jn(k=>{let M=this.getAxisMotionValue(k).get()||0;if(ts.test(M)){const{projection:C}=this.visualElement;if(C&&C.layout){const P=C.layout.layoutBox[k];P&&(M=qt(P)*(parseFloat(M)/100))}}this.originPoint[k]=M}),T&&Xe.update(()=>T(v,x),!1,!0),Xd(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},d=(v,x)=>{this.latestPointerEvent=v,this.latestPanInfo=x;const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:T,onDrag:j}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:k}=x;if(S&&this.currentDirection===null){this.currentDirection=zj(k),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",x.point,k),this.updateAxis("y",x.point,k),this.visualElement.render(),j&&Xe.update(()=>j(v,x),!1,!0)},m=(v,x)=>{this.latestPointerEvent=v,this.latestPanInfo=x,this.stop(v,x),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>{const{dragSnapToOrigin:v}=this.getProps();(v||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:y}=this.getProps();this.panSession=new iw(e,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:m,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:a,contextWindow:sw(this.visualElement),element:this.visualElement.current})}stop(e,i){const a=e||this.latestPointerEvent,l=i||this.latestPanInfo,c=this.isDragging;if(this.cancel(),!c||!l||!a)return;const{velocity:u}=l;this.startAnimation(u);const{onDragEnd:d}=this.getProps();d&&Xe.postRender(()=>d(a,l))}cancel(){this.isDragging=!1;const{projection:e,animationState:i}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,i,a){const{drag:l}=this.getProps();if(!a||!Yl(e,l,this.currentDirection))return;const c=this.getAxisMotionValue(e);let u=this.originPoint[e]+a[e];this.constraints&&this.constraints[e]&&(u=Rj(u,this.constraints[e],this.elastic[e])),c.set(u)}resolveConstraints(){var c;const{dragConstraints:e,dragElastic:i}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(c=this.visualElement.projection)==null?void 0:c.layout,l=this.constraints;e&&ka(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&a?this.constraints=kj(a.layoutBox,e):this.constraints=!1,this.elastic=Mj(i),l!==this.constraints&&!ka(e)&&a&&this.constraints&&!this.hasMutatedConstraints&&Jn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=Dj(a.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:i}=this.getProps();if(!e||!ka(e))return!1;const a=e.current,{projection:l}=this.visualElement;if(!l||!l.layout)return!1;l.root&&(l.root.scroll=void 0,l.root.updateScroll());const c=zE(a,l.root,this.visualElement.getTransformPagePoint());let u=Cj(l.layout.layoutBox,c);if(i){const d=i(BE(u));this.hasMutatedConstraints=!!d,d&&(u=jx(d))}return u}startAnimation(e){const{drag:i,dragMomentum:a,dragElastic:l,dragTransition:c,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),m=this.constraints||{},p=Jn(y=>{if(!Yl(y,i,this.currentDirection))return;let v=m&&m[y]||{};(u===!0||u===y)&&(v={min:0,max:0});const x=l?200:1e6,_=l?40:1e7,S={type:"inertia",velocity:a?e[y]:0,bounceStiffness:x,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...c,...v};return this.startAxisValueAnimation(y,S)});return Promise.all(p).then(d)}startAxisValueAnimation(e,i){const a=this.getAxisMotionValue(e);return Xd(this.visualElement,e),a.start(Vf(e,a,0,i,this.visualElement,!1))}stopAnimation(){Jn(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const i=`_drag${e.toUpperCase()}`,l=this.visualElement.getProps()[i];return l||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){Jn(i=>{const{drag:a}=this.getProps();if(!Yl(i,a,this.currentDirection))return;const{projection:l}=this.visualElement,c=this.getAxisMotionValue(i);if(l&&l.layout){const{min:u,max:d}=l.layout.layoutBox[i],m=c.get()||0;c.set(e[i]-Ye(u,d,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:i}=this.getProps(),{projection:a}=this.visualElement;if(!ka(i)||!a||!this.constraints)return;this.stopAnimation();const l={x:0,y:0};Jn(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const m=d.get();l[u]=Oj({min:m,max:m},this.constraints[u])}});const{transformTemplate:c}=this.visualElement.getProps();this.visualElement.current.style.transform=c?c({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),Jn(u=>{if(!Yl(u,e,null))return;const d=this.getAxisMotionValue(u),{min:m,max:p}=this.constraints[u];d.set(Ye(m,p,l[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Bj.set(this.visualElement,this);const e=this.visualElement.current,i=no(e,"pointerdown",p=>{const{drag:y,dragListener:v=!0}=this.getProps(),x=p.target,_=x!==e&&pE(x);y&&v&&!_&&this.start(p)});let a;const l=()=>{const{dragConstraints:p}=this.getProps();ka(p)&&p.current&&(this.constraints=this.resolveRefConstraints(),a||(a=Lj(e,p.current,()=>this.scalePositionWithinConstraints())))},{projection:c}=this.visualElement,u=c.addEventListener("measure",l);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),Xe.read(l);const d=co(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:y})=>{this.isDragging&&y&&(Jn(v=>{const x=this.getAxisMotionValue(v);x&&(this.originPoint[v]+=p[v].translate,x.set(x.get()+p[v].translate))}),this.visualElement.render())}));return()=>{d(),i(),u(),m&&m(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:a=!1,dragPropagation:l=!1,dragConstraints:c=!1,dragElastic:u=rf,dragMomentum:d=!0}=e;return{...e,drag:i,dragDirectionLock:a,dragPropagation:l,dragConstraints:c,dragElastic:u,dragMomentum:d}}}function pb(n){let e=!0;return()=>{if(e){e=!1;return}n()}}function Lj(n,e,i){const a=_0(n,pb(i)),l=_0(e,pb(i));return()=>{a(),l()}}function Yl(n,e,i){return(e===!0||e===n)&&(i===null||i===n)}function zj(n,e=10){let i=null;return Math.abs(n.y)>e?i="y":Math.abs(n.x)>e&&(i="x"),i}class Pj extends li{constructor(e){super(e),this.removeGroupControls=An,this.removeListeners=An,this.controls=new Uj(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||An}update(){const{dragControls:e}=this.node.getProps(),{dragControls:i}=this.node.prevProps||{};e!==i&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const xd=n=>(e,i)=>{n&&Xe.update(()=>n(e,i),!1,!0)};class Vj extends li{constructor(){super(...arguments),this.removePointerDownListener=An}onPointerDown(e){this.session=new iw(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:sw(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:i,onPan:a,onPanEnd:l}=this.node.getProps();return{onSessionStart:xd(e),onStart:xd(i),onMove:xd(a),onEnd:(c,u)=>{delete this.session,l&&Xe.postRender(()=>l(c,u))}}}mount(){this.removePointerDownListener=no(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let wd=!1;class Hj extends D.Component{componentDidMount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:a,layoutId:l}=this.props,{projection:c}=e;c&&(i.group&&i.group.add(c),a&&a.register&&l&&a.register(c),wd&&c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),fc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:i,visualElement:a,drag:l,isPresent:c}=this.props,{projection:u}=a;return u&&(u.isPresent=c,e.layoutDependency!==i&&u.setOptions({...u.options,layoutDependency:i}),wd=!0,l||e.layoutDependency!==i||i===void 0||e.isPresent!==c?u.willUpdate():this.safeToRemove(),e.isPresent!==c&&(c?u.promote():u.relegate()||Xe.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:i}=this.props,{projection:a}=e;a&&(a.options.layoutAnchor=i,a.root.didUpdate(),Ff.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:a}=this.props,{projection:l}=e;wd=!0,l&&(l.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(l),a&&a.deregister&&a.deregister(l))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function rw(n){const[e,i]=Yx(),a=D.useContext(Tf);return g.jsx(Hj,{...n,layoutGroup:a,switchLayoutGroup:D.useContext(tw),isPresent:e,safeToRemove:i})}const $j={pan:{Feature:Vj},drag:{Feature:Pj,ProjectionNode:Kx,MeasureLayout:rw}};function gb(n,e,i){const{props:a}=n;n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",i==="Start");const l="onHover"+i,c=a[l];c&&Xe.postRender(()=>c(e,So(e)))}class qj extends li{mount(){const{current:e}=this.node;e&&(this.unmount=hE(e,(i,a)=>(gb(this.node,a,"Start"),l=>gb(this.node,l,"End"))))}unmount(){}}class Fj extends li{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=xo(co(this.node.current,"focus",()=>this.onFocus()),co(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function yb(n,e,i){const{props:a}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&a.whileTap&&n.animationState.setActive("whileTap",i==="Start");const l="onTap"+(i==="End"?"":i),c=a[l];c&&Xe.postRender(()=>c(e,So(e)))}class Ij extends li{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:i,propagate:a}=this.node.props;this.unmount=yE(e,(l,c)=>(yb(this.node,c,"Start"),(u,{success:d})=>yb(this.node,u,d?"End":"Cancel")),{useGlobalTarget:i,stopPropagation:(a==null?void 0:a.tap)===!1})}unmount(){}}const of=new WeakMap,_d=new WeakMap,Gj=n=>{const e=of.get(n.target);e&&e(n)},Kj=n=>{n.forEach(Gj)};function Yj({root:n,...e}){const i=n||document;_d.has(i)||_d.set(i,{});const a=_d.get(i),l=JSON.stringify(e);return a[l]||(a[l]=new IntersectionObserver(Kj,{root:n,...e})),a[l]}function Xj(n,e,i){const a=Yj(e);return of.set(n,i),a.observe(n),()=>{of.delete(n),a.unobserve(n)}}const Jj={some:0,all:1};class Qj extends li{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var m;(m=this.stopObserver)==null||m.call(this);const{viewport:e={}}=this.node.getProps(),{root:i,margin:a,amount:l="some",once:c}=e,u={root:i?i.current:void 0,rootMargin:a,threshold:typeof l=="number"?l:Jj[l]},d=p=>{const{isIntersecting:y}=p;if(this.isInView===y||(this.isInView=y,c&&!y&&this.hasEnteredView))return;y&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",y);const{onViewportEnter:v,onViewportLeave:x}=this.node.getProps(),_=y?v:x;_&&_(p)};this.stopObserver=Xj(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:i}=this.node;["amount","margin","root"].some(Zj(e,i))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function Zj({viewport:n={}},{viewport:e={}}={}){return i=>n[i]!==e[i]}const Wj={inView:{Feature:Qj},tap:{Feature:Ij},focus:{Feature:Fj},hover:{Feature:qj}},e2={layout:{ProjectionNode:Kx,MeasureLayout:rw}},t2={...Tj,...Wj,...$j,...e2},n2=vj(t2,xj),Tn=n2;/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const s2=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i2=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,i,a)=>a?a.toUpperCase():i.toLowerCase()),bb=n=>{const e=i2(n);return e.charAt(0).toUpperCase()+e.slice(1)},ow=(...n)=>n.filter((e,i,a)=>!!e&&e.trim()!==""&&a.indexOf(e)===i).join(" ").trim(),a2=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var r2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const o2=D.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:a,className:l="",children:c,iconNode:u,...d},m)=>D.createElement("svg",{ref:m,...r2,width:e,height:e,stroke:n,strokeWidth:a?Number(i)*24/Number(e):i,className:ow("lucide",l),...!c&&!a2(d)&&{"aria-hidden":"true"},...d},[...u.map(([p,y])=>D.createElement(p,y)),...Array.isArray(c)?c:[c]]));/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Me=(n,e)=>{const i=D.forwardRef(({className:a,...l},c)=>D.createElement(o2,{ref:c,iconNode:e,className:ow(`lucide-${s2(bb(n))}`,`lucide-${n}`,a),...l}));return i.displayName=bb(n),i};/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const l2=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],c2=Me("arrow-left-right",l2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const u2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],h2=Me("arrow-right",u2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const d2=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]],vb=Me("banknote",d2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f2=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],m2=Me("calendar-days",f2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const p2=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],g2=Me("calendar",p2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const y2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],b2=Me("chevron-down",y2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],x2=Me("circle-alert",v2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const w2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ec=Me("circle-check",w2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],S2=Me("circle-user",_2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const T2=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],lw=Me("earth",T2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const E2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],A2=Me("external-link",E2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const j2=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],N2=Me("eye",j2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const R2=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],Ca=Me("file-spreadsheet",R2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const k2=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Xl=Me("file-text",k2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const C2=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],O2=Me("funnel",C2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const D2=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],xb=Me("gift",D2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const M2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],B2=Me("history",M2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const U2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],cw=Me("info",U2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const L2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ha=Me("loader-circle",L2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const z2=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],P2=Me("lock-keyhole",z2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const V2=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],H2=Me("log-out",V2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $2=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],uw=Me("menu",$2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const q2=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 15h.01",key:"q59x07"}],["path",{d:"M12 7v4",key:"xawao1"}]],F2=Me("message-square-warning",q2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const I2=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],G2=Me("play",I2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Y2=Me("plus",K2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const X2=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],J2=Me("refresh-cw",X2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Q2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Xr=Me("search",Q2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Z2=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],hw=Me("send",Z2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ta=Me("trash-2",W2);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eN=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ac=Me("triangle-alert",eN);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tN=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Ir=Me("upload",tN);/**
* @license lucide-react v0.546.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ga=Me("x",nN),uo=[{code:"GT",name:"Guatemala",flag:"/cruce-cuentas/gt-flag.png",currency:"GTQ",locale:"es-GT",enabled:!0},{code:"TT",name:"Trinidad y Tobago",flag:"/cruce-cuentas/tt-flag.png",currency:"TTD",locale:"en-TT",enabled:!0},{code:"PA",name:"Panamá",flag:"https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/Flag_of_Panama.svg",currency:"USD",locale:"es-PA",enabled:!0},{code:"SV",name:"El Salvador",flag:"https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/Flag_of_El_Salvador.svg.webp",currency:"USD",locale:"es-SV",enabled:!0},{code:"HN",name:"Honduras",flag:"https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/Bandera%20de%20Honduras.webp",currency:"HNL",locale:"es-HN",enabled:!0},{code:"PR",name:"Puerto Rico",flag:"https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/bandera-nacional-tela-puerto-rico_113767-1759.avif",currency:"USD",locale:"es-PR",enabled:!0},{code:"RD",name:"República Dominicana",flag:"https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/Flag_of_the_Dominican_Republic.svg.webp",currency:"DOP",locale:"es-DO",enabled:!0}];function wb(n){return uo.find(e=>e.code===n)??uo[0]}const sN="https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM_completo.png";function iN({currentView:n,onViewChange:e,onNewCruce:i,isSidebarOpen:a=!1,onCloseSidebar:l,user:c,isAuthEnabled:u=!1,onLogout:d,country:m,onCountryChange:p,onChooseAnotherCountry:y}){const[v,x]=D.useState(!1),_=D.useRef(null);return D.useEffect(()=>{function S(T){_.current&&!_.current.contains(T.target)&&x(!1)}return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),g.jsxs("aside",{className:`bg-neutral-100 h-screen w-64 fixed left-0 top-0 flex flex-col z-50 pb-6 min-h-screen font-sans transition-transform duration-300 md:translate-x-0 ${a?"translate-x-0":"-translate-x-full"}`,children:[g.jsx("div",{className:"absolute right-0 top-0 h-[80px] w-px bg-[#D0D0D0] pointer-events-none z-10 hidden md:block"}),g.jsx("div",{className:"absolute right-0 top-[84px] bottom-0 w-px bg-[#D0D0D0] pointer-events-none z-10 hidden md:block"}),g.jsxs("div",{className:"h-[84px] px-4 flex justify-between md:justify-center items-center bg-white border-b-4 border-[#6CC24A] relative",children:[g.jsx("img",{alt:"GomezLee Marketing logo",className:"h-10 object-contain selection:bg-transparent",src:sN}),g.jsx("button",{onClick:l,className:"md:hidden p-2 text-neutral-500 hover:text-neutral-800 transition-colors","aria-label":"Cerrar menú",children:g.jsx(Ga,{className:"w-5 h-5"})})]}),g.jsxs("div",{className:"px-4 pt-5",children:[g.jsxs("label",{className:"block",children:[g.jsxs("span",{className:"text-[9px] uppercase tracking-wider font-black text-neutral-400 flex items-center gap-1.5 mb-1.5",children:[g.jsx(lw,{className:"w-3.5 h-3.5"}),"País"]}),g.jsxs("div",{className:"relative",ref:_,children:[g.jsxs("button",{type:"button",onClick:()=>x(!v),className:"w-full border border-neutral-300 bg-white px-3 py-2 text-xs font-bold text-[#4F758B] focus:outline-none focus:border-[#4F758B] flex items-center justify-between transition-colors hover:bg-neutral-50",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("img",{src:m.flag,alt:"",className:"w-5 h-3.5 object-cover shadow-sm border border-neutral-200"}),g.jsx("span",{children:m.name})]}),g.jsx(b2,{className:`w-4 h-4 text-[#4F758B] transition-transform ${v?"rotate-180":""}`})]}),v&&g.jsx("ul",{className:"absolute left-0 right-0 top-full mt-1 bg-white border border-neutral-300 shadow-lg z-50 py-1",children:uo.map(S=>g.jsx("li",{children:g.jsxs("button",{type:"button",disabled:!S.enabled,onClick:()=>{p(S.code),x(!1)},className:`w-full text-left px-3 py-2.5 text-xs font-bold flex items-center gap-2.5 transition-colors ${S.enabled?"hover:bg-neutral-100 text-[#4F758B]":"opacity-60 cursor-not-allowed text-neutral-500 bg-neutral-50"}`,children:[g.jsx("img",{src:S.flag,alt:"",className:"w-6 h-4 object-cover shadow-sm border border-neutral-200 bg-white flex-shrink-0"}),g.jsxs("span",{className:"min-w-0 text-left leading-tight",children:[g.jsx("span",{className:"block",children:S.name}),!S.enabled&&g.jsx("span",{className:"block mt-1 text-[10px] text-neutral-400 font-medium italic",children:"Próximamente"})]})]})},S.code))})]})]}),g.jsx("button",{type:"button",onClick:y,className:"mt-2 text-[9px] font-bold uppercase tracking-wider text-neutral-400 hover:text-[#4F758B]",children:"Ver países disponibles"})]}),g.jsx("nav",{className:"flex-1 flex flex-col mt-5",children:g.jsxs("ul",{className:"space-y-1",children:[g.jsx("li",{children:g.jsxs("button",{onClick:()=>e("cruce"),className:`w-full flex items-center gap-3 px-6 py-3.5 transition-all duration-150 text-left font-bold text-sm tracking-wide ${n==="cruce"?"bg-[#4F758B] text-white":"text-neutral-600 hover:bg-neutral-200 hover:text-neutral-800"}`,children:[g.jsx(c2,{className:`w-4 h-4 ${n==="cruce"?"text-[#6CC24A]":""}`}),g.jsx("span",{children:"Cruce de Cuentas"})]})}),g.jsx("li",{children:g.jsxs("button",{onClick:()=>e("historial"),className:`w-full flex items-center gap-3 px-6 py-3.5 transition-all duration-150 text-left font-bold text-sm tracking-wide ${n==="historial"?"bg-[#4F758B] text-white":"text-neutral-600 hover:bg-neutral-200 hover:text-neutral-800"}`,children:[g.jsx(B2,{className:`w-4 h-4 ${n==="historial"?"text-[#6CC24A]":""}`}),g.jsx("span",{children:"Reportes Históricos"})]})})]})}),g.jsxs("div",{className:"px-4 space-y-3 pt-4 border-t border-[#D0D0D0] bg-neutral-100",children:[c&&g.jsxs("div",{className:"border border-neutral-200 bg-white px-3 py-3 flex items-center gap-2",children:[g.jsx(S2,{className:"w-4 h-4 text-[#4F758B] flex-shrink-0"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"text-[11px] font-black text-neutral-700 truncate",title:c.name,children:c.name}),g.jsx("p",{className:"text-[9px] text-neutral-400 truncate",title:c.email,children:c.email})]})]}),g.jsxs("button",{onClick:i,className:"w-full bg-[#6CC24A] hover:bg-[#5bb03c] text-white py-3 px-4 font-bold text-xs uppercase tracking-wider flex items-center justify-center gap-2 transition-all duration-150 shadow-sm active:scale-98",children:[g.jsx(Y2,{className:"w-4 h-4"}),g.jsx("span",{children:"Nuevo Cruce"})]}),u&&d&&g.jsxs("button",{onClick:d,className:"w-full border border-neutral-300 bg-white hover:bg-neutral-50 text-neutral-600 py-2.5 px-4 font-bold text-[11px] uppercase tracking-wider flex items-center justify-center gap-2 transition-all duration-150",children:[g.jsx(H2,{className:"w-4 h-4"}),g.jsx("span",{children:"Cerrar sesión"})]})]})]})}function Hc(n,e){var i={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&e.indexOf(a)<0&&(i[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,a=Object.getOwnPropertySymbols(n);l<a.length;l++)e.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(n,a[l])&&(i[a[l]]=n[a[l]]);return i}function aN(n,e,i,a){function l(c){return c instanceof i?c:new i(function(u){u(c)})}return new(i||(i=Promise))(function(c,u){function d(y){try{p(a.next(y))}catch(v){u(v)}}function m(y){try{p(a.throw(y))}catch(v){u(v)}}function p(y){y.done?c(y.value):l(y.value).then(d,m)}p((a=a.apply(n,e||[])).next())})}const rN=n=>n?(...e)=>n(...e):(...e)=>fetch(...e);class em extends Error{constructor(e,i="FunctionsError",a){super(e),this.name=i,this.context=a}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class oN extends em{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class _b extends em{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Sb extends em{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var lf;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(lf||(lf={}));class lN{constructor(e,{headers:i={},customFetch:a,region:l=lf.Any}={}){this.url=e,this.headers=i,this.region=l,this.fetch=rN(a)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return aN(this,arguments,void 0,function*(i,a={}){var l;let c,u;try{const{headers:d,method:m,body:p,signal:y,timeout:v}=a;let x={},{region:_}=a;_||(_=this.region);const S=new URL(`${this.url}/${i}`);_&&_!=="any"&&(x["x-region"]=_,S.searchParams.set("forceFunctionRegion",_));let T;const j=!!d&&Object.keys(d).some(G=>G.toLowerCase()==="content-type");p&&!j?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(x["Content-Type"]="application/octet-stream",T=p):typeof p=="string"?(x["Content-Type"]="text/plain",T=p):typeof FormData<"u"&&p instanceof FormData?T=p:(x["Content-Type"]="application/json",T=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?T=JSON.stringify(p):T=p;let k=y;v&&(u=new AbortController,c=setTimeout(()=>u.abort(),v),y?(k=u.signal,y.addEventListener("abort",()=>u.abort())):k=u.signal);const M=yield this.fetch(S.toString(),{method:m||"POST",headers:Object.assign(Object.assign(Object.assign({},x),this.headers),d),body:T,signal:k}).catch(G=>{throw new oN(G)}),C=M.headers.get("x-relay-error");if(C&&C==="true")throw new _b(M);if(!M.ok)throw new Sb(M);let P=((l=M.headers.get("Content-Type"))!==null&&l!==void 0?l:"text/plain").split(";")[0].trim(),K;return P==="application/json"?K=yield M.json():P==="application/octet-stream"||P==="application/pdf"?K=yield M.blob():P==="text/event-stream"?K=M:P==="multipart/form-data"?K=yield M.formData():K=yield M.text(),{data:K,error:null,response:M}}catch(d){return{data:null,error:d,response:d instanceof Sb||d instanceof _b?d.context:void 0}}finally{c&&clearTimeout(c)}})}}const dw=3,Tb=n=>Math.min(1e3*2**n,3e4),cN=[520,503],fw=["GET","HEAD","OPTIONS"];var Eb=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Ab(n,e){return new Promise(i=>{if(e!=null&&e.aborted){i();return}const a=setTimeout(()=>{e==null||e.removeEventListener("abort",l),i()},n);function l(){clearTimeout(a),i()}e==null||e.addEventListener("abort",l)})}function uN(n,e,i,a){return!(!a||i>=dw||!fw.includes(n)||!cN.includes(e))}var hN=class{constructor(n){var e,i,a,l,c;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(e=n.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=n.signal,this.isMaybeSingle=(i=n.isMaybeSingle)!==null&&i!==void 0?i:!1,this.shouldStripNulls=(a=n.shouldStripNulls)!==null&&a!==void 0?a:!1,this.urlLengthLimit=(l=n.urlLengthLimit)!==null&&l!==void 0?l:8e3,this.retryEnabled=(c=n.retry)!==null&&c!==void 0?c:!0,n.fetch?this.fetch=n.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(n,e){return this.headers=new Headers(this.headers),this.headers.set(n,e),this}retry(n){return this.retryEnabled=n,this}then(n,e){var i=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 c=(async()=>{let u=0;for(;;){const p={};i.headers.forEach((v,x)=>{p[x]=v}),u>0&&(p["X-Retry-Count"]=String(u));let y;try{y=await a(i.url.toString(),{method:i.method,headers:p,body:JSON.stringify(i.body,(v,x)=>typeof x=="bigint"?x.toString():x),signal:i.signal})}catch(v){if((v==null?void 0:v.name)==="AbortError"||(v==null?void 0:v.code)==="ABORT_ERR"||!fw.includes(i.method))throw v;if(i.retryEnabled&&u<dw){const x=Tb(u);u++,await Ab(x,i.signal);continue}throw v}if(uN(i.method,y.status,u,i.retryEnabled)){var d,m;const v=(d=(m=y.headers)===null||m===void 0?void 0:m.get("Retry-After"))!==null&&d!==void 0?d:null,x=v!==null?Math.max(0,parseInt(v,10)||0)*1e3:Tb(u);await y.text(),u++,await Ab(x,i.signal);continue}return await i.processResponse(y)}})();return this.shouldThrowOnError||(c=c.catch(u=>{var d;let m="",p="",y="";const v=u==null?void 0:u.cause;if(v){var x,_,S,T;const M=(x=v==null?void 0:v.message)!==null&&x!==void 0?x:"",C=(_=v==null?void 0:v.code)!==null&&_!==void 0?_:"";m=`${(S=u==null?void 0:u.name)!==null&&S!==void 0?S:"FetchError"}: ${u==null?void 0:u.message}`,m+=`
Caused by: ${(T=v==null?void 0:v.name)!==null&&T!==void 0?T:"Error"}: ${M}`,C&&(m+=` (${C})`),v!=null&&v.stack&&(m+=`
${v.stack}`)}else{var j;m=(j=u==null?void 0:u.stack)!==null&&j!==void 0?j:""}const k=this.url.toString().length;return(u==null?void 0:u.name)==="AbortError"||(u==null?void 0:u.code)==="ABORT_ERR"?(y="",p="Request was aborted (timeout or manual cancellation)",k>this.urlLengthLimit&&(p+=`. Note: Your request URL is ${k} 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.`)):((v==null?void 0:v.name)==="HeadersOverflowError"||(v==null?void 0:v.code)==="UND_ERR_HEADERS_OVERFLOW")&&(y="",p="HTTP headers exceeded server limits (typically 16KB)",k>this.urlLengthLimit&&(p+=`. Your request URL is ${k} 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:`${(d=u==null?void 0:u.name)!==null&&d!==void 0?d:"FetchError"}: ${u==null?void 0:u.message}`,details:m,hint:p,code:y},data:null,count:null,status:0,statusText:""}})),c.then(n,e)}async processResponse(n){var e=this;let i=null,a=null,l=null,c=n.status,u=n.statusText;if(n.ok){var d,m;if(e.method!=="HEAD"){var p;const x=await n.text();if(x!=="")if(e.headers.get("Accept")==="text/csv")a=x;else if(e.headers.get("Accept")&&(!((p=e.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text")))a=x;else try{a=JSON.parse(x)}catch{if(i={message:x},a=null,e.shouldThrowOnError)throw new Eb({message:x,details:"",hint:"",code:""})}}const y=(d=e.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),v=(m=n.headers.get("content-range"))===null||m===void 0?void 0:m.split("/");y&&v&&v.length>1&&(l=parseInt(v[1])),e.isMaybeSingle&&Array.isArray(a)&&(a.length>1?(i={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,l=null,c=406,u="Not Acceptable"):a.length===1?a=a[0]:a=null)}else{const y=await n.text();try{i=JSON.parse(y),Array.isArray(i)&&n.status===404&&(a=[],i=null,c=200,u="OK")}catch{n.status===404&&y===""?(c=204,u="No Content"):i={message:y}}if(i&&e.shouldThrowOnError)throw new Eb(i)}return{success:i===null,error:i,data:a,count:l,status:c,statusText:u}}returns(){return this}overrideTypes(){return this}},dN=class extends hN{throwOnError(){return super.throwOnError()}select(n){let e=!1;const i=(n??"*").split("").map(a=>/\s/.test(a)&&!e?"":(a==='"'&&(e=!e),a)).join("");return this.url.searchParams.set("select",i),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:e=!0,nullsFirst:i,foreignTable:a,referencedTable:l=a}={}){const c=l?`${l}.order`:"order",u=this.url.searchParams.get(c);return this.url.searchParams.set(c,`${u?`${u},`:""}${n}.${e?"asc":"desc"}${i===void 0?"":i?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:e,referencedTable:i=e}={}){const a=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(a,`${n}`),this}range(n,e,{foreignTable:i,referencedTable:a=i}={}){const l=typeof a>"u"?"offset":`${a}.offset`,c=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${n}`),this.url.searchParams.set(c,`${e-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:n=!1,verbose:e=!1,settings:i=!1,buffers:a=!1,wal:l=!1,format:c="text"}={}){var u;const d=[n?"analyze":null,e?"verbose":null,i?"settings":null,a?"buffers":null,l?"wal":null].filter(Boolean).join("|"),m=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${c}; for="${m}"; options=${d};`),c==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const jb=new RegExp("[,()]");var Oa=class extends dN{throwOnError(){return super.throwOnError()}eq(n,e){return this.url.searchParams.append(n,`eq.${e}`),this}neq(n,e){return this.url.searchParams.append(n,`neq.${e}`),this}gt(n,e){return this.url.searchParams.append(n,`gt.${e}`),this}gte(n,e){return this.url.searchParams.append(n,`gte.${e}`),this}lt(n,e){return this.url.searchParams.append(n,`lt.${e}`),this}lte(n,e){return this.url.searchParams.append(n,`lte.${e}`),this}like(n,e){return this.url.searchParams.append(n,`like.${e}`),this}likeAllOf(n,e){return this.url.searchParams.append(n,`like(all).{${e.join(",")}}`),this}likeAnyOf(n,e){return this.url.searchParams.append(n,`like(any).{${e.join(",")}}`),this}ilike(n,e){return this.url.searchParams.append(n,`ilike.${e}`),this}ilikeAllOf(n,e){return this.url.searchParams.append(n,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(n,e){return this.url.searchParams.append(n,`ilike(any).{${e.join(",")}}`),this}regexMatch(n,e){return this.url.searchParams.append(n,`match.${e}`),this}regexIMatch(n,e){return this.url.searchParams.append(n,`imatch.${e}`),this}is(n,e){return this.url.searchParams.append(n,`is.${e}`),this}isDistinct(n,e){return this.url.searchParams.append(n,`isdistinct.${e}`),this}in(n,e){const i=Array.from(new Set(e)).map(a=>typeof a=="string"&&jb.test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(n,`in.(${i})`),this}notIn(n,e){const i=Array.from(new Set(e)).map(a=>typeof a=="string"&&jb.test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(n,`not.in.(${i})`),this}contains(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cs.{${e.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(e)}`),this}containedBy(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cd.{${e.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(e)}`),this}rangeGt(n,e){return this.url.searchParams.append(n,`sr.${e}`),this}rangeGte(n,e){return this.url.searchParams.append(n,`nxl.${e}`),this}rangeLt(n,e){return this.url.searchParams.append(n,`sl.${e}`),this}rangeLte(n,e){return this.url.searchParams.append(n,`nxr.${e}`),this}rangeAdjacent(n,e){return this.url.searchParams.append(n,`adj.${e}`),this}overlaps(n,e){return typeof e=="string"?this.url.searchParams.append(n,`ov.${e}`):this.url.searchParams.append(n,`ov.{${e.join(",")}}`),this}textSearch(n,e,{config:i,type:a}={}){let l="";a==="plain"?l="pl":a==="phrase"?l="ph":a==="websearch"&&(l="w");const c=i===void 0?"":`(${i})`;return this.url.searchParams.append(n,`${l}fts${c}.${e}`),this}match(n){return Object.entries(n).filter(([e,i])=>i!==void 0).forEach(([e,i])=>{this.url.searchParams.append(e,`eq.${i}`)}),this}not(n,e,i){return this.url.searchParams.append(n,`not.${e}.${i}`),this}or(n,{foreignTable:e,referencedTable:i=e}={}){const a=i?`${i}.or`:"or";return this.url.searchParams.append(a,`(${n})`),this}filter(n,e,i){return this.url.searchParams.append(n,`${e}.${i}`),this}},fN=class{constructor(n,{headers:e={},schema:i,fetch:a,urlLengthLimit:l=8e3,retry:c}){this.url=n,this.headers=new Headers(e),this.schema=i,this.fetch=a,this.urlLengthLimit=l,this.retry=c}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(n,e){const{head:i=!1,count:a}=e??{},l=i?"HEAD":"GET";let c=!1;const u=(n??"*").split("").map(p=>/\s/.test(p)&&!c?"":(p==='"'&&(c=!c),p)).join(""),{url:d,headers:m}=this.cloneRequestState();return d.searchParams.set("select",u),a&&m.append("Prefer",`count=${a}`),new Oa({method:l,url:d,headers:m,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(n,{count:e,defaultToNull:i=!0}={}){var a;const l="POST",{url:c,headers:u}=this.cloneRequestState();if(e&&u.append("Prefer",`count=${e}`),i||u.append("Prefer","missing=default"),Array.isArray(n)){const d=n.reduce((m,p)=>m.concat(Object.keys(p)),[]);if(d.length>0){const m=[...new Set(d)].map(p=>`"${p}"`);c.searchParams.set("columns",m.join(","))}}return new Oa({method:l,url:c,headers:u,schema:this.schema,body:n,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(n,{onConflict:e,ignoreDuplicates:i=!1,count:a,defaultToNull:l=!0}={}){var c;const u="POST",{url:d,headers:m}=this.cloneRequestState();if(m.append("Prefer",`resolution=${i?"ignore":"merge"}-duplicates`),e!==void 0&&d.searchParams.set("on_conflict",e),a&&m.append("Prefer",`count=${a}`),l||m.append("Prefer","missing=default"),Array.isArray(n)){const p=n.reduce((y,v)=>y.concat(Object.keys(v)),[]);if(p.length>0){const y=[...new Set(p)].map(v=>`"${v}"`);d.searchParams.set("columns",y.join(","))}}return new Oa({method:u,url:d,headers:m,schema:this.schema,body:n,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(n,{count:e}={}){var i;const a="PATCH",{url:l,headers:c}=this.cloneRequestState();return e&&c.append("Prefer",`count=${e}`),new Oa({method:a,url:l,headers:c,schema:this.schema,body:n,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:n}={}){var e;const i="DELETE",{url:a,headers:l}=this.cloneRequestState();return n&&l.append("Prefer",`count=${n}`),new Oa({method:i,url:a,headers:l,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function ho(n){"@babel/helpers - typeof";return ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ho(n)}function mN(n,e){if(ho(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var a=i.call(n,e);if(ho(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function pN(n){var e=mN(n,"string");return ho(e)=="symbol"?e:e+""}function gN(n,e,i){return(e=pN(e))in n?Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[e]=i,n}function Nb(n,e){var i=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),i.push.apply(i,a)}return i}function Jl(n){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?Nb(Object(i),!0).forEach(function(a){gN(n,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Nb(Object(i)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(i,a))})}return n}var yN=class mw{constructor(e,{headers:i={},schema:a,fetch:l,timeout:c,urlLengthLimit:u=8e3,retry:d}={}){this.url=e,this.headers=new Headers(i),this.schemaName=a,this.urlLengthLimit=u;const m=l??globalThis.fetch;c!==void 0&&c>0?this.fetch=(p,y)=>{const v=new AbortController,x=setTimeout(()=>v.abort(),c),_=y==null?void 0:y.signal;if(_){if(_.aborted)return clearTimeout(x),m(p,y);const S=()=>{clearTimeout(x),v.abort()};return _.addEventListener("abort",S,{once:!0}),m(p,Jl(Jl({},y),{},{signal:v.signal})).finally(()=>{clearTimeout(x),_.removeEventListener("abort",S)})}return m(p,Jl(Jl({},y),{},{signal:v.signal})).finally(()=>clearTimeout(x))}:this.fetch=m,this.retry=d}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new fN(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new mw(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,i={},{head:a=!1,get:l=!1,count:c}={}){var u;let d;const m=new URL(`${this.url}/rpc/${e}`);let p;const y=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(y)),v=a&&Object.values(i).some(y);v?(d="POST",p=i):a||l?(d=a?"HEAD":"GET",Object.entries(i).filter(([_,S])=>S!==void 0).map(([_,S])=>[_,Array.isArray(S)?`{${S.join(",")}}`:`${S}`]).forEach(([_,S])=>{m.searchParams.append(_,S)})):(d="POST",p=i);const x=new Headers(this.headers);return v?x.set("Prefer",c?`count=${c},return=minimal`:"return=minimal"):c&&x.set("Prefer",`count=${c}`),new Oa({method:d,url:m,headers:x,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class bN{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const i=globalThis;if(typeof globalThis<"u"&&typeof i.WebSocket<"u")return{type:"native",wsConstructor:i.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 i.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"&&i.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.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 l=globalThis.process;if(l){const c=l.versions;if(c&&c.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 e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let i=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(i+=`
Suggested solution: ${e.workaround}`),new Error(i)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const vN="2.110.2",xN=`realtime-js/${vN}`,wN="1.0.0",pw="2.0.0",_N=pw,SN=1e4,TN=100,si={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},gw={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},cf={connecting:"connecting",closing:"closing",closed:"closed"};class EN{constructor(e){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=e??[]}encode(e,i){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return i(this._binaryEncodeUserBroadcastPush(e));let a=[e.join_ref,e.ref,e.topic,e.event,e.payload];return i(JSON.stringify(a))}_binaryEncodeUserBroadcastPush(e){var i;return this._isArrayBuffer((i=e.payload)===null||i===void 0?void 0:i.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var i,a;const l=(a=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&a!==void 0?a:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,l)}_encodeJsonUserBroadcastPush(e){var i,a;const l=(a=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&a!==void 0?a:{},u=new TextEncoder().encode(JSON.stringify(l)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(e,i,a){var l,c;const u=e.topic,d=(l=e.ref)!==null&&l!==void 0?l:"",m=(c=e.join_ref)!==null&&c!==void 0?c:"",p=e.payload.event,y=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},v=Object.keys(y).length===0?"":JSON.stringify(y);if(m.length>255)throw new Error(`joinRef length ${m.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`ref length ${d.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`topic length ${u.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(v.length>255)throw new Error(`metadata length ${v.length} exceeds maximum of 255`);const x=this.USER_BROADCAST_PUSH_META_LENGTH+m.length+d.length+u.length+p.length+v.length,_=new ArrayBuffer(this.HEADER_LENGTH+x);let S=new DataView(_),T=0;S.setUint8(T++,this.KINDS.userBroadcastPush),S.setUint8(T++,m.length),S.setUint8(T++,d.length),S.setUint8(T++,u.length),S.setUint8(T++,p.length),S.setUint8(T++,v.length),S.setUint8(T++,i),Array.from(m,k=>S.setUint8(T++,k.charCodeAt(0))),Array.from(d,k=>S.setUint8(T++,k.charCodeAt(0))),Array.from(u,k=>S.setUint8(T++,k.charCodeAt(0))),Array.from(p,k=>S.setUint8(T++,k.charCodeAt(0))),Array.from(v,k=>S.setUint8(T++,k.charCodeAt(0)));var j=new Uint8Array(_.byteLength+a.byteLength);return j.set(new Uint8Array(_),0),j.set(new Uint8Array(a),_.byteLength),j.buffer}decode(e,i){if(this._isArrayBuffer(e)){let a=this._binaryDecode(e);return i(a)}if(typeof e=="string"){const a=JSON.parse(e),[l,c,u,d,m]=a;return i({join_ref:l,ref:c,topic:u,event:d,payload:m})}return i({})}_binaryDecode(e){const i=new DataView(e),a=i.getUint8(0),l=new TextDecoder;switch(a){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,i,l)}}_decodeUserBroadcast(e,i,a){const l=i.getUint8(1),c=i.getUint8(2),u=i.getUint8(3),d=i.getUint8(4);let m=this.HEADER_LENGTH+4;const p=a.decode(e.slice(m,m+l));m=m+l;const y=a.decode(e.slice(m,m+c));m=m+c;const v=a.decode(e.slice(m,m+u));m=m+u;const x=e.slice(m,e.byteLength),_=d===this.JSON_ENCODING?JSON.parse(a.decode(x)):x,S={type:this.BROADCAST_EVENT,event:y,payload:_};return u>0&&(S.meta=JSON.parse(v)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:S}}_isArrayBuffer(e){var i;return e instanceof ArrayBuffer||((i=e==null?void 0:e.constructor)===null||i===void 0?void 0:i.name)==="ArrayBuffer"}_pick(e,i){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([a])=>i.includes(a)))}}var Qe;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(Qe||(Qe={}));const Rb=(n,e,i={})=>{var a;const l=(a=i.skipTypes)!==null&&a!==void 0?a:[];return e?Object.keys(e).reduce((c,u)=>(c[u]=AN(u,n,e,l),c),{}):{}},AN=(n,e,i,a)=>{const l=e.find(d=>d.name===n),c=l==null?void 0:l.type,u=i[n];return c&&!a.includes(c)?yw(c,u):uf(u)},yw=(n,e)=>{if(n.charAt(0)==="_"){const i=n.slice(1,n.length);return kN(e,i)}switch(n){case Qe.bool:return jN(e);case Qe.float4:case Qe.float8:case Qe.int2:case Qe.int4:case Qe.int8:case Qe.numeric:case Qe.oid:return NN(e);case Qe.json:case Qe.jsonb:return RN(e);case Qe.timestamp:return CN(e);case Qe.abstime:case Qe.date:case Qe.daterange:case Qe.int4range:case Qe.int8range:case Qe.money:case Qe.reltime:case Qe.text:case Qe.time:case Qe.timestamptz:case Qe.timetz:case Qe.tsrange:case Qe.tstzrange:return uf(e);default:return uf(e)}},uf=n=>n,jN=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},NN=n=>{if(typeof n=="string"){const e=parseFloat(n);if(!Number.isNaN(e))return e}return n},RN=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},kN=(n,e)=>{if(typeof n!="string")return n;const i=n.length-1,a=n[i];if(n[0]==="{"&&a==="}"){let c;const u=n.slice(1,i);try{c=JSON.parse("["+u+"]")}catch{c=u?u.split(","):[]}return c.map(d=>yw(e,d))}return n},CN=n=>typeof n=="string"?n.replace(" ","T"):n,bw=n=>{const e=new URL(n);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var so=n=>typeof n=="function"?n:function(){return n},ON=typeof self<"u"?self:null,Da=typeof window<"u"?window:null,Qn=ON||Da||globalThis,DN="2.0.0",MN=1e4,BN=1e3,Wn={connecting:0,open:1,closing:2,closed:3},Jt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ns={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},hf={longpoll:"longpoll",websocket:"websocket"},UN={complete:4},df="base64url.bearer.phx.",Ql=class{constructor(n,e,i,a){this.channel=n,this.event=e,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=a,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(n){this.timeout=n,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(n,e){return this.hasReceived(n)&&e(this.receivedResp.response),this.recHooks.push({status:n,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:n,response:e,_ref:i}){this.recHooks.filter(a=>a.status===n).forEach(a=>a.callback(e))}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,n=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=n,this.matchReceive(n)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(n){return this.receivedResp&&this.receivedResp.status===n}trigger(n,e){this.channel.trigger(this.refEvent,{status:n,response:e})}},vw=class{constructor(n,e){this.callback=n,this.timerCalc=e,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))}},LN=class{constructor(n,e,i){this.state=Jt.closed,this.topic=n,this.params=so(e||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ql(this,Ns.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new vw(()=>{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=Jt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this.joinPush.receive("error",a=>{this.state=Jt.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=Jt.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=Jt.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 Ql(this,Ns.leave,so({}),this.timeout).send(),this.state=Jt.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ns.reply,(a,l)=>{this.trigger(this.replyEventName(l),a)})}join(n=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=n,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(n=>n.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Jt.closed,this.bindings=[]}onClose(n){this.on(Ns.close,n)}onError(n){return this.on(Ns.error,e=>n(e))}on(n,e){let i=this.bindingRef++;return this.bindings.push({event:n,ref:i,callback:e}),i}off(n,e){this.bindings=this.bindings.filter(i=>!(i.event===n&&(typeof e>"u"||e===i.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(n,e,i=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${n}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let a=new Ql(this,n,function(){return e},i);return this.canPush()?a.send():(a.startTimeout(),this.pushBuffer.push(a)),a}leave(n=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Jt.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ns.close,"leave")},i=new Ql(this,Ns.leave,so({}),n);return i.receive("ok",()=>e()).receive("timeout",()=>e()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(n,e,i){return e}filterBindings(n,e,i){return!0}isMember(n,e,i,a){return this.topic!==n?!1:a&&a!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:n,event:e,payload:i,joinRef:a}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(n=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Jt.joining,this.joinPush.resend(n))}trigger(n,e,i,a){let l=this.onMessage(n,e,i,a);if(e&&!l)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let c=this.bindings.filter(u=>u.event===n&&this.filterBindings(u,e,i));for(let u=0;u<c.length;u++)c[u].callback(l,i,a||this.joinRef())}replyEventName(n){return`chan_reply_${n}`}isClosed(){return this.state===Jt.closed}isErrored(){return this.state===Jt.errored}isJoined(){return this.state===Jt.joined}isJoining(){return this.state===Jt.joining}isLeaving(){return this.state===Jt.leaving}},jc=class{static request(n,e,i,a,l,c,u){if(Qn.XDomainRequest){let d=new Qn.XDomainRequest;return this.xdomainRequest(d,n,e,a,l,c,u)}else if(Qn.XMLHttpRequest){let d=new Qn.XMLHttpRequest;return this.xhrRequest(d,n,e,i,a,l,c,u)}else{if(Qn.fetch&&Qn.AbortController)return this.fetchRequest(n,e,i,a,l,c,u);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(n,e,i,a,l,c,u){let d={method:n,headers:i,body:a},m=null;return l&&(m=new AbortController,setTimeout(()=>m.abort(),l),d.signal=m.signal),Qn.fetch(e,d).then(p=>p.text()).then(p=>this.parseJSON(p)).then(p=>u&&u(p)).catch(p=>{p.name==="AbortError"&&c?c():u&&u(null)}),m}static xdomainRequest(n,e,i,a,l,c,u){return n.timeout=l,n.open(e,i),n.onload=()=>{let d=this.parseJSON(n.responseText);u&&u(d)},c&&(n.ontimeout=c),n.onprogress=()=>{},n.send(a),n}static xhrRequest(n,e,i,a,l,c,u,d){n.open(e,i,!0),n.timeout=c;for(let[m,p]of Object.entries(a))n.setRequestHeader(m,p);return n.onerror=()=>d&&d(null),n.onreadystatechange=()=>{if(n.readyState===UN.complete&&d){let m=this.parseJSON(n.responseText);d(m)}},u&&(n.ontimeout=u),n.send(l),n}static parseJSON(n){if(!n||n==="")return null;try{return JSON.parse(n)}catch{return console&&console.log("failed to parse JSON response",n),null}}static serialize(n,e){let i=[];for(var a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let l=e?`${e}[${a}]`:a,c=n[a];typeof c=="object"?i.push(this.serialize(c,l)):i.push(encodeURIComponent(l)+"="+encodeURIComponent(c))}return i.join("&")}static appendParams(n,e){if(Object.keys(e).length===0)return n;let i=n.match(/\?/)?"&":"?";return`${n}${i}${this.serialize(e)}`}},zN=n=>{let e="",i=new Uint8Array(n),a=i.byteLength;for(let l=0;l<a;l++)e+=String.fromCharCode(i[l]);return btoa(e)},Ea=class{constructor(n,e){e&&e.length===2&&e[1].startsWith(df)&&(this.authToken=atob(e[1].slice(df.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(n),this.readyState=Wn.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(n){return n.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+hf.websocket),"$1/"+hf.longpoll)}endpointURL(){return jc.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(n,e,i){this.close(n,e,i),this.readyState=Wn.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Wn.open||this.readyState===Wn.connecting}poll(){const n={Accept:"application/json"};this.authToken&&(n["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",n,null,()=>this.ontimeout(),e=>{if(e){var{status:i,token:a,messages:l}=e;if(i===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=a}else i=0;switch(i){case 200:l.forEach(c=>{setTimeout(()=>this.onmessage({data:c}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Wn.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${i}`)}})}send(n){typeof n!="string"&&(n=zN(n)),this.currentBatch?this.currentBatch.push(n):this.awaitingBatchAck?this.batchBuffer.push(n):(this.currentBatch=[n],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(n){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},n.join(`
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(n,e,i){for(let l of this.reqs)l.abort();this.readyState=Wn.closed;let a=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:n,reason:e,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",a)):this.onclose(a)}ajax(n,e,i,a,l){let c,u=()=>{this.reqs.delete(c),a()};c=jc.request(n,this.endpointURL(),e,i,this.timeout,u,d=>{this.reqs.delete(c),this.isActive()&&l(d)}),this.reqs.add(c)}},PN=class Jr{constructor(e,i={}){let a=i.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(a.state,l=>{let{onJoin:c,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Jr.syncState(this.state,l,c,u),this.pendingDiffs.forEach(m=>{this.state=Jr.syncDiff(this.state,m,c,u)}),this.pendingDiffs=[],d()}),this.channel.on(a.diff,l=>{let{onJoin:c,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(l):(this.state=Jr.syncDiff(this.state,l,c,u),d())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Jr.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,i,a,l){let c=this.clone(e),u={},d={};return this.map(c,(m,p)=>{i[m]||(d[m]=p)}),this.map(i,(m,p)=>{let y=c[m];if(y){let v=p.metas.map(T=>T.phx_ref),x=y.metas.map(T=>T.phx_ref),_=p.metas.filter(T=>x.indexOf(T.phx_ref)<0),S=y.metas.filter(T=>v.indexOf(T.phx_ref)<0);_.length>0&&(u[m]=p,u[m].metas=_),S.length>0&&(d[m]=this.clone(y),d[m].metas=S)}else u[m]=p}),this.syncDiff(c,{joins:u,leaves:d},a,l)}static syncDiff(e,i,a,l){let{joins:c,leaves:u}=this.clone(i);return a||(a=function(){}),l||(l=function(){}),this.map(c,(d,m)=>{let p=e[d];if(e[d]=this.clone(m),p){let y=e[d].metas.map(x=>x.phx_ref),v=p.metas.filter(x=>y.indexOf(x.phx_ref)<0);e[d].metas.unshift(...v)}a(d,p,m)}),this.map(u,(d,m)=>{let p=e[d];if(!p)return;let y=m.metas.map(v=>v.phx_ref);p.metas=p.metas.filter(v=>y.indexOf(v.phx_ref)<0),l(d,p,m),p.metas.length===0&&delete e[d]}),e}static list(e,i){return i||(i=function(a,l){return l}),this.map(e,(a,l)=>i(a,l))}static map(e,i){return Object.getOwnPropertyNames(e).map(a=>i(a,e[a]))}static clone(e){return JSON.parse(JSON.stringify(e))}},Zl={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(n,e){if(n.payload.constructor===ArrayBuffer)return e(this.binaryEncode(n));{let i=[n.join_ref,n.ref,n.topic,n.event,n.payload];return e(JSON.stringify(i))}},decode(n,e){if(n.constructor===ArrayBuffer)return e(this.binaryDecode(n));{let[i,a,l,c,u]=JSON.parse(n);return e({join_ref:i,ref:a,topic:l,event:c,payload:u})}},binaryEncode(n){let{join_ref:e,ref:i,event:a,topic:l,payload:c}=n,u=this.META_LENGTH+e.length+i.length+l.length+a.length,d=new ArrayBuffer(this.HEADER_LENGTH+u),m=new DataView(d),p=0;m.setUint8(p++,this.KINDS.push),m.setUint8(p++,e.length),m.setUint8(p++,i.length),m.setUint8(p++,l.length),m.setUint8(p++,a.length),Array.from(e,v=>m.setUint8(p++,v.charCodeAt(0))),Array.from(i,v=>m.setUint8(p++,v.charCodeAt(0))),Array.from(l,v=>m.setUint8(p++,v.charCodeAt(0))),Array.from(a,v=>m.setUint8(p++,v.charCodeAt(0)));var y=new Uint8Array(d.byteLength+c.byteLength);return y.set(new Uint8Array(d),0),y.set(new Uint8Array(c),d.byteLength),y.buffer},binaryDecode(n){let e=new DataView(n),i=e.getUint8(0),a=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(n,e,a);case this.KINDS.reply:return this.decodeReply(n,e,a);case this.KINDS.broadcast:return this.decodeBroadcast(n,e,a)}},decodePush(n,e,i){let a=e.getUint8(1),l=e.getUint8(2),c=e.getUint8(3),u=this.HEADER_LENGTH+this.META_LENGTH-1,d=i.decode(n.slice(u,u+a));u=u+a;let m=i.decode(n.slice(u,u+l));u=u+l;let p=i.decode(n.slice(u,u+c));u=u+c;let y=n.slice(u,n.byteLength);return{join_ref:d,ref:null,topic:m,event:p,payload:y}},decodeReply(n,e,i){let a=e.getUint8(1),l=e.getUint8(2),c=e.getUint8(3),u=e.getUint8(4),d=this.HEADER_LENGTH+this.META_LENGTH,m=i.decode(n.slice(d,d+a));d=d+a;let p=i.decode(n.slice(d,d+l));d=d+l;let y=i.decode(n.slice(d,d+c));d=d+c;let v=i.decode(n.slice(d,d+u));d=d+u;let x=n.slice(d,n.byteLength),_={status:v,response:x};return{join_ref:m,ref:p,topic:y,event:Ns.reply,payload:_}},decodeBroadcast(n,e,i){let a=e.getUint8(1),l=e.getUint8(2),c=this.HEADER_LENGTH+2,u=i.decode(n.slice(c,c+a));c=c+a;let d=i.decode(n.slice(c,c+l));c=c+l;let m=n.slice(c,n.byteLength);return{join_ref:null,ref:null,topic:u,event:d,payload:m}}},VN=class{constructor(n,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||MN,this.transport=e.transport||Qn.WebSocket||Ea,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let i=null;try{i=Qn&&Qn.sessionStorage}catch{}this.sessionStore=e.sessionStorage||i,this.establishedConnections=0,this.defaultEncoder=Zl.encode.bind(Zl),this.defaultDecoder=Zl.decode.bind(Zl),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Ea?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let a=null;Da&&Da.addEventListener&&(Da.addEventListener("pagehide",l=>{this.conn&&(this.disconnect(),a=this.connectClock)}),Da.addEventListener("pageshow",l=>{a===this.connectClock&&(a=null,this.connect())}),Da.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=l=>e.rejoinAfterMs?e.rejoinAfterMs(l):[1e3,2e3,5e3][l-1]||1e4,this.reconnectAfterMs=l=>e.reconnectAfterMs?e.reconnectAfterMs(l):[10,50,100,150,200,250,500,1e3,2e3][l-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(l,c,u)=>{console.log(`${l}: ${c}`,u)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=so(e.params||{}),this.endPoint=`${n}/${hf.websocket}`,this.vsn=e.vsn||DN,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new vw(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return Ea}replaceTransport(n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=n}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let n=jc.appendParams(jc.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return n.charAt(0)!=="/"?n:n.charAt(1)==="/"?`${this.protocol()}:${n}`:`${this.protocol()}://${location.host}${n}`}disconnect(n,e,i){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,n&&n()},e,i)}connect(n){n&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=so(n)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Ea?this.connectWithFallback(Ea,this.longPollFallbackMs):this.transportConnect())}log(n,e,i){this.logger&&this.logger(n,e,i)}hasLogger(){return this.logger!==null}onOpen(n){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,n]),e}onClose(n){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,n]),e}onError(n){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,n]),e}onMessage(n){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,n]),e}onHeartbeat(n){this.heartbeatCallback=n}ping(n){if(!this.isConnected())return!1;let e=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let a=this.onMessage(l=>{l.ref===e&&(this.off([a]),n(Date.now()-i))});return!0}transportName(n){switch(n){case Ea:return"LongPoll";default:return n.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let n;this.authToken&&(n=["phoenix",`${df}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),n),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(n){return this.sessionStore&&this.sessionStore.getItem(n)}storeSession(n,e){this.sessionStore&&this.sessionStore.setItem(n,e)}connectWithFallback(n,e=2500){clearTimeout(this.fallbackTimer);let i=!1,a=!0,l,c,u=this.transportName(n),d=m=>{this.log("transport",`falling back to ${u}...`,m),this.off([l,c]),a=!1,this.replaceTransport(n),this.transportConnect()};if(this.getSession(`phx:fallback:${u}`))return d("memorized");this.fallbackTimer=setTimeout(d,e),c=this.onError(m=>{this.log("transport","error",m),a&&!i&&(clearTimeout(this.fallbackTimer),d(m))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!a){let m=this.transportName(n);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${m}`,"true"),this.log("transport",`established ${m} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(d,e),this.ping(m=>{this.log("transport","connected to primary after",m),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(n){this.log("error","error in heartbeat callback",n)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),BN,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(n,e,i){if(!this.conn)return n&&n();const a=this.conn;this.waitForBufferDone(a,()=>{e?a.close(e,i||""):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),n&&n()})})}waitForBufferDone(n,e,i=1){if(i===5||!n.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(n,e,i+1)},150*i)}waitForSocketClosed(n,e,i=1){if(i===5||n.readyState===Wn.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(n,e,i+1)},150*i)}onConnClose(n){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",n),this.triggerChanError(n),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",n)}onConnError(n){this.hasLogger()&&this.log("transport","error",n);let e=this.transport,i=this.establishedConnections;this.triggerStateCallbacks("error",n,e,i),(e===this.transport||i>0)&&this.triggerChanError(n)}triggerChanError(n){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Ns.error,n)})}connectionState(){switch(this.conn&&this.conn.readyState){case Wn.connecting:return"connecting";case Wn.open:return"open";case Wn.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(n){this.off(n.stateChangeRefs),this.channels=this.channels.filter(e=>e!==n)}off(n){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([i])=>n.indexOf(i)===-1)}channel(n,e={}){let i=new LN(n,e,this);return this.channels.push(i),i}push(n){if(this.hasLogger()){let{topic:e,event:i,payload:a,ref:l,join_ref:c}=n;this.log("push",`${e} ${i} (${c}, ${l})`,a)}this.isConnected()?this.encode(n,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(n,e=>this.conn.send(e)))}makeRef(){let n=this.ref+1;return n===this.ref?this.ref=0:this.ref=n,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}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(n){this.log("error","error in heartbeat callback",n)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(n=>n()),this.sendBuffer=[])}onConnMessage(n){this.decode(n.data,e=>{let{topic:i,event:a,payload:l,ref:c,join_ref:u}=e;if(c&&c===this.pendingHeartbeatRef){const d=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(l.status==="ok"?"ok":"error",d)}catch(m){this.log("error","error in heartbeat callback",m)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${l.status||""} ${i} ${a} ${c&&"("+c+")"||""}`.trim(),l);for(let d=0;d<this.channels.length;d++){const m=this.channels[d];m.isMember(i,a,l,u)&&m.trigger(a,l,c,u)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(n,...e){try{this.stateChangeCallbacks[n].forEach(([i,a])=>{try{a(...e)}catch(l){this.log("error",`error in ${n} callback`,l)}})}catch(i){this.log("error",`error triggering ${n} callbacks`,i)}}leaveOpenTopic(n){let e=this.channels.find(i=>i.topic===n&&(i.isJoined()||i.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${n}"`),e.leave())}};class io{constructor(e,i){const a=$N(i);this.presence=new PN(e.getChannel(),a),this.presence.onJoin((l,c,u)=>{const d=io.onJoinPayload(l,c,u);e.getChannel().trigger("presence",d)}),this.presence.onLeave((l,c,u)=>{const d=io.onLeavePayload(l,c,u);e.getChannel().trigger("presence",d)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return io.transformState(this.presence.state)}static transformState(e){return e=HN(e),Object.getOwnPropertyNames(e).reduce((i,a)=>{const l=e[a];return i[a]=mc(l),i},{})}static onJoinPayload(e,i,a){const l=kb(i),c=mc(a);return{event:"join",key:e,currentPresences:l,newPresences:c}}static onLeavePayload(e,i,a){const l=kb(i),c=mc(a);return{event:"leave",key:e,currentPresences:l,leftPresences:c}}}function mc(n){return n.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function HN(n){return JSON.parse(JSON.stringify(n))}function $N(n){return(n==null?void 0:n.events)&&{events:n.events}}function kb(n){return n!=null&&n.metas?mc(n):[]}var Cb;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(Cb||(Cb={}));class qN{get state(){return this.presenceAdapter.state}constructor(e,i){this.channel=e,this.presenceAdapter=new io(this.channel.channelAdapter,i)}}function FN(n){if(n instanceof Error)return n;if(typeof n=="string")return new Error(n);if(n&&typeof n=="object"){const e=n;if(typeof e.code=="number"){const i=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${i}`,{cause:n})}return new Error("channel error: transport failure",{cause:n})}return new Error("channel error: connection lost")}class IN{constructor(e,i,a){const l=GN(a);this.channel=e.getSocket().channel(i,l),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,i){return this.channel.on(e,i)}off(e,i){this.channel.off(e,i)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,i,a){let l;try{l=this.channel.push(e,i,a)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>TN){const c=this.channel.pushBuffer.shift();c.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${c.event}`,c.payload())}return l}updateJoinPayload(e){const i=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},i),e)}canPush(){return this.socket.isConnected()&&this.state===si.joined}isJoined(){return this.state===si.joined}isJoining(){return this.state===si.joining}isClosed(){return this.state===si.closed}isLeaving(){return this.state===si.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function GN(n){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config)}}const KN=/[,()"\\]/,YN=n=>KN.test(n)||n!==n.trim(),XN=n=>`"${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ob=n=>{const e=n===null?"null":String(n);return YN(e)?XN(e):e},JN=n=>n===null?"null":String(n),QN=(n,e)=>{if(n==="in"){const i=Array.isArray(e)?e:[e];if(i.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(i)).map(l=>Ob(l)).join(",")})`}return n==="is"?`is.${JN(e)}`:`${n}.${Ob(e)}`};class ZN{constructor(){this.filters=[]}add(e,i,a,l=!1){const c=l?"not.":"";return this.filters.push(`${e}=${c}${QN(i,a)}`),this}eq(e,i){return this.add(e,"eq",i)}neq(e,i){return this.add(e,"neq",i)}gt(e,i){return this.add(e,"gt",i)}gte(e,i){return this.add(e,"gte",i)}lt(e,i){return this.add(e,"lt",i)}lte(e,i){return this.add(e,"lte",i)}in(e,i){return this.add(e,"in",i)}like(e,i){return this.add(e,"like",i)}ilike(e,i){return this.add(e,"ilike",i)}match(e,i){return this.add(e,"match",i)}imatch(e,i){return this.add(e,"imatch",i)}is(e,i){return this.add(e,"is",i)}isDistinct(e,i){return this.add(e,"isdistinct",i)}not(e,i,a){return this.add(e,i,a,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var Db;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(Db||(Db={}));var Pa;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(Pa||(Pa={}));var Rs;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(Rs||(Rs={}));class ao{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}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(e,i={config:{}},a){var l,c;if(this.topic=e,this.params=i,this.socket=a,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},i.config),this.channelAdapter=new IN(this.socket.socketAdapter,e,this.params),this.presence=new qN(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=bw(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((c=(l=this.params.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,i=this.timeout){var a,l,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:m}}=this.params,p=(l=(a=this.bindings.postgres_changes)===null||a===void 0?void 0:a.map(_=>_.filter))!==null&&l!==void 0?l:[],y=!!this.bindings[Pa.PRESENCE]&&this.bindings[Pa.PRESENCE].length>0||((c=this.params.config.presence)===null||c===void 0?void 0:c.enabled)===!0,v={},x={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:y}),postgres_changes:p,private:m};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(_=>{e==null||e(Rs.CHANNEL_ERROR,FN(_))}),this._onClose(()=>e==null?void 0:e(Rs.CLOSED)),this.updateJoinPayload(Object.assign({config:x},v)),this._updateFilterMessage(),this.channelAdapter.subscribe(i).receive("ok",async({postgres_changes:_})=>{if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){e==null||e(Rs.SUBSCRIBED);return}this._updatePostgresBindings(_,e)}).receive("error",_=>{this.state=si.errored;const S=Object.values(_).join(", ")||"error";e==null||e(Rs.CHANNEL_ERROR,new Error(S,{cause:_}))}).receive("timeout",()=>{e==null||e(Rs.TIMED_OUT)})}return this}_updatePostgresBindings(e,i){var a;const l=this.bindings.postgres_changes,c=(a=l==null?void 0:l.length)!==null&&a!==void 0?a:0,u=[];for(let d=0;d<c;d++){const m=l[d],{filter:{event:p,schema:y,table:v,filter:x}}=m,_=e&&e[d];if(_&&_.event===p&&ao.isFilterValueEqual(_.schema,y)&&ao.isFilterValueEqual(_.table,v)&&ao.isFilterValueEqual(_.filter,x))u.push(Object.assign(Object.assign({},m),{id:_.id}));else{this.unsubscribe(),this.state=si.errored,i==null||i(Rs.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=u,this.state!=si.errored&&i&&i(Rs.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,i={}){return await this.send({type:"presence",event:"track",payload:e},i.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,i,a){const l=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),c=e===Pa.PRESENCE||e===Pa.POSTGRES_CHANGES;if(l&&c)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,i,a)}async httpSend(e,i,a={}){var l;if(i==null)return Promise.reject(new Error("Payload is required for httpSend()"));const c=i instanceof ArrayBuffer||ArrayBuffer.isView(i),u={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":c?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(u.Authorization=`Bearer ${this.socket.accessTokenValue}`);const d=new URL(this.broadcastEndpointURL);d.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&d.searchParams.set("private","true");const m={method:"POST",headers:u,body:c?i:JSON.stringify(i)},p=await this._fetchWithTimeout(d.toString(),m,(l=a.timeout)!==null&&l!==void 0?l:this.timeout);if(p.status===202)return{success:!0};if(p.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let y=p.statusText;try{const v=await p.json();y=v.error||v.message||y}catch{}return Promise.reject(new Error(y))}async send(e,i={}){var a,l;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:c,payload:u}=e,d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const m={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:c,payload:u,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,m,(a=i.timeout)!==null&&a!==void 0?a:this.timeout);return await((l=p.body)===null||l===void 0?void 0:l.cancel()),p.ok?"ok":"error"}catch(p){return p instanceof Error&&p.name==="AbortError"?"timed out":"error"}}else return new Promise(c=>{var u,d,m;const p=this.channelAdapter.push(e.type,e,i.timeout||this.timeout);e.type==="broadcast"&&!(!((m=(d=(u=this.params)===null||u===void 0?void 0:u.config)===null||d===void 0?void 0:d.broadcast)===null||m===void 0)&&m.ack)&&c("ok"),p.receive("ok",()=>c("ok")),p.receive("error",()=>c("error")),p.receive("timeout",()=>c("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(i=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>i("ok")).receive("timeout",()=>i("timed out")).receive("error",()=>i("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,i,a){const l=new AbortController,c=setTimeout(()=>l.abort(),a),u=await this.socket.fetch(e,Object.assign(Object.assign({},i),{signal:l.signal}));return clearTimeout(c),u}_on(e,i,a){const l=e.toLocaleLowerCase(),c=i==null?void 0:i.filter;(c instanceof ZN||typeof c=="object"&&c!==null&&typeof c.build=="function")&&(i=Object.assign(Object.assign({},i),{filter:c.build()}));const u=this.channelAdapter.on(e,a),d={type:l,filter:i,callback:a,ref:u};return this.bindings[l]?this.bindings[l].push(d):this.bindings[l]=[d],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,i,a)=>{var l,c,u,d,m,p,y;const v=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(v,a))return!1;const x=(l=this.bindings[v])===null||l===void 0?void 0:l.find(_=>_.ref===e.ref);if(!x)return!0;if(["broadcast","presence","postgres_changes"].includes(v))if("id"in x){const _=x.id,S=(c=x.filter)===null||c===void 0?void 0:c.event;return _&&((u=i.ids)===null||u===void 0?void 0:u.includes(_))&&(S==="*"||(S==null?void 0:S.toLocaleLowerCase())===((d=i.data)===null||d===void 0?void 0:d.type.toLocaleLowerCase()))}else{const _=(p=(m=x==null?void 0:x.filter)===null||m===void 0?void 0:m.event)===null||p===void 0?void 0:p.toLocaleLowerCase();return _==="*"||_===((y=i==null?void 0:i.event)===null||y===void 0?void 0:y.toLocaleLowerCase())}else return x.type.toLocaleLowerCase()===v})}_notThisChannelEvent(e,i){const{close:a,error:l,leave:c,join:u}=gw;return i&&[a,l,c,u].includes(e)&&i!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,i,a)=>{if(typeof i=="object"&&"ids"in i){const l=i.data,{schema:c,table:u,commit_timestamp:d,type:m,errors:p}=l;return Object.assign(Object.assign({},{schema:c,table:u,commit_timestamp:d,eventType:m,new:{},old:{},errors:p}),this._getPayloadRecords(l))}return i})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const i in e.bindings)for(const a of e.bindings[i])this._on(a.type,a.filter,a.callback)}static isFilterValueEqual(e,i){return(e??void 0)===(i??void 0)}_getPayloadRecords(e){const i={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(i.new=Rb(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(i.old=Rb(e.columns,e.old_record)),i}}class WN{constructor(e,i){this.socket=new VN(e,i)}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(e){this.socket.heartbeatCallback=e}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(e,i,a,l=1e4){return new Promise(c=>{setTimeout(()=>c("timeout"),l),this.socket.disconnect(()=>{e(),c("ok")},i,a)})}push(e){this.socket.push(e)}log(e,i,a){this.socket.log(e,i,a)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==cf.connecting}isDisconnecting(){return this.socket.connectionState()==cf.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Mb={HEARTBEAT_INTERVAL:25e3},eR=[1e3,2e3,5e3,1e4],tR=1e4;function nR(){const n=new Map;return{get length(){return n.size},clear(){n.clear()},getItem(e){return n.has(e)?n.get(e):null},key(e){var i;return(i=Array.from(n.keys())[e])!==null&&i!==void 0?i:null},removeItem(e){n.delete(e)},setItem(e,i){n.set(e,String(i))}}}function sR(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return nR()}const iR=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class aR{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(e,i){var a;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new EN,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=c=>c?(...u)=>c(...u):(...u)=>fetch(...u),!(!((a=i==null?void 0:i.params)===null||a===void 0)&&a.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=i.params.apikey;const l=this._initializeOptions(i);this.socketAdapter=new WN(e,l),this.httpEndpoint=bw(e),this.fetch=this._resolveFetch(i==null?void 0:i.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const i=e.message;throw new Error(`WebSocket not available: ${i}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,i){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,i)}getChannels(){return this.channels}async removeChannel(e){const i=await e.unsubscribe();return i==="ok"&&e.teardown(),i}async removeAllChannels(){const e=this.channels.map(async a=>{const l=await a.unsubscribe();return a.teardown(),l}),i=await Promise.all(e);return await this.disconnect(),i}log(e,i,a){this.socketAdapter.log(e,i,a)}connectionState(){return this.socketAdapter.connectionState()||cf.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,i={config:{}}){const a=`realtime:${e}`,l=this.getChannels().find(c=>c.topic===a);if(l)return l;{const c=new ao(`realtime:${e}`,i,this);return this._cancelPendingDisconnect(),this.channels.push(c),c}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(i=>i.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let i,a=!1;if(e)i=e,a=!0;else if(this.accessToken)try{i=await this.accessToken()}catch(l){this.log("error","Error fetching access token from callback",l),i=this.accessTokenValue}else i=this.accessTokenValue;a?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=i&&(this.accessTokenValue=i,this.channels.forEach(l=>{const c={access_token:i,version:xN};i&&l.updateJoinPayload(c),l.joinedOnce&&l.channelAdapter.isJoined()&&l.channelAdapter.push(gw.access_token,{access_token:i})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(i=>{this.log("error",`Error setting auth in ${e}`,i)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(i=>{this.log("error","error waiting for auth on connect",i)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(i,a)=>{i!=="disconnected"&&(i=="sent"&&this._setAuthSafely(),e&&e(i,a))}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=i=>{this.log("worker","worker error",i.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=i=>{i.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(e){let i;if(e)i=e;else{const a=new Blob([iR],{type:"application/javascript"});i=URL.createObjectURL(a)}return i}_initializeOptions(e){var i,a,l,c,u,d,m,p,y,v,x,_;this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(a=e==null?void 0:e.accessToken)!==null&&a!==void 0?a:null;const S={};S.timeout=(l=e==null?void 0:e.timeout)!==null&&l!==void 0?l:SN,S.heartbeatIntervalMs=(c=e==null?void 0:e.heartbeatIntervalMs)!==null&&c!==void 0?c:Mb.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(u=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&u!==void 0?u:2*((d=e==null?void 0:e.heartbeatIntervalMs)!==null&&d!==void 0?d:Mb.HEARTBEAT_INTERVAL),S.transport=(m=e==null?void 0:e.transport)!==null&&m!==void 0?m:bN.getWebSocketConstructor(),S.params=e==null?void 0:e.params,S.logger=e==null?void 0:e.logger,S.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),S.sessionStorage=(p=e==null?void 0:e.sessionStorage)!==null&&p!==void 0?p:sR(),S.reconnectAfterMs=(y=e==null?void 0:e.reconnectAfterMs)!==null&&y!==void 0?y:(M=>eR[M-1]||tR);let T,j;const k=(v=e==null?void 0:e.vsn)!==null&&v!==void 0?v:_N;switch(k){case wN:T=(M,C)=>C(JSON.stringify(M)),j=(M,C)=>C(JSON.parse(M));break;case pw:T=this.serializer.encode.bind(this.serializer),j=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${S.vsn}`)}if(S.vsn=k,S.encode=(x=e==null?void 0:e.encode)!==null&&x!==void 0?x:T,S.decode=(_=e==null?void 0:e.decode)!==null&&_!==void 0?_:j,S.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.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=e==null?void 0:e.workerUrl,S.autoSendHeartbeat=!this.worker}return S}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var fo=class extends Error{constructor(n,e){var i;super(n),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((i=e.icebergType)==null?void 0:i.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function rR(n,e,i){const a=new URL(e,n);if(i)for(const[l,c]of Object.entries(i))c!==void 0&&a.searchParams.set(l,c);return a.toString()}async function oR(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function lR(n){const e=n.fetchImpl??globalThis.fetch;return{async request({method:i,path:a,query:l,body:c,headers:u}){const d=rR(n.baseUrl,a,l),m=await oR(n.auth),p=await e(d,{method:i,headers:{...c?{"Content-Type":"application/json"}:{},...m,...u},body:c?JSON.stringify(c):void 0}),y=await p.text(),v=(p.headers.get("content-type")||"").includes("application/json"),x=v&&y?JSON.parse(y):y;if(!p.ok){const _=v?x:void 0,S=_==null?void 0:_.error;throw new fo((S==null?void 0:S.message)??`Request failed with status ${p.status}`,{status:p.status,icebergType:S==null?void 0:S.type,icebergCode:S==null?void 0:S.code,details:_})}return{status:p.status,headers:p.headers,data:x}}}}function Wl(n){return n.join("")}var cR=class{constructor(n,e=""){this.client=n,this.prefix=e}async listNamespaces(n){const e=n?{parent:Wl(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(a=>({namespace:a}))}async createNamespace(n,e){const i={namespace:n.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:i})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Wl(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Wl(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Wl(n.namespace)}`}),!0}catch(e){if(e instanceof fo&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(n,e){try{return await this.createNamespace(n,e)}catch(i){if(i instanceof fo&&i.status===409)return;throw i}}};function Aa(n){return n.join("")}var uR=class{constructor(n,e="",i){this.client=n,this.prefix=e,this.accessDelegation=i}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Aa(n.namespace)}/tables`})).data.identifiers}async createTable(n,e){const i={};return this.accessDelegation&&(i["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Aa(n.namespace)}/tables`,body:e,headers:i})).data.metadata}async updateTable(n,e){const i=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Aa(n.namespace)}/tables/${n.name}`,body:e});return{"metadata-location":i.data["metadata-location"],metadata:i.data.metadata}}async dropTable(n,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Aa(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(n){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Aa(n.namespace)}/tables/${n.name}`,headers:e})).data.metadata}async tableExists(n){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Aa(n.namespace)}/tables/${n.name}`,headers:e}),!0}catch(i){if(i instanceof fo&&i.status===404)return!1;throw i}}async createTableIfNotExists(n,e){try{return await this.createTable(n,e)}catch(i){if(i instanceof fo&&i.status===409)return await this.loadTable({namespace:n.namespace,name:e.name});throw i}}},hR=class{constructor(n){var a;let e="v1";n.catalogName&&(e+=`/${n.catalogName}`);const i=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=lR({baseUrl:i,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=(a=n.accessDelegation)==null?void 0:a.join(","),this.namespaceOps=new cR(this.client,e),this.tableOps=new uR(this.client,e,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,e){return this.namespaceOps.createNamespace(n,e)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}async createTable(n,e){return this.tableOps.createTable(n,e)}async updateTable(n,e){return this.tableOps.updateTable(n,e)}async dropTable(n,e){await this.tableOps.dropTable(n,e)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,e){return this.namespaceOps.createNamespaceIfNotExists(n,e)}async createTableIfNotExists(n,e){return this.tableOps.createTableIfNotExists(n,e)}};function mo(n){"@babel/helpers - typeof";return mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mo(n)}function dR(n,e){if(mo(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var a=i.call(n,e);if(mo(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function fR(n){var e=dR(n,"string");return mo(e)=="symbol"?e:e+""}function mR(n,e,i){return(e=fR(e))in n?Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[e]=i,n}function Bb(n,e){var i=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),i.push.apply(i,a)}return i}function fe(n){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?Bb(Object(i),!0).forEach(function(a){mR(n,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Bb(Object(i)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(i,a))})}return n}var $c=class extends Error{constructor(n,e="storage",i,a){super(n),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=i,this.statusCode=a}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function qc(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var ff=class extends $c{constructor(n,e,i,a="storage"){super(n,a,e,i),this.name=a==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=i}toJSON(){return fe({},super.toJSON())}},xw=class extends $c{constructor(n,e,i="storage"){super(n,i),this.name=i==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Nc(n,e,i){const a=fe({},n),l=e.toLowerCase();for(const c of Object.keys(a))c.toLowerCase()===l&&delete a[c];return a[l]=i,a}function pR(n){const e={};for(const[i,a]of Object.entries(n))e[i.toLowerCase()]=a;return e}const gR=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),yR=n=>{if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},mf=n=>{if(Array.isArray(n))return n.map(i=>mf(i));if(typeof n=="function"||n!==Object(n))return n;const e={};return Object.entries(n).forEach(([i,a])=>{const l=i.replace(/([-_][a-z])/gi,c=>c.toUpperCase().replace(/[-_]/g,""));e[l]=mf(a)}),e},bR=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n),Ub=n=>{if(typeof n=="object"&&n!==null){const e=n;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const i=e.error;if(typeof i.message=="string")return i.message}}return JSON.stringify(n)},vR=async(n,e,i,a)=>{if(n!==null&&typeof n=="object"&&"json"in n&&typeof n.json=="function"){const l=n;let c=parseInt(String(l.status),10);Number.isFinite(c)||(c=500),l.json().then(u=>{const d=(u==null?void 0:u.statusCode)||(u==null?void 0:u.code)||c+"";e(new ff(Ub(u),c,d,a))}).catch(()=>{const u=c+"";e(new ff(l.statusText||`HTTP ${c} error`,c,u,a))})}else e(new xw(Ub(n),n,a))},xR=(n,e,i,a)=>{const l={method:n,headers:(e==null?void 0:e.headers)||{}};if(n==="GET"||n==="HEAD"||!a)return fe(fe({},l),i);if(yR(a)){var c;const u=(e==null?void 0:e.headers)||{};let d;for(const[m,p]of Object.entries(u))m.toLowerCase()==="content-type"&&(d=p);l.headers=Nc(u,"Content-Type",(c=d)!==null&&c!==void 0?c:"application/json"),l.body=JSON.stringify(a)}else l.body=a;return e!=null&&e.duplex&&(l.duplex=e.duplex),fe(fe({},l),i)};async function Gr(n,e,i,a,l,c,u){return new Promise((d,m)=>{n(i,xR(e,a,l,c)).then(p=>{if(!p.ok)throw p;if(a!=null&&a.noResolveJson)return p;if(u==="vectors"){const y=p.headers.get("content-type");if(p.headers.get("content-length")==="0"||p.status===204)return{};if(!y||!y.includes("application/json"))return{}}return p.json()}).then(p=>d(p)).catch(p=>vR(p,m,a,u))})}function ww(n="storage"){return{get:async(e,i,a,l)=>Gr(e,"GET",i,a,l,void 0,n),post:async(e,i,a,l,c)=>Gr(e,"POST",i,l,c,a,n),put:async(e,i,a,l,c)=>Gr(e,"PUT",i,l,c,a,n),head:async(e,i,a,l)=>Gr(e,"HEAD",i,fe(fe({},a),{},{noResolveJson:!0}),l,void 0,n),remove:async(e,i,a,l,c)=>Gr(e,"DELETE",i,l,c,a,n)}}const wR=ww("storage"),{get:po,post:Pn,put:pf,head:_R,remove:go}=wR,on=ww("vectors");var Ja=class{constructor(n,e={},i,a="storage"){this.shouldThrowOnError=!1,this.url=n,this.headers=pR(e),this.fetch=gR(i),this.namespace=a}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,e){return this.headers=Nc(this.headers,n,e),this}async handleOperation(n){var e=this;try{return{data:await n(),error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(qc(i))return{data:null,error:i};throw i}}};let _w;_w=Symbol.toStringTag;var SR=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e,this[_w]="StreamDownloadBuilder",this.promise=null}then(n,e){return this.getPromise().then(n,e)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(qc(e))return{data:null,error:e};throw e}}};let Sw;Sw=Symbol.toStringTag;var TR=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e,this[Sw]="BlobDownloadBuilder",this.promise=null}asStream(){return new SR(this.downloadFn,this.shouldThrowOnError)}then(n,e){return this.getPromise().then(n,e)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(qc(e))return{data:null,error:e};throw e}}};const Sd={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Lb={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var ER=class extends Ja{constructor(n,e={},i,a){super(n,e,a,"storage"),this.bucketId=i}async uploadOrUpdate(n,e,i,a){var l=this;return l.handleOperation(async()=>{let c;const u=fe(fe({},Lb),a);let d=fe(fe({},l.headers),n==="POST"&&{"x-upsert":String(u.upsert)});const m=u.metadata;if(typeof Blob<"u"&&i instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),m&&c.append("metadata",l.encodeMetadata(m)),c.append("",i)):typeof FormData<"u"&&i instanceof FormData?(c=i,c.has("cacheControl")||c.append("cacheControl",u.cacheControl),m&&!c.has("metadata")&&c.append("metadata",l.encodeMetadata(m))):(c=i,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,m&&(d["x-metadata"]=l.toBase64(l.encodeMetadata(m))),(typeof ReadableStream<"u"&&c instanceof ReadableStream||c&&typeof c=="object"&&"pipe"in c&&typeof c.pipe=="function")&&!u.duplex&&(u.duplex="half")),a!=null&&a.headers)for(const[x,_]of Object.entries(a.headers))d=Nc(d,x,_);const p=l._removeEmptyFolders(e),y=l._getFinalPath(p),v=await(n=="PUT"?pf:Pn)(l.fetch,`${l.url}/object/${y}`,c,fe({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}));return{path:p,id:v.Id,fullPath:v.Key}})}async upload(n,e,i){return this.uploadOrUpdate("POST",n,e,i)}async uploadToSignedUrl(n,e,i,a){var l=this;const c=l._removeEmptyFolders(n),u=l._getFinalPath(c),d=new URL(l.url+`/object/upload/sign/${u}`);return d.searchParams.set("token",e),l.handleOperation(async()=>{let m;const p=fe(fe({},Lb),a);let y=fe(fe({},l.headers),{"x-upsert":String(p.upsert)});const v=p.metadata;if(typeof Blob<"u"&&i instanceof Blob?(m=new FormData,m.append("cacheControl",p.cacheControl),v&&m.append("metadata",l.encodeMetadata(v)),m.append("",i)):typeof FormData<"u"&&i instanceof FormData?(m=i,m.has("cacheControl")||m.append("cacheControl",p.cacheControl),v&&!m.has("metadata")&&m.append("metadata",l.encodeMetadata(v))):(m=i,y["cache-control"]=`max-age=${p.cacheControl}`,y["content-type"]=p.contentType,v&&(y["x-metadata"]=l.toBase64(l.encodeMetadata(v))),(typeof ReadableStream<"u"&&m instanceof ReadableStream||m&&typeof m=="object"&&"pipe"in m&&typeof m.pipe=="function")&&!p.duplex&&(p.duplex="half")),a!=null&&a.headers)for(const[x,_]of Object.entries(a.headers))y=Nc(y,x,_);return{path:c,fullPath:(await pf(l.fetch,d.toString(),m,fe({headers:y},p!=null&&p.duplex?{duplex:p.duplex}:{}))).Key}})}async createSignedUploadUrl(n,e){var i=this;return i.handleOperation(async()=>{let a=i._getFinalPath(n);const l=fe({},i.headers);e!=null&&e.upsert&&(l["x-upsert"]="true");const c=await Pn(i.fetch,`${i.url}/object/upload/sign/${a}`,{},{headers:l}),u=new URL(i.url+c.url),d=u.searchParams.get("token");if(!d)throw new $c("No token returned by API");return{signedUrl:u.toString(),path:n,token:d}})}async update(n,e,i){return this.uploadOrUpdate("PUT",n,e,i)}async move(n,e,i){var a=this;return a.handleOperation(async()=>await Pn(a.fetch,`${a.url}/object/move`,{bucketId:a.bucketId,sourceKey:n,destinationKey:e,destinationBucket:i==null?void 0:i.destinationBucket},{headers:a.headers}))}async copy(n,e,i){var a=this;return a.handleOperation(async()=>({path:(await Pn(a.fetch,`${a.url}/object/copy`,{bucketId:a.bucketId,sourceKey:n,destinationKey:e,destinationBucket:i==null?void 0:i.destinationBucket},{headers:a.headers})).Key}))}async createSignedUrl(n,e,i){var a=this;return a.handleOperation(async()=>{let l=a._getFinalPath(n);const c=typeof(i==null?void 0:i.transform)=="object"&&i.transform!==null&&Object.keys(i.transform).length>0;let u=await Pn(a.fetch,`${a.url}/object/sign/${l}`,fe({expiresIn:e},c?{transform:i.transform}:{}),{headers:a.headers});const d=new URLSearchParams;i!=null&&i.download&&d.set("download",i.download===!0?"":i.download),(i==null?void 0:i.cacheNonce)!=null&&d.set("cacheNonce",String(i.cacheNonce));const m=d.toString();return{signedUrl:encodeURI(`${a.url}${u.signedURL}${m?`&${m}`:""}`)}})}async createSignedUrls(n,e,i){var a=this;return a.handleOperation(async()=>{const l=await Pn(a.fetch,`${a.url}/object/sign/${a.bucketId}`,{expiresIn:e,paths:n},{headers:a.headers}),c=new URLSearchParams;i!=null&&i.download&&c.set("download",i.download===!0?"":i.download),(i==null?void 0:i.cacheNonce)!=null&&c.set("cacheNonce",String(i.cacheNonce));const u=c.toString();return l.map(d=>fe(fe({},d),{},{signedUrl:d.signedURL?encodeURI(`${a.url}${d.signedURL}${u?`&${u}`:""}`):null}))})}download(n,e,i){const a=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",l=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(l,e.transform),(e==null?void 0:e.cacheNonce)!=null&&l.set("cacheNonce",String(e.cacheNonce));const c=l.toString(),u=this._getFinalPath(n),d=()=>po(this.fetch,`${this.url}/${a}/${u}${c?`?${c}`:""}`,{headers:this.headers,noResolveJson:!0},i);return new TR(d,this.shouldThrowOnError)}async info(n){var e=this;const i=e._getFinalPath(n);return e.handleOperation(async()=>mf(await po(e.fetch,`${e.url}/object/info/${i}`,{headers:e.headers})))}async exists(n){var e=this;const i=e._getFinalPath(n);try{return await _R(e.fetch,`${e.url}/object/${i}`,{headers:e.headers}),{data:!0,error:null}}catch(l){if(e.shouldThrowOnError)throw l;if(qc(l)){var a;const c=l instanceof ff?l.status:l instanceof xw?(a=l.originalError)===null||a===void 0?void 0:a.status:void 0;if(c!==void 0&&[400,404].includes(c))return{data:!1,error:l}}throw l}}getPublicUrl(n,e){const i=this._getFinalPath(n),a=new URLSearchParams;e!=null&&e.download&&a.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(a,e.transform),(e==null?void 0:e.cacheNonce)!=null&&a.set("cacheNonce",String(e.cacheNonce));const l=a.toString(),c=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${c}/public/${i}`)+(l?`?${l}`:"")}}}async remove(n){var e=this;return e.handleOperation(async()=>await go(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:n},{headers:e.headers}))}async purgeCache(n,e,i){var a=this;return a.handleOperation(async()=>{const l=a._getFinalPath(n),c=new URLSearchParams;e!=null&&e.transformations&&c.set("transformations","true");const u=c.toString();return await go(a.fetch,`${a.url}/cdn/${l}${u?`?${u}`:""}`,{},{headers:a.headers},i)})}async list(n,e,i){var a=this;return a.handleOperation(async()=>{const l=e!=null&&e.sortBy?fe(fe({},Sd.sortBy),e.sortBy):Sd.sortBy,c=fe(fe(fe({},Sd),e),{},{sortBy:l,prefix:n||""});return await Pn(a.fetch,`${a.url}/object/list/${a.bucketId}`,c,{headers:a.headers},i)})}async listV2(n,e){var i=this;return i.handleOperation(async()=>{const a=fe({},n);return await Pn(i.fetch,`${i.url}/object/list-v2/${i.bucketId}`,a,{headers:i.headers},e)})}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(n,e){return e.width&&n.set("width",e.width.toString()),e.height&&n.set("height",e.height.toString()),e.resize&&n.set("resize",e.resize),e.format&&n.set("format",e.format),e.quality&&n.set("quality",e.quality.toString()),n}};const AR="2.110.2",To={"X-Client-Info":`storage-js/${AR}`};var jR=class extends Ja{constructor(n,e={},i,a){const l=new URL(n);a!=null&&a.useNewHostname&&/supabase\.(co|in|red)$/.test(l.hostname)&&!l.hostname.includes("storage.supabase.")&&(l.hostname=l.hostname.replace("supabase.","storage.supabase."));const c=l.href.replace(/\/$/,""),u=fe(fe({},To),e);super(c,u,i,"storage")}async listBuckets(n){var e=this;return e.handleOperation(async()=>{const i=e.listBucketOptionsToQueryString(n);return await po(e.fetch,`${e.url}/bucket${i}`,{headers:e.headers})})}async getBucket(n){var e=this;return e.handleOperation(async()=>await po(e.fetch,`${e.url}/bucket/${n}`,{headers:e.headers}))}async createBucket(n,e={public:!1}){var i=this;return i.handleOperation(async()=>await Pn(i.fetch,`${i.url}/bucket`,{id:n,name:n,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:i.headers}))}async updateBucket(n,e){var i=this;return i.handleOperation(async()=>await pf(i.fetch,`${i.url}/bucket/${n}`,{id:n,name:n,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:i.headers}))}async emptyBucket(n){var e=this;return e.handleOperation(async()=>await Pn(e.fetch,`${e.url}/bucket/${n}/empty`,{},{headers:e.headers}))}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await go(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}))}async purgeBucketCache(n,e,i){var a=this;return a.handleOperation(async()=>{const l=new URLSearchParams;e!=null&&e.transformations&&l.set("transformations","true");const c=l.toString();return await go(a.fetch,`${a.url}/cdn/${n}${c?`?${c}`:""}`,{},{headers:a.headers},i)})}listBucketOptionsToQueryString(n){const e={};return n&&("limit"in n&&(e.limit=String(n.limit)),"offset"in n&&(e.offset=String(n.offset)),n.search&&(e.search=n.search),n.sortColumn&&(e.sortColumn=n.sortColumn),n.sortOrder&&(e.sortOrder=n.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},NR=class extends Ja{constructor(n,e={},i){const a=n.replace(/\/$/,""),l=fe(fe({},To),e);super(a,l,i,"storage")}async createBucket(n){var e=this;return e.handleOperation(async()=>await Pn(e.fetch,`${e.url}/bucket`,{name:n},{headers:e.headers}))}async listBuckets(n){var e=this;return e.handleOperation(async()=>{const i=new URLSearchParams;(n==null?void 0:n.limit)!==void 0&&i.set("limit",n.limit.toString()),(n==null?void 0:n.offset)!==void 0&&i.set("offset",n.offset.toString()),n!=null&&n.sortColumn&&i.set("sortColumn",n.sortColumn),n!=null&&n.sortOrder&&i.set("sortOrder",n.sortOrder),n!=null&&n.search&&i.set("search",n.search);const a=i.toString(),l=a?`${e.url}/bucket?${a}`:`${e.url}/bucket`;return await po(e.fetch,l,{headers:e.headers})})}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await go(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}))}from(n){var e=this;if(!bR(n))throw new $c("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 i=new hR({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),a=this.shouldThrowOnError;return new Proxy(i,{get(l,c){const u=l[c];return typeof u!="function"?u:async(...d)=>{try{return{data:await u.apply(l,d),error:null}}catch(m){if(a)throw m;return{data:null,error:m}}}}})}},RR=class extends Ja{constructor(n,e={},i){const a=n.replace(/\/$/,""),l=fe(fe({},To),{},{"Content-Type":"application/json"},e);super(a,l,i,"vectors")}async createIndex(n){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/CreateIndex`,n,{headers:e.headers})||{})}async getIndex(n,e){var i=this;return i.handleOperation(async()=>await on.post(i.fetch,`${i.url}/GetIndex`,{vectorBucketName:n,indexName:e},{headers:i.headers}))}async listIndexes(n){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/ListIndexes`,n,{headers:e.headers}))}async deleteIndex(n,e){var i=this;return i.handleOperation(async()=>await on.post(i.fetch,`${i.url}/DeleteIndex`,{vectorBucketName:n,indexName:e},{headers:i.headers})||{})}},kR=class extends Ja{constructor(n,e={},i){const a=n.replace(/\/$/,""),l=fe(fe({},To),{},{"Content-Type":"application/json"},e);super(a,l,i,"vectors")}async putVectors(n){var e=this;if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/PutVectors`,n,{headers:e.headers})||{})}async getVectors(n){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/GetVectors`,n,{headers:e.headers}))}async listVectors(n){var e=this;if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/ListVectors`,n,{headers:e.headers}))}async queryVectors(n){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/QueryVectors`,n,{headers:e.headers}))}async deleteVectors(n){var e=this;if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/DeleteVectors`,n,{headers:e.headers})||{})}},CR=class extends Ja{constructor(n,e={},i){const a=n.replace(/\/$/,""),l=fe(fe({},To),{},{"Content-Type":"application/json"},e);super(a,l,i,"vectors")}async createBucket(n){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{})}async getBucket(n){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:n},{headers:e.headers}))}async listBuckets(n={}){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/ListVectorBuckets`,n,{headers:e.headers}))}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await on.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{})}},OR=class extends CR{constructor(n,e={}){super(n,e.headers||{},e.fetch)}from(n){return new DR(this.url,this.headers,n,this.fetch)}async createBucket(n){var e=()=>super.createBucket,i=this;return e().call(i,n)}async getBucket(n){var e=()=>super.getBucket,i=this;return e().call(i,n)}async listBuckets(n={}){var e=()=>super.listBuckets,i=this;return e().call(i,n)}async deleteBucket(n){var e=()=>super.deleteBucket,i=this;return e().call(i,n)}},DR=class extends RR{constructor(n,e,i,a){super(n,e,a),this.vectorBucketName=i}async createIndex(n){var e=()=>super.createIndex,i=this;return e().call(i,fe(fe({},n),{},{vectorBucketName:i.vectorBucketName}))}async listIndexes(n={}){var e=()=>super.listIndexes,i=this;return e().call(i,fe(fe({},n),{},{vectorBucketName:i.vectorBucketName}))}async getIndex(n){var e=()=>super.getIndex,i=this;return e().call(i,i.vectorBucketName,n)}async deleteIndex(n){var e=()=>super.deleteIndex,i=this;return e().call(i,i.vectorBucketName,n)}index(n){return new MR(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},MR=class extends kR{constructor(n,e,i,a,l){super(n,e,l),this.vectorBucketName=i,this.indexName=a}async putVectors(n){var e=()=>super.putVectors,i=this;return e().call(i,fe(fe({},n),{},{vectorBucketName:i.vectorBucketName,indexName:i.indexName}))}async getVectors(n){var e=()=>super.getVectors,i=this;return e().call(i,fe(fe({},n),{},{vectorBucketName:i.vectorBucketName,indexName:i.indexName}))}async listVectors(n={}){var e=()=>super.listVectors,i=this;return e().call(i,fe(fe({},n),{},{vectorBucketName:i.vectorBucketName,indexName:i.indexName}))}async queryVectors(n){var e=()=>super.queryVectors,i=this;return e().call(i,fe(fe({},n),{},{vectorBucketName:i.vectorBucketName,indexName:i.indexName}))}async deleteVectors(n){var e=()=>super.deleteVectors,i=this;return e().call(i,fe(fe({},n),{},{vectorBucketName:i.vectorBucketName,indexName:i.indexName}))}},BR=class extends jR{constructor(n,e={},i,a){super(n,e,i,a)}from(n){return new ER(this.url,this.headers,n,this.fetch)}get vectors(){return new OR(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new NR(this.url+"/iceberg",this.headers,this.fetch)}};const Tw="2.110.2",ks=30*1e3,Qr=3,Td=Qr*ks,UR=2*ks,LR="http://localhost:9999",zR="supabase.auth.token",PR={"X-Client-Info":`gotrue-js/${Tw}`},gf="X-Supabase-Api-Version",Ew={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},VR=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,HR=600*1e3;class yo extends Error{constructor(e,i,a){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=i,this.code=a}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function te(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class $R extends yo{constructor(e,i,a){super(e,i,a),this.name="AuthApiError",this.status=i,this.code=a}}function qR(n){return te(n)&&n.name==="AuthApiError"}class Vn extends yo{constructor(e,i){super(e),this.name="AuthUnknownError",this.originalError=i}}class is extends yo{constructor(e,i,a,l){super(e,a,l),this.name=i,this.status=a}}class kt extends is{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function ec(n){return te(n)&&n.name==="AuthSessionMissingError"}class ja extends is{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class tc extends is{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class nc extends is{constructor(e,i=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=i}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function FR(n){return te(n)&&n.name==="AuthImplicitGrantRedirectError"}class zb extends is{constructor(e,i=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=i}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class IR extends is{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 yf extends is{constructor(e,i){super(e,"AuthRetryableFetchError",i,void 0)}}function Pb(n){return te(n)&&n.name==="AuthRetryableFetchError"}class Vb extends is{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function GR(n){return te(n)&&n.name==="AuthRefreshDiscardedError"}class Hb extends is{constructor(e,i,a){super(e,"AuthWeakPasswordError",i,"weak_password"),this.reasons=a}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Rc extends is{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const kc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),$b=`
\r=`.split(""),KR=(()=>{const n=new Array(128);for(let e=0;e<n.length;e+=1)n[e]=-1;for(let e=0;e<$b.length;e+=1)n[$b[e].charCodeAt(0)]=-2;for(let e=0;e<kc.length;e+=1)n[kc[e].charCodeAt(0)]=e;return n})();function qb(n,e,i){if(n!==null)for(e.queue=e.queue<<8|n,e.queuedBits+=8;e.queuedBits>=6;){const a=e.queue>>e.queuedBits-6&63;i(kc[a]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const a=e.queue>>e.queuedBits-6&63;i(kc[a]),e.queuedBits-=6}}function Aw(n,e,i){const a=KR[n];if(a>-1)for(e.queue=e.queue<<6|a,e.queuedBits+=6;e.queuedBits>=8;)i(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(a===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function Fb(n){const e=[],i=u=>{e.push(String.fromCodePoint(u))},a={utf8seq:0,codepoint:0},l={queue:0,queuedBits:0},c=u=>{JR(u,a,i)};for(let u=0;u<n.length;u+=1)Aw(n.charCodeAt(u),l,c);return e.join("")}function YR(n,e){if(n<=127){e(n);return}else if(n<=2047){e(192|n>>6),e(128|n&63);return}else if(n<=65535){e(224|n>>12),e(128|n>>6&63),e(128|n&63);return}else if(n<=1114111){e(240|n>>18),e(128|n>>12&63),e(128|n>>6&63),e(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function XR(n,e){for(let i=0;i<n.length;i+=1){let a=n.charCodeAt(i);if(a>55295&&a<=56319){const l=(a-55296)*1024&65535;a=(n.charCodeAt(i+1)-56320&65535|l)+65536,i+=1}YR(a,e)}}function JR(n,e,i){if(e.utf8seq===0){if(n<=127){i(n);return}for(let a=1;a<6;a+=1)if((n>>7-a&1)===0){e.utf8seq=a;break}if(e.utf8seq===2)e.codepoint=n&31;else if(e.utf8seq===3)e.codepoint=n&15;else if(e.utf8seq===4)e.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|n&63,e.utf8seq-=1,e.utf8seq===0&&i(e.codepoint)}}function $a(n){const e=[],i={queue:0,queuedBits:0},a=l=>{e.push(l)};for(let l=0;l<n.length;l+=1)Aw(n.charCodeAt(l),i,a);return new Uint8Array(e)}function QR(n){const e=[];return XR(n,i=>e.push(i)),new Uint8Array(e)}function Pi(n){const e=[],i={queue:0,queuedBits:0},a=l=>{e.push(l)};return n.forEach(l=>qb(l,i,a)),qb(null,i,a),e.join("")}function ZR(n){return Math.round(Date.now()/1e3)+n}function WR(){return Symbol("auth-callback")}const Pt=()=>typeof window<"u"&&typeof document<"u",Oi={tested:!1,writable:!1},jw=()=>{if(!Pt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Oi.tested)return Oi.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),Oi.tested=!0,Oi.writable=!0}catch{Oi.tested=!0,Oi.writable=!1}return Oi.writable};function ek(n){const e={},i=new URL(n);if(i.hash&&i.hash[0]==="#")try{new URLSearchParams(i.hash.substring(1)).forEach((l,c)=>{e[c]=l})}catch{}return i.searchParams.forEach((a,l)=>{e[l]=a}),e}const Nw=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),tk=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",Ma=async(n,e,i)=>{await n.setItem(e,JSON.stringify(i))},Bn=async(n,e)=>{const i=await n.getItem(e);if(!i)return null;try{return JSON.parse(i)}catch{return null}},pt=async(n,e)=>{await n.removeItem(e)};class Fc{constructor(){this.promise=new Fc.promiseConstructor((e,i)=>{this.resolve=e,this.reject=i})}}Fc.promiseConstructor=Promise;function sc(n){const e=n.split(".");if(e.length!==3)throw new Rc("Invalid JWT structure");for(let a=0;a<e.length;a++)if(!VR.test(e[a]))throw new Rc("JWT not in base64url format");return{header:JSON.parse(Fb(e[0])),payload:JSON.parse(Fb(e[1])),signature:$a(e[2]),raw:{header:e[0],payload:e[1]}}}async function nk(n){return await new Promise(e=>{setTimeout(()=>e(null),n)})}function sk(n,e){return new Promise((a,l)=>{(async()=>{for(let c=0;c<1/0;c++)try{const u=await n(c);if(!e(c,null,u)){a(u);return}}catch(u){if(!e(c,u)){l(u);return}}})()})}function ik(n){return("0"+n.toString(16)).substr(-2)}function ak(){const e=new Uint32Array(56);if(typeof crypto>"u"){const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",a=i.length;let l="";for(let c=0;c<56;c++)l+=i.charAt(Math.floor(Math.random()*a));return l}return crypto.getRandomValues(e),Array.from(e,ik).join("")}async function rk(n){const i=new TextEncoder().encode(n),a=await crypto.subtle.digest("SHA-256",i),l=new Uint8Array(a);return Array.from(l).map(c=>String.fromCharCode(c)).join("")}async function ok(n){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),n;const i=await rk(n);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Di(n,e,i=!1){const a=ak();let l=a;i&&(l+="/recovery"),await Ma(n,`${e}-code-verifier`,l);const c=await ok(a);return[c,a===c?"plain":"s256"]}const lk=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function ck(n){const e=n.headers.get(gf);if(!e||!e.match(lk))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function uk(n){if(!n)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(n<=e)throw new Error("JWT has expired")}function hk(n){switch(n){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const dk=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function As(n){if(!dk.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function zn(n){if(!n.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 Ed(){const n={};return new Proxy(n,{get:(e,i)=>{if(i==="__isUserNotAvailableProxy")return!0;if(typeof i=="symbol"){const a=i.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 "${i}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,i)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${i}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,i)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${i}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function fk(n,e){return new Proxy(n,{get:(i,a,l)=>{if(a==="__isInsecureUserWarningProxy")return!0;if(typeof a=="symbol"){const c=a.toString();if(c==="Symbol(Symbol.toPrimitive)"||c==="Symbol(Symbol.toStringTag)"||c==="Symbol(util.inspect.custom)"||c==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(i,a,l)}return!e.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."),e.value=!0),Reflect.get(i,a,l)}})}function Ib(n){return JSON.parse(JSON.stringify(n))}const Bi=n=>{if(typeof n=="object"&&n!==null){const e=n;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(n)},mk=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function Gb(n){var e;if(!tk(n))throw new yf(Bi(n),0);if(mk.includes(n.status))throw new yf(Bi(n),n.status);let i;try{i=await n.json()}catch(c){throw new Vn(Bi(c),c)}let a;const l=ck(n);if(l&&l.getTime()>=Ew["2024-01-01"].timestamp&&typeof i=="object"&&i&&typeof i.code=="string"?a=i.code:typeof i=="object"&&i&&typeof i.error_code=="string"&&(a=i.error_code),a){if(a==="weak_password")throw new Hb(Bi(i),n.status,((e=i.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(a==="session_not_found")throw new kt}else if(typeof i=="object"&&i&&typeof i.weak_password=="object"&&i.weak_password&&Array.isArray(i.weak_password.reasons)&&i.weak_password.reasons.length&&i.weak_password.reasons.reduce((c,u)=>c&&typeof u=="string",!0))throw new Hb(Bi(i),n.status,i.weak_password.reasons);throw new $R(Bi(i),n.status||500,a)}const pk=(n,e,i,a)=>{const l={method:n,headers:(e==null?void 0:e.headers)||{}};return n==="GET"?l:(l.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),l.body=JSON.stringify(a),Object.assign(Object.assign({},l),i))};async function oe(n,e,i,a){var l;const c=Object.assign({},a==null?void 0:a.headers);c[gf]||(c[gf]=Ew["2024-01-01"].name),a!=null&&a.jwt&&(c.Authorization=`Bearer ${a.jwt}`);const u=(l=a==null?void 0:a.query)!==null&&l!==void 0?l:{};a!=null&&a.redirectTo&&(u.redirect_to=a.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",m=await gk(n,e,i+d,{headers:c,noResolveJson:a==null?void 0:a.noResolveJson},{},a==null?void 0:a.body);return a!=null&&a.xform?a==null?void 0:a.xform(m):{data:Object.assign({},m),error:null}}async function gk(n,e,i,a,l,c){const u=pk(e,a,l,c);let d;try{d=await n(i,Object.assign({},u))}catch(m){throw console.error(m),new yf(Bi(m),0)}if(d.ok||await Gb(d),a!=null&&a.noResolveJson)return d;try{return await d.json()}catch(m){await Gb(m)}}function Sn(n){var e;let i=null;vk(n)&&(i=Object.assign({},n),n.expires_at||(i.expires_at=ZR(n.expires_in)));const a=(e=n.user)!==null&&e!==void 0?e:typeof(n==null?void 0:n.id)=="string"?n:null;return{data:{session:i,user:a},error:null}}function Kb(n){const e=Sn(n);return!e.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((i,a)=>i&&typeof a=="string",!0)&&(e.data.weak_password=n.weak_password),e}function ii(n){var e;return{data:{user:(e=n.user)!==null&&e!==void 0?e:n},error:null}}function yk(n){return{data:n,error:null}}function bk(n){const{action_link:e,email_otp:i,hashed_token:a,redirect_to:l,verification_type:c}=n,u=Hc(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:e,email_otp:i,hashed_token:a,redirect_to:l,verification_type:c},m=Object.assign({},u);return{data:{properties:d,user:m},error:null}}function Yb(n){return n}function vk(n){return!!n.access_token&&!!n.refresh_token&&!!n.expires_in}const Ad=["global","local","others"];class xk{constructor({url:e="",headers:i={},fetch:a,experimental:l}){this.url=e,this.headers=i,this.fetch=Nw(a),this.experimental=l??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,i=Ad[0]){if(Ad.indexOf(i)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ad.join(", ")}`);try{return await oe(this.fetch,"POST",`${this.url}/logout?scope=${i}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(a){if(te(a))return{data:null,error:a};throw a}}async inviteUserByEmail(e,i={}){try{return await oe(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:i.data},headers:this.headers,redirectTo:i.redirectTo,xform:ii})}catch(a){if(te(a))return{data:{user:null},error:a};throw a}}async generateLink(e){try{const{options:i}=e,a=Hc(e,["options"]),l=Object.assign(Object.assign({},a),i);return"newEmail"in a&&(l.new_email=a==null?void 0:a.newEmail,delete l.newEmail),await oe(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:l,headers:this.headers,xform:bk,redirectTo:i==null?void 0:i.redirectTo})}catch(i){if(te(i))return{data:{properties:null,user:null},error:i};throw i}}async createUser(e){try{return await oe(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ii})}catch(i){if(te(i))return{data:{user:null},error:i};throw i}}async listUsers(e){var i,a,l,c,u,d,m;try{const p={nextPage:null,lastPage:0,total:0},y=await oe(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(a=(i=e==null?void 0:e.page)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:"",per_page:(c=(l=e==null?void 0:e.perPage)===null||l===void 0?void 0:l.toString())!==null&&c!==void 0?c:""},xform:Yb});if(y.error)throw y.error;const v=await y.json(),x=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(m=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&m!==void 0?m:[];return _.length>0&&(_.forEach(S=>{const T=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),j=JSON.parse(S.split(";")[1].split("=")[1]);p[`${j}Page`]=T}),p.total=parseInt(x)),{data:Object.assign(Object.assign({},v),p),error:null}}catch(p){if(te(p))return{data:{users:[]},error:p};throw p}}async getUserById(e){As(e);try{return await oe(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ii})}catch(i){if(te(i))return{data:{user:null},error:i};throw i}}async updateUserById(e,i){As(e);try{return await oe(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:i,headers:this.headers,xform:ii})}catch(a){if(te(a))return{data:{user:null},error:a};throw a}}async deleteUser(e,i=!1){As(e);try{return await oe(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:i},xform:ii})}catch(a){if(te(a))return{data:{user:null},error:a};throw a}}async _listFactors(e){As(e.userId);try{const{data:i,error:a}=await oe(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:l=>({data:{factors:l},error:null})});return{data:i,error:a}}catch(i){if(te(i))return{data:null,error:i};throw i}}async _deleteFactor(e){As(e.userId),As(e.id);try{return{data:await oe(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(i){if(te(i))return{data:null,error:i};throw i}}async _listOAuthClients(e){var i,a,l,c,u,d,m;try{const p={nextPage:null,lastPage:0,total:0},y=await oe(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(a=(i=e==null?void 0:e.page)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:"",per_page:(c=(l=e==null?void 0:e.perPage)===null||l===void 0?void 0:l.toString())!==null&&c!==void 0?c:""},xform:Yb});if(y.error)throw y.error;const v=await y.json(),x=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(m=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&m!==void 0?m:[];return _.length>0&&(_.forEach(S=>{const T=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),j=JSON.parse(S.split(";")[1].split("=")[1]);p[`${j}Page`]=T}),p.total=parseInt(x)),{data:Object.assign(Object.assign({},v),p),error:null}}catch(p){if(te(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(e){try{return await oe(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(te(i))return{data:null,error:i};throw i}}async _getOAuthClient(e){try{return await oe(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(te(i))return{data:null,error:i};throw i}}async _updateOAuthClient(e,i){try{return await oe(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:i,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(te(a))return{data:null,error:a};throw a}}async _deleteOAuthClient(e){try{return await oe(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(i){if(te(i))return{data:null,error:i};throw i}}async _regenerateOAuthClientSecret(e){try{return await oe(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(te(i))return{data:null,error:i};throw i}}async _listCustomProviders(e){try{const i={};return e!=null&&e.type&&(i.type=e.type),await oe(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:i,xform:a=>{var l;return{data:{providers:(l=a==null?void 0:a.providers)!==null&&l!==void 0?l:[]},error:null}}})}catch(i){if(te(i))return{data:{providers:[]},error:i};throw i}}async _createCustomProvider(e){try{return await oe(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(te(i))return{data:null,error:i};throw i}}async _getCustomProvider(e){try{return await oe(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(te(i))return{data:null,error:i};throw i}}async _updateCustomProvider(e,i){try{return await oe(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:i,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(te(a))return{data:null,error:a};throw a}}async _deleteCustomProvider(e){try{return await oe(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(i){if(te(i))return{data:null,error:i};throw i}}async _adminListPasskeys(e){zn(this.experimental),As(e.userId);try{return await oe(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(te(i))return{data:null,error:i};throw i}}async _adminDeletePasskey(e){zn(this.experimental),As(e.userId),As(e.passkeyId);try{return await oe(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(i){if(te(i))return{data:null,error:i};throw i}}}function Xb(n={}){return{getItem:e=>n[e]||null,setItem:(e,i)=>{n[e]=i},removeItem:e=>{delete n[e]}}}globalThis&&jw()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class wk extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function _k(){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 Rw(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function Sk(n){return parseInt(n,16)}function Tk(n){const e=new TextEncoder().encode(n);return"0x"+Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}function Ek(n){var e;const{chainId:i,domain:a,expirationTime:l,issuedAt:c=new Date,nonce:u,notBefore:d,requestId:m,resources:p,scheme:y,uri:v,version:x}=n;{if(!Number.isInteger(i))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${i}`);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(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(x!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${x}`);if(!((e=n.statement)===null||e===void 0)&&e.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const _=Rw(n.address),S=y?`${y}://${a}`:a,T=n.statement?`${n.statement}
`:"",j=`${S} wants you to sign in with your Ethereum account:
${_}
${T}`;let k=`URI: ${v}
Version: ${x}
Chain ID: ${i}${u?`
Nonce: ${u}`:""}
Issued At: ${c.toISOString()}`;if(l&&(k+=`
Expiration Time: ${l.toISOString()}`),d&&(k+=`
Not Before: ${d.toISOString()}`),m&&(k+=`
Request ID: ${m}`),p){let M=`
Resources:`;for(const C of p){if(!C||typeof C!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${C}`);M+=`
- ${C}`}k+=M}return`${j}
${k}`}class _t extends Error{constructor({message:e,code:i,cause:a,name:l}){var c;super(e,{cause:a}),this.__isWebAuthnError=!0,this.name=(c=l??(a instanceof Error?a.name:void 0))!==null&&c!==void 0?c:"Unknown Error",this.code=i}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Cc extends _t{constructor(e,i){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i,message:e}),this.name="WebAuthnUnknownError",this.originalError=i}}function Ak({error:n,options:e}){var i,a,l;const{publicKey:c}=e;if(!c)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new _t({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((i=c.authenticatorSelection)===null||i===void 0?void 0:i.requireResidentKey)===!0)return new _t({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(e.mediation==="conditional"&&((a=c.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new _t({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((l=c.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new _t({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new _t({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new _t({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return c.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new _t({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new _t({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const u=window.location.hostname;if(kw(u)){if(c.rp.id!==u)return new _t({message:`The RP ID "${c.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new _t({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(c.user.id.byteLength<1||c.user.id.byteLength>64)return new _t({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new _t({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new _t({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function jk({error:n,options:e}){const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new _t({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new _t({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const a=window.location.hostname;if(kw(a)){if(i.rpId!==a)return new _t({message:`The RP ID "${i.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new _t({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new _t({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new _t({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class Nk{createNewAbortSignal(){if(this.controller){const i=new Error("Cancelling existing WebAuthn API call for new one");i.name="AbortError",this.controller.abort(i)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const bf=new Nk;function Jb(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:e,user:i,excludeCredentials:a}=n,l=Hc(n,["challenge","user","excludeCredentials"]),c=$a(e).buffer,u=Object.assign(Object.assign({},i),{id:$a(i.id).buffer}),d=Object.assign(Object.assign({},l),{challenge:c,user:u});if(a&&a.length>0){d.excludeCredentials=new Array(a.length);for(let m=0;m<a.length;m++){const p=a[m];d.excludeCredentials[m]=Object.assign(Object.assign({},p),{id:$a(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return d}function Qb(n){if(!n)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(n);const{challenge:e,allowCredentials:i}=n,a=Hc(n,["challenge","allowCredentials"]),l=$a(e).buffer,c=Object.assign(Object.assign({},a),{challenge:l});if(i&&i.length>0){c.allowCredentials=new Array(i.length);for(let u=0;u<i.length;u++){const d=i[u];c.allowCredentials[u]=Object.assign(Object.assign({},d),{id:$a(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return c}function Zb(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const i=n;return{id:n.id,rawId:n.id,response:{attestationObject:Pi(new Uint8Array(n.response.attestationObject)),clientDataJSON:Pi(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:(e=i.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Wb(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const i=n,a=n.getClientExtensionResults(),l=n.response;return{id:n.id,rawId:n.id,response:{authenticatorData:Pi(new Uint8Array(l.authenticatorData)),clientDataJSON:Pi(new Uint8Array(l.clientDataJSON)),signature:Pi(new Uint8Array(l.signature)),userHandle:l.userHandle?Pi(new Uint8Array(l.userHandle)):void 0},type:"public-key",clientExtensionResults:a,authenticatorAttachment:(e=i.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function kw(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function Oc(){var n,e;return!!(Pt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((n=navigator==null?void 0:navigator.credentials)===null||n===void 0?void 0:n.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Cw(n){try{const e=await navigator.credentials.create(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Cc("Browser returned unexpected credential type",e)}:{data:null,error:new Cc("Empty credential response",e)}}catch(e){return{data:null,error:Ak({error:e,options:n})}}}async function Ow(n){try{const e=await navigator.credentials.get(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Cc("Browser returned unexpected credential type",e)}:{data:null,error:new Cc("Empty credential response",e)}}catch(e){return{data:null,error:jk({error:e,options:n})}}}const Rk={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},kk={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Dc(...n){const e=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),i=l=>l instanceof ArrayBuffer||ArrayBuffer.isView(l),a={};for(const l of n)if(l)for(const c in l){const u=l[c];if(u!==void 0)if(Array.isArray(u))a[c]=u;else if(i(u))a[c]=u;else if(e(u)){const d=a[c];e(d)?a[c]=Dc(d,u):a[c]=Dc(u)}else a[c]=u}return a}function Ck(n,e){return Dc(Rk,n,e||{})}function Ok(n,e){return Dc(kk,n,e||{})}class Dk{constructor(e){this.client=e,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(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:i,friendlyName:a,signal:l},c){var u;try{const{data:d,error:m}=await this.client.mfa.challenge({factorId:e,webauthn:i});if(!d)return{data:null,error:m};const p=l??bf.createNewAbortSignal();if(d.webauthn.type==="create"){const{user:y}=d.webauthn.credential_options.publicKey;if(!y.name){const v=a;if(v)y.name=`${y.id}:${v}`;else{const _=(await this.client.getUser()).data.user,S=((u=_==null?void 0:_.user_metadata)===null||u===void 0?void 0:u.name)||(_==null?void 0:_.email)||(_==null?void 0:_.id)||"User";y.name=`${y.id}:${S}`}}y.displayName||(y.displayName=y.name)}switch(d.webauthn.type){case"create":{const y=Ck(d.webauthn.credential_options.publicKey,c==null?void 0:c.create),{data:v,error:x}=await Cw({publicKey:y,signal:p});return v?{data:{factorId:e,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:v}},error:null}:{data:null,error:x}}case"request":{const y=Ok(d.webauthn.credential_options.publicKey,c==null?void 0:c.request),{data:v,error:x}=await Ow(Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:y,signal:p}));return v?{data:{factorId:e,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:v}},error:null}:{data:null,error:x}}}}catch(d){return te(d)?{data:null,error:d}:{data:null,error:new Vn("Unexpected error in challenge",d)}}}async _verify({challengeId:e,factorId:i,webauthn:a}){return this.client.mfa.verify({factorId:i,challengeId:e,webauthn:a})}async _authenticate({factorId:e,webauthn:{rpId:i=typeof window<"u"?window.location.hostname:void 0,rpOrigins:a=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},c){if(!i)return{data:null,error:new yo("rpId is required for WebAuthn authentication")};try{if(!Oc())return{data:null,error:new Vn("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:e,webauthn:{rpId:i,rpOrigins:a},signal:l},{request:c});if(!u)return{data:null,error:d};const{webauthn:m}=u;return this._verify({factorId:e,challengeId:u.challengeId,webauthn:{type:m.type,rpId:i,rpOrigins:a,credential_response:m.credential_response}})}catch(u){return te(u)?{data:null,error:u}:{data:null,error:new Vn("Unexpected error in authenticate",u)}}}async _register({friendlyName:e,webauthn:{rpId:i=typeof window<"u"?window.location.hostname:void 0,rpOrigins:a=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},c){if(!i)return{data:null,error:new yo("rpId is required for WebAuthn registration")};try{if(!Oc())return{data:null,error:new Vn("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:e});if(!u)return await this.client.mfa.listFactors().then(y=>{var v;return(v=y.data)===null||v===void 0?void 0:v.all.find(x=>x.factor_type==="webauthn"&&x.friendly_name===e&&x.status!=="unverified")}).then(y=>y?this.client.mfa.unenroll({factorId:y==null?void 0:y.id}):void 0),{data:null,error:d};const{data:m,error:p}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:i,rpOrigins:a},signal:l},{create:c});return m?this._verify({factorId:u.id,challengeId:m.challengeId,webauthn:{rpId:i,rpOrigins:a,type:m.webauthn.type,credential_response:m.webauthn.credential_response}}):{data:null,error:p}}catch(u){return te(u)?{data:null,error:u}:{data:null,error:new Vn("Unexpected error in register",u)}}}}_k();const Mk={url:LR,storageKey:zR,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:PR,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},Na={};class bo{get jwks(){var e,i;return(i=(e=Na[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&i!==void 0?i:{keys:[]}}set jwks(e){Na[this.storageKey]=Object.assign(Object.assign({},Na[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,i;return(i=(e=Na[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&i!==void 0?i:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Na[this.storageKey]=Object.assign(Object.assign({},Na[this.storageKey]),{cachedAt:e})}constructor(e){var i,a,l;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 c=Object.assign(Object.assign({},Mk),e);if(this.storageKey=c.storageKey,this.instanceID=(i=bo.nextInstanceID[this.storageKey])!==null&&i!==void 0?i:0,bo.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!c.debug,typeof c.debug=="function"&&(this.logger=c.debug),this.instanceID>0&&Pt()){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=c.persistSession,this.autoRefreshToken=c.autoRefreshToken,this.experimental=(a=c.experimental)!==null&&a!==void 0?a:{},this.admin=new xk({url:c.url,headers:c.headers,fetch:c.fetch,experimental:this.experimental}),this.url=c.url,this.headers=c.headers,this.fetch=Nw(c.fetch),this.detectSessionInUrl=c.detectSessionInUrl,this.flowType=c.flowType,this.hasCustomAuthorizationHeader=c.hasCustomAuthorizationHeader,this.throwOnError=c.throwOnError,this.lockAcquireTimeout=c.lockAcquireTimeout,c.lock!=null&&(this.lock=c.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 Dk(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?(c.storage?this.storage=c.storage:jw()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Xb(this.memoryStorage)),c.userStorage&&(this.userStorage=c.userStorage)):(this.memoryStorage={},this.storage=Xb(this.memoryStorage)),Pt()&&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)}(l=this.broadcastChannel)===null||l===void 0||l.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(d){this._debug("#broadcastChannel","error",d)}})}c.skipAutoInitialize||this.initialize().catch(u=>{this._debug("#initialize()","error",u)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Tw}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){var e;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())();const i=await this.initializePromise,a=(e=this._pendingInitNotifications)!==null&&e!==void 0?e:[];this._pendingInitNotifications=null;for(const l of a)await this._notifyAllSubscribers(l.event,l.session,l.broadcast);return i}async _initialize(){var e;try{let i={},a="none";if(Pt()&&(i=ek(window.location.href),this._isImplicitGrantCallback(i)?a="implicit":await this._isPKCECallback(i)&&(a="pkce")),Pt()&&this.detectSessionInUrl&&a!=="none"){const{data:l,error:c}=await this._getSessionFromURL(i,a);if(c){if(this._debug("#_initialize()","error detecting session from URL",c),FR(c)){const m=(e=c.details)===null||e===void 0?void 0:e.code;if(m==="identity_already_exists"||m==="identity_not_found"||m==="single_identity_not_deletable")return{error:c}}return{error:c}}const{session:u,redirectType:d}=l;return this._debug("#_initialize()","detected session in URL",u,"redirect type",d),await this._saveSession(u),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(i){return te(i)?this._returnResult({error:i}):this._returnResult({error:new Vn("Unexpected error during initialization",i)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var i,a,l;try{const c=await oe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(a=(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.data)!==null&&a!==void 0?a:{},gotrue_meta_security:{captcha_token:(l=e==null?void 0:e.options)===null||l===void 0?void 0:l.captchaToken}},xform:Sn}),{data:u,error:d}=c;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const m=u.session,p=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(c){if(te(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signUp(e){var i,a,l;try{let c;if("email"in e){const{email:y,password:v,options:x}=e;let _=null,S=null;this.flowType==="pkce"&&([_,S]=await Di(this.storage,this.storageKey)),c=await oe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:x==null?void 0:x.emailRedirectTo,body:{email:y,password:v,data:(i=x==null?void 0:x.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:x==null?void 0:x.captchaToken},code_challenge:_,code_challenge_method:S},xform:Sn})}else if("phone"in e){const{phone:y,password:v,options:x}=e;c=await oe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:y,password:v,data:(a=x==null?void 0:x.data)!==null&&a!==void 0?a:{},channel:(l=x==null?void 0:x.channel)!==null&&l!==void 0?l:"sms",gotrue_meta_security:{captcha_token:x==null?void 0:x.captchaToken}},xform:Sn})}else throw new tc("You must provide either an email or phone number and a password");const{data:u,error:d}=c;if(d||!u)return await pt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const m=u.session,p=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(c){if(await pt(this.storage,`${this.storageKey}-code-verifier`),te(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithPassword(e){try{let i;if("email"in e){const{email:c,password:u,options:d}=e;i=await oe(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:c,password:u,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Kb})}else if("phone"in e){const{phone:c,password:u,options:d}=e;i=await oe(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:c,password:u,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Kb})}else throw new tc("You must provide either an email or phone number and a password");const{data:a,error:l}=i;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a||!a.session||!a.user){const c=new ja;return this._returnResult({data:{user:null,session:null},error:c})}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:l})}catch(i){if(te(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithOAuth(e){var i,a,l,c;return await this._handleProviderSignIn(e.provider,{redirectTo:(i=e.options)===null||i===void 0?void 0:i.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:(c=e.options)===null||c===void 0?void 0:c.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:i}=e;switch(i){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${i}"`)}}async signInWithEthereum(e){var i,a,l,c,u,d,m,p,y,v,x;let _,S;if("message"in e)_=e.message,S=e.signature;else{const{chain:T,wallet:j,statement:k,options:M}=e;let C;if(Pt())if(typeof j=="object")C=j;else{const Z=window;if("ethereum"in Z&&typeof Z.ethereum=="object"&&"request"in Z.ethereum&&typeof Z.ethereum.request=="function")C=Z.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 j!="object"||!(M!=null&&M.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");C=j}const P=new URL((i=M==null?void 0:M.url)!==null&&i!==void 0?i:window.location.href),K=await C.request({method:"eth_requestAccounts"}).then(Z=>Z).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!K||K.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const G=Rw(K[0]);let H=(a=M==null?void 0:M.signInWithEthereum)===null||a===void 0?void 0:a.chainId;if(!H){const Z=await C.request({method:"eth_chainId"});H=Sk(Z)}const Y={domain:P.host,address:G,statement:k,uri:P.href,version:"1",chainId:H,nonce:(l=M==null?void 0:M.signInWithEthereum)===null||l===void 0?void 0:l.nonce,issuedAt:(u=(c=M==null?void 0:M.signInWithEthereum)===null||c===void 0?void 0:c.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=M==null?void 0:M.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(m=M==null?void 0:M.signInWithEthereum)===null||m===void 0?void 0:m.notBefore,requestId:(p=M==null?void 0:M.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(y=M==null?void 0:M.signInWithEthereum)===null||y===void 0?void 0:y.resources};_=Ek(Y),S=await C.request({method:"personal_sign",params:[Tk(_),G]})}try{const{data:T,error:j}=await oe(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:S},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(x=e.options)===null||x===void 0?void 0:x.captchaToken}}:null),xform:Sn});if(j)throw j;if(!T||!T.session||!T.user){const k=new ja;return this._returnResult({data:{user:null,session:null},error:k})}return T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),this._returnResult({data:Object.assign({},T),error:j})}catch(T){if(te(T))return this._returnResult({data:{user:null,session:null},error:T});throw T}}async signInWithSolana(e){var i,a,l,c,u,d,m,p,y,v,x,_;let S,T;if("message"in e)S=e.message,T=e.signature;else{const{chain:j,wallet:k,statement:M,options:C}=e;let P;if(Pt())if(typeof k=="object")P=k;else{const G=window;if("solana"in G&&typeof G.solana=="object"&&("signIn"in G.solana&&typeof G.solana.signIn=="function"||"signMessage"in G.solana&&typeof G.solana.signMessage=="function"))P=G.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!(C!=null&&C.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=k}const K=new URL((i=C==null?void 0:C.url)!==null&&i!==void 0?i:window.location.href);if("signIn"in P&&P.signIn){const G=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},C==null?void 0:C.signInWithSolana),{version:"1",domain:K.host,uri:K.href}),M?{statement:M}:null));let H;if(Array.isArray(G)&&G[0]&&typeof G[0]=="object")H=G[0];else if(G&&typeof G=="object"&&"signedMessage"in G&&"signature"in G)H=G;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in H&&"signature"in H&&(typeof H.signedMessage=="string"||H.signedMessage instanceof Uint8Array)&&H.signature instanceof Uint8Array)S=typeof H.signedMessage=="string"?H.signedMessage:new TextDecoder().decode(H.signedMessage),T=H.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");S=[`${K.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...M?["",M,""]:[""],"Version: 1",`URI: ${K.href}`,`Issued At: ${(l=(a=C==null?void 0:C.signInWithSolana)===null||a===void 0?void 0:a.issuedAt)!==null&&l!==void 0?l:new Date().toISOString()}`,...!((c=C==null?void 0:C.signInWithSolana)===null||c===void 0)&&c.notBefore?[`Not Before: ${C.signInWithSolana.notBefore}`]:[],...!((u=C==null?void 0:C.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${C.signInWithSolana.expirationTime}`]:[],...!((d=C==null?void 0:C.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${C.signInWithSolana.chainId}`]:[],...!((m=C==null?void 0:C.signInWithSolana)===null||m===void 0)&&m.nonce?[`Nonce: ${C.signInWithSolana.nonce}`]:[],...!((p=C==null?void 0:C.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${C.signInWithSolana.requestId}`]:[],...!((v=(y=C==null?void 0:C.signInWithSolana)===null||y===void 0?void 0:y.resources)===null||v===void 0)&&v.length?["Resources",...C.signInWithSolana.resources.map(H=>`- ${H}`)]:[]].join(`
`);const G=await P.signMessage(new TextEncoder().encode(S),"utf8");if(!G||!(G instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");T=G}}try{const{data:j,error:k}=await oe(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:S,signature:Pi(T)},!((x=e.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(_=e.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Sn});if(k)throw k;if(!j||!j.session||!j.user){const M=new ja;return this._returnResult({data:{user:null,session:null},error:M})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:k})}catch(j){if(te(j))return this._returnResult({data:{user:null,session:null},error:j});throw j}}async _exchangeCodeForSession(e){const i=await Bn(this.storage,`${this.storageKey}-code-verifier`),[a,l]=(i??"").split("/");try{if(!a&&this.flowType==="pkce")throw new IR;const{data:c,error:u}=await oe(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:a},xform:Sn});if(await pt(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!c||!c.session||!c.user){const d=new ja;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers(l==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c.session)),this._returnResult({data:Object.assign(Object.assign({},c),{redirectType:l??null}),error:u})}catch(c){if(await pt(this.storage,`${this.storageKey}-code-verifier`),te(c))return this._returnResult({data:{user:null,session:null,redirectType:null},error:c});throw c}}async signInWithIdToken(e){try{const{options:i,provider:a,token:l,access_token:c,nonce:u}=e,d=await oe(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:a,id_token:l,access_token:c,nonce:u,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:Sn}),{data:m,error:p}=d;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!m||!m.session||!m.user){const y=new ja;return this._returnResult({data:{user:null,session:null},error:y})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:m,error:p})}catch(i){if(te(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithOtp(e){var i,a,l,c,u;try{if("email"in e){const{email:d,options:m}=e;let p=null,y=null;this.flowType==="pkce"&&([p,y]=await Di(this.storage,this.storageKey));const{error:v}=await oe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(i=m==null?void 0:m.data)!==null&&i!==void 0?i:{},create_user:(a=m==null?void 0:m.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:p,code_challenge_method:y},redirectTo:m==null?void 0:m.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:v})}if("phone"in e){const{phone:d,options:m}=e,{data:p,error:y}=await oe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(l=m==null?void 0:m.data)!==null&&l!==void 0?l:{},create_user:(c=m==null?void 0:m.shouldCreateUser)!==null&&c!==void 0?c:!0,gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},channel:(u=m==null?void 0:m.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:y})}throw new tc("You must provide either an email or phone number.")}catch(d){if(await pt(this.storage,`${this.storageKey}-code-verifier`),te(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(e){var i,a;try{let l,c;"options"in e&&(l=(i=e.options)===null||i===void 0?void 0:i.redirectTo,c=(a=e.options)===null||a===void 0?void 0:a.captchaToken);const{data:u,error:d}=await oe(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:c}}),redirectTo:l,xform:Sn});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const m=u.session,p=u.user;return m!=null&&m.access_token&&(await this._saveSession(m),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(l){if(te(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithSSO(e){var i,a,l,c,u;try{let d=null,m=null;this.flowType==="pkce"&&([d,m]=await Di(this.storage,this.storageKey));const p=await oe(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(a=(i=e.options)===null||i===void 0?void 0:i.redirectTo)!==null&&a!==void 0?a:void 0}),!((l=e==null?void 0:e.options)===null||l===void 0)&&l.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:m}),headers:this.headers,xform:yk});return!((c=p.data)===null||c===void 0)&&c.url&&Pt()&&!(!((u=e.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(d){if(await pt(this.storage,`${this.storageKey}-code-verifier`),te(d))return this._returnResult({data:null,error:d});throw d}}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 e=>{const{data:{session:i},error:a}=e;if(a)throw a;if(!i)throw new kt;const{error:l}=await oe(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:i.access_token});return this._returnResult({data:{user:null,session:null},error:l})})}catch(e){if(te(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const i=`${this.url}/resend`;if("email"in e){const{email:a,type:l,options:c}=e;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Di(this.storage,this.storageKey));const{error:m}=await oe(this.fetch,"POST",i,{headers:this.headers,body:{email:a,type:l,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return m&&await pt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m})}else if("phone"in e){const{phone:a,type:l,options:c}=e,{data:u,error:d}=await oe(this.fetch,"POST",i,{headers:this.headers,body:{phone:a,type:l,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new tc("You must provide either an email or phone number and a type")}catch(i){if(await pt(this.storage,`${this.storageKey}-code-verifier`),te(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,i){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const a=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),l=(async()=>(await a,await i()))();return this.pendingInLock.push((async()=>{try{await l}catch{}})()),l}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const a=i();for(this.pendingInLock.push((async()=>{try{await a}catch{}})()),await a;this.pendingInLock.length;){const l=[...this.pendingInLock];await Promise.all(l),this.pendingInLock.splice(0,l.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(e){this._debug("#_useSession","begin");try{const i=await this.__loadSession();return await e(i)}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 e=null;const i=await Bn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",i),i!==null&&(this._isValidSession(i)?e=i:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const a=e.expires_at?e.expires_at*1e3-Date.now()<Td:!1;if(this._debug("#__loadSession()",`session has${a?"":" not"} expired`,"expires_at",e.expires_at),!a){if(this.userStorage){const u=await Bn(this.userStorage,this.storageKey+"-user");u!=null&&u.user?e.user=u.user:e.user=Ed()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};e.user=fk(e.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c){if(!!(e.expires_at&&e.expires_at*1e3>Date.now())){const d=await Bn(this.storage,this.storageKey);if(d&&d.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:c})}return this._returnResult({data:{session:l},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let i;return this.lock!=null?i=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):i=await this._getUser(),i.data.user&&(this.suppressGetSessionWarning=!0),i}async _getUser(e){try{return e?await oe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ii}):await this._useSession(async i=>{var a,l,c;const{data:u,error:d}=i;if(d)throw d;return!(!((a=u.session)===null||a===void 0)&&a.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new kt}:await oe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(c=(l=u.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0,xform:ii})})}catch(i){if(te(i))return ec(i)&&(await this._removeSession(),await pt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:i});throw i}}async updateUser(e,i={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,i)):await this._updateUser(e,i)}async _updateUser(e,i={}){try{return await this._useSession(async a=>{const{data:l,error:c}=a;if(c)throw c;if(!l.session)throw new kt;const u=l.session;let d=null,m=null;this.flowType==="pkce"&&e.email!=null&&([d,m]=await Di(this.storage,this.storageKey));const{data:p,error:y}=await oe(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:i==null?void 0:i.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:d,code_challenge_method:m}),jwt:u.access_token,xform:ii});if(y)throw y;return u.user=p.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(a){if(await pt(this.storage,`${this.storageKey}-code-verifier`),te(a))return this._returnResult({data:{user:null},error:a});throw a}}async setSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new kt;const i=Date.now()/1e3;let a=i,l=!0,c=null;const{payload:u}=sc(e.access_token);if(u.exp&&(a=u.exp,l=a<=i),l){const{data:d,error:m}=await this._callRefreshToken(e.refresh_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!d)return{data:{user:null,session:null},error:null};c=d}else{const{data:d,error:m}=await this._getUser(e.access_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});c={access_token:e.access_token,refresh_token:e.refresh_token,user:d.user,token_type:"bearer",expires_in:a-i,expires_at:a},await this._saveSession(c),await this._notifyAllSubscribers("SIGNED_IN",c)}return this._returnResult({data:{user:c.user,session:c},error:null})}catch(i){if(te(i))return this._returnResult({data:{session:null,user:null},error:i});throw i}}async refreshSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async i=>{var a;if(!e){const{data:u,error:d}=i;if(d)throw d;e=(a=u.session)!==null&&a!==void 0?a:void 0}if(!(e!=null&&e.refresh_token))throw new kt;const{data:l,error:c}=await this._callRefreshToken(e.refresh_token);return c?this._returnResult({data:{user:null,session:null},error:c}):l?this._returnResult({data:{user:l.user,session:l},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(i){if(te(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async _getSessionFromURL(e,i){var a;try{if(!Pt())throw new nc("No browser detected.");if(e.error||e.error_description||e.error_code)throw new nc(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(i){case"implicit":if(this.flowType==="pkce")throw new zb("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new nc("Not a valid implicit grant flow url.");break;default:}if(i==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new zb("No code detected.");const{data:C,error:P}=await this._exchangeCodeForSession(e.code);if(P)throw P;const K=new URL(window.location.href);return K.searchParams.delete("code"),window.history.replaceState(window.history.state,"",K.toString()),{data:{session:C.session,redirectType:(a=C.redirectType)!==null&&a!==void 0?a:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:u,refresh_token:d,expires_in:m,expires_at:p,token_type:y}=e;if(!u||!m||!d||!y)throw new nc("No session defined in URL");const v=Math.round(Date.now()/1e3),x=parseInt(m);let _=v+x;p&&(_=parseInt(p));const S=_-v;S*1e3<=ks&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${x}s`);const T=_-x;v-T>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",T,_,v):v-T<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",T,_,v);const{data:j,error:k}=await this._getUser(u);if(k)throw k;const M={provider_token:l,provider_refresh_token:c,access_token:u,expires_in:x,expires_at:_,refresh_token:d,token_type:y,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:M,redirectType:e.type},error:null})}catch(l){if(te(l))return this._returnResult({data:{session:null,redirectType:null},error:l});throw l}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const i=await Bn(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&i)}async signOut(e={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async i=>{var a;const l=async()=>{await this._removeSession(),await pt(this.storage,`${this.storageKey}-code-verifier`)},{data:c,error:u}=i;if(u&&!ec(u))return this._returnResult({error:u});const d=(a=c.session)===null||a===void 0?void 0:a.access_token;if(d){const{error:m}=await this.admin.signOut(d,e);if(m&&!(qR(m)&&(m.status===404||m.status===401||m.status===403)||ec(m)))return e!=="others"&&await l(),this._returnResult({error:m})}return e!=="others"&&await l(),this._returnResult({error:null})})}onAuthStateChange(e){const i=WR(),a={id:i,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",i),this.stateChangeEmitters.delete(i)}};return this._debug("#onAuthStateChange()","registered callback with id",i),this.stateChangeEmitters.set(i,a),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(i)}):await this._emitInitialSession(i)))(),{data:{subscription:a}}}async _emitInitialSession(e){return await this._useSession(async i=>{var a,l;try{const{data:{session:c},error:u}=i;if(u)throw u;await((a=this.stateChangeEmitters.get(e))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",c)),this._debug("INITIAL_SESSION","callback id",e,"session",c)}catch(c){await((l=this.stateChangeEmitters.get(e))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",c),ec(c)?console.warn(c):console.error(c)}})}async resetPasswordForEmail(e,i={}){let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Di(this.storage,this.storageKey,!0));try{return await oe(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:a,code_challenge_method:l,gotrue_meta_security:{captcha_token:i.captchaToken}},headers:this.headers,redirectTo:i.redirectTo})}catch(c){if(await pt(this.storage,`${this.storageKey}-code-verifier`),te(c))return this._returnResult({data:null,error:c});throw c}}async getUserIdentities(){var e;try{const{data:i,error:a}=await this.getUser();if(a)throw a;return this._returnResult({data:{identities:(e=i.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var i;try{const{data:a,error:l}=await this._useSession(async c=>{var u,d,m,p,y;const{data:v,error:x}=c;if(x)throw x;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(u=e.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=e.options)===null||d===void 0?void 0:d.scopes,queryParams:(m=e.options)===null||m===void 0?void 0:m.queryParams,skipBrowserRedirect:!0});return await oe(this.fetch,"GET",_,{headers:this.headers,jwt:(y=(p=v.session)===null||p===void 0?void 0:p.access_token)!==null&&y!==void 0?y:void 0})});if(l)throw l;return Pt()&&!(!((i=e.options)===null||i===void 0)&&i.skipBrowserRedirect)&&window.location.assign(a==null?void 0:a.url),this._returnResult({data:{provider:e.provider,url:a==null?void 0:a.url},error:null})}catch(a){if(te(a))return this._returnResult({data:{provider:e.provider,url:null},error:a});throw a}}async linkIdentityIdToken(e){return await this._useSession(async i=>{var a;try{const{error:l,data:{session:c}}=i;if(l)throw l;const{options:u,provider:d,token:m,access_token:p,nonce:y}=e,v=await oe(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(a=c==null?void 0:c.access_token)!==null&&a!==void 0?a:void 0,body:{provider:d,id_token:m,access_token:p,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:Sn}),{data:x,error:_}=v;return _?this._returnResult({data:{user:null,session:null},error:_}):!x||!x.session||!x.user?this._returnResult({data:{user:null,session:null},error:new ja}):(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("USER_UPDATED",x.session)),this._returnResult({data:x,error:_}))}catch(l){if(await pt(this.storage,`${this.storageKey}-code-verifier`),te(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}})}async unlinkIdentity(e){try{return await this._useSession(async i=>{var a,l;const{data:c,error:u}=i;if(u)throw u;return await oe(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(l=(a=c.session)===null||a===void 0?void 0:a.access_token)!==null&&l!==void 0?l:void 0})})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async _refreshAccessToken(e){const i="#_refreshAccessToken()";this._debug(i,"begin");try{const a=Date.now();return await sk(async l=>(l>0&&await nk(200*Math.pow(2,l-1)),this._debug(i,"refreshing attempt",l),await oe(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Sn})),(l,c)=>{const u=200*Math.pow(2,l);return c&&Pb(c)&&Date.now()+u-a<ks})}catch(a){if(this._debug(i,"error",a),te(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}finally{this._debug(i,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,i){const a=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:i.redirectTo,scopes:i.scopes,queryParams:i.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",i,"url",a),Pt()&&!i.skipBrowserRedirect&&window.location.assign(a),{data:{provider:e,url:a},error:null}}async _recoverAndRefresh(){var e,i;const a="#_recoverAndRefresh()";this._debug(a,"begin");try{const l=await Bn(this.storage,this.storageKey);if(l&&this.userStorage){let u=await Bn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:l.user},await Ma(this.userStorage,this.storageKey+"-user",u)),l.user=(e=u==null?void 0:u.user)!==null&&e!==void 0?e:Ed()}else if(l&&!l.user&&!l.user){const u=await Bn(this.storage,this.storageKey+"-user");u&&(u!=null&&u.user)?(l.user=u.user,await pt(this.storage,this.storageKey+"-user"),await Ma(this.storage,this.storageKey,l)):l.user=Ed()}if(this._debug(a,"session from storage",l),!this._isValidSession(l)){this._debug(a,"session is not valid"),l!==null&&await this._removeSession();return}const c=((i=l.expires_at)!==null&&i!==void 0?i:1/0)*1e3-Date.now()<Td;if(this._debug(a,`session has${c?"":" not"} expired with margin of ${Td}s`),c){if(this.autoRefreshToken&&l.refresh_token){const{error:u}=await this._callRefreshToken(l.refresh_token);u&&(GR(u)?this._debug(a,"refresh discarded by commit guard",u):this._debug(a,"refresh failed",u))}}else if(l.user&&l.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:d}=await this._getUser(l.access_token);!d&&(u!=null&&u.user)?(l.user=u.user,await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)):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",l)}catch(l){this._debug(a,"error",l),console.error(l);return}finally{this._debug(a,"end")}}async _callRefreshToken(e){var i,a;if(!e)throw new kt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===e&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const l="#_callRefreshToken()";this._debug(l,"begin");try{this.refreshingDeferred=new Fc;const c=await Bn(this.storage,this.storageKey),{data:u,error:d}=await this._refreshAccessToken(e);if(d)throw d;if(!u.session)throw new kt;const m=await Bn(this.storage,this.storageKey);if(c!==null&&(m===null||m.refresh_token!==c.refresh_token)){this._debug(l,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:m?"replaced":"cleared"});const x={data:null,error:new Vb};return this.refreshingDeferred.resolve(x),x}const y=this._sessionRemovalEpoch;if(await this._saveSession(u.session),this._sessionRemovalEpoch!==y){this._debug(l,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await pt(this.storage,this.storageKey),this.userStorage&&await pt(this.userStorage,this.storageKey+"-user");const x={data:null,error:new Vb};return this.refreshingDeferred.resolve(x),x}await this._notifyAllSubscribers("TOKEN_REFRESHED",u.session);const v={data:u.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(v),v}catch(c){if(this._debug(l,"error",c),te(c)){const u={data:null,error:c};if(!Pb(c)){const d=await Bn(this.storage,this.storageKey);!!(d!=null&&d.expires_at&&d.expires_at*1e3>Date.now())?this._debug(l,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:u,expiresAt:Date.now()+UR},(i=this.refreshingDeferred)===null||i===void 0||i.resolve(u),u}throw(a=this.refreshingDeferred)===null||a===void 0||a.reject(c),c}finally{this.refreshingDeferred=null,this._debug(l,"end")}}async _notifyAllSubscribers(e,i,a=!0){if(this._pendingInitNotifications!==null&&a){this._pendingInitNotifications.push({event:e,session:i,broadcast:a});return}const l=`#_notifyAllSubscribers(${e})`;this._debug(l,"begin",i,`broadcast = ${a}`);try{this.broadcastChannel&&a&&this.broadcastChannel.postMessage({event:e,session:i});const c=[],u=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(e,i)}catch(m){c.push(m)}});if(await Promise.all(u),c.length>0){for(let d=0;d<c.length;d+=1)console.error(c[d]);throw c[0]}}finally{this._debug(l,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await pt(this.storage,`${this.storageKey}-code-verifier`);const i=Object.assign({},e),a=i.user&&i.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!a&&i.user&&await Ma(this.userStorage,this.storageKey+"-user",{user:i.user});const l=Object.assign({},i);delete l.user;const c=Ib(l);await Ma(this.storage,this.storageKey,c)}else{const l=Ib(i);await Ma(this.storage,this.storageKey,l)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await pt(this.storage,this.storageKey),await pt(this.storage,this.storageKey+"-code-verifier"),await pt(this.storage,this.storageKey+"-user"),this.userStorage&&await pt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Pt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(i){console.error("removing visibilitychange callback failed",i)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ks);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const i=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=i,i&&typeof i=="object"&&typeof i.unref=="function"?i.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(i)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const i=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,i&&clearTimeout(i)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.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 e=Date.now();try{return await this._useSession(async i=>{const{data:{session:a}}=i;if(!a||!a.refresh_token||!a.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const l=Math.floor((a.expires_at*1e3-e)/ks);this._debug("#_autoRefreshTokenTick()",`access token expires in ${l} ticks, a tick lasts ${ks}ms, refresh threshold is ${Qr} ticks`),l<=Qr&&await this._callRefreshToken(a.refresh_token)})}catch(i){console.error("Auto refresh tick failed with error. This is likely a transient error.",i)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof wk)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{await this._useSession(async i=>{const{data:{session:a}}=i;if(!a||!a.refresh_token||!a.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const l=Math.floor((a.expires_at*1e3-e)/ks);this._debug("#_autoRefreshTokenTick()",`access token expires in ${l} ticks, a tick lasts ${ks}ms, refresh threshold is ${Qr} ticks`),l<=Qr&&await this._callRefreshToken(a.refresh_token)})}catch(i){console.error("Auto refresh tick failed with error. This is likely a transient error.",i)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Pt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const i=`#_onVisibilityChanged(${e})`;if(this._debug(i,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(i,"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(i,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,i,a){const l=[`provider=${encodeURIComponent(i)}`];if(a!=null&&a.redirectTo&&l.push(`redirect_to=${encodeURIComponent(a.redirectTo)}`),a!=null&&a.scopes&&l.push(`scopes=${encodeURIComponent(a.scopes)}`),this.flowType==="pkce"){const[c,u]=await Di(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(c)}`,code_challenge_method:`${encodeURIComponent(u)}`});l.push(d.toString())}if(a!=null&&a.queryParams){const c=new URLSearchParams(a.queryParams);l.push(c.toString())}return a!=null&&a.skipBrowserRedirect&&l.push(`skip_http_redirect=${a.skipBrowserRedirect}`),`${e}?${l.join("&")}`}async _unenroll(e){try{return await this._useSession(async i=>{var a;const{data:l,error:c}=i;return c?this._returnResult({data:null,error:c}):await oe(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(a=l==null?void 0:l.session)===null||a===void 0?void 0:a.access_token})})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async _enroll(e){try{return await this._useSession(async i=>{var a,l;const{data:c,error:u}=i;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:m,error:p}=await oe(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(a=c==null?void 0:c.session)===null||a===void 0?void 0:a.access_token});return p?this._returnResult({data:null,error:p}):(e.factorType==="totp"&&m.type==="totp"&&(!((l=m==null?void 0:m.totp)===null||l===void 0)&&l.qr_code)&&(m.totp.qr_code=`data:image/svg+xml;utf-8,${m.totp.qr_code}`),this._returnResult({data:m,error:null}))})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async _verify(e){const i=async()=>{try{return await this._useSession(async a=>{var l;const{data:c,error:u}=a;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Zb(e.webauthn.credential_response):Wb(e.webauthn.credential_response)})}:{code:e.code}),{data:m,error:p}=await oe(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:d,headers:this.headers,jwt:(l=c==null?void 0:c.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+m.expires_in},m)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",m),this._returnResult({data:m,error:p}))})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,i):i()}async _challenge(e){const i=async()=>{try{return await this._useSession(async a=>{var l;const{data:c,error:u}=a;if(u)return this._returnResult({data:null,error:u});const d=await oe(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(l=c==null?void 0:c.session)===null||l===void 0?void 0:l.access_token});if(d.error)return d;const{data:m}=d;if(m.type!=="webauthn")return{data:m,error:null};switch(m.webauthn.type){case"create":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:Jb(m.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:Qb(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,i):i()}async _challengeAndVerify(e){const{data:i,error:a}=await this._challenge({factorId:e.factorId});return a?this._returnResult({data:null,error:a}):await this._verify({factorId:e.factorId,challengeId:i.id,code:e.code})}async _listFactors(){var e;const{data:{user:i},error:a}=await this.getUser();if(a)return{data:null,error:a};const l={all:[],phone:[],totp:[],webauthn:[]};for(const c of(e=i==null?void 0:i.factors)!==null&&e!==void 0?e:[])l.all.push(c),c.status==="verified"&&l[c.factor_type].push(c);return{data:l,error:null}}async _getAuthenticatorAssuranceLevel(e){var i,a,l,c;if(e)try{const{payload:_}=sc(e);let S=null;_.aal&&(S=_.aal);let T=S;const{data:{user:j},error:k}=await this.getUser(e);if(k)return this._returnResult({data:null,error:k});((a=(i=j==null?void 0:j.factors)===null||i===void 0?void 0:i.filter(P=>P.status==="verified"))!==null&&a!==void 0?a:[]).length>0&&(T="aal2");const C=_.amr||[];return{data:{currentLevel:S,nextLevel:T,currentAuthenticationMethods:C},error:null}}catch(_){if(te(_))return this._returnResult({data:null,error:_});throw _}const{data:{session:u},error:d}=await this.getSession();if(d)return this._returnResult({data:null,error:d});if(!u)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:m}=sc(u.access_token);let p=null;m.aal&&(p=m.aal);let y=p;((c=(l=u.user.factors)===null||l===void 0?void 0:l.filter(_=>_.status==="verified"))!==null&&c!==void 0?c:[]).length>0&&(y="aal2");const x=m.amr||[];return{data:{currentLevel:p,nextLevel:y,currentAuthenticationMethods:x},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async i=>{const{data:{session:a},error:l}=i;return l?this._returnResult({data:null,error:l}):a?await oe(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:a.access_token,xform:c=>({data:c,error:null})}):this._returnResult({data:null,error:new kt})})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async _approveAuthorization(e,i){try{return await this._useSession(async a=>{const{data:{session:l},error:c}=a;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new kt});const u=await oe(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&Pt()&&!(i!=null&&i.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}}async _denyAuthorization(e,i){try{return await this._useSession(async a=>{const{data:{session:l},error:c}=a;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new kt});const u=await oe(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&Pt()&&!(i!=null&&i.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:i},error:a}=e;return a?this._returnResult({data:null,error:a}):i?await oe(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:i.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new kt})})}catch(e){if(te(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async i=>{const{data:{session:a},error:l}=i;return l?this._returnResult({data:null,error:l}):a?(await oe(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:a.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new kt})})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async fetchJwk(e,i={keys:[]}){let a=i.keys.find(d=>d.kid===e);if(a)return a;const l=Date.now();if(a=this.jwks.keys.find(d=>d.kid===e),a&&this.jwks_cached_at+HR>l)return a;const{data:c,error:u}=await oe(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!c.keys||c.keys.length===0||(this.jwks=c,this.jwks_cached_at=l,a=c.keys.find(d=>d.kid===e),!a)?null:a}async getClaims(e,i={}){try{let a=e;if(!a){const{data:_,error:S}=await this.getSession();if(S||!_.session)return this._returnResult({data:null,error:S});a=_.session.access_token}const{header:l,payload:c,signature:u,raw:{header:d,payload:m}}=sc(a);if(!(i!=null&&i.allowExpired))try{uk(c.exp)}catch(_){throw new Rc(_ instanceof Error?_.message:"JWT validation failed")}const p=!l.alg||l.alg.startsWith("HS")||!l.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(l.kid,i!=null&&i.keys?{keys:i.keys}:i==null?void 0:i.jwks);if(!p){const{error:_}=await this.getUser(a);if(_)throw _;return{data:{claims:c,header:l,signature:u},error:null}}const y=hk(l.alg),v=await crypto.subtle.importKey("jwk",p,y,!0,["verify"]);if(!await crypto.subtle.verify(y,v,u,QR(`${d}.${m}`)))throw new Rc("Invalid JWT signature");return{data:{claims:c,header:l,signature:u},error:null}}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}}async signInWithPasskey(e){var i,a,l;zn(this.experimental);try{if(!Oc())return this._returnResult({data:null,error:new Vn("Browser does not support WebAuthn",null)});const{data:c,error:u}=await this._startPasskeyAuthentication({options:{captchaToken:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}});if(u||!c)return this._returnResult({data:null,error:u});const d=Qb(c.options),m=(l=(a=e==null?void 0:e.options)===null||a===void 0?void 0:a.signal)!==null&&l!==void 0?l:bf.createNewAbortSignal(),{data:p,error:y}=await Ow({publicKey:d,signal:m});if(y||!p)return this._returnResult({data:null,error:y??new Vn("WebAuthn ceremony failed",null)});const v=Wb(p);return this._verifyPasskeyAuthentication({challengeId:c.challenge_id,credential:v})}catch(c){if(te(c))return this._returnResult({data:null,error:c});throw c}}async registerPasskey(e){var i,a;zn(this.experimental);try{if(!Oc())return this._returnResult({data:null,error:new Vn("Browser does not support WebAuthn",null)});const{data:l,error:c}=await this._startPasskeyRegistration();if(c||!l)return this._returnResult({data:null,error:c});const u=Jb(l.options),d=(a=(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.signal)!==null&&a!==void 0?a:bf.createNewAbortSignal(),{data:m,error:p}=await Cw({publicKey:u,signal:d});if(p||!m)return this._returnResult({data:null,error:p??new Vn("WebAuthn ceremony failed",null)});const y=Zb(m);return this._verifyPasskeyRegistration({challengeId:l.challenge_id,credential:y})}catch(l){if(te(l))return this._returnResult({data:null,error:l});throw l}}async _startPasskeyRegistration(){zn(this.experimental);try{return await this._useSession(async e=>{const{data:{session:i},error:a}=e;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new kt});const{data:l,error:c}=await oe(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:i.access_token,body:{}});return c?this._returnResult({data:null,error:c}):this._returnResult({data:l,error:null})})}catch(e){if(te(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){zn(this.experimental);try{return await this._useSession(async i=>{const{data:{session:a},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!a)return this._returnResult({data:null,error:new kt});const{data:c,error:u}=await oe(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:a.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:c,error:null})})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async _startPasskeyAuthentication(e){var i;zn(this.experimental);try{const{data:a,error:l}=await oe(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}}});return l?this._returnResult({data:null,error:l}):this._returnResult({data:a,error:null})}catch(a){if(te(a))return this._returnResult({data:null,error:a});throw a}}async _verifyPasskeyAuthentication(e){zn(this.experimental);try{const{data:i,error:a}=await oe(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:Sn});return a?this._returnResult({data:null,error:a}):(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:i,error:null}))}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async _listPasskeys(){zn(this.experimental);try{return await this._useSession(async e=>{const{data:{session:i},error:a}=e;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new kt});const{data:l,error:c}=await oe(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:i.access_token,xform:u=>({data:u,error:null})});return c?this._returnResult({data:null,error:c}):this._returnResult({data:l,error:null})})}catch(e){if(te(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){zn(this.experimental);try{return await this._useSession(async i=>{const{data:{session:a},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!a)return this._returnResult({data:null,error:new kt});const{data:c,error:u}=await oe(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:a.access_token,body:{friendly_name:e.friendlyName}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:c,error:null})})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}async _deletePasskey(e){zn(this.experimental);try{return await this._useSession(async i=>{const{data:{session:a},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!a)return this._returnResult({data:null,error:new kt});const{error:c}=await oe(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:a.access_token,noResolveJson:!0});return c?this._returnResult({data:null,error:c}):this._returnResult({data:null,error:null})})}catch(i){if(te(i))return this._returnResult({data:null,error:i});throw i}}}bo.nextInstanceID={};const Bk=bo,Uk="2.110.2";let Zr="",Mc;if(typeof Deno<"u"){var jd;Zr="deno",Mc=(jd=Deno.version)===null||jd===void 0?void 0:jd.deno}else if(typeof document<"u")Zr="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")Zr="react-native";else{var Nd;Zr="node",Mc=typeof process<"u"?(Nd=process.version)===null||Nd===void 0?void 0:Nd.replace(/^v/,""):void 0}const Dw=[`runtime=${Zr}`];Mc&&Dw.push(`runtime-version=${Mc}`);const Lk={"X-Client-Info":`supabase-js/${Uk}; ${Dw.join("; ")}`},zk={headers:Lk},Pk={schema:"public"},Vk={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Hk={},$k={enabled:!1,respectSamplingDecision:!0};function qk(n,e,i,a){function l(c){return c instanceof i?c:new i(function(u){u(c)})}return new(i||(i=Promise))(function(c,u){function d(y){try{p(a.next(y))}catch(v){u(v)}}function m(y){try{p(a.throw(y))}catch(v){u(v)}}function p(y){y.done?c(y.value):l(y.value).then(d,m)}p((a=a.apply(n,[])).next())})}let Rd=null;const Fk="@opentelemetry/api";function Ik(){return Rd===null&&(Rd=import(Fk).catch(()=>null)),Rd}function Gk(){return qk(this,void 0,void 0,function*(){try{const n=yield Ik();if(!n||!n.propagation||!n.context)return null;const e={};n.propagation.inject(n.context.active(),e);const i=e.traceparent;return i?{traceparent:i,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function Kk(n){if(!n||typeof n!="string")return null;const e=n.split("-");if(e.length!==4)return null;const[i,a,l,c]=e;if(i.length!==2||a.length!==32||l.length!==16||c.length!==2)return null;const u=/^[0-9a-f]+$/i;return!u.test(i)||!u.test(a)||!u.test(l)||!u.test(c)||a==="00000000000000000000000000000000"||l==="0000000000000000"?null:{version:i,traceId:a,parentId:l,traceFlags:c,isSampled:(parseInt(c,16)&1)===1}}function Yk(n,e){if(!n||!e||e.length===0)return!1;let i;if(n instanceof URL)i=n;else try{i=new URL(n)}catch{return!1}for(const a of e)try{if(typeof a=="string"){if(Xk(i.hostname,a))return!0}else if(a instanceof RegExp){if(a.test(i.hostname))return!0}else if(typeof a=="function"&&a(i))return!0}catch{continue}return!1}function Xk(n,e){if(e===n)return!0;if(e.startsWith("*.")){const i=e.slice(2);if(n.endsWith(i)&&(n===i||n.endsWith("."+i)))return!0}return!1}function Jk(n){const e=[];try{const i=new URL(n);e.push(i.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function vo(n){"@babel/helpers - typeof";return vo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vo(n)}function Qk(n,e){if(vo(n)!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var a=i.call(n,e);if(vo(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Zk(n){var e=Qk(n,"string");return vo(e)=="symbol"?e:e+""}function Wk(n,e,i){return(e=Zk(e))in n?Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[e]=i,n}function ev(n,e){var i=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),i.push.apply(i,a)}return i}function ct(n){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?ev(Object(i),!0).forEach(function(a){Wk(n,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):ev(Object(i)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(i,a))})}return n}const eC=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),tC=()=>Headers,nC=(n,e,i,a,l)=>{const c=eC(a),u=tC(),d=(l==null?void 0:l.enabled)===!0,m=(l==null?void 0:l.respectSamplingDecision)!==!1,p=d?Jk(e):null;return async(y,v)=>{var x;const _=(x=await i())!==null&&x!==void 0?x:n;let S=new u(v==null?void 0:v.headers);if(S.has("apikey")||S.set("apikey",n),S.has("Authorization")||S.set("Authorization",`Bearer ${_}`),p){const T=await sC(y,p,m);T&&(T.traceparent&&!S.has("traceparent")&&S.set("traceparent",T.traceparent),T.tracestate&&!S.has("tracestate")&&S.set("tracestate",T.tracestate),T.baggage&&!S.has("baggage")&&S.set("baggage",T.baggage))}return c(y,ct(ct({},v),{},{headers:S}))}};async function sC(n,e,i){if(!Yk(typeof n=="string"||n instanceof URL?n:n.url,e))return null;const a=await Gk();if(!a||!a.traceparent)return null;if(i){const l=Kk(a.traceparent);if(l&&!l.isSampled)return null}return a}function tv(n){return typeof n=="boolean"?{enabled:n}:n}function iC(n){return n.endsWith("/")?n:n+"/"}function aC(n,e){var i,a,l,c,u,d;const{db:m,auth:p,realtime:y,global:v}=n,{db:x,auth:_,realtime:S,global:T}=e,j=tv(n.tracePropagation),k=tv(e.tracePropagation),M={db:ct(ct({},x),m),auth:ct(ct({},_),p),realtime:ct(ct({},S),y),storage:{},global:ct(ct(ct({},T),v),{},{headers:ct(ct({},(i=T==null?void 0:T.headers)!==null&&i!==void 0?i:{}),(a=v==null?void 0:v.headers)!==null&&a!==void 0?a:{})}),tracePropagation:{enabled:(l=(c=j==null?void 0:j.enabled)!==null&&c!==void 0?c:k==null?void 0:k.enabled)!==null&&l!==void 0?l:!1,respectSamplingDecision:(u=(d=j==null?void 0:j.respectSamplingDecision)!==null&&d!==void 0?d:k==null?void 0:k.respectSamplingDecision)!==null&&u!==void 0?u:!0},accessToken:async()=>""};return n.accessToken?M.accessToken=n.accessToken:delete M.accessToken,M}function rC(n){const e=n==null?void 0:n.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(iC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var oC=class extends Bk{constructor(n){super(n)}},lC=class{constructor(n,e,i){var a,l;this.supabaseUrl=n,this.supabaseKey=e;const c=rC(n);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,d={db:Pk,realtime:Hk,auth:ct(ct({},Vk),{},{storageKey:u}),global:zk,tracePropagation:$k},m=aC(i??{},d);if(this.settings=m,this.storageKey=(a=m.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(l=m.global.headers)!==null&&l!==void 0?l:{},m.accessToken)this.accessToken=m.accessToken,this.auth=new Proxy({},{get:(y,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=m.auth)!==null&&p!==void 0?p:{},this.headers,m.global.fetch)}this.fetch=nC(e,n,this._getAccessToken.bind(this),m.global.fetch,m.tracePropagation),this.realtime=this._initRealtimeClient(ct({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},m.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(y=>this.realtime.setAuth(y)).catch(y=>console.warn("Failed to set initial Realtime auth token:",y)),this.rest=new yN(new URL("rest/v1",c).href,{headers:this.headers,schema:m.db.schema,fetch:this.fetch,timeout:m.db.timeout,urlLengthLimit:m.db.urlLengthLimit}),this.storage=new BR(this.storageUrl.href,this.headers,this.fetch,i==null?void 0:i.storage),m.accessToken||this._listenForAuthEvents()}get functions(){return new lN(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,e={},i={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,e,i)}channel(n,e={config:{}}){return this.realtime.channel(n,e)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,e,i;if(n.accessToken)return await n.accessToken();const{data:a}=await n.auth.getSession();return(e=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&e!==void 0?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:e,detectSessionInUrl:i,storage:a,userStorage:l,storageKey:c,flowType:u,lock:d,debug:m,throwOnError:p,experimental:y,lockAcquireTimeout:v,skipAutoInitialize:x},_,S){const T={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new oC({url:this.authUrl.href,headers:ct(ct({},T),_),storageKey:c,autoRefreshToken:n,persistSession:e,detectSessionInUrl:i,storage:a,userStorage:l,flowType:u,lock:d,debug:m,throwOnError:p,experimental:y,fetch:S,lockAcquireTimeout:v,skipAutoInitialize:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(j=>j.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new aR(this.realtimeUrl.href,ct(ct({},n),{},{params:ct(ct({},{apikey:this.supabaseKey}),n==null?void 0:n.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,e)=>{this._handleTokenChanged(n,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(n,e,i){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==i?(this.changedAccessToken=i,this.realtime.setAuth(i)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const cC=(n,e,i)=>new lC(n,e,i);function uC(){if(typeof window<"u")return!1;const n=globalThis.process;if(!n)return!1;const e=n.version;if(e==null)return!1;const i=e.match(/^v(\d+)\./);return i?parseInt(i[1],10)<=20:!1}uC()&&console.warn("⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715");const Mw=void 0,hC=void 0,dC=!!Mw,es=dC?cC(Mw,hC,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}):null,fC=180,mC=8e3;async function pC(n=fC){if(!es)return null;const{data:e,error:i}=await es.auth.getSession();if(i)throw i;let a=e.session;if(!a)throw new Error("Tu sesión expiró. Inicia sesión nuevamente antes de continuar.");const l=Number(a.expires_at||0)*1e3;if(!l||l-Date.now()<=n*1e3){const u=await es.auth.refreshSession();if(u.error)throw u.error;if(a=u.data.session,!a)throw new Error("Tu sesión expiró. Inicia sesión nuevamente antes de continuar.")}return a}async function nv(n){if(typeof window>"u"||typeof fetch>"u")return;if(typeof navigator<"u"&&navigator.onLine===!1)throw new Error("No hay conexión a Internet. Verifica tu conexión e intenta nuevamente.");let e;try{e=new URL(n,window.location.origin)}catch{return}if(e.origin===window.location.origin)return;const i=new URL("/favicon.ico",e.origin);i.searchParams.set("_glm_resume",String(Date.now()));const a=new AbortController,l=window.setTimeout(()=>a.abort(),mC);try{await fetch(i.toString(),{method:"GET",mode:"no-cors",cache:"no-store",credentials:"omit",signal:a.signal})}catch(c){if(typeof navigator<"u"&&navigator.onLine===!1)throw new Error("No hay conexión a Internet. Verifica tu conexión e intenta nuevamente.");console.warn("No se pudo precalentar la conexión con n8n:",c)}finally{window.clearTimeout(l)}}function sv(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`glm-${Date.now()}-${Math.random().toString(36).slice(2,12)}`}function iv(n,e){try{const i=new URL(n,window.location.origin);return i.searchParams.set("client_request_id",e),i.searchParams.set("_ts",String(Date.now())),i.toString()}catch{return n}}const kd=["Nombre mal escrito en BambooHR","Apodo o nombre de uso","Nombre incompleto / nombres adicionales","Otro"];function Bw({row:n,country:e,periodRange:i,operatorName:a,operatorEmail:l,executionId:c,reportUrl:u,onClose:d,onSuccess:m,onShowToast:p}){const y=n.bestBambooCandidate,[v,x]=D.useState((y==null?void 0:y.employeeName)||""),[_,S]=D.useState((y==null?void 0:y.employeeNumber)||""),[T,j]=D.useState(kd[0]),[k,M]=D.useState(""),[C,P]=D.useState(!1),[K,G]=D.useState(!1);D.useEffect(()=>{x((y==null?void 0:y.employeeName)||""),S((y==null?void 0:y.employeeNumber)||""),j(kd[0]),M(""),P(!1)},[n.id,y==null?void 0:y.employeeName,y==null?void 0:y.employeeNumber]);const H=D.useMemo(()=>e.code==="TT"?"Laurele Nicome-Jack":e.code==="PA"?"Delarys Peñalba":e.code==="SV"?"Carlos Antonio Malta Méndez":e.code==="HN"?"Melody Chang Blandin":e.code==="PR"||e.code==="RD"?"Noralmy Laureano":"haguirre@gomezleemarketing.com",[e.code]);D.useMemo(()=>Array.from(new Set([n.employee,n.bankNameFile,n.bankAccountHolder].map(Z=>String(Z||"").trim()).filter(Boolean))),[n.employee,n.bankNameFile,n.bankAccountHolder]);const Y=async()=>{{p("Falta configurar VITE_REPORTAR_BAMBOO_URL.","error");return}};return g.jsxs("div",{className:"fixed inset-0 z-[90] flex items-center justify-center px-4 py-6",children:[g.jsx("button",{type:"button",className:"absolute inset-0 bg-black/45",onClick:K?void 0:d,"aria-label":"Cerrar"}),g.jsxs("div",{className:"relative w-full max-w-2xl bg-white border border-[#D0D0D0] shadow-2xl max-h-[92vh] overflow-y-auto",children:[g.jsx("div",{className:"h-1.5 bg-[#6CC24A]"}),g.jsxs("div",{className:"px-6 py-5 border-b border-neutral-200 flex items-start justify-between gap-4",children:[g.jsxs("div",{children:[g.jsx("p",{className:"text-[10px] uppercase tracking-[0.18em] font-black text-[#6B8FA3]",children:"Banco sin BambooHR"}),g.jsx("h2",{className:"text-xl font-black text-[#4F758B] mt-1",children:"Reportar corrección de identidad a RRHH"}),g.jsx("p",{className:"text-xs text-neutral-500 mt-2 leading-relaxed",children:"Esta validación crea una equivalencia permanente para que el mismo falso positivo no vuelva a aparecer mientras RRHH corrige BambooHR."})]}),g.jsx("button",{type:"button",onClick:d,disabled:K,className:"p-2 text-neutral-400 hover:text-neutral-700 hover:bg-neutral-100 disabled:opacity-40","aria-label":"Cerrar modal",children:g.jsx(Ga,{className:"w-5 h-5"})})]}),g.jsxs("div",{className:"px-6 py-5 space-y-5",children:[g.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 bg-[#F5F5F5] border border-neutral-200 p-4",children:[g.jsxs("div",{children:[g.jsx("p",{className:"text-[9px] uppercase tracking-wider font-black text-[#6B8FA3]",children:"Nombre detectado"}),g.jsx("p",{className:"text-sm font-black text-neutral-800 mt-1",children:n.employee})]}),g.jsxs("div",{children:[g.jsx("p",{className:"text-[9px] uppercase tracking-wider font-black text-[#6B8FA3]",children:"Cuenta bancaria"}),g.jsx("p",{className:"text-sm font-mono font-bold text-neutral-700 mt-1",children:n.account||"—"})]}),g.jsxs("div",{className:"sm:col-span-2",children:[g.jsx("p",{className:"text-[9px] uppercase tracking-wider font-black text-[#6B8FA3]",children:"Se notificará a"}),g.jsx("p",{className:"text-xs font-bold text-neutral-700 mt-1",children:H})]})]}),(y==null?void 0:y.employeeName)&&g.jsxs("div",{className:"border border-[#D6E8F4] bg-[#F7FBFD] p-4 flex items-start gap-3",children:[g.jsx(Ac,{className:"w-4 h-4 text-[#4F758B] mt-0.5 flex-shrink-0"}),g.jsxs("div",{className:"text-xs text-neutral-600 leading-relaxed",children:[g.jsx("strong",{className:"text-[#4F758B]",children:"Candidato sugerido por el cruce:"})," ",y.employeeName,y.employeeNumber?` · Employee Number ${y.employeeNumber}`:"",". Verifícalo manualmente antes de confirmar."]})]}),g.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[g.jsxs("label",{className:"sm:col-span-2",children:[g.jsx("span",{className:"block text-[10px] uppercase tracking-wider font-black text-[#4F758B] mb-1.5",children:"Nombre correcto en BambooHR *"}),g.jsx("input",{type:"text",value:v,onChange:Z=>x(Z.target.value),placeholder:"Ej.: Jonathan Alexander Pérez",className:"w-full border border-[#D0D0D0] px-3 py-2.5 text-sm font-medium focus:outline-none focus:border-[#4F758B]"})]}),g.jsxs("label",{children:[g.jsx("span",{className:"block text-[10px] uppercase tracking-wider font-black text-[#4F758B] mb-1.5",children:"Employee Number"}),g.jsx("input",{type:"text",value:_,onChange:Z=>S(Z.target.value),placeholder:"Recomendado para mayor seguridad",className:"w-full border border-[#D0D0D0] px-3 py-2.5 text-sm font-medium focus:outline-none focus:border-[#4F758B]"})]}),g.jsxs("label",{children:[g.jsx("span",{className:"block text-[10px] uppercase tracking-wider font-black text-[#4F758B] mb-1.5",children:"Motivo *"}),g.jsx("select",{value:T,onChange:Z=>j(Z.target.value),className:"w-full border border-[#D0D0D0] px-3 py-2.5 text-sm font-medium focus:outline-none focus:border-[#4F758B] bg-white",children:kd.map(Z=>g.jsx("option",{value:Z,children:Z},Z))})]}),g.jsxs("label",{className:"sm:col-span-2",children:[g.jsx("span",{className:"block text-[10px] uppercase tracking-wider font-black text-[#4F758B] mb-1.5",children:"Comentario para RRHH"}),g.jsx("textarea",{value:k,onChange:Z=>M(Z.target.value),rows:3,placeholder:"Detalle adicional que ayude a RRHH a corregir el registro.",className:"w-full border border-[#D0D0D0] px-3 py-2.5 text-sm font-medium focus:outline-none focus:border-[#4F758B] resize-y"})]})]}),g.jsxs("label",{className:"flex items-start gap-3 border border-[#D0D0D0] p-4 cursor-pointer",children:[g.jsx("input",{type:"checkbox",checked:C,onChange:Z=>P(Z.target.checked),className:"mt-0.5 accent-[#6CC24A]"}),g.jsxs("span",{className:"text-xs text-neutral-600 leading-relaxed",children:["Confirmo que revisé el caso manualmente y que ",g.jsx("strong",{children:n.employee})," corresponde a la misma persona indicada arriba en BambooHR."]})]})]}),g.jsxs("div",{className:"px-6 py-4 border-t border-neutral-200 bg-neutral-50 flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[g.jsx("button",{type:"button",onClick:d,disabled:K,className:"px-4 py-2.5 border border-neutral-300 bg-white text-neutral-600 text-xs font-black uppercase tracking-wider disabled:opacity-40",children:"Cancelar"}),g.jsx("button",{type:"button",onClick:Y,disabled:K||!C||!v.trim(),className:"px-5 py-2.5 bg-[#4F758B] text-white text-xs font-black uppercase tracking-wider inline-flex items-center justify-center gap-2 border-l-4 border-[#6CC24A] disabled:bg-neutral-300 disabled:border-neutral-300 disabled:cursor-not-allowed",children:K?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}),"Enviando..."]}):g.jsxs(g.Fragment,{children:[g.jsx(hw,{className:"w-4 h-4"}),"Enviar a RRHH"]})})]})]})]})}const gC="https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-reportar";function yC(n){try{return n?JSON.parse(n):null}catch{return null}}function bC(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`report-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Uw({country:n,operatorName:e,operatorEmail:i,section:a,onShowToast:l}){const[c,u]=D.useState(!1),[d,m]=D.useState(""),[p,y]=D.useState(!1),v=()=>{p||u(!1)},x=async()=>{const _=d.trim();if(!_){l("Escribe una descripción del reporte.","error");return}if(!es){l("Supabase no está configurado en esta aplicación.","error");return}y(!0);try{const S=await pC(300),T=S==null?void 0:S.access_token;if(!T)throw new Error("Tu sesión expiró. Inicia sesión nuevamente antes de enviar el reporte.");const j={message:_.slice(0,5e3),userName:e,userEmail:i,country:n.code,countryName:n.name,section:a,submittedAt:new Date().toISOString(),pageUrl:window.location.href,appSessionId:bC()},k=new FormData;k.append("payload",JSON.stringify(j)),k.append("access_token",T);const M=await fetch(gC,{method:"POST",body:k}),C=await M.text(),P=yC(C);if(!M.ok||(P==null?void 0:P.ok)===!1){const K=(P==null?void 0:P.message)||(P==null?void 0:P.error)||C||"No se pudo enviar el reporte.";throw new Error(String(K))}m(""),u(!1),l("Reporte enviado correctamente.","success")}catch(S){l(S instanceof Error?S.message:"No se pudo enviar el reporte.","error")}finally{y(!1)}};return g.jsxs(g.Fragment,{children:[g.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex items-center justify-center gap-2 border border-[#4F758B]/25 bg-white text-[#4F758B] h-9 px-2.5 sm:px-3 text-xs font-black hover:border-[#4F758B]/55 hover:bg-[#4F758B]/5 transition-colors shadow-sm",title:"Reportar un error o incidencia","aria-label":"Reportar",children:[g.jsx(F2,{className:"w-4 h-4"}),g.jsx("span",{className:"hidden sm:inline",children:"Reportar"})]}),c&&g.jsxs("div",{className:"fixed inset-0 z-[90] flex items-center justify-center px-4 py-6",children:[g.jsx("button",{type:"button",className:"absolute inset-0 bg-black/45",onClick:v,"aria-label":"Cerrar reporte"}),g.jsxs("div",{className:"relative w-full max-w-2xl bg-white border border-[#D0D0D0] shadow-2xl",children:[g.jsx("div",{className:"h-1.5 bg-[#6CC24A]"}),g.jsxs("div",{className:"px-6 py-5 border-b border-neutral-200 flex items-center justify-between gap-4",children:[g.jsx("h2",{className:"text-xl font-black text-[#4F758B]",children:"Reporte"}),g.jsx("button",{type:"button",onClick:v,disabled:p,className:"p-2 text-neutral-400 hover:text-neutral-700 hover:bg-neutral-100 disabled:opacity-40","aria-label":"Cerrar modal",children:g.jsx(Ga,{className:"w-5 h-5"})})]}),g.jsxs("div",{className:"px-6 py-5",children:[g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"block text-[10px] uppercase tracking-wider font-black text-[#4F758B] mb-1.5",children:"Descripción del Reporte *"}),g.jsx("textarea",{value:d,onChange:_=>m(_.target.value.slice(0,5e3)),rows:7,autoFocus:!0,disabled:p,placeholder:"Escribe aquí el error, incidencia o mejora que deseas reportar...",className:"w-full resize-y min-h-[150px] border border-[#D0D0D0] bg-white px-3.5 py-3 text-sm text-neutral-700 placeholder-neutral-400 focus:outline-none focus:border-[#4F758B] disabled:bg-neutral-50"})]}),g.jsxs("div",{className:"mt-1.5 text-right text-[10px] text-neutral-400",children:[d.length,"/5000"]})]}),g.jsxs("div",{className:"px-6 py-4 border-t border-neutral-200 bg-neutral-50 flex items-center justify-end gap-3",children:[g.jsx("button",{type:"button",onClick:v,disabled:p,className:"border border-neutral-300 bg-white text-neutral-600 px-4 py-2.5 text-xs font-bold hover:bg-neutral-100 disabled:opacity-50",children:"Cancelar"}),g.jsxs("button",{type:"button",onClick:()=>void x(),disabled:p||!d.trim(),className:"bg-[#4F758B] hover:bg-[#3F6174] text-white px-4 py-2.5 text-xs font-black inline-flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[p?g.jsx(Ha,{className:"w-4 h-4 animate-spin"}):g.jsx(hw,{className:"w-4 h-4"}),g.jsx("span",{children:p?"Enviando...":"Enviar reporte"})]})]})]})]})]})}const Lw=[{value:1,label:"Enero"},{value:2,label:"Febrero"},{value:3,label:"Marzo"},{value:4,label:"Abril"},{value:5,label:"Mayo"},{value:6,label:"Junio"},{value:7,label:"Julio"},{value:8,label:"Agosto"},{value:9,label:"Septiembre"},{value:10,label:"Octubre"},{value:11,label:"Noviembre"},{value:12,label:"Diciembre"}],av=[{value:"quincena_15",label:"Quincena 15",description:"Del día 1 al 15 del mes."},{value:"quincena_30",label:"Quincena 30 / fin de mes",description:"Del día 16 al último día del mes."}];function vC(n){return n==="TT"?"":n==="PA"?"https://agenteit.digitalcompass.agency/webhook/nominapa-bamboo-test":n==="SV"?"https://agenteit.digitalcompass.agency/webhook/nominasv-bamboo-test":n==="HN"?"https://agenteit.digitalcompass.agency/webhook/nominahn-bamboo-test":n==="PR"?"https://agenteit.digitalcompass.agency/webhook/nominapr-bamboo-test":n==="RD"?"https://agenteit.digitalcompass.agency/webhook/nominard-bamboo-test":""}function xC(){return""}function wC(){const n=new Date().getFullYear(),e=n-5,i=n+10;return Array.from({length:i-e+1},(a,l)=>e+l)}function _C(){const n=new Date,e=n.getDate();let i=n.getFullYear(),a=n.getMonth()+1,l="quincena_15";return e<=15&&(a-=1,l="quincena_30",a===0&&(a=12,i-=1)),{year:i,month:a,periodType:l}}function Bc(n){return n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(2)} MB`}function Kr(n){const e=n.name.toLowerCase();return e.endsWith(".xlsx")||e.endsWith(".xls")}function Cd(n){return n.name.toLowerCase().endsWith(".csv")}function rv(n){return n.name.toLowerCase().endsWith(".pdf")}function SC(n){return Array.from(n).map(e=>({name:e.name,size:Bc(e.size),type:"payroll",rawFile:e}))}function Od(n){return Array.from(n).map(e=>({name:e.name,size:Bc(e.size),type:"bank",rawFile:e}))}function Va(n,e,i){return`${n}-${String(e).padStart(2,"0")}-${String(i).padStart(2,"0")}`}function ov(n){const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);return e?`${e[3]}-${e[2]}-${e[1]}`:n}function lv(n,e,i){var c;const a=new Date(n,e,0).getDate(),l=((c=Lw.find(u=>u.value===e))==null?void 0:c.label)??"Mes";return i==="quincena_15"?{start:Va(n,e,1),end:Va(n,e,15),label:`${l} ${n} · Quincena 15`}:{start:Va(n,e,16),end:Va(n,e,a),label:`${l} ${n} · Quincena 30 / fin de mes`}}function TC(n){const e=n-1;return{start:Va(e,7,1),end:Va(n,6,30),label:`Bono 14 ${n} · Julio ${e} a junio ${n}`}}function Dd(n,e,i){if(n==null||Number.isNaN(n))return"—";const a=i==="USD"||i==="GTQ"||i==="TTD"?i:e.currency,l=a==="USD"?"en-US":e.locale;return new Intl.NumberFormat(l,{style:"currency",currency:a,minimumFractionDigits:2}).format(n)}function Un(n,e=0){const i=Number(n);return Number.isFinite(i)?i:e}function At(n){return n.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function EC(n,e){const i=At(String(n??e??""));return i.includes("coincid")?"Coincidencia":i.includes("resuelto")?"Resuelto":i.includes("no encontrado")?"No encontrado":i.includes("pendiente")?"Pendiente revisión":i.includes("riesgo")||i.includes("discrep")||i.includes("mal digitada")?"Riesgo":e==="coincidencia"?"Coincidencia":e==="posible_cuenta_mal_digitada"||e==="discrepancia"?"Riesgo":"Pendiente revisión"}function ic(n,e){for(const i of e){if(typeof n[i]=="number")return n[i];if(typeof n[i]=="string"&&n[i]!==""){const a=n[i].replace(/[Q,$\s]/g,"").replace(/,/g,""),l=Number(a);if(Number.isFinite(l))return l}}return null}function cv(n){return Array.isArray(n)?n.map((e,i)=>{const a=e,l=String(a.category??a.categoria??a.tipo??a.source??a.fuente??""),c=ic(a,["amountPayroll","monto_nomina","payroll_amount","amount_payroll","montoNomina"]),u=ic(a,["amountBank","monto_banco","bank_amount","amount_bank","montoBanco"]),d=ic(a,["difference","diferencia","diff"]);return{id:String(a.id??a.employeeNumber??a.employee_number??a.account??a.cuenta??`row-${i+1}`),employee:String(a.employee??a.empleado??a.name??a.nombre??a.employee_name??"Sin nombre"),employeeNumber:String(a.employeeNumber??a.employee_number??a.codigo??""),account:a.account||a.cuenta||a.bank_account?String(a.account??a.cuenta??a.bank_account):void 0,currency:String(a.currency??a.moneda??"").toUpperCase()||void 0,amountPayroll:c,amountBank:u,difference:d??(c!==null&&u!==null?c-u:null),status:EC(a.status??a.estado,l),category:l,observation:String(a.observation??a.observacion??a.note??a.nota??a.comentario??""),source:a.source??a.fuente??l,bankNameFile:String(a.bank_name_file??a.bankNameFile??""),bankAccountHolder:String(a.bank_account_holder??a.bankAccountHolder??""),bestBambooCandidate:a.best_bamboo_candidate&&typeof a.best_bamboo_candidate=="object"?{employeeNumber:String(a.best_bamboo_candidate.employee_number??""),employeeName:String(a.best_bamboo_candidate.employee_name??""),score:ic(a.best_bamboo_candidate,["score"])}:null,ambiguousBambooMatch:!!a.ambiguous_bamboo_match}}):[]}function uv(n){const i=(Array.isArray(n)?n[0]:n)??{},a=i.originalResponse??i.original_response??i.response??i,l=a.summary??a.resumen??i.summary??i.resumen??{},c=cv(a.rows??i.rows??a.resultados??i.resultados??[]),u=cv(a.bankWithoutBamboo??i.bankWithoutBamboo??a.banco_sin_bamboo_rows??i.banco_sin_bamboo_rows??[]).map(G=>({...G,category:G.category||"banco_sin_bamboo",source:"banco_sin_bamboo",status:G.status==="Coincidencia"?"Pendiente revisión":G.status})),d=new Map;[...c,...u].forEach((G,H)=>{const Y=G.id||`${G.source??G.category??"row"}-${H}`;d.set(Y,G)});const m=Array.from(d.values()),p=Un(l.matches??l.coincidencias,c.filter(G=>G.status==="Coincidencia").length),y=Un(l.discrepancies??l.discrepancias,c.filter(G=>{const H=At(String(G.category??G.source??""));return H.includes("discrepancia")||H.includes("posible_cuenta_mal_digitada")}).length),v=Un(l.bankWithoutPayroll??l.bancoSinNomina??l.banco_sin_nomina,c.filter(G=>Ba(G,"banco_sin_nomina")).length),x=Un(l.bankWithoutBamboo??l.bancoSinBamboo??l.banco_sin_bamboo,u.length),_=Un(l.payrollWithoutAccount??l.nominaSinCuenta??l.nomina_sin_cuenta),S=Un(l.nameDifferences??l.diferenciasNombreBanco??l.diferencias_nombre_banco,c.filter(G=>At(String(G.category??"")).includes("diferencia_nombre_banco")).length),T=Un(l.possibleWrongAccounts??l.posiblesCuentasMalDigitadas??l.posibles_cuentas_mal_digitadas,c.filter(G=>At(String(G.category??"")).includes("posible_cuenta_mal_digitada")).length),j=a.metadata??i.metadata??{},k=String(j.country??j.country_code??"").toUpperCase(),M=y+v+x+_+S,C=y+v+_+S+T,P=k==="RD"?Un(l.totalPending??l.pendientes??l.pendientes_cruce_principal??l.total_pending,C):M,K=String(j.period_type??j.periodType??"").toLowerCase();return{ok:!!(a.ok??i.ok??!0),reportKind:K==="bono14"?"bono14":"nomina",executionId:a.executionId||a.execution_id||i.executionId||i.execution_id?String(a.executionId??a.execution_id??i.executionId??i.execution_id):void 0,reportUrl:a.reportUrl||a.report_url||i.reportUrl||i.report_url||i.google_sheet_url?String(a.reportUrl??a.report_url??i.reportUrl??i.report_url??i.google_sheet_url):void 0,summary:{matches:p,discrepancies:y,bankWithoutPayroll:v,bankWithoutBamboo:x,payrollWithoutAccount:_,nameDifferences:S,possibleWrongAccounts:T,totalPending:P,totalRows:m.length,totalPayroll:Un(l.totalNomina??l.total_nomina,void 0),totalBank:Un(l.totalBanco??l.total_banco,void 0),totalDifference:Un(l.diferenciaTotal??l.diferencia_total,void 0)},rows:m,message:a.message||i.message?String(a.message??i.message):void 0}}function AC(n){return n==="Coincidencia"?"bg-emerald-50 text-emerald-800 border-emerald-200":n==="Resuelto"?"bg-blue-50 text-blue-800 border-blue-200":n==="No encontrado"?"bg-amber-50 text-amber-800 border-amber-200":n==="Pendiente revisión"?"bg-neutral-100 text-neutral-700 border-neutral-300":"bg-red-50 text-[#ba1a1a] border-red-200"}function hv(n){const e=At(String(n.category??n.source??"")),i=At(n.observation??"");return n.status==="Coincidencia"||e.includes("coincidencia")?90:e.includes("posible_cuenta_mal_digitada")||i.includes("mal digitada")?1:e.includes("discrepancia")||n.status==="Riesgo"?2:e.includes("banco_sin_bamboo")?3:e.includes("banco_sin_nomina")?4:e.includes("diferencia_nombre_banco")?5:e.includes("nomina_sin_cuenta")?6:n.status==="Pendiente revisión"?7:n.status==="No encontrado"?10:20}function jC(n){return[...n].sort((e,i)=>{const a=hv(e)-hv(i);return a!==0?a:e.employee.localeCompare(i.employee,"es")})}function NC(n){const e=At(String(n.category??n.source??""));return e.includes("discrepancia")||e.includes("posible_cuenta_mal_digitada")}function Ba(n,e){return n.source===e||At(String(n.category??"")).includes(e)}function RC(n,e="nomina"){const i=At(String(n??""));return i?i.includes("posible_cuenta_mal_digitada")?"Posible cuenta mal digitada":i.includes("banco_sin_bamboo")?"Banco sin Bamboo":i.includes("banco_sin_nomina")?e==="bono14"?"Banco sin Bono 14":"Banco sin nómina":i.includes("diferencia_nombre_banco")?"Diferencia nombre banco":i.includes("nomina_sin_cuenta")?e==="bono14"?"Bono 14 sin cuenta":"Nómina sin cuenta":i.includes("discrepancia")?"Discrepancia":i.includes("coincidencia")?"Coincidencia":String(n).replace(/_/g," "):"—"}function dv(n){const e=n instanceof Error?n.message:"";return e.includes("planillas del banco repetidas")||e.toLowerCase().includes("sesión expiró")||e.toLowerCase().includes("no hay conexión a internet")?e:"No se pudo procesar el cruce. Verifica los archivos e intenta nuevamente."}function kC(n){try{return new TextDecoder("windows-1252").decode(n)}catch{return new TextDecoder("utf-8").decode(n)}}function fv(n,e){let i=0,a=!1;for(let l=0;l<n.length;l+=1){const c=n[l];if(c==='"'){a&&n[l+1]==='"'?l+=1:a=!a;continue}!a&&c===e&&(i+=1)}return i}function zw(n){return[",",";"," ","|"].reduce((i,a)=>fv(n,a)>fv(n,i)?a:i)}function mv(n,e=zw(n)){const i=[];let a="",l=!1;for(let c=0;c<n.length;c+=1){const u=n[c];if(u==='"'){l&&n[c+1]==='"'?(a+='"',c+=1):l=!l;continue}if(u===e&&!l){i.push(a.trim()),a="";continue}a+=u}return i.push(a.trim()),i.map(c=>c.replace(/^\uFEFF/,"").trim())}function CC(n){const e=String(n??"").replace(/\D/g,"");return/^\d{1,20}$/.test(e)?e:null}function OC(n){const e=n.split(/\r?\n/).slice(0,120);for(const i of e.slice(0,25)){const l=At(i).match(/(?:consulta\s+(?:del\s+)?)?detalle\s+(?:del\s+)?envio\s+(\d{1,20})/);if(l!=null&&l[1])return l[1]}for(let i=0;i<e.length;i+=1){const a=e[i],l=zw(a),d=mv(a,l).map(m=>At(m).trim()).findIndex(m=>m==="numero de envio"||m.includes("numero de envio"));if(!(d<0))for(let m=i+1;m<Math.min(i+8,e.length);m+=1){const p=e[m];if(!p.trim())continue;const y=mv(p,l),v=CC(y[d]);if(v)return v}}for(const i of e){const l=At(i).match(/numero\s+de\s+envio[^0-9]{0,40}(\d{1,20})/);if(l!=null&&l[1])return l[1]}return null}async function DC(n){const e=await n.arrayBuffer(),i=kC(e);return OC(i)}async function pv(n){const e=new Map;for(const i of n){if(!i.rawFile)continue;const a=await DC(i.rawFile);if(!a)continue;const l=e.get(a)??[];l.push(i.name),e.set(a,l)}return Array.from(e.entries()).filter(([,i])=>i.length>1).map(([i,a])=>({shipmentNumber:i,fileNames:a}))}const MC={1:["enero","january","jan"],2:["febrero","february","feb"],3:["marzo","march","mar"],4:["abril","april","apr"],5:["mayo","may"],6:["junio","june","jun"],7:["julio","july","jul"],8:["agosto","august","aug"],9:["septiembre","setiembre","september","sep"],10:["octubre","october","oct"],11:["noviembre","november","nov"],12:["diciembre","december","dec"]};function BC(n,e){const i=At(n).replace(/[_\-.()]+/g," ").replace(/\s+/g," ").trim(),a=i.match(/\b(20\d{2})\b/),l=a?Number(a[1]):void 0;let c;for(const[m,p]of Object.entries(MC))if(p.some(y=>new RegExp(`\\b${y}\\b`,"i").test(i))){c=Number(m);break}const u=i.match(/\b(1[0-2]|[1-9])\s+(1|2)\s+(20\d{2})\b/);!c&&u&&(c=Number(u[1]));let d;if((u==null?void 0:u[2])==="1")d="quincena_15";else if((u==null?void 0:u[2])==="2")d="quincena_30";else if(/\b(?:1q|q1|quincena\s*15|primera\s+quincena)\b/.test(i))d="quincena_15";else if(/\b(?:2q|q2|quincena\s*30|segunda\s+quincena|fin\s+de\s+mes)\b/.test(i))d="quincena_30";else if(/\b15\b/.test(i))d="quincena_15";else if(/\b(?:30|31)\b/.test(i))d="quincena_30";else if(e==="RD"&&l&&c){const m=new Date(l,c,0).getDate();new RegExp(`\\b${m}\\b`).test(i)&&(d="quincena_30")}return{year:l,month:c,periodType:d}}function gv(n){const e=_C();try{const i=window.localStorage.getItem(`glm_cruce_period_${n}`);if(!i)return e;const a=JSON.parse(i);if(Number.isInteger(a.year)&&Number.isInteger(a.month)&&a.month>=1&&a.month<=12&&(a.periodType==="quincena_15"||a.periodType==="quincena_30"))return a}catch{}return e}async function UC(n,e){const i=BC(n,e.code);return{...i,source:"local_fallback",requiresManualReview:!(Number.isInteger(i.year)&&Number.isInteger(i.month)&&(i.periodType==="quincena_15"||i.periodType==="quincena_30"))}}function LC({onShowToast:n,uploadedPayroll:e,setUploadedPayroll:i,uploadedPayrollFiles:a,setUploadedPayrollFiles:l,uploadedBankFiles:c,setUploadedBankFiles:u,isCruceExecuted:d,setIsCruceExecuted:m,response:p,setResponse:y,onOpenSidebar:v,operatorName:x,operatorEmail:_,resetToken:S=0,country:T}){const j=D.useMemo(()=>gv(T.code),[T.code]),k=T.code==="PA",M=T.code==="SV",C=T.code==="HN",P=T.code==="PR",K=T.code==="RD",G=k||M,H=K?"CSV / PDF":P?"PDF":"CSV",Y=K?".csv, .pdf":P?".pdf":".csv",Z=R=>K?Cd(R)||rv(R):P?rv(R):Cd(R),[se,me]=D.useState(!1),[ye,Ae]=D.useState(""),[Ne,Be]=D.useState("todos"),[L,W]=D.useState(j.year),[Q,le]=D.useState(j.month),[ue,A]=D.useState(j.periodType),[q,J]=D.useState(1),[ne,de]=D.useState(""),[ge,we]=D.useState(""),[ke,qe]=D.useState(null),[at,jn]=D.useState([]),[Nn,as]=D.useState(""),[ee,Ce]=D.useState(null),[ze,Re]=D.useState(()=>new Set),rt=`glm_cruce_period_${T.code}`,st=D.useRef(null),ht=D.useRef(null),it=D.useRef(null),Qt=D.useRef(null),$n=D.useMemo(()=>wC(),[]),Ze=D.useMemo(()=>lv(L,Q,ue),[L,Q,ue]),ci=T.code==="GT"&&Q===7&&ue==="quincena_15",gt=D.useMemo(()=>TC(L),[L]),jt=(p==null?void 0:p.reportKind)==="bono14",qn=jt?gt.label:Ze.label,Rn=D.useMemo(()=>jC((p==null?void 0:p.rows)??[]),[p==null?void 0:p.rows]),Cs=D.useMemo(()=>{const R=At(ge.trim());return c.map((X,ae)=>({file:X,originalIndex:ae})).filter(({file:X})=>!R||At(X.name).includes(R))},[c,ge]),$i=D.useMemo(()=>{const R=At(Nn.trim());return at.map((X,ae)=>({file:X,originalIndex:ae})).filter(({file:X})=>!R||At(X.name).includes(R))},[at,Nn]),ui=Rn.filter(R=>{const X=At(ne.trim());return At(`${R.employee} ${R.employeeNumber} ${R.account??""} ${R.observation} ${R.category??""} ${R.source??""}`).includes(X)?Ne==="discrepancias"?NC(R):Ne==="coincidencias"?R.status==="Coincidencia":Ne==="banco_sin_nomina"?Ba(R,"banco_sin_nomina"):Ne==="banco_sin_bamboo"?Ba(R,"banco_sin_bamboo"):Ne==="diferencia_nombre_banco"?Ba(R,"diferencia_nombre_banco"):Ne==="nomina_sin_cuenta"?Ba(R,"nomina_sin_cuenta"):!0:!1}),rs=10,yt=Math.max(1,Math.ceil(ui.length/rs)),cn=ui.slice((q-1)*rs,q*rs);D.useEffect(()=>{q>yt&&J(yt)},[q,yt]);const Vt=D.useMemo(()=>{var R;return((R=av.find(X=>X.value===ue))==null?void 0:R.description)??""},[ue]);D.useEffect(()=>{const R=gv(T.code);W(R.year),le(R.month),A(R.periodType),J(1),de(""),we(""),as(""),qe(null),jn([]),Be("todos"),Ce(null),Re(new Set)},[T.code]),D.useEffect(()=>{window.localStorage.setItem(rt,JSON.stringify({year:L,month:Q,periodType:ue}))},[rt,L,Q,ue]),D.useEffect(()=>{de(""),we(""),as(""),qe(null),jn([]),Be("todos"),J(1),Ae(""),me(!1),Ce(null),Re(new Set),st.current&&(st.current.value=""),ht.current&&(ht.current.value=""),it.current&&(it.current.value=""),Qt.current&&(Qt.current.value="")},[S]),D.useEffect(()=>{c.length===0&&ge&&we("")},[c.length,ge]),D.useEffect(()=>{at.length===0&&Nn&&as("")},[at.length,Nn]);const Ct=()=>{m(!1),y(null),J(1),de(""),Be("todos")},Eo=async(R,X=1)=>{const ae=await UC(R.name,T);if(Number.isInteger(ae.year)&&Number.isInteger(ae.month)&&(ae.periodType==="quincena_15"||ae.periodType==="quincena_30")){W(ae.year),le(ae.month),A(ae.periodType);const hn=lv(ae.year,ae.month,ae.periodType),dt=X>1?`${X} archivos de nómina cargados.`:"Nómina cargada.";return ae.requiresManualReview?n(`${dt} Período sugerido: ${hn.label}. Confirma los datos antes de ejecutar.`,"info"):n(`${dt} Período detectado: ${hn.label}.`,"success"),!0}return!1},Ao=async R=>{i({name:R.name,size:Bc(R.size),type:"payroll",rawFile:R}),l([]),Ct(),await Eo(R)||n("Archivo de nómina cargado con éxito.","success")},hi=async R=>{const X=R.filter(Kr);if(X.length===0){n(`Formato inválido. ${T.name} requiere uno o varios archivos Excel (.xlsx, .xls).`,"error");return}const ae=new Set(a.map(Je=>{var tt;return`${Je.name}|${((tt=Je.rawFile)==null?void 0:tt.size)??Je.size}`})),un=SC(X).filter(Je=>{var tt;return!ae.has(`${Je.name}|${((tt=Je.rawFile)==null?void 0:tt.size)??Je.size}`)}),hn=[...a,...un];l(hn),i(null),Ct();const dt=X.find(Je=>/quincenal/i.test(Je.name))||X[0];await Eo(dt,hn.length)||n(`${un.length} archivo(s) de nómina de ${T.name} cargado(s) con éxito.`,"success")},Fn=R=>{R.preventDefault()},di=async R=>{R.preventDefault();const X=Array.from(R.dataTransfer.files);if(X.length===0)return;if(G){await hi(X);return}const ae=X[0];Kr(ae)?await Ao(ae):n("Formato inválido. Por favor carga un archivo Excel (.xlsx, .xls).","error")},os=R=>{R.preventDefault();const ae=Array.from(R.dataTransfer.files).filter(Z);if(ae.length===0){n(`Formato inválido. Por favor carga uno o varios archivos ${H} (${Y}).`,"error");return}u([...c,...Od(ae)]),Ct(),n(`${ae.length} archivo(s) del banco cargado(s) con éxito.`,"success")},qi=async R=>{const X=Array.from(R.target.files||[]);if(X.length===0)return;if(G){await hi(X);return}const ae=X[0];Kr(ae)?await Ao(ae):n("Formato inválido. Por favor carga un archivo Excel (.xlsx, .xls).","error")},fi=R=>{l(a.filter((X,ae)=>ae!==R)),st.current&&(st.current.value=""),Ct(),n("Archivo de nómina removido.","info")},Gc=R=>{const X=R.target.files;if(!X||X.length===0)return;const ae=Array.from(X).filter(Z);if(ae.length===0){n(`Formato inválido. Por favor carga uno o varios archivos ${H} (${Y}).`,"error");return}u([...c,...Od(ae)]),Ct(),n(`${ae.length} archivo(s) del banco cargado(s) con éxito.`,"success")},jo=R=>{u(c.filter((X,ae)=>ae!==R)),ht.current&&(ht.current.value=""),Ct(),n("Planilla de banco removida.","info")},Qa=()=>{i(null),l([]),u([]),we(""),st.current&&(st.current.value=""),ht.current&&(ht.current.value=""),Ct(),n("Todos los archivos cargados fueron eliminados.","info")},Os=R=>{qe({name:R.name,size:Bc(R.size),type:"payroll",rawFile:R}),Ct(),n("Archivo Excel de Bono 14 cargado con éxito.","success")},Kc=R=>{R.preventDefault();const X=R.dataTransfer.files[0];if(X){if(!Kr(X)){n("Formato inválido. El Bono 14 requiere un archivo Excel (.xlsx, .xls).","error");return}Os(X)}},No=R=>{var ae;const X=(ae=R.target.files)==null?void 0:ae[0];if(X){if(!Kr(X)){n("Formato inválido. El Bono 14 requiere un archivo Excel (.xlsx, .xls).","error");return}Os(X)}},Za=R=>{const X=R.filter(Cd);if(X.length===0){n("Formato inválido. Carga uno o varios archivos CSV del Bono 14.","error");return}jn([...at,...Od(X)]),Ct(),n(`${X.length} archivo(s) bancario(s) de Bono 14 cargado(s).`,"success")},Ro=R=>{R.preventDefault(),Za(Array.from(R.dataTransfer.files))},Wa=R=>{var X;(X=R.target.files)!=null&&X.length&&Za(Array.from(R.target.files))},er=R=>{jn(at.filter((X,ae)=>ae!==R)),Qt.current&&(Qt.current.value=""),Ct(),n("Archivo bancario de Bono 14 removido.","info")},ko=async()=>{if(se)return;if(!L||!Q||!ue){n("Debes seleccionar año, mes y tipo de cruce antes de ejecutar.","error");return}const R=G?a:e?[e]:[];if(R.length===0||R.some(X=>!X.rawFile)){n(G?`Debes cargar todos los archivos de nómina de ${T.name} correspondientes al período antes de ejecutar el cruce.`:"Debes cargar la nómina antes de ejecutar el cruce.","error");return}if(c.length===0||c.some(X=>!X.rawFile)){n("Debes cargar al menos una planilla del banco antes de ejecutar el cruce.","error");return}me(!0),Ae("Validando archivos..."),J(1);try{const X=P||K?[]:await pv(c);if(X.length>0){const Ue=X.map(Ve=>`Número de envío ${Ve.shipmentNumber}: ${Ve.fileNames.join(", ")}`).join(`
`);throw new Error(`Hay planillas del banco repetidas. Revisa los archivos cargados antes de continuar.
${Ue}`)}const ae=vC(T.code);if(!ae)throw new Error("No se pudo procesar el cruce. El servicio de conciliación no está disponible.");const un=sv();Ae("Reactivando conexión segura..."),await nv(ae);const hn=iv(ae,un),dt=R.find(Ue=>/quincenal/i.test(Ue.name))||R[0],dn={country:T.code,country_name:T.name,year:L,month:Q,period_type:ue,period_label:Ze.label,period_start:Ze.start,period_end:Ze.end,payroll_file_name:dt.name,payroll_file_names:R.map(Ue=>Ue.name),bank_file_names:c.map(Ue=>Ue.name),requested_by_name:x,requested_by_email:_,auth_mode:"temporal_sin_login",source_app:"portal-cruce-cuentas-glm",client_request_id:un};Ae("Procesando cruce de cuentas...");const Je=new FormData;Je.append("metadata",JSON.stringify(dn)),Object.entries(dn).forEach(([Ue,Ve])=>{Je.append(Ue,Array.isArray(Ve)?JSON.stringify(Ve):String(Ve))}),G&&R.forEach((Ue,Ve)=>{Ue.rawFile&&(Je.append("payroll_files",Ue.rawFile,Ue.name),Je.append(`payroll_file_${Ve+1}`,Ue.rawFile,Ue.name))}),dt.rawFile&&Je.append("payroll_file",dt.rawFile,dt.name),c.forEach((Ue,Ve)=>{Ue.rawFile&&(Je.append("bank_files",Ue.rawFile,Ue.name),Je.append(`bank_file_${Ve+1}`,Ue.rawFile,Ue.name))});const tt=await fetch(hn,{method:"POST",body:Je,cache:"no-store",credentials:"omit"});Ae("Generando reporte...");const Pe=(tt.headers.get("content-type")??"").includes("application/json")?await tt.json():{ok:tt.ok,message:await tt.text()};if(!tt.ok||(Pe==null?void 0:Pe.ok)===!1)throw new Error(typeof(Pe==null?void 0:Pe.message)=="string"?Pe.message:"No se pudo procesar el cruce. Verifica los archivos e intenta nuevamente.");const Nt=uv(Pe);Nt.reportKind="nomina",y(Nt),m(!0),n(Nt.message||"Cruce procesado correctamente.","success"),setTimeout(()=>{const Ue=document.getElementById("resultados-seccion");Ue&&Ue.scrollIntoView({behavior:"smooth",block:"start"})},150)}catch(X){const ae=dv(X);m(!1),y(null),n(ae,"error")}finally{me(!1),Ae("")}},Co=async()=>{if(!se){if(!ci){n("El cruce de Bono 14 solo está disponible en Guatemala para julio · Quincena 15.","error");return}if(!(ke!=null&&ke.rawFile)){n("Debes cargar el Excel de Bono 14 antes de generar el reporte.","error");return}if(at.length===0||at.some(R=>!R.rawFile)){n("Debes cargar al menos un CSV bancario del Bono 14.","error");return}me(!0),Ae("Validando archivos de Bono 14..."),J(1);try{const R=await pv(at);if(R.length>0){const Pe=R.map(Nt=>`Número de envío ${Nt.shipmentNumber}: ${Nt.fileNames.join(", ")}`).join(`
`);throw new Error(`Hay planillas del banco repetidas. Revisa los archivos cargados antes de continuar.
${Pe}`)}const X=xC();if(!X)throw new Error("No se pudo procesar el Bono 14. El webhook VITE_N8N_GUATEMALA_BONO14_WEBHOOK_URL no está configurado.");const ae=sv();Ae("Reactivando conexión segura..."),await nv(X);const un=iv(X,ae),hn={country:"GT",country_name:"Guatemala",year:L,month:7,period_type:"bono14",report_kind:"bono14",period_label:gt.label,period_start:gt.start,period_end:gt.end,payroll_file_name:ke.name,bank_file_names:at.map(Pe=>Pe.name),requested_by_name:x,requested_by_email:_,auth_mode:"temporal_sin_login",source_app:"portal-cruce-cuentas-glm-bono14",client_request_id:ae},dt=new FormData;dt.append("metadata",JSON.stringify(hn)),Object.entries(hn).forEach(([Pe,Nt])=>{dt.append(Pe,Array.isArray(Nt)?JSON.stringify(Nt):String(Nt))}),dt.append("payroll_file",ke.rawFile,ke.name),at.forEach((Pe,Nt)=>{Pe.rawFile&&(dt.append("bank_files",Pe.rawFile,Pe.name),dt.append(`bank_file_${Nt+1}`,Pe.rawFile,Pe.name))}),Ae("Procesando Bono 14...");const dn=await fetch(un,{method:"POST",body:dt,cache:"no-store",credentials:"omit"});Ae("Generando reporte independiente de Bono 14...");const tt=(dn.headers.get("content-type")??"").includes("application/json")?await dn.json():{ok:dn.ok,message:await dn.text()};if(!dn.ok||(tt==null?void 0:tt.ok)===!1)throw new Error(typeof(tt==null?void 0:tt.message)=="string"?tt.message:"No se pudo procesar el Bono 14. Verifica los archivos e intenta nuevamente.");const kn=uv(tt);kn.reportKind="bono14",y(kn),m(!0),n(kn.message||"Bono 14 procesado correctamente.","success"),setTimeout(()=>{const Pe=document.getElementById("resultados-seccion");Pe&&Pe.scrollIntoView({behavior:"smooth",block:"start"})},150)}catch(R){m(!1),y(null),n(dv(R),"error")}finally{me(!1),Ae("")}}},In=()=>{if(p!=null&&p.reportUrl){window.open(p.reportUrl,"_blank","noopener,noreferrer");return}n("El reporte aún no tiene un enlace disponible.","info")};return g.jsxs("div",{className:"flex-1 flex flex-col min-h-screen bg-neutral-50 text-neutral-800 font-sans",children:[g.jsxs("header",{className:"bg-white border-b-4 border-[#6CC24A] flex justify-between items-center w-full px-4 sm:px-8 h-[84px] sticky top-0 z-40 shadow-sm gap-x-4",children:[g.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[g.jsx("button",{onClick:v,className:"md:hidden p-2 -ml-2 text-neutral-600 hover:text-neutral-800 hover:bg-neutral-100 transition-colors flex-shrink-0","aria-label":"Abrir menú",children:g.jsx(uw,{className:"w-6 h-6"})}),g.jsx("h1",{className:"text-xs sm:text-sm md:text-lg lg:text-2xl font-black text-[#4F758B] tracking-tight uppercase flex items-center gap-1.5 sm:gap-2 min-w-0",children:g.jsxs("span",{className:"truncate",children:["Cruce de Cuentas GLM - ",T.name]})})]}),g.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2",children:[g.jsx(Uw,{country:T,operatorName:x,operatorEmail:_,section:"Cruce de Cuentas",onShowToast:n}),g.jsx("div",{className:"border border-neutral-200 bg-white px-2.5 py-2 shadow-sm","aria-label":`Bandera de ${T.name}`,children:g.jsx("img",{src:T.flag,alt:`Bandera de ${T.name}`,className:"h-5 sm:h-6 w-auto object-contain"})})]})]}),g.jsxs("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 py-8 flex flex-col gap-8",children:[g.jsxs("section",{className:"bg-white border border-[#D0D0D0] p-5 shadow-sm",children:[g.jsx("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4 mb-5",children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"bg-[#4F758B]/10 p-2 rounded-full",children:g.jsx(cw,{className:"w-5 h-5 text-[#4F758B]"})}),g.jsx("div",{className:"pt-0.5",children:g.jsx("h2",{className:"text-sm font-black text-[#4F758B] uppercase tracking-wider leading-none",children:"Datos del cruce"})})]})}),g.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[g.jsxs("label",{className:"flex flex-col gap-1.5",children:[g.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider text-neutral-500",children:"Año"}),g.jsx("select",{value:L,onChange:R=>{W(Number(R.target.value)),Ct()},className:"border border-[#D0D0D0] bg-white px-3 py-2.5 text-sm font-bold text-neutral-700 focus:outline-none focus:border-[#4F758B]",children:$n.map(R=>g.jsx("option",{value:R,children:R},R))})]}),g.jsxs("label",{className:"flex flex-col gap-1.5",children:[g.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider text-neutral-500",children:"Mes"}),g.jsx("select",{value:Q,onChange:R=>{le(Number(R.target.value)),Ct()},className:"border border-[#D0D0D0] bg-white px-3 py-2.5 text-sm font-bold text-neutral-700 focus:outline-none focus:border-[#4F758B]",children:Lw.map(R=>g.jsx("option",{value:R.value,children:R.label},R.value))})]}),g.jsxs("label",{className:"flex flex-col gap-1.5",children:[g.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider text-neutral-500",children:"Tipo de cruce"}),g.jsx("select",{value:ue,onChange:R=>{A(R.target.value),Ct()},className:"border border-[#D0D0D0] bg-white px-3 py-2.5 text-sm font-bold text-neutral-700 focus:outline-none focus:border-[#4F758B]",children:av.map(R=>g.jsx("option",{value:R.value,children:R.label},R.value))})]})]}),g.jsxs("div",{className:"mt-4 grid grid-cols-1 md:grid-cols-[1fr_auto] gap-3 items-center bg-[#4F758B]/5 border border-[#4F758B]/10 px-4 py-3",children:[g.jsxs("div",{className:"flex items-start gap-2 text-xs text-neutral-600",children:[g.jsx(m2,{className:"w-4 h-4 text-[#4F758B] mt-0.5 flex-shrink-0"}),g.jsxs("div",{children:[g.jsx("span",{className:"font-black text-[#4F758B]",children:"Período calculado:"})," ",ov(Ze.start)," al ",ov(Ze.end),g.jsx("p",{className:"text-[10px] text-neutral-500 mt-0.5",children:Vt})]})]}),g.jsx("div",{className:"text-[10px] font-bold text-neutral-500 uppercase tracking-wider",children:Ze.label})]})]}),(G||C||P||K)&&(e!==null||a.length>0||c.length>0)&&g.jsx("div",{className:"flex justify-end",style:{marginBottom:"-20px"},children:g.jsxs("button",{type:"button",onClick:Qa,className:"inline-flex items-center gap-2 border border-red-100 bg-white px-3 py-2 text-[10px] font-black text-red-600 hover:bg-red-50 transition-colors uppercase tracking-wide shadow-sm","aria-label":"Borrar todos los archivos cargados",title:"Eliminar de una vez todas las nóminas y planillas del banco cargadas",children:[g.jsx(Ta,{className:"w-4 h-4"}),"Borrar todo"]})}),g.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[g.jsxs("div",{className:"bg-white border border-[#D0D0D0] p-6 flex flex-col justify-between relative shadow-sm hover:shadow-md transition-shadow",children:[g.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-[#4F758B]"}),g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[g.jsx(Ca,{className:"w-5 h-5 text-[#4F758B]"}),g.jsx("h2",{className:"text-sm font-black text-neutral-800 uppercase tracking-wider",children:"1. Carga de Nómina"})]}),g.jsx("input",{type:"file",ref:st,onChange:qi,accept:".xlsx,.xls",multiple:G,className:"hidden"}),G?a.length>0?g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"border border-[#4F758B]/20 bg-[#4F758B]/5 px-4 py-3",children:[g.jsxs("p",{className:"text-[10px] font-black uppercase tracking-wider text-[#4F758B]",children:[a.length," archivo(s) de nómina cargado(s)"]}),g.jsx("p",{className:"text-[10px] text-neutral-500 mt-1",children:k?"Incluye la quincenal y todas las planillas extraordinarias, vacaciones o XIII Mes que correspondan al período.":"Incluye todos los archivos de nómina de El Salvador que correspondan a la quincena seleccionada (General, Karla Elias, Nestlé, Motorola u otros del mismo formato)."})]}),g.jsx("div",{className:"max-h-[260px] overflow-y-auto border border-neutral-200 divide-y divide-neutral-100",children:a.map((R,X)=>g.jsxs("div",{className:"bg-white px-4 py-3 flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx(Ca,{className:"w-6 h-6 text-[#6CC24A] flex-shrink-0"}),g.jsxs("div",{className:"overflow-hidden",children:[g.jsx("p",{className:"text-xs font-bold text-neutral-700 truncate max-w-[290px]",title:R.name,children:R.name}),g.jsxs("p",{className:"text-[10px] text-neutral-400 font-mono mt-0.5",children:[R.size," • Excel"]})]})]}),g.jsx("button",{onClick:()=>fi(X),className:"p-1.5 text-neutral-400 hover:text-red-500 hover:bg-neutral-100 transition-all rounded","aria-label":`Remover ${R.name}`,children:g.jsx(Ta,{className:"w-4.5 h-4.5"})})]},`${R.name}-${X}`))}),g.jsx("button",{type:"button",onClick:()=>{var R;return(R=st.current)==null?void 0:R.click()},className:"w-full border border-dashed border-[#4F758B]/40 bg-white px-4 py-2.5 text-[10px] font-black text-[#4F758B] hover:bg-[#4F758B]/5 transition-colors uppercase tracking-wide",children:"Agregar más archivos de nómina"})]}):g.jsxs("div",{onDragOver:Fn,onDrop:di,onClick:()=>{var R;return(R=st.current)==null?void 0:R.click()},className:"border-2 border-dashed border-[#D0D0D0] bg-neutral-50 hover:bg-[#4F758B]/5 hover:border-[#4F758B]/40 transition-colors flex flex-col items-center justify-center py-10 px-4 text-center cursor-pointer min-h-[190px]",children:[g.jsx(Ir,{className:"w-8 h-8 text-neutral-300 mb-2"}),g.jsx("p",{className:"text-xs font-bold text-neutral-700",children:"Arrastre la nómina y sus suplementos"}),g.jsx("p",{className:"text-[10px] text-neutral-400 mt-1 font-medium",children:"Puede seleccionar varios .xlsx / .xls a la vez"}),g.jsx("button",{type:"button",className:"mt-4 border border-[#D0D0D0] bg-white px-4 py-1.5 text-[10px] font-bold text-neutral-600 hover:border-[#4F758B] hover:text-[#4F758B] transition-colors shadow-sm uppercase tracking-wide",children:"Seleccionar Archivos"})]}):e?g.jsxs("div",{className:"border border-[#6CC24A]/30 bg-[#6CC24A]/5 p-5 flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx(Ca,{className:"w-8 h-8 text-[#6CC24A] flex-shrink-0"}),g.jsxs("div",{className:"overflow-hidden",children:[g.jsx("p",{className:"text-xs font-bold text-neutral-700 truncate max-w-[300px]",title:e.name,children:e.name}),g.jsxs("p",{className:"text-[10px] text-neutral-400 font-mono mt-0.5",children:[e.size," • Excel"]})]})]}),g.jsx("button",{onClick:()=>{i(null),st.current&&(st.current.value=""),Ct(),n("Nómina removida.","info")},className:"p-1.5 text-neutral-400 hover:text-red-500 hover:bg-neutral-100 transition-all rounded","aria-label":"Remover nómina",children:g.jsx(Ta,{className:"w-4.5 h-4.5"})})]}):g.jsxs("div",{onDragOver:Fn,onDrop:di,onClick:()=>{var R;return(R=st.current)==null?void 0:R.click()},className:"border-2 border-dashed border-[#D0D0D0] bg-neutral-50 hover:bg-[#4F758B]/5 hover:border-[#4F758B]/40 transition-colors flex flex-col items-center justify-center py-10 px-4 text-center cursor-pointer min-h-[190px]",children:[g.jsx(Ir,{className:"w-8 h-8 text-neutral-300 mb-2"}),g.jsx("p",{className:"text-xs font-bold text-neutral-700",children:"Arrastre y suelte archivo Excel"}),g.jsx("p",{className:"text-[10px] text-neutral-400 mt-1 font-medium",children:"Formato .xlsx, .xls"}),g.jsx("button",{type:"button",className:"mt-4 border border-[#D0D0D0] bg-white px-4 py-1.5 text-[10px] font-bold text-neutral-600 hover:border-[#4F758B] hover:text-[#4F758B] transition-colors shadow-sm uppercase tracking-wide",children:"Seleccionar Archivo"})]})]})]}),g.jsxs("div",{className:"bg-white border border-[#D0D0D0] p-6 flex flex-col justify-between relative shadow-sm hover:shadow-md transition-shadow",children:[g.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-[#4F758B]"}),g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2.5 mb-2",children:[g.jsx(Xl,{className:"w-5 h-5 text-[#4F758B]"}),g.jsx("h2",{className:"text-sm font-black text-neutral-800 uppercase tracking-wider",children:"2. Carga de Planillas del Banco"})]}),g.jsx("p",{className:"text-[11px] text-neutral-500 mb-4 leading-relaxed",children:"Puede subir múltiples archivos separados o un archivo consolidado del período."}),g.jsx("input",{type:"file",ref:ht,onChange:Gc,accept:K?".csv,.pdf":P?".pdf":".csv",multiple:!0,className:"hidden"}),g.jsxs("div",{onDragOver:Fn,onDrop:os,onClick:()=>{var R;return(R=ht.current)==null?void 0:R.click()},className:"border-2 border-dashed border-[#D0D0D0] bg-neutral-50 hover:bg-[#4F758B]/5 hover:border-[#4F758B]/40 transition-colors flex flex-col items-center justify-center py-8 px-4 text-center cursor-pointer min-h-[130px]",children:[g.jsx(Ir,{className:"w-7 h-7 text-neutral-300 mb-2"}),g.jsx("p",{className:"text-xs font-bold text-neutral-700",children:`Arrastre y suelte archivo ${H}`}),g.jsx("p",{className:"text-[10px] text-neutral-400 mt-1 font-medium",children:`Formato ${Y}`}),g.jsx("button",{type:"button",className:"mt-4 border border-[#D0D0D0] bg-white px-4 py-1.5 text-[10px] font-bold text-neutral-600 hover:border-[#4F758B] hover:text-[#4F758B] transition-colors shadow-sm uppercase tracking-wide",children:"Seleccionar Archivos"})]}),c.length>0&&g.jsxs("div",{className:"mt-4 border border-neutral-200 bg-white",children:[g.jsxs("div",{className:"p-3 border-b border-neutral-200 bg-neutral-50",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-2",children:[g.jsxs("div",{children:[g.jsxs("p",{className:"text-[11px] font-black text-neutral-700 uppercase tracking-wide",children:[c.length," ",c.length===1?"archivo cargado":"archivos cargados"]}),g.jsx("p",{className:"text-[9px] text-neutral-400 mt-0.5",children:"Busque por nombre para localizar y eliminar una planilla rápidamente."})]}),ge&&g.jsx("button",{type:"button",onClick:R=>{R.stopPropagation(),we("")},className:"self-start sm:self-auto text-[9px] font-bold uppercase tracking-wide text-[#4F758B] hover:underline",children:"Limpiar búsqueda"})]}),g.jsxs("div",{className:"relative",children:[g.jsx(Xr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-neutral-400 pointer-events-none"}),g.jsx("input",{type:"search",value:ge,onChange:R=>we(R.target.value),onClick:R=>R.stopPropagation(),placeholder:`Buscar archivo ${H} por nombre...`,className:"w-full h-9 pl-9 pr-3 border border-[#D0D0D0] bg-white text-[11px] text-neutral-700 outline-none focus:border-[#4F758B] focus:ring-2 focus:ring-[#4F758B]/10 transition-all","aria-label":`Buscar archivos ${H} cargados`})]}),ge&&g.jsxs("p",{className:"text-[9px] text-neutral-400 mt-2",children:["Mostrando ",Cs.length," de ",c.length," archivos."]})]}),g.jsx("div",{className:"max-h-[330px] overflow-y-auto overscroll-contain p-2 space-y-2",children:Cs.length>0?Cs.map(({file:R,originalIndex:X})=>g.jsxs("div",{className:"border border-neutral-200 bg-white px-3 py-3 flex items-center justify-between gap-3 hover:border-[#4F758B]/40 hover:bg-[#4F758B]/[0.025] transition-colors",children:[g.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[g.jsx("div",{className:"w-7 h-7 mt-0.5 border border-[#4F758B]/20 bg-[#4F758B]/5 flex items-center justify-center flex-shrink-0",children:g.jsx(Xl,{className:"w-4 h-4 text-[#4F758B]"})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("p",{className:"text-[11px] leading-4 font-bold text-neutral-700 whitespace-normal break-words",title:R.name,children:R.name}),g.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[g.jsx("span",{className:"text-[9px] text-neutral-400 font-mono",children:R.size}),g.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-[#4F758B] bg-[#4F758B]/5 border border-[#4F758B]/10 px-1.5 py-0.5",children:H})]})]})]}),g.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),jo(X)},className:"w-8 h-8 flex items-center justify-center flex-shrink-0 text-neutral-400 hover:text-red-600 hover:bg-red-50 border border-transparent hover:border-red-100 rounded transition-colors","aria-label":`Remover ${R.name}`,title:`Eliminar ${R.name}`,children:g.jsx(Ta,{className:"w-4 h-4"})})]},`${R.name}-${X}`)):g.jsxs("div",{className:"py-8 px-4 text-center",children:[g.jsx(Xr,{className:"w-5 h-5 text-neutral-300 mx-auto mb-2"}),g.jsx("p",{className:"text-[11px] font-bold text-neutral-600",children:"No encontramos archivos con ese nombre."}),g.jsx("p",{className:"text-[9px] text-neutral-400 mt-1",children:"Pruebe con otra parte del nombre del archivo."})]})})]})]})]})]}),ci&&g.jsx("section",{className:"bg-white border border-[#D0D0D0] shadow-sm",children:g.jsxs("div",{className:"border-t-4 border-[#6CC24A] p-5 sm:p-6",children:[g.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4 mb-5",children:[g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx("div",{className:"bg-[#6CC24A]/10 p-2 rounded-full",children:g.jsx(xb,{className:"w-5 h-5 text-[#4F758B]"})}),g.jsxs("div",{children:[g.jsx("h2",{className:"text-sm font-black text-[#4F758B] uppercase tracking-wider",children:"Bono 14 · Reporte independiente"}),g.jsx("p",{className:"text-[11px] text-neutral-500 mt-1 max-w-3xl leading-relaxed",children:"Esta sección aparece únicamente para Guatemala · Julio · Quincena 15. El Bono 14 se procesa separado de la nómina quincenal y genera su propio Google Sheet e histórico."})]})]}),g.jsxs("div",{className:"text-left lg:text-right",children:[g.jsx("p",{className:"text-[9px] font-black uppercase tracking-wider text-neutral-400",children:"Período del Bono 14"}),g.jsxs("p",{className:"text-[11px] font-bold text-[#4F758B] mt-1",children:[gt.start," al ",gt.end]})]})]}),g.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:[g.jsxs("div",{className:"border border-neutral-200 p-4 bg-neutral-50/50",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx(Ca,{className:"w-4.5 h-4.5 text-[#4F758B]"}),g.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-neutral-700",children:"1. Excel de Bono 14"})]}),g.jsx("p",{className:"text-[10px] text-neutral-500 mb-3",children:"Archivo anual con los montos calculados de Bono 14."}),g.jsx("input",{type:"file",ref:it,onChange:No,accept:".xlsx,.xls",className:"hidden"}),ke?g.jsxs("div",{className:"border border-neutral-200 bg-white px-3 py-3 flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"text-[11px] font-bold text-neutral-700 break-words",title:ke.name,children:ke.name}),g.jsxs("p",{className:"text-[9px] text-neutral-400 font-mono mt-1",children:[ke.size," · Excel"]})]}),g.jsx("button",{type:"button",onClick:()=>{qe(null),it.current&&(it.current.value=""),Ct(),n("Excel de Bono 14 removido.","info")},className:"w-8 h-8 flex items-center justify-center text-neutral-400 hover:text-red-600 hover:bg-red-50 border border-transparent hover:border-red-100 rounded transition-colors","aria-label":"Remover Excel de Bono 14",children:g.jsx(Ta,{className:"w-4 h-4"})})]}):g.jsxs("div",{onDragOver:Fn,onDrop:Kc,onClick:()=>{var R;return(R=it.current)==null?void 0:R.click()},className:"border-2 border-dashed border-[#D0D0D0] bg-white hover:bg-[#4F758B]/5 hover:border-[#4F758B]/40 transition-colors py-8 px-4 text-center cursor-pointer",children:[g.jsx(Ir,{className:"w-7 h-7 text-neutral-300 mx-auto mb-2"}),g.jsx("p",{className:"text-xs font-bold text-neutral-700",children:"Arrastre el Excel de Bono 14"}),g.jsx("p",{className:"text-[10px] text-neutral-400 mt-1",children:"Formato .xlsx, .xls"}),g.jsx("button",{type:"button",className:"mt-4 border border-[#D0D0D0] bg-white px-4 py-1.5 text-[10px] font-bold text-neutral-600 hover:border-[#4F758B] hover:text-[#4F758B] transition-colors shadow-sm uppercase tracking-wide",children:"Seleccionar Archivo"})]})]}),g.jsxs("div",{className:"border border-neutral-200 p-4 bg-neutral-50/50",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[g.jsx(Xl,{className:"w-4.5 h-4.5 text-[#4F758B]"}),g.jsx("h3",{className:"text-xs font-black uppercase tracking-wider text-neutral-700",children:"2. CSV bancarios del Bono 14"})]}),g.jsx("p",{className:"text-[10px] text-neutral-500 mb-3",children:"Puede cargar todos los envíos bancarios correspondientes al Bono 14."}),g.jsx("input",{type:"file",ref:Qt,onChange:Wa,accept:".csv",multiple:!0,className:"hidden"}),g.jsxs("div",{onDragOver:Fn,onDrop:Ro,onClick:()=>{var R;return(R=Qt.current)==null?void 0:R.click()},className:"border-2 border-dashed border-[#D0D0D0] bg-white hover:bg-[#4F758B]/5 hover:border-[#4F758B]/40 transition-colors py-6 px-4 text-center cursor-pointer",children:[g.jsx(Ir,{className:"w-6 h-6 text-neutral-300 mx-auto mb-2"}),g.jsx("p",{className:"text-xs font-bold text-neutral-700",children:"Arrastre uno o varios CSV"}),g.jsx("p",{className:"text-[10px] text-neutral-400 mt-1",children:"Formato .csv"}),g.jsx("button",{type:"button",className:"mt-4 border border-[#D0D0D0] bg-white px-4 py-1.5 text-[10px] font-bold text-neutral-600 hover:border-[#4F758B] hover:text-[#4F758B] transition-colors shadow-sm uppercase tracking-wide",children:"Seleccionar Archivos"})]}),at.length>0&&g.jsxs("div",{className:"mt-3 border border-neutral-200 bg-white",children:[g.jsxs("div",{className:"p-3 border-b border-neutral-200 bg-neutral-50",children:[g.jsxs("div",{className:"relative",children:[g.jsx(Xr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-neutral-400 pointer-events-none"}),g.jsx("input",{type:"search",value:Nn,onChange:R=>as(R.target.value),onClick:R=>R.stopPropagation(),placeholder:"Buscar CSV de Bono 14...",className:"w-full h-9 pl-9 pr-3 border border-[#D0D0D0] bg-white text-[11px] text-neutral-700 outline-none focus:border-[#4F758B]"})]}),g.jsxs("p",{className:"text-[9px] text-neutral-400 mt-2",children:[at.length," archivo(s) cargado(s)."]})]}),g.jsx("div",{className:"max-h-[250px] overflow-y-auto p-2 space-y-2",children:$i.map(({file:R,originalIndex:X})=>g.jsxs("div",{className:"border border-neutral-200 px-3 py-2.5 flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"text-[10px] leading-4 font-bold text-neutral-700 break-words",children:R.name}),g.jsx("p",{className:"text-[9px] text-neutral-400 font-mono mt-0.5",children:R.size})]}),g.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),er(X)},className:"w-8 h-8 flex items-center justify-center flex-shrink-0 text-neutral-400 hover:text-red-600 hover:bg-red-50 rounded transition-colors","aria-label":`Remover ${R.name}`,children:g.jsx(Ta,{className:"w-4 h-4"})})]},`bonus14-${R.name}-${X}`))})]})]})]}),g.jsxs("div",{className:"mt-5 flex flex-col items-center gap-2",children:[g.jsxs("button",{type:"button",onClick:Co,disabled:se||!(ke!=null&&ke.rawFile)||at.length===0,className:"inline-flex items-center justify-center gap-2 bg-[#4F758B] hover:bg-[#3d6378] text-white px-7 py-3 text-xs font-black uppercase tracking-wider transition-colors disabled:opacity-45 disabled:cursor-not-allowed min-w-[280px]",children:[se?g.jsx(Ha,{className:"w-4 h-4 animate-spin"}):g.jsx(xb,{className:"w-4 h-4"}),"Generar reporte Bono 14"]}),g.jsxs("p",{className:"text-[9px] text-neutral-400 text-center",children:["Se guardará como un reporte separado: GT · ",L," · Bono 14."]})]})]})}),g.jsx("section",{className:"flex flex-col items-center gap-3",children:g.jsx("button",{onClick:ko,disabled:se,className:"w-full sm:w-auto min-w-[280px] bg-[#4F758B] hover:bg-[#41677b] disabled:bg-neutral-300 disabled:cursor-not-allowed text-white px-8 py-4 font-black text-sm uppercase tracking-wider shadow-md flex items-center justify-center gap-3 transition-all duration-150 active:scale-[0.99] border-l-4 border-[#6CC24A]",children:se?g.jsxs(g.Fragment,{children:[g.jsx(Ha,{className:"w-5 h-5 animate-spin"}),g.jsx("span",{children:ye||"Procesando cruce de cuentas..."})]}):g.jsxs(g.Fragment,{children:[g.jsx(G2,{className:"w-5 h-5"}),g.jsx("span",{children:"Ejecutar Cruce de Cuentas"})]})})}),g.jsx(zi,{children:d&&p&&g.jsxs(Tn.section,{id:"resultados-seccion",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:"flex flex-col gap-5 scroll-mt-28",children:[g.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4",children:[g.jsxs("div",{className:"bg-white border border-emerald-200 p-4 shadow-sm",children:[g.jsxs("div",{className:"flex items-center gap-2 text-emerald-700",children:[g.jsx(Ec,{className:"w-5 h-5"}),g.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Coincidencias"})]}),g.jsx("p",{className:"text-3xl font-black text-emerald-800 mt-2",children:p.summary.matches})]}),g.jsxs("div",{className:"bg-white border border-red-200 p-4 shadow-sm",children:[g.jsxs("div",{className:"flex items-center gap-2 text-[#ba1a1a]",children:[g.jsx(Ac,{className:"w-5 h-5"}),g.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Discrepancias"})]}),g.jsx("p",{className:"text-3xl font-black text-[#ba1a1a] mt-2",children:p.summary.discrepancies})]}),g.jsxs("div",{className:"bg-white border border-amber-200 p-4 shadow-sm",children:[g.jsxs("div",{className:"flex items-center gap-2 text-amber-800",children:[g.jsx(vb,{className:"w-5 h-5"}),g.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:jt?"Banco sin Bono 14":"Banco sin nómina"})]}),g.jsx("p",{className:"text-3xl font-black text-amber-800 mt-2",children:p.summary.bankWithoutPayroll})]}),g.jsxs("div",{className:"bg-white border border-orange-200 p-4 shadow-sm",children:[g.jsxs("div",{className:"flex items-center gap-2 text-orange-800",children:[g.jsx(vb,{className:"w-5 h-5"}),g.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Banco sin Bamboo"})]}),g.jsx("p",{className:"text-3xl font-black text-orange-800 mt-2",children:p.summary.bankWithoutBamboo})]}),g.jsxs("div",{className:"bg-white border border-violet-200 p-4 shadow-sm",children:[g.jsxs("div",{className:"flex items-center gap-2 text-violet-800",children:[g.jsx(Xl,{className:"w-5 h-5"}),g.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:"Diferencias nombre banco"})]}),g.jsx("p",{className:"text-3xl font-black text-violet-800 mt-2",children:p.summary.nameDifferences})]}),g.jsxs("div",{className:"bg-white border border-blue-200 p-4 shadow-sm",children:[g.jsxs("div",{className:"flex items-center gap-2 text-blue-800",children:[g.jsx(Ca,{className:"w-5 h-5"}),g.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black",children:jt?"Bono 14 sin cuenta":"Nómina sin cuenta"})]}),g.jsx("p",{className:"text-3xl font-black text-blue-800 mt-2",children:p.summary.payrollWithoutAccount})]})]}),g.jsxs("div",{className:"bg-white border border-[#D0D0D0] shadow-sm overflow-hidden",children:[g.jsxs("div",{className:"p-5 border-b border-neutral-200 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[g.jsxs("div",{children:[g.jsx("h2",{className:"text-lg font-black text-[#4F758B] uppercase tracking-tight",children:jt?"Resultados del Bono 14":"Resultados del Cruce"}),g.jsx("p",{className:"text-[11px] text-neutral-500 mt-1",children:qn})]}),g.jsx("div",{className:"flex flex-col sm:flex-row gap-2",children:g.jsxs("button",{onClick:In,disabled:!p.reportUrl,className:"inline-flex items-center justify-center gap-2 border border-[#4F758B] text-[#4F758B] hover:bg-[#4F758B] hover:text-white px-4 py-2 text-xs font-bold transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[g.jsx(A2,{className:"w-4 h-4"}),"Abrir Google Sheet"]})})]}),g.jsxs("div",{className:"p-4 border-b border-neutral-200 bg-neutral-50 flex flex-col lg:flex-row gap-3 lg:items-center lg:justify-between",children:[g.jsxs("div",{className:"relative w-full lg:max-w-sm",children:[g.jsx(Xr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-neutral-400"}),g.jsx("input",{type:"text",value:ne,onChange:R=>{de(R.target.value),J(1)},placeholder:"Buscar empleado, Employee Number o cuenta...",className:"w-full pl-9 pr-3 py-2 border border-[#D0D0D0] text-xs font-medium focus:outline-none focus:border-[#4F758B]"})]}),g.jsx("div",{className:"flex flex-wrap gap-2",children:[["todos","Todos"],["discrepancias","Discrepancias"],["coincidencias","Coincidencias"],["banco_sin_nomina",jt?"Banco sin Bono 14":"Banco sin nómina"],["banco_sin_bamboo","Banco sin Bamboo"],["diferencia_nombre_banco","Diferencias nombre banco"],["nomina_sin_cuenta",jt?"Bono 14 sin cuenta":"Nómina sin cuenta"]].map(([R,X])=>g.jsx("button",{onClick:()=>{Be(R),J(1)},className:`px-3 py-1.5 text-[10px] uppercase tracking-wider font-black border transition-colors ${Ne===R?"bg-[#4F758B] text-white border-[#4F758B]":"bg-white text-neutral-500 border-neutral-300 hover:border-[#4F758B] hover:text-[#4F758B]"}`,children:X},R))})]}),g.jsx("div",{className:"overflow-x-hidden",children:g.jsxs("table",{className:"w-full table-fixed text-left border-collapse",children:[g.jsxs("colgroup",{children:[g.jsx("col",{style:{width:"10%"}}),g.jsx("col",{style:{width:"8%"}}),g.jsx("col",{style:{width:"10%"}}),g.jsx("col",{style:{width:"9%"}}),g.jsx("col",{style:{width:"9%"}}),g.jsx("col",{style:{width:"9%"}}),g.jsx("col",{style:{width:"8%"}}),g.jsx("col",{style:{width:"9%"}}),g.jsx("col",{style:{width:"17%"}}),g.jsx("col",{style:{width:"11%"}})]}),g.jsx("thead",{children:g.jsxs("tr",{className:"bg-[#4F758B] text-white text-xs font-bold uppercase tracking-wider",children:[g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Empleado"}),g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Employee Number"}),g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Cuenta"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-right",children:jt?"Monto Bono 14":"Monto Nómina"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-right",children:"Monto Banco"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-right",children:"Diferencia"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-center",children:"Estado"}),g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Categoría"}),g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Observación"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-center",children:"Acciones"})]})}),g.jsx("tbody",{className:"divide-y divide-neutral-200 text-xs",children:cn.length>0?cn.map(R=>g.jsxs("tr",{className:"hover:bg-neutral-50 transition-colors",children:[g.jsx("td",{className:"py-3 px-2 xl:px-3 font-bold text-neutral-800 break-words",children:R.employee}),g.jsx("td",{className:"py-3 px-2 xl:px-3 font-mono text-neutral-600 break-all",children:R.employeeNumber||"—"}),g.jsx("td",{className:"py-3 px-2 xl:px-3 font-mono text-neutral-500 break-all",children:R.account??"—"}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-right font-mono text-neutral-700 whitespace-nowrap",children:Dd(R.amountPayroll,T,R.currency)}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-right font-mono text-neutral-700 whitespace-nowrap",children:Dd(R.amountBank,T,R.currency)}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-right font-mono text-neutral-700 whitespace-nowrap",children:Dd(R.difference,T,R.currency)}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-center",children:g.jsx("span",{className:`inline-block max-w-full px-2 py-1 text-[9px] font-black uppercase tracking-wider border leading-tight ${AC(R.status)}`,children:R.status})}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-neutral-600 capitalize break-words",children:RC(R.category??R.source,(p==null?void 0:p.reportKind)??"nomina")}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-neutral-600 break-words",children:R.observation}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-center",children:Ba(R,"banco_sin_bamboo")?ze.has(R.id)?g.jsx("span",{className:"inline-flex items-center px-2.5 py-1 border border-emerald-200 bg-emerald-50 text-emerald-800 text-[9px] font-black uppercase tracking-wider",children:"Reportado a RRHH"}):g.jsx("button",{type:"button",onClick:()=>Ce(R),className:"inline-flex max-w-full items-center justify-center px-2.5 py-2 border border-[#4F758B] text-[#4F758B] hover:bg-[#4F758B] hover:text-white text-[9px] font-black uppercase tracking-wider transition-colors whitespace-nowrap",children:"Reportar a RRHH"}):g.jsx("span",{className:"text-neutral-300",children:"—"})})]},R.id)):g.jsx("tr",{children:g.jsx("td",{colSpan:10,className:"py-12 text-center text-neutral-400 font-medium",children:"No hay resultados para el filtro seleccionado."})})})]})}),g.jsxs("div",{className:"p-4 border-t border-neutral-200 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 text-xs text-neutral-500",children:[g.jsxs("span",{children:["Mostrando ",cn.length," de ",ui.length," resultado(s)."]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>J(R=>Math.max(1,R-1)),disabled:q===1,className:"px-3 py-1.5 border border-neutral-300 bg-white disabled:opacity-40 disabled:cursor-not-allowed hover:border-[#4F758B] font-bold",children:"Anterior"}),g.jsxs("span",{className:"font-bold text-neutral-700",children:["Página ",q," de ",yt]}),g.jsx("button",{onClick:()=>J(R=>Math.min(yt,R+1)),disabled:q===yt,className:"px-3 py-1.5 border border-neutral-300 bg-white disabled:opacity-40 disabled:cursor-not-allowed hover:border-[#4F758B] font-bold",children:"Siguiente"})]})]})]})]})})]}),ee&&p&&g.jsx(Bw,{row:ee,country:T,periodRange:jt?gt:Ze,operatorName:x,operatorEmail:_,executionId:p.executionId,reportUrl:p.reportUrl,onClose:()=>Ce(null),onSuccess:R=>Re(X=>{const ae=new Set(X);return ae.add(R),ae}),onShowToast:n})]})}const ac=10;function zC(n){return n==="TT"?"":n==="PA"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-pa-historicos":n==="SV"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-sv-historicos":n==="HN"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-hn-historicos":n==="PR"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-pr-historicos":n==="RD"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-rd-historicos":"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-gt-historicos"}function PC(n){return n==="TT"?"":n==="PA"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-pa-marcar-resuelto":n==="SV"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-sv-marcar-resuelto":n==="HN"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-hn-marcar-resuelto":n==="PR"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-pr-marcar-resuelto":n==="RD"?"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-rd-marcar-resuelto":"https://agenteit.digitalcompass.agency/webhook/cruce-cuentas-gt-marcar-resuelto"}function rn(n){const e=Number(n);return Number.isFinite(e)?e:0}function VC(n,e){if(!n)return"";const i=new Date(String(n));return Number.isNaN(i.getTime())?String(n).slice(0,10):i.toLocaleDateString(e,{year:"numeric",month:"2-digit",day:"2-digit"})}function vf(n,e){if(!n)return"";const i=new Date(String(n));return Number.isNaN(i.getTime())?String(n):i.toLocaleString(e,{dateStyle:"short",timeStyle:"short"})}function HC(n){return String(n??"").toLowerCase().includes("resuelto")?"Resuelto":"Pendiente revisión"}function yv(n,e){const i=n,a=!Array.isArray(i)&&i?i:{};return(Array.isArray(i)?i:Array.isArray(a.reports)?a.reports:[]).map((c,u)=>{const d=c,m=rn(d.discrepancias??d.discrepancies),p=rn(d.bancoSinNomina??d.banco_sin_nomina??d.bankWithoutPayroll),y=rn(d.bancoSinBamboo??d.banco_sin_bamboo??d.bankWithoutBamboo),v=rn(d.nominaSinCuenta??d.nomina_sin_cuenta??d.payrollWithoutAccount),x=d.metadata&&typeof d.metadata=="object"&&!Array.isArray(d.metadata)?d.metadata:{},_=d.summary&&typeof d.summary=="object"&&!Array.isArray(d.summary)?d.summary:{},S=rn(d.diferenciasNombreBanco??d.diferencias_nombre_banco??d.nameDifferences??x.diferencias_nombre_banco??_.diferenciasNombreBanco);rn(d.posiblesCuentasMalDigitadas??d.posibles_cuentas_mal_digitadas??d.possibleWrongAccounts??x.posibles_cuentas_mal_digitadas??_.posiblesCuentasMalDigitadas);const T=m+p+y+v+S,j=String(d.country??d.pais??d.country_code??e.code).toUpperCase(),k=j==="RD"?rn(d.pendientes??d.total_pending??d.totalPending??x.pendientes_cruce_principal??_.pendientes):T,M=Array.isArray(d.archivosBanco)?d.archivosBanco.map(String):Array.isArray(d.bank_file_names)?d.bank_file_names.map(String):[],C=d.updated_at??d.fechaEjecucion??d.ejecutado_en??d.created_at;return{id:String(d.id??`reporte-${u+1}`),country:j==="TT"?"TT":j==="PA"?"PA":j==="SV"?"SV":j==="HN"?"HN":j==="PR"?"PR":j==="RD"?"RD":"GT",date:VC(d.fecha??d.period_end??C,e.locale),executionDate:vf(C,e.locale),period:String(d.periodo??d.period_label??d.period??"Período no especificado"),periodStart:d.period_start?String(d.period_start):void 0,periodEnd:d.period_end?String(d.period_end):void 0,payrollFile:String(d.archivoNomina??d.payroll_file_name??d.payrollFile??""),bankFiles:M,matches:rn(d.coincidencias??d.matches),discrepancies:m,bankWithoutPayroll:p,bankWithoutBamboo:y,payrollWithoutAccount:v,nameDifferences:S,totalPending:k,totalPayroll:rn(d.totalNomina??d.total_nomina),totalBank:rn(d.totalBanco??d.total_banco),totalDifference:rn(d.diferenciaTotal??d.diferencia_total),status:HC(d.estado??d.status??d.estadoLabel),reportUrl:d.reportUrl||d.report_url?String(d.reportUrl??d.report_url):void 0,spreadsheetId:d.spreadsheetId||d.spreadsheet_id?String(d.spreadsheetId??d.spreadsheet_id):void 0,executedBy:d.ejecutadoPorNombre||d.ejecutado_por_nombre?String(d.ejecutadoPorNombre??d.ejecutado_por_nombre):void 0,executedByEmail:d.ejecutadoPorEmail||d.ejecutado_por_email?String(d.ejecutadoPorEmail??d.ejecutado_por_email):void 0,resolvedBy:d.resueltoPorNombre||d.resuelto_por_nombre?String(d.resueltoPorNombre??d.resuelto_por_nombre):void 0,resolvedByEmail:d.resueltoPorEmail||d.resuelto_por_email?String(d.resueltoPorEmail??d.resuelto_por_email):void 0,resolvedAt:vf(d.resueltoEn??d.resuelto_en,e.locale),resolutionComment:d.comentarioResolucion||d.comentario_resolucion?String(d.comentarioResolucion??d.comentario_resolucion):void 0,_sortTime:new Date(String(C??d.period_end??"")).getTime()||0}}).filter(c=>c.country===e.code).sort((c,u)=>u._sortTime-c._sortTime).map(({_sortTime:c,...u})=>u)}function xf(n){return String(n??"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9 ]/g," ").replace(/\s+/g," ").trim()}function wf(n){return String(n??"").replace(/\.0$/g,"").replace(/\D/g,"").trim()}function bv(n,e){for(const i of e){const a=n[i];if(typeof a=="number"&&Number.isFinite(a))return a;if(typeof a=="string"&&a.trim()){const l=Number(a.replace(/[A-Za-z$Q,\s]/g,"").trim());if(Number.isFinite(l))return l}}return null}function $C(n){return Array.isArray(n)?n.map((e,i)=>{const a=e??{},l=String(a.employee??a.employee_name??a.bank_name_file??a.bank_account_holder??"Sin nombre"),c=bv(a,["bankAmount","bank_amount","amount","monto_banco"]),u=a.best_bamboo_candidate&&typeof a.best_bamboo_candidate=="object"?a.best_bamboo_candidate:null;return{id:String(a.id??`historical-bamboo-${xf(l)}-${wf(a.account??a.bank_account)}-${i+1}`),employee:l,employeeNumber:"",account:String(a.account??a.bank_account??a.bankAccount??""),amountPayroll:0,amountBank:c,difference:c===null?null:0-c,status:"Pendiente revisión",category:"banco_sin_bamboo",source:"banco_sin_bamboo",observation:String(a.observation??a.observacion??"Pago bancario sin empleado identificado de forma confiable en BambooHR."),bankNameFile:String(a.bank_name_file??a.bankNameFile??""),bankAccountHolder:String(a.bank_account_holder??a.bankAccountHolder??""),bestBambooCandidate:u?{employeeNumber:String(u.employee_number??u.employeeNumber??""),employeeName:String(u.employee_name??u.employeeName??""),score:bv(u,["score"])}:null,ambiguousBambooMatch:!!a.ambiguous_bamboo_match}}):[]}function qC(n){return Array.isArray(n)?n.map(e=>{const i=e??{};return{id:String(i.id??""),sourceName:String(i.nombre_origen_principal??i.source_name??""),sourceNames:Array.isArray(i.nombres_origen)?i.nombres_origen.map(String):[],bankAccount:String(i.cuenta_bancaria??i.bank_account??""),status:String(i.estado??""),emailSent:i.correo_enviado===!0}}):[]}function FC(n,e){const i=n.status.toLowerCase();if(!(n.emailSent||i==="notificado_rrhh"||i==="corregido_bamboo"))return!1;const l=wf(n.bankAccount),c=wf(e.account);if(l&&c&&l!==c)return!1;const u=new Set([n.sourceName,...n.sourceNames].map(xf).filter(Boolean));return[e.employee,e.bankNameFile,e.bankAccountHolder].map(xf).filter(Boolean).some(m=>u.has(m))}function IC(n){return n==="Resuelto"?"bg-blue-50 text-blue-800 border-blue-200":"bg-amber-50 text-amber-800 border-amber-200"}function GC(n){return n==="Resuelto"?"RESUELTO":"PENDIENTE REVISIÓN"}function KC({onShowToast:n,onOpenSidebar:e,operatorName:i,operatorEmail:a,country:l}){const[c,u]=D.useState(""),[d,m]=D.useState("todos"),[p,y]=D.useState([]),[v,x]=D.useState(1),[_,S]=D.useState(!1),[T,j]=D.useState(!1),[k,M]=D.useState(""),[C,P]=D.useState(null),[K,G]=D.useState(""),[H,Y]=D.useState(null),[Z,se]=D.useState([]),[me,ye]=D.useState(new Set),[Ae,Ne]=D.useState(!1),[Be,L]=D.useState(""),[W,Q]=D.useState(null),[le,ue]=D.useState(0),[A,q]=D.useState(0),J=D.useRef(0),ne=D.useRef(null),de=Math.max(1,Math.ceil(A/ac)),ge=p;D.useEffect(()=>{x(1)},[c,d,l.code]),D.useEffect(()=>{v>de&&x(de)},[v,de]);const we=async()=>{var Re;const ee=++J.current;(Re=ne.current)==null||Re.abort();const Ce=new AbortController;ne.current=Ce;const ze=()=>J.current===ee&&!Ce.signal.aborted;S(!0),M("");try{if(es){const gt=d==="pendiente"?"pendiente_revision":d==="resuelto"?"resuelto":null,{data:jt,error:qn}=await es.rpc("cruce_cuentas_get_historicos",{p_country:l.code,p_page:v,p_page_size:ac,p_search:c.trim()||null,p_status:gt});if(!ze())return;if(!qn&&jt){const Rn=Array.isArray(jt)?jt[0]:jt,Cs=yv(Rn,l),$i=rn(Rn==null?void 0:Rn.total),ui=rn((Rn==null?void 0:Rn.filtered_total)??$i);y(Cs),ue($i),q(ui);return}}if(!ze())return;const rt=zC(l.code);if(!rt)throw new Error(`No está configurado el origen histórico de ${l.name}.`);const st=new URL(rt);st.searchParams.set("country",l.code);const ht=await fetch(st.toString(),{method:"GET",signal:Ce.signal}),it=await ht.json().catch(()=>null);if(!ze())return;if(!ht.ok||(it==null?void 0:it.ok)===!1)throw new Error("No se pudieron cargar los reportes históricos.");const Qt=yv(it,l),$n=c.trim().toLowerCase(),Ze=Qt.filter(gt=>{const jt=d==="todos"||d==="pendiente"&&gt.status==="Pendiente revisión"||d==="resuelto"&&gt.status==="Resuelto",qn=!$n||gt.period.toLowerCase().includes($n)||gt.payrollFile.toLowerCase().includes($n)||gt.id.toLowerCase().includes($n)||(gt.resolvedBy??"").toLowerCase().includes($n)||(gt.executedBy??"").toLowerCase().includes($n);return jt&&qn});if(!ze())return;const ci=(v-1)*ac;y(Ze.slice(ci,ci+ac)),ue(Qt.length),q(Ze.length)}catch(rt){if(!ze()||rt instanceof DOMException&&rt.name==="AbortError")return;y([]),ue(0),q(0),M(rt instanceof Error?rt.message:"No se pudieron cargar los reportes históricos. Intenta nuevamente."),n("No se pudieron cargar los reportes históricos.","error")}finally{ze()&&(S(!1),ne.current===Ce&&(ne.current=null))}};D.useEffect(()=>{const ee=window.setTimeout(()=>{we()},c.trim()?300:0);return()=>{var Ce;window.clearTimeout(ee),J.current+=1,(Ce=ne.current)==null||Ce.abort(),ne.current=null}},[l.code,v,c,d]);const ke=()=>{Q(null),Y(null),se([]),ye(new Set),L("")},qe=async ee=>{if(ee.bankWithoutBamboo<=0){n("Este reporte no tiene casos de Banco sin Bamboo.","info");return}if(!es){n("Supabase no está configurado en esta aplicación.","error");return}Y(ee),Q(null),se([]),ye(new Set),L(""),Ne(!0);try{const{data:Ce,error:ze}=await es.rpc("cruce_cuentas_get_banco_sin_bamboo_reporte",{p_report_id:ee.id,p_country:l.code});if(ze)throw ze;const Re=Array.isArray(Ce)?Ce[0]:Ce;if(!Re||Re.ok===!1)throw new Error(String((Re==null?void 0:Re.message)||"No se pudieron recuperar los casos de Banco sin Bamboo."));const rt=$C(Re.cases),st=qC(Re.corrections),ht=new Set(rt.filter(it=>st.some(Qt=>FC(Qt,it))).map(it=>it.id));se(rt),ye(ht),rt.length===0&&L("Este reporte fue creado antes de que se guardara el detalle de Banco sin Bamboo. Los reportes nuevos conservarán los casos para revisarlos desde Históricos.")}catch(Ce){const ze=Ce instanceof Error?Ce.message:"No se pudieron recuperar los casos de Banco sin Bamboo.";L(ze),n(ze,"error")}finally{Ne(!1)}},at={label:(H==null?void 0:H.period)||"Período no especificado",start:(H==null?void 0:H.periodStart)||"",end:(H==null?void 0:H.periodEnd)||""},jn=ee=>{if(ee.reportUrl){window.open(ee.reportUrl,"_blank","noopener,noreferrer");return}n("Este reporte aún no tiene un Google Sheet disponible.","info")},Nn=ee=>{if(ee.status==="Resuelto"){n("Este reporte ya fue marcado como resuelto.","info");return}P(ee),G("")},as=async()=>{if(!C)return;const ee=K.trim();if(ee.length<10){n("Debes escribir un comentario de resolución más descriptivo.","error");return}const Ce=PC(l.code);if(!Ce){n(`La resolución de reportes para ${l.name} estará disponible próximamente.`,"info");return}j(!0);try{const ze=await fetch(Ce,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reportId:C.id,comentarioResolucion:ee,resueltoPorNombre:i,resueltoPorEmail:a,country:l.code,countryName:l.name})}),Re=await ze.json().catch(()=>null);if(!ze.ok||(Re==null?void 0:Re.ok)===!1){const ht=Array.isArray(Re==null?void 0:Re.errors)?Re.errors.join(`
`):(Re==null?void 0:Re.message)||"No se pudo marcar el reporte como resuelto.";throw new Error(ht)}const rt=Re.report??{},st=vf(rt.resueltoEn??new Date().toISOString(),l.locale);y(ht=>ht.map(it=>it.id===C.id?{...it,status:"Resuelto",resolvedBy:String(rt.resueltoPorNombre??i),resolvedByEmail:String(rt.resueltoPorEmail??a),resolvedAt:st,resolutionComment:String(rt.comentarioResolucion??ee)}:it)),P(null),G(""),n("Reporte marcado como resuelto correctamente.","success")}catch(ze){const Re=ze instanceof Error?ze.message:"No se pudo marcar el reporte como resuelto.";n(Re,"error")}finally{j(!1)}};return g.jsxs("div",{className:"flex-1 flex flex-col min-h-screen bg-neutral-50 text-neutral-800 font-sans",children:[g.jsxs("header",{className:"bg-white border-b-4 border-[#6CC24A] flex justify-between items-center w-full px-4 sm:px-8 h-[84px] sticky top-0 z-40 shadow-sm gap-x-4",children:[g.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[g.jsx("button",{onClick:e,className:"md:hidden p-2 -ml-2 text-neutral-600 hover:text-neutral-800 hover:bg-neutral-100 transition-colors flex-shrink-0","aria-label":"Abrir menú",children:g.jsx(uw,{className:"w-6 h-6"})}),g.jsx("h1",{className:"text-xs sm:text-sm md:text-lg lg:text-2xl font-black text-[#4F758B] tracking-tight uppercase flex items-center gap-1.5 sm:gap-2 min-w-0",children:g.jsxs("span",{className:"truncate",children:["Reportes Históricos - ",l.name]})})]}),g.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0",children:[g.jsx(Uw,{country:l,operatorName:i,operatorEmail:a,section:"Reportes Históricos",onShowToast:n}),g.jsx("div",{className:"hidden sm:flex items-center border border-neutral-200 bg-white px-2.5 py-2 shadow-sm","aria-label":`Bandera de ${l.name}`,children:g.jsx("img",{src:l.flag,alt:`Bandera de ${l.name}`,className:"h-5 sm:h-6 w-auto object-contain"})}),g.jsxs("button",{onClick:we,disabled:_,className:"hidden sm:inline-flex items-center gap-2 border border-[#4F758B]/20 text-[#4F758B] px-3 py-2 text-xs font-bold hover:border-[#4F758B]/50 disabled:opacity-50",children:[g.jsx(J2,{className:`w-4 h-4 ${_?"animate-spin":""}`}),"Actualizar"]})]})]}),g.jsxs("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 py-8 flex flex-col gap-6",children:[g.jsxs("div",{className:"bg-white border border-[#D0D0D0] p-4 flex flex-col lg:flex-row items-center justify-between gap-4 shadow-sm",children:[g.jsxs("div",{className:"relative w-full lg:max-w-md",children:[g.jsx(Xr,{className:"absolute left-3.5 top-1/2 transform -translate-y-1/2 text-neutral-400 w-4 h-4"}),g.jsx("input",{type:"text",placeholder:"Buscar por período, reporte, archivo o resolutor...",value:c,onChange:ee=>u(ee.target.value),className:"w-full pl-10 pr-4 py-2 border border-[#D0D0D0] text-xs font-medium placeholder-neutral-400 focus:outline-none focus:border-[#4F758B] transition-colors"})]}),g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 w-full lg:w-auto",children:[g.jsx("div",{className:"flex flex-wrap gap-2",children:[["todos","Todos"],["pendiente","Pendiente revisión"],["resuelto","Resuelto"]].map(([ee,Ce])=>g.jsx("button",{onClick:()=>m(ee),className:`px-3 py-1.5 text-[10px] uppercase tracking-wider font-black border transition-colors ${d===ee?"bg-[#4F758B] text-white border-[#4F758B]":"bg-white text-neutral-500 border-neutral-300 hover:border-[#4F758B] hover:text-[#4F758B]"}`,children:Ce},ee))}),g.jsxs("div",{className:"flex items-center gap-2 text-xs font-bold text-neutral-500",children:[g.jsx(O2,{className:"w-4 h-4 text-neutral-400"}),g.jsxs("span",{children:["Mostrando: ",A," de ",le," reportes"]})]})]})]}),k&&g.jsxs("div",{className:"border border-red-200 bg-red-50 text-[#ba1a1a] px-4 py-3 text-xs font-bold flex items-center gap-2",children:[g.jsx(Ac,{className:"w-4 h-4"}),k]}),g.jsxs("div",{className:"bg-white border border-[#D0D0D0] shadow-sm overflow-hidden",children:[g.jsx("div",{className:"overflow-x-auto lg:overflow-x-hidden",children:g.jsxs("table",{className:"w-full text-left border-collapse min-w-[960px] lg:min-w-0 lg:table-fixed",children:[g.jsxs("colgroup",{children:[g.jsx("col",{className:"lg:w-[9%]"}),g.jsx("col",{className:"lg:w-[8%]"}),g.jsx("col",{className:"lg:w-[21%]"}),g.jsx("col",{className:"lg:w-[9%]"}),g.jsx("col",{className:"lg:w-[9%]"}),g.jsx("col",{className:"lg:w-[9%]"}),g.jsx("col",{className:"lg:w-[9%]"}),g.jsx("col",{className:"lg:w-[10%]"}),g.jsx("col",{className:"lg:w-[16%]"})]}),g.jsx("thead",{children:g.jsxs("tr",{className:"bg-[#4F758B] text-white text-xs font-bold uppercase tracking-wider",children:[g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Fecha"}),g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Período"}),g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Archivo de Nómina / Bono 14"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-center",children:"Coincidencias"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-center",children:"Banco sin Bamboo"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-center",children:"Pendientes"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-center",children:"Estado"}),g.jsx("th",{className:"py-3 px-2 xl:px-3",children:"Resuelto por"}),g.jsx("th",{className:"py-3 px-2 xl:px-3 text-center",children:"Acciones"})]})}),g.jsx("tbody",{className:"divide-y divide-neutral-200 text-xs",children:_?g.jsx("tr",{children:g.jsx("td",{colSpan:9,className:"py-12 text-center text-neutral-400 font-medium",children:g.jsxs("div",{className:"inline-flex items-center gap-2",children:[g.jsx(Ha,{className:"w-4 h-4 animate-spin"}),"Cargando reportes históricos..."]})})}):ge.length>0?ge.map(ee=>g.jsxs(Tn.tr,{initial:{opacity:0},animate:{opacity:1},className:"hover:bg-neutral-50/70 transition-colors",children:[g.jsx("td",{className:"py-3 px-2 xl:px-3 font-medium text-neutral-700",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(g2,{className:"w-4 h-4 text-neutral-400"}),g.jsxs("div",{children:[g.jsx("span",{children:ee.date}),ee.executionDate&&g.jsx("p",{className:"text-[9px] text-neutral-400 mt-0.5",children:ee.executionDate})]})]})}),g.jsx("td",{className:"py-3 px-2 xl:px-3 font-bold text-[#4F758B]",children:ee.period}),g.jsx("td",{className:"py-3 px-2 xl:px-3 font-mono text-neutral-500 min-w-0",title:ee.payrollFile,children:g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(Ca,{className:"w-4 h-4 text-neutral-400 flex-shrink-0"}),g.jsx("span",{className:"truncate min-w-0",children:ee.payrollFile||"No especificado"})]})}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-center font-black text-emerald-800",children:ee.matches}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-center",children:ee.bankWithoutBamboo>0?g.jsxs("button",{type:"button",onClick:()=>void qe(ee),className:"inline-flex items-center gap-1.5 min-w-8 px-2.5 py-1 text-[10px] font-black border bg-orange-50 text-orange-800 border-orange-200 hover:bg-orange-100 hover:border-orange-300 transition-colors",title:"Revisar casos y reportar correcciones a RRHH",children:[g.jsx("span",{children:ee.bankWithoutBamboo}),g.jsx("span",{className:"hidden 2xl:inline",children:"Revisar"})]}):g.jsx("span",{className:"inline-block min-w-8 px-2.5 py-1 text-[10px] font-black border bg-neutral-50 text-neutral-400 border-neutral-200",children:"0"})}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-center",children:g.jsx("span",{className:`inline-block px-2.5 py-1 text-[10px] font-bold border ${ee.totalPending>0?"bg-red-50 text-[#ba1a1a] border-red-200":"bg-emerald-50 text-emerald-800 border-emerald-200"}`,children:ee.totalPending===0?"Sin pendientes":`${ee.totalPending} pendiente${ee.totalPending>1?"s":""}`})}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-center",children:g.jsx("span",{className:`inline-block px-2.5 py-1 text-[9px] uppercase font-black tracking-wider border ${IC(ee.status)}`,children:GC(ee.status)})}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-neutral-600 max-w-[220px]",children:ee.resolvedBy?g.jsxs("div",{title:ee.resolutionComment||"",children:[g.jsx("p",{className:"font-bold text-neutral-700 truncate",children:ee.resolvedBy}),g.jsx("p",{className:"text-[10px] text-neutral-400",children:ee.resolvedAt})]}):g.jsx("span",{className:"text-neutral-400",children:"Pendiente"})}),g.jsx("td",{className:"py-3 px-2 xl:px-3 text-center",children:g.jsxs("div",{className:"flex justify-center items-stretch gap-1.5 min-w-0",children:[g.jsxs("button",{onClick:()=>jn(ee),className:"inline-flex items-center gap-1.5 text-[#4F758B] hover:text-[#3d6378] font-bold text-xs border border-[#4F758B]/20 hover:border-[#4F758B]/50 px-2.5 py-1.5 bg-white hover:bg-neutral-50 transition-colors",children:[g.jsx(N2,{className:"w-3.5 h-3.5"}),g.jsx("span",{children:"Ver"})]}),g.jsxs("button",{onClick:()=>Nn(ee),disabled:ee.status==="Resuelto",className:"inline-flex items-center gap-1.5 text-emerald-700 hover:text-emerald-800 font-bold text-xs border border-emerald-200 hover:border-emerald-400 px-2.5 py-1.5 bg-emerald-50 hover:bg-emerald-100 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[g.jsx(Ec,{className:"w-3.5 h-3.5"}),g.jsx("span",{className:"leading-tight",children:ee.status==="Resuelto"?"Resuelto":"Marcar resuelto"})]})]})})]},ee.id)):g.jsx("tr",{children:g.jsx("td",{colSpan:9,className:"py-12 text-center text-neutral-400 font-medium",children:"No se encontraron reportes históricos."})})})]})}),g.jsxs("div",{className:"p-4 border-t border-neutral-200 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 text-xs text-neutral-500",children:[g.jsxs("span",{children:["Mostrando ",ge.length," de ",A," reporte(s)."]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>x(ee=>Math.max(1,ee-1)),disabled:v===1,className:"px-3 py-1.5 border border-neutral-300 bg-white disabled:opacity-40 disabled:cursor-not-allowed hover:border-[#4F758B] font-bold",children:"Anterior"}),g.jsxs("span",{className:"font-bold text-neutral-700",children:["Página ",v," de ",de]}),g.jsx("button",{onClick:()=>x(ee=>Math.min(de,ee+1)),disabled:v===de,className:"px-3 py-1.5 border border-neutral-300 bg-white disabled:opacity-40 disabled:cursor-not-allowed hover:border-[#4F758B] font-bold",children:"Siguiente"})]})]})]})]}),g.jsx(zi,{children:H&&g.jsx(Tn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/45 px-4 py-6",children:g.jsxs(Tn.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},className:"w-full max-w-5xl bg-white border border-[#D0D0D0] shadow-2xl max-h-[92vh] flex flex-col",children:[g.jsx("div",{className:"h-1.5 bg-[#6CC24A] flex-shrink-0"}),g.jsxs("div",{className:"border-b border-neutral-200 px-5 sm:px-6 py-4 flex items-start justify-between gap-4 flex-shrink-0",children:[g.jsxs("div",{children:[g.jsx("p",{className:"text-[10px] uppercase tracking-[0.18em] font-black text-[#6B8FA3]",children:"Histórico · Banco sin BambooHR"}),g.jsx("h2",{className:"text-lg sm:text-xl font-black text-[#4F758B] mt-1",children:H.period}),g.jsxs("p",{className:"text-xs text-neutral-500 mt-1",children:[l.name," · ",H.bankWithoutBamboo," caso",H.bankWithoutBamboo===1?"":"s"," guardado",H.bankWithoutBamboo===1?"":"s"," en este reporte"]})]}),g.jsx("button",{type:"button",onClick:ke,className:"p-2 text-neutral-400 hover:text-neutral-700 hover:bg-neutral-100","aria-label":"Cerrar revisión de Banco sin Bamboo",children:g.jsx(Ga,{className:"w-5 h-5"})})]}),g.jsxs("div",{className:"px-5 sm:px-6 py-4 overflow-y-auto",children:[g.jsxs("div",{className:"border border-[#D6E8F4] bg-[#F7FBFD] px-4 py-3 text-xs text-neutral-600 leading-relaxed mb-4",children:["Aquí puedes volver días después al reporte y enviar a RRHH únicamente los falsos positivos que ya verificaste manualmente. Los casos previamente enviados se muestran como ",g.jsx("strong",{children:"Reportado a RRHH"}),"."]}),Ae?g.jsxs("div",{className:"py-14 text-center text-neutral-500 text-sm",children:[g.jsx(Ha,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-[#4F758B]"}),"Recuperando casos del reporte..."]}):Be?g.jsxs("div",{className:"border border-amber-200 bg-amber-50 text-amber-800 px-4 py-3 text-xs font-medium flex items-start gap-2",children:[g.jsx(Ac,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),g.jsx("span",{children:Be})]}):Z.length>0?g.jsx("div",{className:"overflow-x-auto border border-neutral-200",children:g.jsxs("table",{className:"w-full text-left border-collapse min-w-[760px]",children:[g.jsx("thead",{children:g.jsxs("tr",{className:"bg-[#4F758B] text-white text-[10px] font-black uppercase tracking-wider",children:[g.jsx("th",{className:"px-3 py-3",children:"Nombre detectado"}),g.jsx("th",{className:"px-3 py-3",children:"Cuenta"}),g.jsx("th",{className:"px-3 py-3 text-right",children:"Monto banco"}),g.jsx("th",{className:"px-3 py-3",children:"Candidato BambooHR"}),g.jsx("th",{className:"px-3 py-3 text-center",children:"Acción"})]})}),g.jsx("tbody",{className:"divide-y divide-neutral-200 text-xs",children:Z.map(ee=>{var Re;const Ce=me.has(ee.id),ze=ee.amountBank;return g.jsxs("tr",{className:"hover:bg-neutral-50",children:[g.jsxs("td",{className:"px-3 py-3",children:[g.jsx("p",{className:"font-black text-neutral-800",children:ee.employee}),(ee.bankNameFile||ee.bankAccountHolder)&&g.jsx("p",{className:"text-[10px] text-neutral-400 mt-1",children:[ee.bankNameFile,ee.bankAccountHolder].filter(Boolean).join(" · ")})]}),g.jsx("td",{className:"px-3 py-3 font-mono font-bold text-neutral-600",children:ee.account||"—"}),g.jsx("td",{className:"px-3 py-3 text-right font-black text-neutral-700",children:ze===null?"—":new Intl.NumberFormat(l.locale,{style:"currency",currency:l.currency,maximumFractionDigits:2}).format(ze)}),g.jsx("td",{className:"px-3 py-3 text-neutral-600 max-w-[260px]",children:(Re=ee.bestBambooCandidate)!=null&&Re.employeeName?g.jsxs("div",{children:[g.jsx("p",{className:"font-bold text-[#4F758B]",children:ee.bestBambooCandidate.employeeName}),ee.bestBambooCandidate.employeeNumber&&g.jsxs("p",{className:"text-[10px] text-neutral-400 mt-0.5",children:["Employee Number ",ee.bestBambooCandidate.employeeNumber]})]}):g.jsx("span",{className:"text-neutral-400",children:"Sin candidato confiable"})}),g.jsx("td",{className:"px-3 py-3 text-center",children:Ce?g.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-emerald-200 bg-emerald-50 text-emerald-800 text-[10px] font-black uppercase tracking-wider",children:[g.jsx(Ec,{className:"w-3.5 h-3.5"}),"Reportado a RRHH"]}):g.jsx("button",{type:"button",onClick:()=>Q(ee),className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-[#6CC24A] hover:bg-[#5aaa3f] text-white text-[10px] font-black uppercase tracking-wider transition-colors",children:"Reportar a RRHH"})})]},ee.id)})})]})}):g.jsx("div",{className:"py-12 text-center text-neutral-400 text-sm",children:"No hay casos guardados en este reporte."})]}),g.jsxs("div",{className:"border-t border-neutral-200 px-5 sm:px-6 py-4 flex items-center justify-between gap-3 flex-shrink-0",children:[g.jsxs("span",{className:"text-[10px] text-neutral-400",children:["ID del reporte: ",H.id]}),g.jsx("button",{type:"button",onClick:ke,className:"border border-neutral-300 bg-white px-4 py-2 text-xs font-bold text-neutral-600 hover:bg-neutral-50",children:"Cerrar"})]})]})})}),W&&H&&g.jsx(Bw,{row:W,country:l,periodRange:at,operatorName:i,operatorEmail:a,executionId:H.id,reportUrl:H.reportUrl,onClose:()=>Q(null),onSuccess:ee=>{ye(Ce=>{const ze=new Set(Ce);return ze.add(ee),ze})},onShowToast:n}),g.jsx(zi,{children:C&&g.jsx(Tn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/45 px-4",children:g.jsxs(Tn.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},className:"w-full max-w-lg bg-white border border-[#D0D0D0] shadow-xl",children:[g.jsxs("div",{className:"border-b border-neutral-200 px-5 py-4 flex items-center justify-between",children:[g.jsxs("div",{children:[g.jsx("h2",{className:"text-base font-black text-[#4F758B] uppercase tracking-tight",children:"Marcar reporte como resuelto"}),g.jsx("p",{className:"text-xs text-neutral-500 mt-1",children:C.period})]}),g.jsx("button",{onClick:()=>P(null),disabled:T,className:"p-2 text-neutral-400 hover:text-neutral-700 disabled:opacity-50","aria-label":"Cerrar",children:g.jsx(Ga,{className:"w-4 h-4"})})]}),g.jsxs("div",{className:"p-5 space-y-4",children:[g.jsx("div",{className:"bg-amber-50 border border-amber-200 text-amber-800 p-3 text-xs leading-relaxed",children:"Antes de resolver, confirma que las diferencias fueron revisadas y explica cómo se cerró el caso."}),g.jsxs("label",{className:"block",children:[g.jsx("span",{className:"text-[10px] uppercase tracking-wider font-black text-neutral-500",children:"Comentario de resolución"}),g.jsx("textarea",{value:K,onChange:ee=>G(ee.target.value),placeholder:"Ejemplo: Se corrigió la cuenta bancaria en nómina y se validó contra el banco.",className:"mt-2 w-full min-h-[130px] border border-[#D0D0D0] px-3 py-2 text-sm focus:outline-none focus:border-[#4F758B]"})]})]}),g.jsxs("div",{className:"border-t border-neutral-200 px-5 py-4 flex justify-end gap-3",children:[g.jsx("button",{onClick:()=>P(null),disabled:T,className:"border border-neutral-300 bg-white px-4 py-2 text-xs font-bold text-neutral-600 hover:bg-neutral-50 disabled:opacity-50",children:"Cancelar"}),g.jsxs("button",{onClick:as,disabled:T,className:"bg-[#4F758B] hover:bg-[#41677b] text-white px-4 py-2 text-xs font-black uppercase tracking-wider disabled:opacity-50 inline-flex items-center gap-2",children:[T&&g.jsx(Ha,{className:"w-4 h-4 animate-spin"}),"Confirmar resolución"]})]})]})})})]})}function vv({message:n,type:e,onClose:i}){D.useEffect(()=>{const c=setTimeout(()=>{i()},2e3);return()=>clearTimeout(c)},[i]);const a={success:"bg-[#6CC24A] text-white border-l-4 border-emerald-700",error:"bg-[#ba1a1a] text-white border-l-4 border-red-800",info:"bg-[#4F758B] text-white border-l-4 border-slate-700"},l={success:Ec,error:x2,info:cw}[e];return g.jsx("div",{className:"fixed bottom-6 right-6 z-50 max-w-sm w-full",children:g.jsxs(Tn.div,{initial:{opacity:0,y:30,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:20,scale:.95},className:`flex items-center gap-3 p-4 shadow-lg rounded-md border border-neutral-200/10 ${a[e]}`,children:[g.jsx("span",{className:"flex-shrink-0",children:g.jsx(l,{className:"w-5 h-5"})}),g.jsx("div",{className:"flex-1 font-medium text-sm leading-tight pr-2",children:n}),g.jsx("button",{onClick:i,className:"flex-shrink-0 hover:bg-white/20 p-1 rounded transition-colors text-white",children:g.jsx(Ga,{className:"w-4 h-4"})})]})})}const YC="https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM_completo.png";function XC({onSelect:n}){return g.jsxs("div",{className:"min-h-screen bg-[#F5F5F5] flex flex-col font-sans",children:[g.jsx("div",{className:"h-1.5 bg-[#6CC24A]"}),g.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-10",children:g.jsxs(Tn.section,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},className:"w-full max-w-3xl bg-white border border-[#D0D0D0] shadow-xl p-6 sm:p-9",children:[g.jsx("img",{src:YC,alt:"GomezLee Marketing",className:"h-14 object-contain mb-7"}),g.jsxs("div",{className:"flex items-start gap-3 mb-7",children:[g.jsx("div",{className:"bg-[#4F758B]/10 p-2.5 rounded-full",children:g.jsx(lw,{className:"w-5 h-5 text-[#4F758B]"})}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-xl sm:text-2xl font-black text-[#4F758B] uppercase tracking-tight",children:"Selecciona el país"}),g.jsx("p",{className:"text-sm text-neutral-500 mt-1",children:"El portal cargará las reglas, la moneda y los reportes correspondientes."})]})]}),g.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:uo.map(e=>g.jsxs("button",{type:"button",disabled:!e.enabled,onClick:()=>e.enabled&&n(e.code),className:`text-left border p-5 transition-all min-h-[150px] flex flex-col justify-between ${e.enabled?"border-[#4F758B]/30 hover:border-[#4F758B] hover:shadow-md bg-white":"border-neutral-200 bg-neutral-50 cursor-not-allowed opacity-70"}`,children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsx("img",{src:e.flag,alt:"",className:"w-12 h-8 sm:w-16 sm:h-10 object-cover shadow-sm border border-neutral-200","aria-hidden":"true"}),e.enabled?g.jsx(h2,{className:"w-5 h-5 text-[#6CC24A]"}):g.jsx(P2,{className:"w-4 h-4 text-neutral-400"})]}),g.jsxs("div",{children:[g.jsx("p",{className:"font-black text-[#4F758B] uppercase tracking-wide",children:e.name}),g.jsx("p",{className:"text-xs text-neutral-500 mt-1",children:e.enabled?`Moneda ${e.currency}`:"Próximamente"})]})]},e.code))})]})})]})}const JC="glm_cruce_cuentas_tab_state",QC=1,ss="drafts",xv="glm_cruce_cuentas_tab_session_id",Pw=1,ZC=10080*60*1e3;let Ra=null,qa=Promise.resolve(),wv=null;function _v(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`}function tm(){try{const n=window.sessionStorage.getItem(xv);if(n)return n;const e=_v();return window.sessionStorage.setItem(xv,e),e}catch{return wv??(wv=_v()),wv}}function nm(){return Ra||(Ra=new Promise((n,e)=>{if(typeof indexedDB>"u"){e(new Error("IndexedDB no está disponible en este navegador."));return}const i=indexedDB.open(JC,QC);i.onupgradeneeded=()=>{const a=i.result;a.objectStoreNames.contains(ss)||a.createObjectStore(ss,{keyPath:"sessionId"})},i.onsuccess=()=>n(i.result),i.onerror=()=>e(i.error??new Error("No se pudo abrir IndexedDB.")),i.onblocked=()=>e(new Error("La base local está bloqueada por otra pestaña."))}),Ra.catch(()=>{Ra=null}),Ra)}function WC(n){return new Promise((e,i)=>{n.onsuccess=()=>e(n.result),n.onerror=()=>i(n.error??new Error("Falló una operación local."))})}function Ic(n){return new Promise((e,i)=>{n.oncomplete=()=>e(),n.onerror=()=>i(n.error??new Error("Falló la transacción local.")),n.onabort=()=>i(n.error??new Error("La transacción local fue cancelada."))})}function eO(n){if(!n||typeof n!="object")return!1;const e=n;return e.version===Pw&&typeof e.sessionId=="string"&&typeof e.updatedAt=="number"&&(e.currentView==="cruce"||e.currentView==="historial")&&Array.isArray(e.uploadedBankFiles)&&typeof e.isCruceExecuted=="boolean"}async function tO(n,e){const i=Date.now()-ZC,a=n.transaction(ss,"readwrite"),l=Ic(a),u=a.objectStore(ss).openCursor();await new Promise((d,m)=>{u.onsuccess=()=>{const p=u.result;if(!p){d();return}const y=p.value;y.sessionId!==e&&typeof y.updatedAt=="number"&&y.updatedAt<i&&p.delete(),p.continue()},u.onerror=()=>m(u.error??new Error("No se pudieron limpiar borradores antiguos."))}),await l}async function nO(){const n=tm();try{const e=await nm(),i=e.transaction(ss,"readonly"),a=Ic(i),l=await WC(i.objectStore(ss).get(n));return await a,tO(e,n).catch(()=>{}),eO(l)?l:null}catch{return null}}function sO(n){const e=tm(),i={...n,version:Pw,sessionId:e,updatedAt:Date.now()};return qa=qa.catch(()=>{}).then(async()=>{const l=(await nm()).transaction(ss,"readwrite"),c=Ic(l);l.objectStore(ss).put(i),await c}).catch(()=>{}),qa}function Sv(){const n=tm();return qa=qa.catch(()=>{}).then(async()=>{const i=(await nm()).transaction(ss,"readwrite"),a=Ic(i);i.objectStore(ss).delete(n),await a}).catch(()=>{}),qa}const Md=!1,_f="glm_cruce_selected_country",Bd={name:"Usuario GLM",email:"usuario@gomezleemarketing.com"};function iO(){try{const n=window.localStorage.getItem(_f),e=uo.find(i=>i.code===n&&i.enabled);return(e==null?void 0:e.code)??null}catch{return null}}function aO(){const[n,e]=D.useState("cruce"),[i,a]=D.useState(!1),[l,c]=D.useState(null),[u,d]=D.useState([]),[m,p]=D.useState([]),[y,v]=D.useState(!1),[x,_]=D.useState(null),[S,T]=D.useState(0),[j,k]=D.useState(()=>iO()),[M,C]=D.useState(Bd),[P,K]=D.useState(Md),[G,H]=D.useState(!1),[Y,Z]=D.useState(null);D.useRef(0);const se=D.useMemo(()=>Md,[]),me=j?wb(j):null,ye=(le,ue)=>{Z({message:le,type:ue})};D.useEffect(()=>{},[se]),D.useEffect(()=>{},[se]),D.useEffect(()=>{let le=!0;return(async()=>{const A=await nO();le&&(A&&(!j||A.countryCode===j?(A.countryCode&&k(A.countryCode),e(A.currentView),c(A.uploadedPayroll),d(Array.isArray(A.uploadedPayrollFiles)?A.uploadedPayrollFiles:[]),p(A.uploadedBankFiles),v(A.isCruceExecuted),_(A.cruceResponse)):await Sv()),le&&H(!0))})(),()=>{le=!1}},[]),D.useEffect(()=>{G&&sO({countryCode:j,currentView:n,uploadedPayroll:l,uploadedPayrollFiles:u,uploadedBankFiles:m,isCruceExecuted:y,cruceResponse:x})},[G,j,n,l,u,m,y,x]);const Ae=()=>{c(null),d([]),p([]),v(!1),_(null),T(le=>le+1)},Ne=async()=>{await Sv(),es&&await es.auth.signOut(),C(Bd),k(null),window.localStorage.removeItem(_f),Ae(),e("cruce"),ye("Sesión cerrada correctamente.","success")},Be=()=>{Ae(),e("cruce"),ye("Nuevo cruce iniciado.","success")},L=le=>{const ue=wb(le);if(!ue.enabled){ye(`${ue.name} estará disponible próximamente.`,"info");return}j&&j!==le&&Ae(),k(le),window.localStorage.setItem(_f,le),e("cruce"),a(!1)},W=()=>{k(null),a(!1)};if(P)return g.jsx("div",{className:"min-h-screen bg-[#F5F5F5] flex items-center justify-center text-[#4F758B] font-black uppercase tracking-wider",children:"Validando acceso..."});if(!me)return g.jsxs(g.Fragment,{children:[g.jsx(XC,{onSelect:L}),g.jsx(zi,{children:Y&&g.jsx(vv,{message:Y.message,type:Y.type,onClose:()=>Z(null)})})]});const Q=M??Bd;return g.jsxs("div",{className:"min-h-screen bg-[#F5F5F5] selection:bg-[#6CC24A] selection:text-white antialiased font-sans flex flex-col",children:[g.jsxs(Tn.div,{initial:{opacity:0},animate:{opacity:1},className:"min-h-screen flex w-full relative overflow-x-hidden",children:[g.jsx(zi,{children:i&&g.jsx(Tn.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>a(!1),className:"fixed inset-0 bg-black/45 z-45 md:hidden"},"backdrop")}),g.jsx(iN,{currentView:n,onViewChange:le=>{e(le),a(!1)},onNewCruce:()=>{Be(),a(!1)},isSidebarOpen:i,onCloseSidebar:()=>a(!1),user:Q,isAuthEnabled:Md,onLogout:Ne,country:me,onCountryChange:L,onChooseAnotherCountry:W}),g.jsx("div",{className:"pl-0 md:pl-64 flex-1 flex flex-col w-full min-h-screen transition-all duration-300",children:g.jsx(zi,{mode:"wait",children:n==="cruce"?g.jsx(Tn.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2},className:"flex-1 flex flex-col",children:g.jsx(LC,{onShowToast:ye,uploadedPayroll:l,setUploadedPayroll:c,uploadedPayrollFiles:u,setUploadedPayrollFiles:d,uploadedBankFiles:m,setUploadedBankFiles:p,isCruceExecuted:y,setIsCruceExecuted:v,response:x,setResponse:_,onOpenSidebar:()=>a(!0),operatorName:Q.name,operatorEmail:Q.email,resetToken:S,country:me})},`view-cruce-${me.code}`):g.jsx(Tn.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2},className:"flex-1 flex flex-col",children:g.jsx(KC,{onShowToast:ye,onOpenSidebar:()=>a(!0),operatorName:Q.name,operatorEmail:Q.email,country:me})},`view-history-${me.code}`)})})]},`interface-${me.code}`),g.jsx(zi,{children:Y&&g.jsx(vv,{message:Y.message,type:Y.type,onClose:()=>Z(null)})})]})}window.addEventListener("pageshow",n=>{n.persisted&&window.location.reload()});i1.createRoot(document.getElementById("root")).render(g.jsx(D.StrictMode,{children:g.jsx(aO,{})}));