Files
tablero-cdc/dist/assets/index-BrJEDdGr.js
T

399 lines
760 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function XT(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(s,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();function fx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fh={exports:{}},Yo={};/**
* @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 c0;function JT(){if(c0)return Yo;c0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:s,key:u,ref:o!==void 0?o:null,props:l}}return Yo.Fragment=t,Yo.jsx=r,Yo.jsxs=r,Yo}var u0;function QT(){return u0||(u0=1,Fh.exports=JT()),Fh.exports}var y=QT(),Kh={exports:{}},Oe={};/**
* @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 d0;function ZT(){if(d0)return Oe;d0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),w=Symbol.iterator;function _(k){return k===null||typeof k!="object"?null:(k=w&&k[w]||k["@@iterator"],typeof k=="function"?k:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,A={};function C(k,j,I){this.props=k,this.context=j,this.refs=A,this.updater=I||E}C.prototype.isReactComponent={},C.prototype.setState=function(k,j){if(typeof k!="object"&&typeof k!="function"&&k!=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,k,j,"setState")},C.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function R(){}R.prototype=C.prototype;function N(k,j,I){this.props=k,this.context=j,this.refs=A,this.updater=I||E}var P=N.prototype=new R;P.constructor=N,S(P,C.prototype),P.isPureReactComponent=!0;var F=Array.isArray;function $(){}var L={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function ie(k,j,I){var Y=I.ref;return{$$typeof:e,type:k,key:j,ref:Y!==void 0?Y:null,props:I}}function he(k,j){return ie(k.type,j,k.props)}function pe(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function oe(k){var j={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(I){return j[I]})}var ue=/\/+/g;function ce(k,j){return typeof k=="object"&&k!==null&&k.key!=null?oe(""+k.key):j.toString(36)}function fe(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then($,$):(k.status="pending",k.then(function(j){k.status==="pending"&&(k.status="fulfilled",k.value=j)},function(j){k.status==="pending"&&(k.status="rejected",k.reason=j)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function M(k,j,I,Y,V){var Z=typeof k;(Z==="undefined"||Z==="boolean")&&(k=null);var z=!1;if(k===null)z=!0;else switch(Z){case"bigint":case"string":case"number":z=!0;break;case"object":switch(k.$$typeof){case e:case t:z=!0;break;case b:return z=k._init,M(z(k._payload),j,I,Y,V)}}if(z)return V=V(k),z=Y===""?"."+ce(k,0):Y,F(V)?(I="",z!=null&&(I=z.replace(ue,"$&/")+"/"),M(V,j,I,"",function(xe){return xe})):V!=null&&(pe(V)&&(V=he(V,I+(V.key==null||k&&k.key===V.key?"":(""+V.key).replace(ue,"$&/")+"/")+z)),j.push(V)),1;z=0;var ee=Y===""?".":Y+":";if(F(k))for(var ae=0;ae<k.length;ae++)Y=k[ae],Z=ee+ce(Y,ae),z+=M(Y,j,I,Z,V);else if(ae=_(k),typeof ae=="function")for(k=ae.call(k),ae=0;!(Y=k.next()).done;)Y=Y.value,Z=ee+ce(Y,ae++),z+=M(Y,j,I,Z,V);else if(Z==="object"){if(typeof k.then=="function")return M(fe(k),j,I,Y,V);throw j=String(k),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return z}function K(k,j,I){if(k==null)return k;var Y=[],V=0;return M(k,Y,"","",function(Z){return j.call(I,Z,V++)}),Y}function J(k){if(k._status===-1){var j=k._result;j=j(),j.then(function(I){(k._status===0||k._status===-1)&&(k._status=1,k._result=I)},function(I){(k._status===0||k._status===-1)&&(k._status=2,k._result=I)}),k._status===-1&&(k._status=0,k._result=j)}if(k._status===1)return k._result.default;throw k._result}var ne=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var j=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(j))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},X={map:K,forEach:function(k,j,I){K(k,function(){j.apply(this,arguments)},I)},count:function(k){var j=0;return K(k,function(){j++}),j},toArray:function(k){return K(k,function(j){return j})||[]},only:function(k){if(!pe(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return Oe.Activity=g,Oe.Children=X,Oe.Component=C,Oe.Fragment=r,Oe.Profiler=o,Oe.PureComponent=N,Oe.StrictMode=s,Oe.Suspense=f,Oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Oe.__COMPILER_RUNTIME={__proto__:null,c:function(k){return L.H.useMemoCache(k)}},Oe.cache=function(k){return function(){return k.apply(null,arguments)}},Oe.cacheSignal=function(){return null},Oe.cloneElement=function(k,j,I){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var Y=S({},k.props),V=k.key;if(j!=null)for(Z in j.key!==void 0&&(V=""+j.key),j)!q.call(j,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&j.ref===void 0||(Y[Z]=j[Z]);var Z=arguments.length-2;if(Z===1)Y.children=I;else if(1<Z){for(var z=Array(Z),ee=0;ee<Z;ee++)z[ee]=arguments[ee+2];Y.children=z}return ie(k.type,V,Y)},Oe.createContext=function(k){return k={$$typeof:u,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:l,_context:k},k},Oe.createElement=function(k,j,I){var Y,V={},Z=null;if(j!=null)for(Y in j.key!==void 0&&(Z=""+j.key),j)q.call(j,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(V[Y]=j[Y]);var z=arguments.length-2;if(z===1)V.children=I;else if(1<z){for(var ee=Array(z),ae=0;ae<z;ae++)ee[ae]=arguments[ae+2];V.children=ee}if(k&&k.defaultProps)for(Y in z=k.defaultProps,z)V[Y]===void 0&&(V[Y]=z[Y]);return ie(k,Z,V)},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(k){return{$$typeof:d,render:k}},Oe.isValidElement=pe,Oe.lazy=function(k){return{$$typeof:b,_payload:{_status:-1,_result:k},_init:J}},Oe.memo=function(k,j){return{$$typeof:m,type:k,compare:j===void 0?null:j}},Oe.startTransition=function(k){var j=L.T,I={};L.T=I;try{var Y=k(),V=L.S;V!==null&&V(I,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then($,ne)}catch(Z){ne(Z)}finally{j!==null&&I.types!==null&&(j.types=I.types),L.T=j}},Oe.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Oe.use=function(k){return L.H.use(k)},Oe.useActionState=function(k,j,I){return L.H.useActionState(k,j,I)},Oe.useCallback=function(k,j){return L.H.useCallback(k,j)},Oe.useContext=function(k){return L.H.useContext(k)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(k,j){return L.H.useDeferredValue(k,j)},Oe.useEffect=function(k,j){return L.H.useEffect(k,j)},Oe.useEffectEvent=function(k){return L.H.useEffectEvent(k)},Oe.useId=function(){return L.H.useId()},Oe.useImperativeHandle=function(k,j,I){return L.H.useImperativeHandle(k,j,I)},Oe.useInsertionEffect=function(k,j){return L.H.useInsertionEffect(k,j)},Oe.useLayoutEffect=function(k,j){return L.H.useLayoutEffect(k,j)},Oe.useMemo=function(k,j){return L.H.useMemo(k,j)},Oe.useOptimistic=function(k,j){return L.H.useOptimistic(k,j)},Oe.useReducer=function(k,j,I){return L.H.useReducer(k,j,I)},Oe.useRef=function(k){return L.H.useRef(k)},Oe.useState=function(k){return L.H.useState(k)},Oe.useSyncExternalStore=function(k,j,I){return L.H.useSyncExternalStore(k,j,I)},Oe.useTransition=function(){return L.H.useTransition()},Oe.version="19.2.6",Oe}var f0;function od(){return f0||(f0=1,Kh.exports=ZT()),Kh.exports}var v=od();const le=fx(v),fp=XT({__proto__:null,default:le},[v]);var Yh={exports:{}},Wo={},Wh={exports:{}},Xh={};/**
* @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 h0;function eR(){return h0||(h0=1,(function(e){function t(M,K){var J=M.length;M.push(K);e:for(;0<J;){var ne=J-1>>>1,X=M[ne];if(0<o(X,K))M[ne]=K,M[J]=X,J=ne;else break e}}function r(M){return M.length===0?null:M[0]}function s(M){if(M.length===0)return null;var K=M[0],J=M.pop();if(J!==K){M[0]=J;e:for(var ne=0,X=M.length,k=X>>>1;ne<k;){var j=2*(ne+1)-1,I=M[j],Y=j+1,V=M[Y];if(0>o(I,J))Y<X&&0>o(V,I)?(M[ne]=V,M[Y]=J,ne=Y):(M[ne]=I,M[j]=J,ne=j);else if(Y<X&&0>o(V,J))M[ne]=V,M[Y]=J,ne=Y;else break e}}return K}function o(M,K){var J=M.sortIndex-K.sortIndex;return J!==0?J:M.id-K.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var f=[],m=[],b=1,g=null,w=3,_=!1,E=!1,S=!1,A=!1,C=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function P(M){for(var K=r(m);K!==null;){if(K.callback===null)s(m);else if(K.startTime<=M)s(m),K.sortIndex=K.expirationTime,t(f,K);else break;K=r(m)}}function F(M){if(S=!1,P(M),!E)if(r(f)!==null)E=!0,$||($=!0,oe());else{var K=r(m);K!==null&&fe(F,K.startTime-M)}}var $=!1,L=-1,q=5,ie=-1;function he(){return A?!0:!(e.unstable_now()-ie<q)}function pe(){if(A=!1,$){var M=e.unstable_now();ie=M;var K=!0;try{e:{E=!1,S&&(S=!1,R(L),L=-1),_=!0;var J=w;try{t:{for(P(M),g=r(f);g!==null&&!(g.expirationTime>M&&he());){var ne=g.callback;if(typeof ne=="function"){g.callback=null,w=g.priorityLevel;var X=ne(g.expirationTime<=M);if(M=e.unstable_now(),typeof X=="function"){g.callback=X,P(M),K=!0;break t}g===r(f)&&s(f),P(M)}else s(f);g=r(f)}if(g!==null)K=!0;else{var k=r(m);k!==null&&fe(F,k.startTime-M),K=!1}}break e}finally{g=null,w=J,_=!1}K=void 0}}finally{K?oe():$=!1}}}var oe;if(typeof N=="function")oe=function(){N(pe)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,ce=ue.port2;ue.port1.onmessage=pe,oe=function(){ce.postMessage(null)}}else oe=function(){C(pe,0)};function fe(M,K){L=C(function(){M(e.unstable_now())},K)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(M){switch(w){case 1:case 2:case 3:var K=3;break;default:K=w}var J=w;w=K;try{return M()}finally{w=J}},e.unstable_requestPaint=function(){A=!0},e.unstable_runWithPriority=function(M,K){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var J=w;w=M;try{return K()}finally{w=J}},e.unstable_scheduleCallback=function(M,K,J){var ne=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ne+J:ne):J=ne,M){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=J+X,M={id:b++,callback:K,priorityLevel:M,startTime:J,expirationTime:X,sortIndex:-1},J>ne?(M.sortIndex=J,t(m,M),r(f)===null&&M===r(m)&&(S?(R(L),L=-1):S=!0,fe(F,J-ne))):(M.sortIndex=X,t(f,M),E||_||(E=!0,$||($=!0,oe()))),M},e.unstable_shouldYield=he,e.unstable_wrapCallback=function(M){var K=w;return function(){var J=w;w=K;try{return M.apply(this,arguments)}finally{w=J}}}})(Xh)),Xh}var m0;function tR(){return m0||(m0=1,Wh.exports=eR()),Wh.exports}var Jh={exports:{}},Jt={};/**
* @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 p0;function nR(){if(p0)return Jt;p0=1;var e=od();function t(f){var m="https://react.dev/errors/"+f;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)m+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+f+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(f,m,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:f,containerInfo:m,implementation:b}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,m){if(f==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Jt.createPortal=function(f,m){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(f,m,null,b)},Jt.flushSync=function(f){var m=u.T,b=s.p;try{if(u.T=null,s.p=2,f)return f()}finally{u.T=m,s.p=b,s.d.f()}},Jt.preconnect=function(f,m){typeof f=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,s.d.C(f,m))},Jt.prefetchDNS=function(f){typeof f=="string"&&s.d.D(f)},Jt.preinit=function(f,m){if(typeof f=="string"&&m&&typeof m.as=="string"){var b=m.as,g=d(b,m.crossOrigin),w=typeof m.integrity=="string"?m.integrity:void 0,_=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;b==="style"?s.d.S(f,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:w,fetchPriority:_}):b==="script"&&s.d.X(f,{crossOrigin:g,integrity:w,fetchPriority:_,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Jt.preinitModule=function(f,m){if(typeof f=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var b=d(m.as,m.crossOrigin);s.d.M(f,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&s.d.M(f)},Jt.preload=function(f,m){if(typeof f=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var b=m.as,g=d(b,m.crossOrigin);s.d.L(f,b,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Jt.preloadModule=function(f,m){if(typeof f=="string")if(m){var b=d(m.as,m.crossOrigin);s.d.m(f,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(f)},Jt.requestFormReset=function(f){s.d.r(f)},Jt.unstable_batchedUpdates=function(f,m){return f(m)},Jt.useFormState=function(f,m,b){return u.H.useFormState(f,m,b)},Jt.useFormStatus=function(){return u.H.useHostTransitionStatus()},Jt.version="19.2.6",Jt}var g0;function hx(){if(g0)return Jh.exports;g0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Jh.exports=nR(),Jh.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 y0;function rR(){if(y0)return Wo;y0=1;var e=tR(),t=od(),r=hx();function s(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var a=n,i=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(i=a.return),n=a.return;while(n)}return a.tag===3?i:null}function u(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function d(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function f(n){if(l(n)!==n)throw Error(s(188))}function m(n){var a=n.alternate;if(!a){if(a=l(n),a===null)throw Error(s(188));return a!==n?null:n}for(var i=n,c=a;;){var h=i.return;if(h===null)break;var p=h.alternate;if(p===null){if(c=h.return,c!==null){i=c;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===i)return f(h),n;if(p===c)return f(h),a;p=p.sibling}throw Error(s(188))}if(i.return!==c.return)i=h,c=p;else{for(var x=!1,T=h.child;T;){if(T===i){x=!0,i=h,c=p;break}if(T===c){x=!0,c=h,i=p;break}T=T.sibling}if(!x){for(T=p.child;T;){if(T===i){x=!0,i=p,c=h;break}if(T===c){x=!0,c=p,i=h;break}T=T.sibling}if(!x)throw Error(s(189))}}if(i.alternate!==c)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?n:a}function b(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=b(n),a!==null)return a;n=n.sibling}return null}var g=Object.assign,w=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),N=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),he=Symbol.for("react.memo_cache_sentinel"),pe=Symbol.iterator;function oe(n){return n===null||typeof n!="object"?null:(n=pe&&n[pe]||n["@@iterator"],typeof n=="function"?n:null)}var ue=Symbol.for("react.client.reference");function ce(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ue?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case S:return"Fragment";case C:return"Profiler";case A:return"StrictMode";case F:return"Suspense";case $:return"SuspenseList";case ie:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case E:return"Portal";case N:return n.displayName||"Context";case R:return(n._context.displayName||"Context")+".Consumer";case P:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case L:return a=n.displayName||null,a!==null?a:ce(n.type)||"Memo";case q:a=n._payload,n=n._init;try{return ce(n(a))}catch{}}return null}var fe=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},ne=[],X=-1;function k(n){return{current:n}}function j(n){0>X||(n.current=ne[X],ne[X]=null,X--)}function I(n,a){X++,ne[X]=n.current,n.current=a}var Y=k(null),V=k(null),Z=k(null),z=k(null);function ee(n,a){switch(I(Z,a),I(V,n),I(Y,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?Ob(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=Ob(a),n=Mb(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}j(Y),I(Y,n)}function ae(){j(Y),j(V),j(Z)}function xe(n){n.memoizedState!==null&&I(z,n);var a=Y.current,i=Mb(a,n.type);a!==i&&(I(V,n),I(Y,i))}function Ee(n){V.current===n&&(j(Y),j(V)),z.current===n&&(j(z),Vo._currentValue=J)}var Te,nt;function Be(n){if(Te===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);Te=a&&a[1]||"",nt=-1<i.stack.indexOf(`
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Te+n+nt}var Kt=!1;function Yt(n,a){if(!n||Kt)return"";Kt=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(W){var G=W}Reflect.construct(n,[],re)}else{try{re.call()}catch(W){G=W}n.call(re.prototype)}}else{try{throw Error()}catch(W){G=W}(re=n())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(W){if(W&&G&&typeof W.stack=="string")return[W.stack,G.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=c.DetermineComponentFrameRoot(),x=p[0],T=p[1];if(x&&T){var O=x.split(`
`),H=T.split(`
`);for(h=c=0;c<O.length&&!O[c].includes("DetermineComponentFrameRoot");)c++;for(;h<H.length&&!H[h].includes("DetermineComponentFrameRoot");)h++;if(c===O.length||h===H.length)for(c=O.length-1,h=H.length-1;1<=c&&0<=h&&O[c]!==H[h];)h--;for(;1<=c&&0<=h;c--,h--)if(O[c]!==H[h]){if(c!==1||h!==1)do if(c--,h--,0>h||O[c]!==H[h]){var Q=`
`+O[c].replace(" at new "," at ");return n.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",n.displayName)),Q}while(1<=c&&0<=h);break}}}finally{Kt=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?Be(i):""}function Ot(n,a){switch(n.tag){case 26:case 27:case 5:return Be(n.type);case 16:return Be("Lazy");case 13:return n.child!==a&&a!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Yt(n.type,!1);case 11:return Yt(n.type.render,!1);case 1:return Yt(n.type,!0);case 31:return Be("Activity");default:return""}}function wn(n){try{var a="",i=null;do a+=Ot(n,i),i=n,n=n.return;while(n);return a}catch(c){return`
Error generating stack: `+c.message+`
`+c.stack}}var yt=Object.prototype.hasOwnProperty,cr=e.unstable_scheduleCallback,Pe=e.unstable_cancelCallback,ot=e.unstable_shouldYield,rt=e.unstable_requestPaint,ht=e.unstable_now,no=e.unstable_getCurrentPriorityLevel,Nr=e.unstable_ImmediatePriority,ur=e.unstable_UserBlockingPriority,dr=e.unstable_NormalPriority,kr=e.unstable_LowPriority,Fn=e.unstable_IdlePriority,Qa=e.log,Kn=e.unstable_setDisableYieldValue,fr=null,Ut=null;function xn(n){if(typeof Qa=="function"&&Kn(n),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(fr,n)}catch{}}var Mt=Math.clz32?Math.clz32:Ce,ro=Math.log,se=Math.LN2;function Ce(n){return n>>>=0,n===0?32:31-(ro(n)/se|0)|0}var Ge=256,Ye=262144,Wt=4194304;function nn(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function ke(n,a,i){var c=n.pendingLanes;if(c===0)return 0;var h=0,p=n.suspendedLanes,x=n.pingedLanes;n=n.warmLanes;var T=c&134217727;return T!==0?(c=T&~p,c!==0?h=nn(c):(x&=T,x!==0?h=nn(x):i||(i=T&~n,i!==0&&(h=nn(i))))):(T=c&~p,T!==0?h=nn(T):x!==0?h=nn(x):i||(i=c&~n,i!==0&&(h=nn(i)))),h===0?0:a!==0&&a!==h&&(a&p)===0&&(p=h&-h,i=a&-a,p>=i||p===32&&(i&4194048)!==0)?a:h}function dt(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Dt(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 Xt(){var n=Wt;return Wt<<=1,(Wt&62914560)===0&&(Wt=4194304),n}function ua(n){for(var a=[],i=0;31>i;i++)a.push(n);return a}function mt(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function rn(n,a,i,c,h,p){var x=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var T=n.entanglements,O=n.expirationTimes,H=n.hiddenUpdates;for(i=x&~i;0<i;){var Q=31-Mt(i),re=1<<Q;T[Q]=0,O[Q]=-1;var G=H[Q];if(G!==null)for(H[Q]=null,Q=0;Q<G.length;Q++){var W=G[Q];W!==null&&(W.lane&=-536870913)}i&=~re}c!==0&&Za(n,c,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(x&~a))}function Za(n,a,i){n.pendingLanes|=a,n.suspendedLanes&=~a;var c=31-Mt(a);n.entangledLanes|=a,n.entanglements[c]=n.entanglements[c]|1073741824|i&261930}function an(n,a){var i=n.entangledLanes|=a;for(n=n.entanglements;i;){var c=31-Mt(i),h=1<<c;h&a|n[c]&a&&(n[c]|=a),i&=~h}}function sn(n,a){var i=a&-a;return i=(i&42)!==0?1:zs(i),(i&(n.suspendedLanes|a))!==0?0:i}function zs(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Yn(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Ld(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:n0(n.type))}function vg(n,a){var i=K.p;try{return K.p=n,a()}finally{K.p=i}}var da=Math.random().toString(36).slice(2),It="__reactFiber$"+da,on="__reactProps$"+da,Us="__reactContainer$"+da,Pd="__reactEvents$"+da,IC="__reactListeners$"+da,$C="__reactHandles$"+da,bg="__reactResources$"+da,ao="__reactMarker$"+da;function zd(n){delete n[It],delete n[on],delete n[Pd],delete n[IC],delete n[$C]}function Is(n){var a=n[It];if(a)return a;for(var i=n.parentNode;i;){if(a=i[Us]||i[It]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(n=$b(n);n!==null;){if(i=n[It])return i;n=$b(n)}return a}n=i,i=n.parentNode}return null}function $s(n){if(n=n[It]||n[Us]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function so(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(s(33))}function Bs(n){var a=n[bg];return a||(a=n[bg]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Lt(n){n[ao]=!0}var wg=new Set,xg={};function es(n,a){Hs(n,a),Hs(n+"Capture",a)}function Hs(n,a){for(xg[n]=a,n=0;n<a.length;n++)wg.add(a[n])}var BC=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]*$"),_g={},Sg={};function HC(n){return yt.call(Sg,n)?!0:yt.call(_g,n)?!1:BC.test(n)?Sg[n]=!0:(_g[n]=!0,!1)}function ql(n,a,i){if(HC(a))if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var c=a.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+i)}}function Vl(n,a,i){if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+i)}}function jr(n,a,i,c){if(c===null)n.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(a,i,""+c)}}function Mn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Eg(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function qC(n,a,i){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var h=c.get,p=c.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return h.call(this)},set:function(x){i=""+x,p.call(this,x)}}),Object.defineProperty(n,a,{enumerable:c.enumerable}),{getValue:function(){return i},setValue:function(x){i=""+x},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function Ud(n){if(!n._valueTracker){var a=Eg(n)?"checked":"value";n._valueTracker=qC(n,a,""+n[a])}}function Cg(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var i=a.getValue(),c="";return n&&(c=Eg(n)?n.checked?"true":"false":n.value),n=c,n!==i?(a.setValue(n),!0):!1}function Gl(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var VC=/[\n"\\]/g;function Dn(n){return n.replace(VC,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Id(n,a,i,c,h,p,x,T){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),a!=null?x==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Mn(a)):n.value!==""+Mn(a)&&(n.value=""+Mn(a)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),a!=null?$d(n,x,Mn(a)):i!=null?$d(n,x,Mn(i)):c!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?n.name=""+Mn(T):n.removeAttribute("name")}function Ag(n,a,i,c,h,p,x,T){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),a!=null||i!=null){if(!(p!=="submit"&&p!=="reset"||a!=null)){Ud(n);return}i=i!=null?""+Mn(i):"",a=a!=null?""+Mn(a):i,T||a===n.value||(n.value=a),n.defaultValue=a}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=T?n.checked:!!c,n.defaultChecked=!!c,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),Ud(n)}function $d(n,a,i){a==="number"&&Gl(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function qs(n,a,i,c){if(n=n.options,a){a={};for(var h=0;h<i.length;h++)a["$"+i[h]]=!0;for(i=0;i<n.length;i++)h=a.hasOwnProperty("$"+n[i].value),n[i].selected!==h&&(n[i].selected=h),h&&c&&(n[i].defaultSelected=!0)}else{for(i=""+Mn(i),a=null,h=0;h<n.length;h++){if(n[h].value===i){n[h].selected=!0,c&&(n[h].defaultSelected=!0);return}a!==null||n[h].disabled||(a=n[h])}a!==null&&(a.selected=!0)}}function Tg(n,a,i){if(a!=null&&(a=""+Mn(a),a!==n.value&&(n.value=a),i==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=i!=null?""+Mn(i):""}function Rg(n,a,i,c){if(a==null){if(c!=null){if(i!=null)throw Error(s(92));if(fe(c)){if(1<c.length)throw Error(s(93));c=c[0]}i=c}i==null&&(i=""),a=i}i=Mn(a),n.defaultValue=i,c=n.textContent,c===i&&c!==""&&c!==null&&(n.value=c),Ud(n)}function Vs(n,a){if(a){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=a;return}}n.textContent=a}var GC=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 Ng(n,a,i){var c=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?c?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":c?n.setProperty(a,i):typeof i!="number"||i===0||GC.has(a)?a==="float"?n.cssFloat=i:n[a]=(""+i).trim():n[a]=i+"px"}function kg(n,a,i){if(a!=null&&typeof a!="object")throw Error(s(62));if(n=n.style,i!=null){for(var c in i)!i.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var h in a)c=a[h],a.hasOwnProperty(h)&&i[h]!==c&&Ng(n,h,c)}else for(var p in a)a.hasOwnProperty(p)&&Ng(n,p,a[p])}function Bd(n){if(n.indexOf("-")===-1)return!1;switch(n){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 FC=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"]]),KC=/^[\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 Fl(n){return KC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Or(){}var Hd=null;function qd(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Gs=null,Fs=null;function jg(n){var a=$s(n);if(a&&(n=a.stateNode)){var i=n[on]||null;e:switch(n=a.stateNode,a.type){case"input":if(Id(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Dn(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var c=i[a];if(c!==n&&c.form===n.form){var h=c[on]||null;if(!h)throw Error(s(90));Id(c,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(a=0;a<i.length;a++)c=i[a],c.form===n.form&&Cg(c)}break e;case"textarea":Tg(n,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&qs(n,!!i.multiple,a,!1)}}}var Vd=!1;function Og(n,a,i){if(Vd)return n(a,i);Vd=!0;try{var c=n(a);return c}finally{if(Vd=!1,(Gs!==null||Fs!==null)&&(Mc(),Gs&&(a=Gs,n=Fs,Fs=Gs=null,jg(a),n)))for(a=0;a<n.length;a++)jg(n[a])}}function io(n,a){var i=n.stateNode;if(i===null)return null;var c=i[on]||null;if(c===null)return null;i=c[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(s(231,a,typeof i));return i}var Mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gd=!1;if(Mr)try{var oo={};Object.defineProperty(oo,"passive",{get:function(){Gd=!0}}),window.addEventListener("test",oo,oo),window.removeEventListener("test",oo,oo)}catch{Gd=!1}var fa=null,Fd=null,Kl=null;function Mg(){if(Kl)return Kl;var n,a=Fd,i=a.length,c,h="value"in fa?fa.value:fa.textContent,p=h.length;for(n=0;n<i&&a[n]===h[n];n++);var x=i-n;for(c=1;c<=x&&a[i-c]===h[p-c];c++);return Kl=h.slice(n,1<c?1-c:void 0)}function Yl(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Wl(){return!0}function Dg(){return!1}function ln(n){function a(i,c,h,p,x){this._reactName=i,this._targetInst=h,this.type=c,this.nativeEvent=p,this.target=x,this.currentTarget=null;for(var T in n)n.hasOwnProperty(T)&&(i=n[T],this[T]=i?i(p):p[T]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Wl:Dg,this.isPropagationStopped=Dg,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Wl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Wl)},persist:function(){},isPersistent:Wl}),a}var ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xl=ln(ts),lo=g({},ts,{view:0,detail:0}),YC=ln(lo),Kd,Yd,co,Jl=g({},lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xd,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==co&&(co&&n.type==="mousemove"?(Kd=n.screenX-co.screenX,Yd=n.screenY-co.screenY):Yd=Kd=0,co=n),Kd)},movementY:function(n){return"movementY"in n?n.movementY:Yd}}),Lg=ln(Jl),WC=g({},Jl,{dataTransfer:0}),XC=ln(WC),JC=g({},lo,{relatedTarget:0}),Wd=ln(JC),QC=g({},ts,{animationName:0,elapsedTime:0,pseudoElement:0}),ZC=ln(QC),eA=g({},ts,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),tA=ln(eA),nA=g({},ts,{data:0}),Pg=ln(nA),rA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aA={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"},sA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iA(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=sA[n])?!!a[n]:!1}function Xd(){return iA}var oA=g({},lo,{key:function(n){if(n.key){var a=rA[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=Yl(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?aA[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xd,charCode:function(n){return n.type==="keypress"?Yl(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Yl(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),lA=ln(oA),cA=g({},Jl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zg=ln(cA),uA=g({},lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xd}),dA=ln(uA),fA=g({},ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),hA=ln(fA),mA=g({},Jl,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),pA=ln(mA),gA=g({},ts,{newState:0,oldState:0}),yA=ln(gA),vA=[9,13,27,32],Jd=Mr&&"CompositionEvent"in window,uo=null;Mr&&"documentMode"in document&&(uo=document.documentMode);var bA=Mr&&"TextEvent"in window&&!uo,Ug=Mr&&(!Jd||uo&&8<uo&&11>=uo),Ig=" ",$g=!1;function Bg(n,a){switch(n){case"keyup":return vA.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ks=!1;function wA(n,a){switch(n){case"compositionend":return Hg(a);case"keypress":return a.which!==32?null:($g=!0,Ig);case"textInput":return n=a.data,n===Ig&&$g?null:n;default:return null}}function xA(n,a){if(Ks)return n==="compositionend"||!Jd&&Bg(n,a)?(n=Mg(),Kl=Fd=fa=null,Ks=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Ug&&a.locale!=="ko"?null:a.data;default:return null}}var _A={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 qg(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!_A[n.type]:a==="textarea"}function Vg(n,a,i,c){Gs?Fs?Fs.push(c):Fs=[c]:Gs=c,a=$c(a,"onChange"),0<a.length&&(i=new Xl("onChange","change",null,i,c),n.push({event:i,listeners:a}))}var fo=null,ho=null;function SA(n){Ab(n,0)}function Ql(n){var a=so(n);if(Cg(a))return n}function Gg(n,a){if(n==="change")return a}var Fg=!1;if(Mr){var Qd;if(Mr){var Zd="oninput"in document;if(!Zd){var Kg=document.createElement("div");Kg.setAttribute("oninput","return;"),Zd=typeof Kg.oninput=="function"}Qd=Zd}else Qd=!1;Fg=Qd&&(!document.documentMode||9<document.documentMode)}function Yg(){fo&&(fo.detachEvent("onpropertychange",Wg),ho=fo=null)}function Wg(n){if(n.propertyName==="value"&&Ql(ho)){var a=[];Vg(a,ho,n,qd(n)),Og(SA,a)}}function EA(n,a,i){n==="focusin"?(Yg(),fo=a,ho=i,fo.attachEvent("onpropertychange",Wg)):n==="focusout"&&Yg()}function CA(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Ql(ho)}function AA(n,a){if(n==="click")return Ql(a)}function TA(n,a){if(n==="input"||n==="change")return Ql(a)}function RA(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var _n=typeof Object.is=="function"?Object.is:RA;function mo(n,a){if(_n(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var i=Object.keys(n),c=Object.keys(a);if(i.length!==c.length)return!1;for(c=0;c<i.length;c++){var h=i[c];if(!yt.call(a,h)||!_n(n[h],a[h]))return!1}return!0}function Xg(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Jg(n,a){var i=Xg(n);n=0;for(var c;i;){if(i.nodeType===3){if(c=n+i.textContent.length,n<=a&&c>=a)return{node:i,offset:a-n};n=c}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Xg(i)}}function Qg(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Qg(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Zg(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=Gl(n.document);a instanceof n.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)n=a.contentWindow;else break;a=Gl(n.document)}return a}function ef(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var NA=Mr&&"documentMode"in document&&11>=document.documentMode,Ys=null,tf=null,po=null,nf=!1;function ey(n,a,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;nf||Ys==null||Ys!==Gl(c)||(c=Ys,"selectionStart"in c&&ef(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),po&&mo(po,c)||(po=c,c=$c(tf,"onSelect"),0<c.length&&(a=new Xl("onSelect","select",null,a,i),n.push({event:a,listeners:c}),a.target=Ys)))}function ns(n,a){var i={};return i[n.toLowerCase()]=a.toLowerCase(),i["Webkit"+n]="webkit"+a,i["Moz"+n]="moz"+a,i}var Ws={animationend:ns("Animation","AnimationEnd"),animationiteration:ns("Animation","AnimationIteration"),animationstart:ns("Animation","AnimationStart"),transitionrun:ns("Transition","TransitionRun"),transitionstart:ns("Transition","TransitionStart"),transitioncancel:ns("Transition","TransitionCancel"),transitionend:ns("Transition","TransitionEnd")},rf={},ty={};Mr&&(ty=document.createElement("div").style,"AnimationEvent"in window||(delete Ws.animationend.animation,delete Ws.animationiteration.animation,delete Ws.animationstart.animation),"TransitionEvent"in window||delete Ws.transitionend.transition);function rs(n){if(rf[n])return rf[n];if(!Ws[n])return n;var a=Ws[n],i;for(i in a)if(a.hasOwnProperty(i)&&i in ty)return rf[n]=a[i];return n}var ny=rs("animationend"),ry=rs("animationiteration"),ay=rs("animationstart"),kA=rs("transitionrun"),jA=rs("transitionstart"),OA=rs("transitioncancel"),sy=rs("transitionend"),iy=new Map,af="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(" ");af.push("scrollEnd");function Wn(n,a){iy.set(n,a),es(a,[n])}var Zl=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Ln=[],Xs=0,sf=0;function ec(){for(var n=Xs,a=sf=Xs=0;a<n;){var i=Ln[a];Ln[a++]=null;var c=Ln[a];Ln[a++]=null;var h=Ln[a];Ln[a++]=null;var p=Ln[a];if(Ln[a++]=null,c!==null&&h!==null){var x=c.pending;x===null?h.next=h:(h.next=x.next,x.next=h),c.pending=h}p!==0&&oy(i,h,p)}}function tc(n,a,i,c){Ln[Xs++]=n,Ln[Xs++]=a,Ln[Xs++]=i,Ln[Xs++]=c,sf|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function of(n,a,i,c){return tc(n,a,i,c),nc(n)}function as(n,a){return tc(n,null,null,a),nc(n)}function oy(n,a,i){n.lanes|=i;var c=n.alternate;c!==null&&(c.lanes|=i);for(var h=!1,p=n.return;p!==null;)p.childLanes|=i,c=p.alternate,c!==null&&(c.childLanes|=i),p.tag===22&&(n=p.stateNode,n===null||n._visibility&1||(h=!0)),n=p,p=p.return;return n.tag===3?(p=n.stateNode,h&&a!==null&&(h=31-Mt(i),n=p.hiddenUpdates,c=n[h],c===null?n[h]=[a]:c.push(a),a.lane=i|536870912),p):null}function nc(n){if(50<zo)throw zo=0,gh=null,Error(s(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var Js={};function MA(n,a,i,c){this.tag=n,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sn(n,a,i,c){return new MA(n,a,i,c)}function lf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Dr(n,a){var i=n.alternate;return i===null?(i=Sn(n.tag,a,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=a,i.type=n.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=n.flags&65011712,i.childLanes=n.childLanes,i.lanes=n.lanes,i.child=n.child,i.memoizedProps=n.memoizedProps,i.memoizedState=n.memoizedState,i.updateQueue=n.updateQueue,a=n.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function ly(n,a){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=i.childLanes,n.lanes=i.lanes,n.child=i.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=i.memoizedProps,n.memoizedState=i.memoizedState,n.updateQueue=i.updateQueue,n.type=i.type,a=i.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function rc(n,a,i,c,h,p){var x=0;if(c=n,typeof n=="function")lf(n)&&(x=1);else if(typeof n=="string")x=UT(n,i,Y.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case ie:return n=Sn(31,i,a,h),n.elementType=ie,n.lanes=p,n;case S:return ss(i.children,h,p,a);case A:x=8,h|=24;break;case C:return n=Sn(12,i,a,h|2),n.elementType=C,n.lanes=p,n;case F:return n=Sn(13,i,a,h),n.elementType=F,n.lanes=p,n;case $:return n=Sn(19,i,a,h),n.elementType=$,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:x=10;break e;case R:x=9;break e;case P:x=11;break e;case L:x=14;break e;case q:x=16,c=null;break e}x=29,i=Error(s(130,n===null?"null":typeof n,"")),c=null}return a=Sn(x,i,a,h),a.elementType=n,a.type=c,a.lanes=p,a}function ss(n,a,i,c){return n=Sn(7,n,c,a),n.lanes=i,n}function cf(n,a,i){return n=Sn(6,n,null,a),n.lanes=i,n}function cy(n){var a=Sn(18,null,null,0);return a.stateNode=n,a}function uf(n,a,i){return a=Sn(4,n.children!==null?n.children:[],n.key,a),a.lanes=i,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var uy=new WeakMap;function Pn(n,a){if(typeof n=="object"&&n!==null){var i=uy.get(n);return i!==void 0?i:(a={value:n,source:a,stack:wn(a)},uy.set(n,a),a)}return{value:n,source:a,stack:wn(a)}}var Qs=[],Zs=0,ac=null,go=0,zn=[],Un=0,ha=null,hr=1,mr="";function Lr(n,a){Qs[Zs++]=go,Qs[Zs++]=ac,ac=n,go=a}function dy(n,a,i){zn[Un++]=hr,zn[Un++]=mr,zn[Un++]=ha,ha=n;var c=hr;n=mr;var h=32-Mt(c)-1;c&=~(1<<h),i+=1;var p=32-Mt(a)+h;if(30<p){var x=h-h%5;p=(c&(1<<x)-1).toString(32),c>>=x,h-=x,hr=1<<32-Mt(a)+h|i<<h|c,mr=p+n}else hr=1<<p|i<<h|c,mr=n}function df(n){n.return!==null&&(Lr(n,1),dy(n,1,0))}function ff(n){for(;n===ac;)ac=Qs[--Zs],Qs[Zs]=null,go=Qs[--Zs],Qs[Zs]=null;for(;n===ha;)ha=zn[--Un],zn[Un]=null,mr=zn[--Un],zn[Un]=null,hr=zn[--Un],zn[Un]=null}function fy(n,a){zn[Un++]=hr,zn[Un++]=mr,zn[Un++]=ha,hr=a.id,mr=a.overflow,ha=n}var $t=null,lt=null,He=!1,ma=null,In=!1,hf=Error(s(519));function pa(n){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yo(Pn(a,n)),hf}function hy(n){var a=n.stateNode,i=n.type,c=n.memoizedProps;switch(a[It]=n,a[on]=c,i){case"dialog":Ue("cancel",a),Ue("close",a);break;case"iframe":case"object":case"embed":Ue("load",a);break;case"video":case"audio":for(i=0;i<Io.length;i++)Ue(Io[i],a);break;case"source":Ue("error",a);break;case"img":case"image":case"link":Ue("error",a),Ue("load",a);break;case"details":Ue("toggle",a);break;case"input":Ue("invalid",a),Ag(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Ue("invalid",a);break;case"textarea":Ue("invalid",a),Rg(a,c.value,c.defaultValue,c.children)}i=c.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||c.suppressHydrationWarning===!0||kb(a.textContent,i)?(c.popover!=null&&(Ue("beforetoggle",a),Ue("toggle",a)),c.onScroll!=null&&Ue("scroll",a),c.onScrollEnd!=null&&Ue("scrollend",a),c.onClick!=null&&(a.onclick=Or),a=!0):a=!1,a||pa(n,!0)}function my(n){for($t=n.return;$t;)switch($t.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:$t=$t.return}}function ei(n){if(n!==$t)return!1;if(!He)return my(n),He=!0,!1;var a=n.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||jh(n.type,n.memoizedProps)),i=!i),i&&lt&&pa(n),my(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));lt=Ib(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));lt=Ib(n)}else a===27?(a=lt,Na(n.type)?(n=Ph,Ph=null,lt=n):lt=a):lt=$t?Bn(n.stateNode.nextSibling):null;return!0}function is(){lt=$t=null,He=!1}function mf(){var n=ma;return n!==null&&(fn===null?fn=n:fn.push.apply(fn,n),ma=null),n}function yo(n){ma===null?ma=[n]:ma.push(n)}var pf=k(null),os=null,Pr=null;function ga(n,a,i){I(pf,a._currentValue),a._currentValue=i}function zr(n){n._currentValue=pf.current,j(pf)}function gf(n,a,i){for(;n!==null;){var c=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,c!==null&&(c.childLanes|=a)):c!==null&&(c.childLanes&a)!==a&&(c.childLanes|=a),n===i)break;n=n.return}}function yf(n,a,i,c){var h=n.child;for(h!==null&&(h.return=n);h!==null;){var p=h.dependencies;if(p!==null){var x=h.child;p=p.firstContext;e:for(;p!==null;){var T=p;p=h;for(var O=0;O<a.length;O++)if(T.context===a[O]){p.lanes|=i,T=p.alternate,T!==null&&(T.lanes|=i),gf(p.return,i,n),c||(x=null);break e}p=T.next}}else if(h.tag===18){if(x=h.return,x===null)throw Error(s(341));x.lanes|=i,p=x.alternate,p!==null&&(p.lanes|=i),gf(x,i,n),x=null}else x=h.child;if(x!==null)x.return=h;else for(x=h;x!==null;){if(x===n){x=null;break}if(h=x.sibling,h!==null){h.return=x.return,x=h;break}x=x.return}h=x}}function ti(n,a,i,c){n=null;for(var h=a,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var x=h.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var T=h.type;_n(h.pendingProps.value,x.value)||(n!==null?n.push(T):n=[T])}}else if(h===z.current){if(x=h.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(Vo):n=[Vo])}h=h.return}n!==null&&yf(a,n,i,c),a.flags|=262144}function sc(n){for(n=n.firstContext;n!==null;){if(!_n(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ls(n){os=n,Pr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Bt(n){return py(os,n)}function ic(n,a){return os===null&&ls(n),py(n,a)}function py(n,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},Pr===null){if(n===null)throw Error(s(308));Pr=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Pr=Pr.next=a;return i}var DA=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(i,c){n.push(c)}};this.abort=function(){a.aborted=!0,n.forEach(function(i){return i()})}},LA=e.unstable_scheduleCallback,PA=e.unstable_NormalPriority,Et={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vf(){return{controller:new DA,data:new Map,refCount:0}}function vo(n){n.refCount--,n.refCount===0&&LA(PA,function(){n.controller.abort()})}var bo=null,bf=0,ni=0,ri=null;function zA(n,a){if(bo===null){var i=bo=[];bf=0,ni=_h(),ri={status:"pending",value:void 0,then:function(c){i.push(c)}}}return bf++,a.then(gy,gy),a}function gy(){if(--bf===0&&bo!==null){ri!==null&&(ri.status="fulfilled");var n=bo;bo=null,ni=0,ri=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function UA(n,a){var i=[],c={status:"pending",value:null,reason:null,then:function(h){i.push(h)}};return n.then(function(){c.status="fulfilled",c.value=a;for(var h=0;h<i.length;h++)(0,i[h])(a)},function(h){for(c.status="rejected",c.reason=h,h=0;h<i.length;h++)(0,i[h])(void 0)}),c}var yy=M.S;M.S=function(n,a){eb=ht(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&zA(n,a),yy!==null&&yy(n,a)};var cs=k(null);function wf(){var n=cs.current;return n!==null?n:at.pooledCache}function oc(n,a){a===null?I(cs,cs.current):I(cs,a.pool)}function vy(){var n=wf();return n===null?null:{parent:Et._currentValue,pool:n}}var ai=Error(s(460)),xf=Error(s(474)),lc=Error(s(542)),cc={then:function(){}};function by(n){return n=n.status,n==="fulfilled"||n==="rejected"}function wy(n,a,i){switch(i=n[i],i===void 0?n.push(a):i!==a&&(a.then(Or,Or),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,_y(n),n;default:if(typeof a.status=="string")a.then(Or,Or);else{if(n=at,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=a,n.status="pending",n.then(function(c){if(a.status==="pending"){var h=a;h.status="fulfilled",h.value=c}},function(c){if(a.status==="pending"){var h=a;h.status="rejected",h.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,_y(n),n}throw ds=a,ai}}function us(n){try{var a=n._init;return a(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(ds=i,ai):i}}var ds=null;function xy(){if(ds===null)throw Error(s(459));var n=ds;return ds=null,n}function _y(n){if(n===ai||n===lc)throw Error(s(483))}var si=null,wo=0;function uc(n){var a=wo;return wo+=1,si===null&&(si=[]),wy(si,n,a)}function xo(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function dc(n,a){throw a.$$typeof===w?Error(s(525)):(n=Object.prototype.toString.call(a),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function Sy(n){function a(U,D){if(n){var B=U.deletions;B===null?(U.deletions=[D],U.flags|=16):B.push(D)}}function i(U,D){if(!n)return null;for(;D!==null;)a(U,D),D=D.sibling;return null}function c(U){for(var D=new Map;U!==null;)U.key!==null?D.set(U.key,U):D.set(U.index,U),U=U.sibling;return D}function h(U,D){return U=Dr(U,D),U.index=0,U.sibling=null,U}function p(U,D,B){return U.index=B,n?(B=U.alternate,B!==null?(B=B.index,B<D?(U.flags|=67108866,D):B):(U.flags|=67108866,D)):(U.flags|=1048576,D)}function x(U){return n&&U.alternate===null&&(U.flags|=67108866),U}function T(U,D,B,te){return D===null||D.tag!==6?(D=cf(B,U.mode,te),D.return=U,D):(D=h(D,B),D.return=U,D)}function O(U,D,B,te){var Se=B.type;return Se===S?Q(U,D,B.props.children,te,B.key):D!==null&&(D.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===q&&us(Se)===D.type)?(D=h(D,B.props),xo(D,B),D.return=U,D):(D=rc(B.type,B.key,B.props,null,U.mode,te),xo(D,B),D.return=U,D)}function H(U,D,B,te){return D===null||D.tag!==4||D.stateNode.containerInfo!==B.containerInfo||D.stateNode.implementation!==B.implementation?(D=uf(B,U.mode,te),D.return=U,D):(D=h(D,B.children||[]),D.return=U,D)}function Q(U,D,B,te,Se){return D===null||D.tag!==7?(D=ss(B,U.mode,te,Se),D.return=U,D):(D=h(D,B),D.return=U,D)}function re(U,D,B){if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return D=cf(""+D,U.mode,B),D.return=U,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case _:return B=rc(D.type,D.key,D.props,null,U.mode,B),xo(B,D),B.return=U,B;case E:return D=uf(D,U.mode,B),D.return=U,D;case q:return D=us(D),re(U,D,B)}if(fe(D)||oe(D))return D=ss(D,U.mode,B,null),D.return=U,D;if(typeof D.then=="function")return re(U,uc(D),B);if(D.$$typeof===N)return re(U,ic(U,D),B);dc(U,D)}return null}function G(U,D,B,te){var Se=D!==null?D.key:null;if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return Se!==null?null:T(U,D,""+B,te);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case _:return B.key===Se?O(U,D,B,te):null;case E:return B.key===Se?H(U,D,B,te):null;case q:return B=us(B),G(U,D,B,te)}if(fe(B)||oe(B))return Se!==null?null:Q(U,D,B,te,null);if(typeof B.then=="function")return G(U,D,uc(B),te);if(B.$$typeof===N)return G(U,D,ic(U,B),te);dc(U,B)}return null}function W(U,D,B,te,Se){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return U=U.get(B)||null,T(D,U,""+te,Se);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case _:return U=U.get(te.key===null?B:te.key)||null,O(D,U,te,Se);case E:return U=U.get(te.key===null?B:te.key)||null,H(D,U,te,Se);case q:return te=us(te),W(U,D,B,te,Se)}if(fe(te)||oe(te))return U=U.get(B)||null,Q(D,U,te,Se,null);if(typeof te.then=="function")return W(U,D,B,uc(te),Se);if(te.$$typeof===N)return W(U,D,B,ic(D,te),Se);dc(D,te)}return null}function ve(U,D,B,te){for(var Se=null,Fe=null,_e=D,De=D=0,$e=null;_e!==null&&De<B.length;De++){_e.index>De?($e=_e,_e=null):$e=_e.sibling;var Ke=G(U,_e,B[De],te);if(Ke===null){_e===null&&(_e=$e);break}n&&_e&&Ke.alternate===null&&a(U,_e),D=p(Ke,D,De),Fe===null?Se=Ke:Fe.sibling=Ke,Fe=Ke,_e=$e}if(De===B.length)return i(U,_e),He&&Lr(U,De),Se;if(_e===null){for(;De<B.length;De++)_e=re(U,B[De],te),_e!==null&&(D=p(_e,D,De),Fe===null?Se=_e:Fe.sibling=_e,Fe=_e);return He&&Lr(U,De),Se}for(_e=c(_e);De<B.length;De++)$e=W(_e,U,De,B[De],te),$e!==null&&(n&&$e.alternate!==null&&_e.delete($e.key===null?De:$e.key),D=p($e,D,De),Fe===null?Se=$e:Fe.sibling=$e,Fe=$e);return n&&_e.forEach(function(Da){return a(U,Da)}),He&&Lr(U,De),Se}function Re(U,D,B,te){if(B==null)throw Error(s(151));for(var Se=null,Fe=null,_e=D,De=D=0,$e=null,Ke=B.next();_e!==null&&!Ke.done;De++,Ke=B.next()){_e.index>De?($e=_e,_e=null):$e=_e.sibling;var Da=G(U,_e,Ke.value,te);if(Da===null){_e===null&&(_e=$e);break}n&&_e&&Da.alternate===null&&a(U,_e),D=p(Da,D,De),Fe===null?Se=Da:Fe.sibling=Da,Fe=Da,_e=$e}if(Ke.done)return i(U,_e),He&&Lr(U,De),Se;if(_e===null){for(;!Ke.done;De++,Ke=B.next())Ke=re(U,Ke.value,te),Ke!==null&&(D=p(Ke,D,De),Fe===null?Se=Ke:Fe.sibling=Ke,Fe=Ke);return He&&Lr(U,De),Se}for(_e=c(_e);!Ke.done;De++,Ke=B.next())Ke=W(_e,U,De,Ke.value,te),Ke!==null&&(n&&Ke.alternate!==null&&_e.delete(Ke.key===null?De:Ke.key),D=p(Ke,D,De),Fe===null?Se=Ke:Fe.sibling=Ke,Fe=Ke);return n&&_e.forEach(function(WT){return a(U,WT)}),He&&Lr(U,De),Se}function tt(U,D,B,te){if(typeof B=="object"&&B!==null&&B.type===S&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case _:e:{for(var Se=B.key;D!==null;){if(D.key===Se){if(Se=B.type,Se===S){if(D.tag===7){i(U,D.sibling),te=h(D,B.props.children),te.return=U,U=te;break e}}else if(D.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===q&&us(Se)===D.type){i(U,D.sibling),te=h(D,B.props),xo(te,B),te.return=U,U=te;break e}i(U,D);break}else a(U,D);D=D.sibling}B.type===S?(te=ss(B.props.children,U.mode,te,B.key),te.return=U,U=te):(te=rc(B.type,B.key,B.props,null,U.mode,te),xo(te,B),te.return=U,U=te)}return x(U);case E:e:{for(Se=B.key;D!==null;){if(D.key===Se)if(D.tag===4&&D.stateNode.containerInfo===B.containerInfo&&D.stateNode.implementation===B.implementation){i(U,D.sibling),te=h(D,B.children||[]),te.return=U,U=te;break e}else{i(U,D);break}else a(U,D);D=D.sibling}te=uf(B,U.mode,te),te.return=U,U=te}return x(U);case q:return B=us(B),tt(U,D,B,te)}if(fe(B))return ve(U,D,B,te);if(oe(B)){if(Se=oe(B),typeof Se!="function")throw Error(s(150));return B=Se.call(B),Re(U,D,B,te)}if(typeof B.then=="function")return tt(U,D,uc(B),te);if(B.$$typeof===N)return tt(U,D,ic(U,B),te);dc(U,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,D!==null&&D.tag===6?(i(U,D.sibling),te=h(D,B),te.return=U,U=te):(i(U,D),te=cf(B,U.mode,te),te.return=U,U=te),x(U)):i(U,D)}return function(U,D,B,te){try{wo=0;var Se=tt(U,D,B,te);return si=null,Se}catch(_e){if(_e===ai||_e===lc)throw _e;var Fe=Sn(29,_e,null,U.mode);return Fe.lanes=te,Fe.return=U,Fe}finally{}}}var fs=Sy(!0),Ey=Sy(!1),ya=!1;function _f(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sf(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function va(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ba(n,a,i){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(We&2)!==0){var h=c.pending;return h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a,a=nc(n),oy(n,null,i),a}return tc(n,c,a,i),nc(n)}function _o(n,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,i|=c,a.lanes=i,an(n,i)}}function Ef(n,a){var i=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,i===c)){var h=null,p=null;if(i=i.firstBaseUpdate,i!==null){do{var x={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};p===null?h=p=x:p=p.next=x,i=i.next}while(i!==null);p===null?h=p=a:p=p.next=a}else h=p=a;i={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:c.shared,callbacks:c.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=a:n.next=a,i.lastBaseUpdate=a}var Cf=!1;function So(){if(Cf){var n=ri;if(n!==null)throw n}}function Eo(n,a,i,c){Cf=!1;var h=n.updateQueue;ya=!1;var p=h.firstBaseUpdate,x=h.lastBaseUpdate,T=h.shared.pending;if(T!==null){h.shared.pending=null;var O=T,H=O.next;O.next=null,x===null?p=H:x.next=H,x=O;var Q=n.alternate;Q!==null&&(Q=Q.updateQueue,T=Q.lastBaseUpdate,T!==x&&(T===null?Q.firstBaseUpdate=H:T.next=H,Q.lastBaseUpdate=O))}if(p!==null){var re=h.baseState;x=0,Q=H=O=null,T=p;do{var G=T.lane&-536870913,W=G!==T.lane;if(W?(Ie&G)===G:(c&G)===G){G!==0&&G===ni&&(Cf=!0),Q!==null&&(Q=Q.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var ve=n,Re=T;G=a;var tt=i;switch(Re.tag){case 1:if(ve=Re.payload,typeof ve=="function"){re=ve.call(tt,re,G);break e}re=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Re.payload,G=typeof ve=="function"?ve.call(tt,re,G):ve,G==null)break e;re=g({},re,G);break e;case 2:ya=!0}}G=T.callback,G!==null&&(n.flags|=64,W&&(n.flags|=8192),W=h.callbacks,W===null?h.callbacks=[G]:W.push(G))}else W={lane:G,tag:T.tag,payload:T.payload,callback:T.callback,next:null},Q===null?(H=Q=W,O=re):Q=Q.next=W,x|=G;if(T=T.next,T===null){if(T=h.shared.pending,T===null)break;W=T,T=W.next,W.next=null,h.lastBaseUpdate=W,h.shared.pending=null}}while(!0);Q===null&&(O=re),h.baseState=O,h.firstBaseUpdate=H,h.lastBaseUpdate=Q,p===null&&(h.shared.lanes=0),Ea|=x,n.lanes=x,n.memoizedState=re}}function Cy(n,a){if(typeof n!="function")throw Error(s(191,n));n.call(a)}function Ay(n,a){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)Cy(i[n],a)}var ii=k(null),fc=k(0);function Ty(n,a){n=Fr,I(fc,n),I(ii,a),Fr=n|a.baseLanes}function Af(){I(fc,Fr),I(ii,ii.current)}function Tf(){Fr=fc.current,j(ii),j(fc)}var En=k(null),$n=null;function wa(n){var a=n.alternate;I(_t,_t.current&1),I(En,n),$n===null&&(a===null||ii.current!==null||a.memoizedState!==null)&&($n=n)}function Rf(n){I(_t,_t.current),I(En,n),$n===null&&($n=n)}function Ry(n){n.tag===22?(I(_t,_t.current),I(En,n),$n===null&&($n=n)):xa()}function xa(){I(_t,_t.current),I(En,En.current)}function Cn(n){j(En),$n===n&&($n=null),j(_t)}var _t=k(0);function hc(n){for(var a=n;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Dh(i)||Lh(i)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ur=0,Me=null,Ze=null,Ct=null,mc=!1,oi=!1,hs=!1,pc=0,Co=0,li=null,IA=0;function vt(){throw Error(s(321))}function Nf(n,a){if(a===null)return!1;for(var i=0;i<a.length&&i<n.length;i++)if(!_n(n[i],a[i]))return!1;return!0}function kf(n,a,i,c,h,p){return Ur=p,Me=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,M.H=n===null||n.memoizedState===null?dv:Gf,hs=!1,p=i(c,h),hs=!1,oi&&(p=ky(a,i,c,h)),Ny(n),p}function Ny(n){M.H=Ro;var a=Ze!==null&&Ze.next!==null;if(Ur=0,Ct=Ze=Me=null,mc=!1,Co=0,li=null,a)throw Error(s(300));n===null||At||(n=n.dependencies,n!==null&&sc(n)&&(At=!0))}function ky(n,a,i,c){Me=n;var h=0;do{if(oi&&(li=null),Co=0,oi=!1,25<=h)throw Error(s(301));if(h+=1,Ct=Ze=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}M.H=fv,p=a(i,c)}while(oi);return p}function $A(){var n=M.H,a=n.useState()[0];return a=typeof a.then=="function"?Ao(a):a,n=n.useState()[0],(Ze!==null?Ze.memoizedState:null)!==n&&(Me.flags|=1024),a}function jf(){var n=pc!==0;return pc=0,n}function Of(n,a,i){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~i}function Mf(n){if(mc){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}mc=!1}Ur=0,Ct=Ze=Me=null,oi=!1,Co=pc=0,li=null}function Zt(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?Me.memoizedState=Ct=n:Ct=Ct.next=n,Ct}function St(){if(Ze===null){var n=Me.alternate;n=n!==null?n.memoizedState:null}else n=Ze.next;var a=Ct===null?Me.memoizedState:Ct.next;if(a!==null)Ct=a,Ze=n;else{if(n===null)throw Me.alternate===null?Error(s(467)):Error(s(310));Ze=n,n={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},Ct===null?Me.memoizedState=Ct=n:Ct=Ct.next=n}return Ct}function gc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ao(n){var a=Co;return Co+=1,li===null&&(li=[]),n=wy(li,n,a),a=Me,(Ct===null?a.memoizedState:Ct.next)===null&&(a=a.alternate,M.H=a===null||a.memoizedState===null?dv:Gf),n}function yc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ao(n);if(n.$$typeof===N)return Bt(n)}throw Error(s(438,String(n)))}function Df(n){var a=null,i=Me.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var c=Me.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(h){return h.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=gc(),Me.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(n),c=0;c<n;c++)i[c]=he;return a.index++,i}function Ir(n,a){return typeof a=="function"?a(n):a}function vc(n){var a=St();return Lf(a,Ze,n)}function Lf(n,a,i){var c=n.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=i;var h=n.baseQueue,p=c.pending;if(p!==null){if(h!==null){var x=h.next;h.next=p.next,p.next=x}a.baseQueue=h=p,c.pending=null}if(p=n.baseState,h===null)n.memoizedState=p;else{a=h.next;var T=x=null,O=null,H=a,Q=!1;do{var re=H.lane&-536870913;if(re!==H.lane?(Ie&re)===re:(Ur&re)===re){var G=H.revertLane;if(G===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),re===ni&&(Q=!0);else if((Ur&G)===G){H=H.next,G===ni&&(Q=!0);continue}else re={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},O===null?(T=O=re,x=p):O=O.next=re,Me.lanes|=G,Ea|=G;re=H.action,hs&&i(p,re),p=H.hasEagerState?H.eagerState:i(p,re)}else G={lane:re,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},O===null?(T=O=G,x=p):O=O.next=G,Me.lanes|=re,Ea|=re;H=H.next}while(H!==null&&H!==a);if(O===null?x=p:O.next=T,!_n(p,n.memoizedState)&&(At=!0,Q&&(i=ri,i!==null)))throw i;n.memoizedState=p,n.baseState=x,n.baseQueue=O,c.lastRenderedState=p}return h===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function Pf(n){var a=St(),i=a.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=n;var c=i.dispatch,h=i.pending,p=a.memoizedState;if(h!==null){i.pending=null;var x=h=h.next;do p=n(p,x.action),x=x.next;while(x!==h);_n(p,a.memoizedState)||(At=!0),a.memoizedState=p,a.baseQueue===null&&(a.baseState=p),i.lastRenderedState=p}return[p,c]}function jy(n,a,i){var c=Me,h=St(),p=He;if(p){if(i===void 0)throw Error(s(407));i=i()}else i=a();var x=!_n((Ze||h).memoizedState,i);if(x&&(h.memoizedState=i,At=!0),h=h.queue,If(Dy.bind(null,c,h,n),[n]),h.getSnapshot!==a||x||Ct!==null&&Ct.memoizedState.tag&1){if(c.flags|=2048,ci(9,{destroy:void 0},My.bind(null,c,h,i,a),null),at===null)throw Error(s(349));p||(Ur&127)!==0||Oy(c,a,i)}return i}function Oy(n,a,i){n.flags|=16384,n={getSnapshot:a,value:i},a=Me.updateQueue,a===null?(a=gc(),Me.updateQueue=a,a.stores=[n]):(i=a.stores,i===null?a.stores=[n]:i.push(n))}function My(n,a,i,c){a.value=i,a.getSnapshot=c,Ly(a)&&Py(n)}function Dy(n,a,i){return i(function(){Ly(a)&&Py(n)})}function Ly(n){var a=n.getSnapshot;n=n.value;try{var i=a();return!_n(n,i)}catch{return!0}}function Py(n){var a=as(n,2);a!==null&&hn(a,n,2)}function zf(n){var a=Zt();if(typeof n=="function"){var i=n;if(n=i(),hs){xn(!0);try{i()}finally{xn(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:n},a}function zy(n,a,i,c){return n.baseState=i,Lf(n,Ze,typeof c=="function"?c:Ir)}function BA(n,a,i,c,h){if(xc(n))throw Error(s(485));if(n=a.action,n!==null){var p={payload:h,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){p.listeners.push(x)}};M.T!==null?i(!0):p.isTransition=!1,c(p),i=a.pending,i===null?(p.next=a.pending=p,Uy(a,p)):(p.next=i.next,a.pending=i.next=p)}}function Uy(n,a){var i=a.action,c=a.payload,h=n.state;if(a.isTransition){var p=M.T,x={};M.T=x;try{var T=i(h,c),O=M.S;O!==null&&O(x,T),Iy(n,a,T)}catch(H){Uf(n,a,H)}finally{p!==null&&x.types!==null&&(p.types=x.types),M.T=p}}else try{p=i(h,c),Iy(n,a,p)}catch(H){Uf(n,a,H)}}function Iy(n,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(c){$y(n,a,c)},function(c){return Uf(n,a,c)}):$y(n,a,i)}function $y(n,a,i){a.status="fulfilled",a.value=i,By(a),n.state=i,a=n.pending,a!==null&&(i=a.next,i===a?n.pending=null:(i=i.next,a.next=i,Uy(n,i)))}function Uf(n,a,i){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=i,By(a),a=a.next;while(a!==c)}n.action=null}function By(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Hy(n,a){return a}function qy(n,a){if(He){var i=at.formState;if(i!==null){e:{var c=Me;if(He){if(lt){t:{for(var h=lt,p=In;h.nodeType!==8;){if(!p){h=null;break t}if(h=Bn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){lt=Bn(h.nextSibling),c=h.data==="F!";break e}}pa(c)}c=!1}c&&(a=i[0])}}return i=Zt(),i.memoizedState=i.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hy,lastRenderedState:a},i.queue=c,i=lv.bind(null,Me,c),c.dispatch=i,c=zf(!1),p=Vf.bind(null,Me,!1,c.queue),c=Zt(),h={state:a,dispatch:null,action:n,pending:null},c.queue=h,i=BA.bind(null,Me,h,p,i),h.dispatch=i,c.memoizedState=n,[a,i,!1]}function Vy(n){var a=St();return Gy(a,Ze,n)}function Gy(n,a,i){if(a=Lf(n,a,Hy)[0],n=vc(Ir)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=Ao(a)}catch(x){throw x===ai?lc:x}else c=a;a=St();var h=a.queue,p=h.dispatch;return i!==a.memoizedState&&(Me.flags|=2048,ci(9,{destroy:void 0},HA.bind(null,h,i),null)),[c,p,n]}function HA(n,a){n.action=a}function Fy(n){var a=St(),i=Ze;if(i!==null)return Gy(a,i,n);St(),a=a.memoizedState,i=St();var c=i.queue.dispatch;return i.memoizedState=n,[a,c,!1]}function ci(n,a,i,c){return n={tag:n,create:i,deps:c,inst:a,next:null},a=Me.updateQueue,a===null&&(a=gc(),Me.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=n.next=n:(c=i.next,i.next=n,n.next=c,a.lastEffect=n),n}function Ky(){return St().memoizedState}function bc(n,a,i,c){var h=Zt();Me.flags|=n,h.memoizedState=ci(1|a,{destroy:void 0},i,c===void 0?null:c)}function wc(n,a,i,c){var h=St();c=c===void 0?null:c;var p=h.memoizedState.inst;Ze!==null&&c!==null&&Nf(c,Ze.memoizedState.deps)?h.memoizedState=ci(a,p,i,c):(Me.flags|=n,h.memoizedState=ci(1|a,p,i,c))}function Yy(n,a){bc(8390656,8,n,a)}function If(n,a){wc(2048,8,n,a)}function qA(n){Me.flags|=4;var a=Me.updateQueue;if(a===null)a=gc(),Me.updateQueue=a,a.events=[n];else{var i=a.events;i===null?a.events=[n]:i.push(n)}}function Wy(n){var a=St().memoizedState;return qA({ref:a,nextImpl:n}),function(){if((We&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function Xy(n,a){return wc(4,2,n,a)}function Jy(n,a){return wc(4,4,n,a)}function Qy(n,a){if(typeof a=="function"){n=n();var i=a(n);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function Zy(n,a,i){i=i!=null?i.concat([n]):null,wc(4,4,Qy.bind(null,a,n),i)}function $f(){}function ev(n,a){var i=St();a=a===void 0?null:a;var c=i.memoizedState;return a!==null&&Nf(a,c[1])?c[0]:(i.memoizedState=[n,a],n)}function tv(n,a){var i=St();a=a===void 0?null:a;var c=i.memoizedState;if(a!==null&&Nf(a,c[1]))return c[0];if(c=n(),hs){xn(!0);try{n()}finally{xn(!1)}}return i.memoizedState=[c,a],c}function Bf(n,a,i){return i===void 0||(Ur&1073741824)!==0&&(Ie&261930)===0?n.memoizedState=a:(n.memoizedState=i,n=nb(),Me.lanes|=n,Ea|=n,i)}function nv(n,a,i,c){return _n(i,a)?i:ii.current!==null?(n=Bf(n,i,c),_n(n,a)||(At=!0),n):(Ur&42)===0||(Ur&1073741824)!==0&&(Ie&261930)===0?(At=!0,n.memoizedState=i):(n=nb(),Me.lanes|=n,Ea|=n,a)}function rv(n,a,i,c,h){var p=K.p;K.p=p!==0&&8>p?p:8;var x=M.T,T={};M.T=T,Vf(n,!1,a,i);try{var O=h(),H=M.S;if(H!==null&&H(T,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Q=UA(O,c);To(n,a,Q,Rn(n))}else To(n,a,c,Rn(n))}catch(re){To(n,a,{then:function(){},status:"rejected",reason:re},Rn())}finally{K.p=p,x!==null&&T.types!==null&&(x.types=T.types),M.T=x}}function VA(){}function Hf(n,a,i,c){if(n.tag!==5)throw Error(s(476));var h=av(n).queue;rv(n,h,a,J,i===null?VA:function(){return sv(n),i(c)})}function av(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:J},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:i},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function sv(n){var a=av(n);a.next===null&&(a=n.alternate.memoizedState),To(n,a.next.queue,{},Rn())}function qf(){return Bt(Vo)}function iv(){return St().memoizedState}function ov(){return St().memoizedState}function GA(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var i=Rn();n=va(i);var c=ba(a,n,i);c!==null&&(hn(c,a,i),_o(c,a,i)),a={cache:vf()},n.payload=a;return}a=a.return}}function FA(n,a,i){var c=Rn();i={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},xc(n)?cv(a,i):(i=of(n,a,i,c),i!==null&&(hn(i,n,c),uv(i,a,c)))}function lv(n,a,i){var c=Rn();To(n,a,i,c)}function To(n,a,i,c){var h={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(xc(n))cv(a,h);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=a.lastRenderedReducer,p!==null))try{var x=a.lastRenderedState,T=p(x,i);if(h.hasEagerState=!0,h.eagerState=T,_n(T,x))return tc(n,a,h,0),at===null&&ec(),!1}catch{}finally{}if(i=of(n,a,h,c),i!==null)return hn(i,n,c),uv(i,a,c),!0}return!1}function Vf(n,a,i,c){if(c={lane:2,revertLane:_h(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},xc(n)){if(a)throw Error(s(479))}else a=of(n,i,c,2),a!==null&&hn(a,n,2)}function xc(n){var a=n.alternate;return n===Me||a!==null&&a===Me}function cv(n,a){oi=mc=!0;var i=n.pending;i===null?a.next=a:(a.next=i.next,i.next=a),n.pending=a}function uv(n,a,i){if((i&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,i|=c,a.lanes=i,an(n,i)}}var Ro={readContext:Bt,use:yc,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useLayoutEffect:vt,useInsertionEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useSyncExternalStore:vt,useId:vt,useHostTransitionStatus:vt,useFormState:vt,useActionState:vt,useOptimistic:vt,useMemoCache:vt,useCacheRefresh:vt};Ro.useEffectEvent=vt;var dv={readContext:Bt,use:yc,useCallback:function(n,a){return Zt().memoizedState=[n,a===void 0?null:a],n},useContext:Bt,useEffect:Yy,useImperativeHandle:function(n,a,i){i=i!=null?i.concat([n]):null,bc(4194308,4,Qy.bind(null,a,n),i)},useLayoutEffect:function(n,a){return bc(4194308,4,n,a)},useInsertionEffect:function(n,a){bc(4,2,n,a)},useMemo:function(n,a){var i=Zt();a=a===void 0?null:a;var c=n();if(hs){xn(!0);try{n()}finally{xn(!1)}}return i.memoizedState=[c,a],c},useReducer:function(n,a,i){var c=Zt();if(i!==void 0){var h=i(a);if(hs){xn(!0);try{i(a)}finally{xn(!1)}}}else h=a;return c.memoizedState=c.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},c.queue=n,n=n.dispatch=FA.bind(null,Me,n),[c.memoizedState,n]},useRef:function(n){var a=Zt();return n={current:n},a.memoizedState=n},useState:function(n){n=zf(n);var a=n.queue,i=lv.bind(null,Me,a);return a.dispatch=i,[n.memoizedState,i]},useDebugValue:$f,useDeferredValue:function(n,a){var i=Zt();return Bf(i,n,a)},useTransition:function(){var n=zf(!1);return n=rv.bind(null,Me,n.queue,!0,!1),Zt().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,i){var c=Me,h=Zt();if(He){if(i===void 0)throw Error(s(407));i=i()}else{if(i=a(),at===null)throw Error(s(349));(Ie&127)!==0||Oy(c,a,i)}h.memoizedState=i;var p={value:i,getSnapshot:a};return h.queue=p,Yy(Dy.bind(null,c,p,n),[n]),c.flags|=2048,ci(9,{destroy:void 0},My.bind(null,c,p,i,a),null),i},useId:function(){var n=Zt(),a=at.identifierPrefix;if(He){var i=mr,c=hr;i=(c&~(1<<32-Mt(c)-1)).toString(32)+i,a="_"+a+"R_"+i,i=pc++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=IA++,a="_"+a+"r_"+i.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:qf,useFormState:qy,useActionState:qy,useOptimistic:function(n){var a=Zt();a.memoizedState=a.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=Vf.bind(null,Me,!0,i),i.dispatch=a,[n,a]},useMemoCache:Df,useCacheRefresh:function(){return Zt().memoizedState=GA.bind(null,Me)},useEffectEvent:function(n){var a=Zt(),i={impl:n};return a.memoizedState=i,function(){if((We&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}},Gf={readContext:Bt,use:yc,useCallback:ev,useContext:Bt,useEffect:If,useImperativeHandle:Zy,useInsertionEffect:Xy,useLayoutEffect:Jy,useMemo:tv,useReducer:vc,useRef:Ky,useState:function(){return vc(Ir)},useDebugValue:$f,useDeferredValue:function(n,a){var i=St();return nv(i,Ze.memoizedState,n,a)},useTransition:function(){var n=vc(Ir)[0],a=St().memoizedState;return[typeof n=="boolean"?n:Ao(n),a]},useSyncExternalStore:jy,useId:iv,useHostTransitionStatus:qf,useFormState:Vy,useActionState:Vy,useOptimistic:function(n,a){var i=St();return zy(i,Ze,n,a)},useMemoCache:Df,useCacheRefresh:ov};Gf.useEffectEvent=Wy;var fv={readContext:Bt,use:yc,useCallback:ev,useContext:Bt,useEffect:If,useImperativeHandle:Zy,useInsertionEffect:Xy,useLayoutEffect:Jy,useMemo:tv,useReducer:Pf,useRef:Ky,useState:function(){return Pf(Ir)},useDebugValue:$f,useDeferredValue:function(n,a){var i=St();return Ze===null?Bf(i,n,a):nv(i,Ze.memoizedState,n,a)},useTransition:function(){var n=Pf(Ir)[0],a=St().memoizedState;return[typeof n=="boolean"?n:Ao(n),a]},useSyncExternalStore:jy,useId:iv,useHostTransitionStatus:qf,useFormState:Fy,useActionState:Fy,useOptimistic:function(n,a){var i=St();return Ze!==null?zy(i,Ze,n,a):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:Df,useCacheRefresh:ov};fv.useEffectEvent=Wy;function Ff(n,a,i,c){a=n.memoizedState,i=i(c,a),i=i==null?a:g({},a,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var Kf={enqueueSetState:function(n,a,i){n=n._reactInternals;var c=Rn(),h=va(c);h.payload=a,i!=null&&(h.callback=i),a=ba(n,h,c),a!==null&&(hn(a,n,c),_o(a,n,c))},enqueueReplaceState:function(n,a,i){n=n._reactInternals;var c=Rn(),h=va(c);h.tag=1,h.payload=a,i!=null&&(h.callback=i),a=ba(n,h,c),a!==null&&(hn(a,n,c),_o(a,n,c))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var i=Rn(),c=va(i);c.tag=2,a!=null&&(c.callback=a),a=ba(n,c,i),a!==null&&(hn(a,n,i),_o(a,n,i))}};function hv(n,a,i,c,h,p,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,p,x):a.prototype&&a.prototype.isPureReactComponent?!mo(i,c)||!mo(h,p):!0}function mv(n,a,i,c){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,c),a.state!==n&&Kf.enqueueReplaceState(a,a.state,null)}function ms(n,a){var i=a;if("ref"in a){i={};for(var c in a)c!=="ref"&&(i[c]=a[c])}if(n=n.defaultProps){i===a&&(i=g({},i));for(var h in n)i[h]===void 0&&(i[h]=n[h])}return i}function pv(n){Zl(n)}function gv(n){console.error(n)}function yv(n){Zl(n)}function _c(n,a){try{var i=n.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function vv(n,a,i){try{var c=n.onCaughtError;c(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Yf(n,a,i){return i=va(i),i.tag=3,i.payload={element:null},i.callback=function(){_c(n,a)},i}function bv(n){return n=va(n),n.tag=3,n}function wv(n,a,i,c){var h=i.type.getDerivedStateFromError;if(typeof h=="function"){var p=c.value;n.payload=function(){return h(p)},n.callback=function(){vv(a,i,c)}}var x=i.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){vv(a,i,c),typeof h!="function"&&(Ca===null?Ca=new Set([this]):Ca.add(this));var T=c.stack;this.componentDidCatch(c.value,{componentStack:T!==null?T:""})})}function KA(n,a,i,c,h){if(i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=i.alternate,a!==null&&ti(a,i,h,!0),i=En.current,i!==null){switch(i.tag){case 31:case 13:return $n===null?Dc():i.alternate===null&&bt===0&&(bt=3),i.flags&=-257,i.flags|=65536,i.lanes=h,c===cc?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([c]):a.add(c),bh(n,c,h)),!1;case 22:return i.flags|=65536,c===cc?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([c]):i.add(c)),bh(n,c,h)),!1}throw Error(s(435,i.tag))}return bh(n,c,h),Dc(),!1}if(He)return a=En.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=h,c!==hf&&(n=Error(s(422),{cause:c}),yo(Pn(n,i)))):(c!==hf&&(a=Error(s(423),{cause:c}),yo(Pn(a,i))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,c=Pn(c,i),h=Yf(n.stateNode,c,h),Ef(n,h),bt!==4&&(bt=2)),!1;var p=Error(s(520),{cause:c});if(p=Pn(p,i),Po===null?Po=[p]:Po.push(p),bt!==4&&(bt=2),a===null)return!0;c=Pn(c,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,n=h&-h,i.lanes|=n,n=Yf(i.stateNode,c,n),Ef(i,n),!1;case 1:if(a=i.type,p=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Ca===null||!Ca.has(p))))return i.flags|=65536,h&=-h,i.lanes|=h,h=bv(h),wv(h,n,i,c),Ef(i,h),!1}i=i.return}while(i!==null);return!1}var Wf=Error(s(461)),At=!1;function Ht(n,a,i,c){a.child=n===null?Ey(a,null,i,c):fs(a,n.child,i,c)}function xv(n,a,i,c,h){i=i.render;var p=a.ref;if("ref"in c){var x={};for(var T in c)T!=="ref"&&(x[T]=c[T])}else x=c;return ls(a),c=kf(n,a,i,x,p,h),T=jf(),n!==null&&!At?(Of(n,a,h),$r(n,a,h)):(He&&T&&df(a),a.flags|=1,Ht(n,a,c,h),a.child)}function _v(n,a,i,c,h){if(n===null){var p=i.type;return typeof p=="function"&&!lf(p)&&p.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=p,Sv(n,a,p,c,h)):(n=rc(i.type,null,c,a,a.mode,h),n.ref=a.ref,n.return=a,a.child=n)}if(p=n.child,!rh(n,h)){var x=p.memoizedProps;if(i=i.compare,i=i!==null?i:mo,i(x,c)&&n.ref===a.ref)return $r(n,a,h)}return a.flags|=1,n=Dr(p,c),n.ref=a.ref,n.return=a,a.child=n}function Sv(n,a,i,c,h){if(n!==null){var p=n.memoizedProps;if(mo(p,c)&&n.ref===a.ref)if(At=!1,a.pendingProps=c=p,rh(n,h))(n.flags&131072)!==0&&(At=!0);else return a.lanes=n.lanes,$r(n,a,h)}return Xf(n,a,i,c,h)}function Ev(n,a,i,c){var h=c.children,p=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((a.flags&128)!==0){if(p=p!==null?p.baseLanes|i:i,n!==null){for(c=a.child=n.child,h=0;c!==null;)h=h|c.lanes|c.childLanes,c=c.sibling;c=h&~p}else c=0,a.child=null;return Cv(n,a,p,i,c)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&oc(a,p!==null?p.cachePool:null),p!==null?Ty(a,p):Af(),Ry(a);else return c=a.lanes=536870912,Cv(n,a,p!==null?p.baseLanes|i:i,i,c)}else p!==null?(oc(a,p.cachePool),Ty(a,p),xa(),a.memoizedState=null):(n!==null&&oc(a,null),Af(),xa());return Ht(n,a,h,i),a.child}function No(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Cv(n,a,i,c,h){var p=wf();return p=p===null?null:{parent:Et._currentValue,pool:p},a.memoizedState={baseLanes:i,cachePool:p},n!==null&&oc(a,null),Af(),Ry(a),n!==null&&ti(n,a,c,!0),a.childLanes=h,null}function Sc(n,a){return a=Cc({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function Av(n,a,i){return fs(a,n.child,null,i),n=Sc(a,a.pendingProps),n.flags|=2,Cn(a),a.memoizedState=null,n}function YA(n,a,i){var c=a.pendingProps,h=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(He){if(c.mode==="hidden")return n=Sc(a,c),a.lanes=536870912,No(null,n);if(Rf(a),(n=lt)?(n=Ub(n,In),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:ha!==null?{id:hr,overflow:mr}:null,retryLane:536870912,hydrationErrors:null},i=cy(n),i.return=a,a.child=i,$t=a,lt=null)):n=null,n===null)throw pa(a);return a.lanes=536870912,null}return Sc(a,c)}var p=n.memoizedState;if(p!==null){var x=p.dehydrated;if(Rf(a),h)if(a.flags&256)a.flags&=-257,a=Av(n,a,i);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(s(558));else if(At||ti(n,a,i,!1),h=(i&n.childLanes)!==0,At||h){if(c=at,c!==null&&(x=sn(c,i),x!==0&&x!==p.retryLane))throw p.retryLane=x,as(n,x),hn(c,n,x),Wf;Dc(),a=Av(n,a,i)}else n=p.treeContext,lt=Bn(x.nextSibling),$t=a,He=!0,ma=null,In=!1,n!==null&&fy(a,n),a=Sc(a,c),a.flags|=4096;return a}return n=Dr(n.child,{mode:c.mode,children:c.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Ec(n,a){var i=a.ref;if(i===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(s(284));(n===null||n.ref!==i)&&(a.flags|=4194816)}}function Xf(n,a,i,c,h){return ls(a),i=kf(n,a,i,c,void 0,h),c=jf(),n!==null&&!At?(Of(n,a,h),$r(n,a,h)):(He&&c&&df(a),a.flags|=1,Ht(n,a,i,h),a.child)}function Tv(n,a,i,c,h,p){return ls(a),a.updateQueue=null,i=ky(a,c,i,h),Ny(n),c=jf(),n!==null&&!At?(Of(n,a,p),$r(n,a,p)):(He&&c&&df(a),a.flags|=1,Ht(n,a,i,p),a.child)}function Rv(n,a,i,c,h){if(ls(a),a.stateNode===null){var p=Js,x=i.contextType;typeof x=="object"&&x!==null&&(p=Bt(x)),p=new i(c,p),a.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Kf,a.stateNode=p,p._reactInternals=a,p=a.stateNode,p.props=c,p.state=a.memoizedState,p.refs={},_f(a),x=i.contextType,p.context=typeof x=="object"&&x!==null?Bt(x):Js,p.state=a.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&(Ff(a,i,x,c),p.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(x=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),x!==p.state&&Kf.enqueueReplaceState(p,p.state,null),Eo(a,c,p,h),So(),p.state=a.memoizedState),typeof p.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(n===null){p=a.stateNode;var T=a.memoizedProps,O=ms(i,T);p.props=O;var H=p.context,Q=i.contextType;x=Js,typeof Q=="object"&&Q!==null&&(x=Bt(Q));var re=i.getDerivedStateFromProps;Q=typeof re=="function"||typeof p.getSnapshotBeforeUpdate=="function",T=a.pendingProps!==T,Q||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(T||H!==x)&&mv(a,p,c,x),ya=!1;var G=a.memoizedState;p.state=G,Eo(a,c,p,h),So(),H=a.memoizedState,T||G!==H||ya?(typeof re=="function"&&(Ff(a,i,re,c),H=a.memoizedState),(O=ya||hv(a,i,O,c,G,H,x))?(Q||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(a.flags|=4194308)):(typeof p.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=H),p.props=c,p.state=H,p.context=x,c=O):(typeof p.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{p=a.stateNode,Sf(n,a),x=a.memoizedProps,Q=ms(i,x),p.props=Q,re=a.pendingProps,G=p.context,H=i.contextType,O=Js,typeof H=="object"&&H!==null&&(O=Bt(H)),T=i.getDerivedStateFromProps,(H=typeof T=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==re||G!==O)&&mv(a,p,c,O),ya=!1,G=a.memoizedState,p.state=G,Eo(a,c,p,h),So();var W=a.memoizedState;x!==re||G!==W||ya||n!==null&&n.dependencies!==null&&sc(n.dependencies)?(typeof T=="function"&&(Ff(a,i,T,c),W=a.memoizedState),(Q=ya||hv(a,i,Q,c,G,W,O)||n!==null&&n.dependencies!==null&&sc(n.dependencies))?(H||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(c,W,O),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(c,W,O)),typeof p.componentDidUpdate=="function"&&(a.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===n.memoizedProps&&G===n.memoizedState||(a.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&G===n.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=W),p.props=c,p.state=W,p.context=O,c=Q):(typeof p.componentDidUpdate!="function"||x===n.memoizedProps&&G===n.memoizedState||(a.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&G===n.memoizedState||(a.flags|=1024),c=!1)}return p=c,Ec(n,a),c=(a.flags&128)!==0,p||c?(p=a.stateNode,i=c&&typeof i.getDerivedStateFromError!="function"?null:p.render(),a.flags|=1,n!==null&&c?(a.child=fs(a,n.child,null,h),a.child=fs(a,null,i,h)):Ht(n,a,i,h),a.memoizedState=p.state,n=a.child):n=$r(n,a,h),n}function Nv(n,a,i,c){return is(),a.flags|=256,Ht(n,a,i,c),a.child}var Jf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qf(n){return{baseLanes:n,cachePool:vy()}}function Zf(n,a,i){return n=n!==null?n.childLanes&~i:0,a&&(n|=Tn),n}function kv(n,a,i){var c=a.pendingProps,h=!1,p=(a.flags&128)!==0,x;if((x=p)||(x=n!==null&&n.memoizedState===null?!1:(_t.current&2)!==0),x&&(h=!0,a.flags&=-129),x=(a.flags&32)!==0,a.flags&=-33,n===null){if(He){if(h?wa(a):xa(),(n=lt)?(n=Ub(n,In),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:ha!==null?{id:hr,overflow:mr}:null,retryLane:536870912,hydrationErrors:null},i=cy(n),i.return=a,a.child=i,$t=a,lt=null)):n=null,n===null)throw pa(a);return Lh(n)?a.lanes=32:a.lanes=536870912,null}var T=c.children;return c=c.fallback,h?(xa(),h=a.mode,T=Cc({mode:"hidden",children:T},h),c=ss(c,h,i,null),T.return=a,c.return=a,T.sibling=c,a.child=T,c=a.child,c.memoizedState=Qf(i),c.childLanes=Zf(n,x,i),a.memoizedState=Jf,No(null,c)):(wa(a),eh(a,T))}var O=n.memoizedState;if(O!==null&&(T=O.dehydrated,T!==null)){if(p)a.flags&256?(wa(a),a.flags&=-257,a=th(n,a,i)):a.memoizedState!==null?(xa(),a.child=n.child,a.flags|=128,a=null):(xa(),T=c.fallback,h=a.mode,c=Cc({mode:"visible",children:c.children},h),T=ss(T,h,i,null),T.flags|=2,c.return=a,T.return=a,c.sibling=T,a.child=c,fs(a,n.child,null,i),c=a.child,c.memoizedState=Qf(i),c.childLanes=Zf(n,x,i),a.memoizedState=Jf,a=No(null,c));else if(wa(a),Lh(T)){if(x=T.nextSibling&&T.nextSibling.dataset,x)var H=x.dgst;x=H,c=Error(s(419)),c.stack="",c.digest=x,yo({value:c,source:null,stack:null}),a=th(n,a,i)}else if(At||ti(n,a,i,!1),x=(i&n.childLanes)!==0,At||x){if(x=at,x!==null&&(c=sn(x,i),c!==0&&c!==O.retryLane))throw O.retryLane=c,as(n,c),hn(x,n,c),Wf;Dh(T)||Dc(),a=th(n,a,i)}else Dh(T)?(a.flags|=192,a.child=n.child,a=null):(n=O.treeContext,lt=Bn(T.nextSibling),$t=a,He=!0,ma=null,In=!1,n!==null&&fy(a,n),a=eh(a,c.children),a.flags|=4096);return a}return h?(xa(),T=c.fallback,h=a.mode,O=n.child,H=O.sibling,c=Dr(O,{mode:"hidden",children:c.children}),c.subtreeFlags=O.subtreeFlags&65011712,H!==null?T=Dr(H,T):(T=ss(T,h,i,null),T.flags|=2),T.return=a,c.return=a,c.sibling=T,a.child=c,No(null,c),c=a.child,T=n.child.memoizedState,T===null?T=Qf(i):(h=T.cachePool,h!==null?(O=Et._currentValue,h=h.parent!==O?{parent:O,pool:O}:h):h=vy(),T={baseLanes:T.baseLanes|i,cachePool:h}),c.memoizedState=T,c.childLanes=Zf(n,x,i),a.memoizedState=Jf,No(n.child,c)):(wa(a),i=n.child,n=i.sibling,i=Dr(i,{mode:"visible",children:c.children}),i.return=a,i.sibling=null,n!==null&&(x=a.deletions,x===null?(a.deletions=[n],a.flags|=16):x.push(n)),a.child=i,a.memoizedState=null,i)}function eh(n,a){return a=Cc({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Cc(n,a){return n=Sn(22,n,null,a),n.lanes=0,n}function th(n,a,i){return fs(a,n.child,null,i),n=eh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function jv(n,a,i){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a),gf(n.return,a,i)}function nh(n,a,i,c,h,p){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:h,treeForkCount:p}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=c,x.tail=i,x.tailMode=h,x.treeForkCount=p)}function Ov(n,a,i){var c=a.pendingProps,h=c.revealOrder,p=c.tail;c=c.children;var x=_t.current,T=(x&2)!==0;if(T?(x=x&1|2,a.flags|=128):x&=1,I(_t,x),Ht(n,a,c,i),c=He?go:0,!T&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&jv(n,i,a);else if(n.tag===19)jv(n,i,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(h){case"forwards":for(i=a.child,h=null;i!==null;)n=i.alternate,n!==null&&hc(n)===null&&(h=i),i=i.sibling;i=h,i===null?(h=a.child,a.child=null):(h=i.sibling,i.sibling=null),nh(a,!1,h,i,p,c);break;case"backwards":case"unstable_legacy-backwards":for(i=null,h=a.child,a.child=null;h!==null;){if(n=h.alternate,n!==null&&hc(n)===null){a.child=h;break}n=h.sibling,h.sibling=i,i=h,h=n}nh(a,!0,i,null,p,c);break;case"together":nh(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function $r(n,a,i){if(n!==null&&(a.dependencies=n.dependencies),Ea|=a.lanes,(i&a.childLanes)===0)if(n!==null){if(ti(n,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(s(153));if(a.child!==null){for(n=a.child,i=Dr(n,n.pendingProps),a.child=i,i.return=a;n.sibling!==null;)n=n.sibling,i=i.sibling=Dr(n,n.pendingProps),i.return=a;i.sibling=null}return a.child}function rh(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&sc(n)))}function WA(n,a,i){switch(a.tag){case 3:ee(a,a.stateNode.containerInfo),ga(a,Et,n.memoizedState.cache),is();break;case 27:case 5:xe(a);break;case 4:ee(a,a.stateNode.containerInfo);break;case 10:ga(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Rf(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(wa(a),a.flags|=128,null):(i&a.child.childLanes)!==0?kv(n,a,i):(wa(a),n=$r(n,a,i),n!==null?n.sibling:null);wa(a);break;case 19:var h=(n.flags&128)!==0;if(c=(i&a.childLanes)!==0,c||(ti(n,a,i,!1),c=(i&a.childLanes)!==0),h){if(c)return Ov(n,a,i);a.flags|=128}if(h=a.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),I(_t,_t.current),c)break;return null;case 22:return a.lanes=0,Ev(n,a,i,a.pendingProps);case 24:ga(a,Et,n.memoizedState.cache)}return $r(n,a,i)}function Mv(n,a,i){if(n!==null)if(n.memoizedProps!==a.pendingProps)At=!0;else{if(!rh(n,i)&&(a.flags&128)===0)return At=!1,WA(n,a,i);At=(n.flags&131072)!==0}else At=!1,He&&(a.flags&1048576)!==0&&dy(a,go,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(n=us(a.elementType),a.type=n,typeof n=="function")lf(n)?(c=ms(n,c),a.tag=1,a=Rv(null,a,n,c,i)):(a.tag=0,a=Xf(null,a,n,c,i));else{if(n!=null){var h=n.$$typeof;if(h===P){a.tag=11,a=xv(null,a,n,c,i);break e}else if(h===L){a.tag=14,a=_v(null,a,n,c,i);break e}}throw a=ce(n)||n,Error(s(306,a,""))}}return a;case 0:return Xf(n,a,a.type,a.pendingProps,i);case 1:return c=a.type,h=ms(c,a.pendingProps),Rv(n,a,c,h,i);case 3:e:{if(ee(a,a.stateNode.containerInfo),n===null)throw Error(s(387));c=a.pendingProps;var p=a.memoizedState;h=p.element,Sf(n,a),Eo(a,c,null,i);var x=a.memoizedState;if(c=x.cache,ga(a,Et,c),c!==p.cache&&yf(a,[Et],i,!0),So(),c=x.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:x.cache},a.updateQueue.baseState=p,a.memoizedState=p,a.flags&256){a=Nv(n,a,c,i);break e}else if(c!==h){h=Pn(Error(s(424)),a),yo(h),a=Nv(n,a,c,i);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(lt=Bn(n.firstChild),$t=a,He=!0,ma=null,In=!0,i=Ey(a,null,c,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(is(),c===h){a=$r(n,a,i);break e}Ht(n,a,c,i)}a=a.child}return a;case 26:return Ec(n,a),n===null?(i=Vb(a.type,null,a.pendingProps,null))?a.memoizedState=i:He||(i=a.type,n=a.pendingProps,c=Bc(Z.current).createElement(i),c[It]=a,c[on]=n,qt(c,i,n),Lt(c),a.stateNode=c):a.memoizedState=Vb(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return xe(a),n===null&&He&&(c=a.stateNode=Bb(a.type,a.pendingProps,Z.current),$t=a,In=!0,h=lt,Na(a.type)?(Ph=h,lt=Bn(c.firstChild)):lt=h),Ht(n,a,a.pendingProps.children,i),Ec(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&He&&((h=c=lt)&&(c=CT(c,a.type,a.pendingProps,In),c!==null?(a.stateNode=c,$t=a,lt=Bn(c.firstChild),In=!1,h=!0):h=!1),h||pa(a)),xe(a),h=a.type,p=a.pendingProps,x=n!==null?n.memoizedProps:null,c=p.children,jh(h,p)?c=null:x!==null&&jh(h,x)&&(a.flags|=32),a.memoizedState!==null&&(h=kf(n,a,$A,null,null,i),Vo._currentValue=h),Ec(n,a),Ht(n,a,c,i),a.child;case 6:return n===null&&He&&((n=i=lt)&&(i=AT(i,a.pendingProps,In),i!==null?(a.stateNode=i,$t=a,lt=null,n=!0):n=!1),n||pa(a)),null;case 13:return kv(n,a,i);case 4:return ee(a,a.stateNode.containerInfo),c=a.pendingProps,n===null?a.child=fs(a,null,c,i):Ht(n,a,c,i),a.child;case 11:return xv(n,a,a.type,a.pendingProps,i);case 7:return Ht(n,a,a.pendingProps,i),a.child;case 8:return Ht(n,a,a.pendingProps.children,i),a.child;case 12:return Ht(n,a,a.pendingProps.children,i),a.child;case 10:return c=a.pendingProps,ga(a,a.type,c.value),Ht(n,a,c.children,i),a.child;case 9:return h=a.type._context,c=a.pendingProps.children,ls(a),h=Bt(h),c=c(h),a.flags|=1,Ht(n,a,c,i),a.child;case 14:return _v(n,a,a.type,a.pendingProps,i);case 15:return Sv(n,a,a.type,a.pendingProps,i);case 19:return Ov(n,a,i);case 31:return YA(n,a,i);case 22:return Ev(n,a,i,a.pendingProps);case 24:return ls(a),c=Bt(Et),n===null?(h=wf(),h===null&&(h=at,p=vf(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=i),h=p),a.memoizedState={parent:c,cache:h},_f(a),ga(a,Et,h)):((n.lanes&i)!==0&&(Sf(n,a),Eo(a,null,null,i),So()),h=n.memoizedState,p=a.memoizedState,h.parent!==c?(h={parent:c,cache:c},a.memoizedState=h,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=h),ga(a,Et,c)):(c=p.cache,ga(a,Et,c),c!==h.cache&&yf(a,[Et],i,!0))),Ht(n,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function Br(n){n.flags|=4}function ah(n,a,i,c,h){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(h&335544128)===h)if(n.stateNode.complete)n.flags|=8192;else if(ib())n.flags|=8192;else throw ds=cc,xf}else n.flags&=-16777217}function Dv(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Wb(a))if(ib())n.flags|=8192;else throw ds=cc,xf}function Ac(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Xt():536870912,n.lanes|=a,hi|=a)}function ko(n,a){if(!He)switch(n.tailMode){case"hidden":a=n.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function ct(n){var a=n.alternate!==null&&n.alternate.child===n.child,i=0,c=0;if(a)for(var h=n.child;h!==null;)i|=h.lanes|h.childLanes,c|=h.subtreeFlags&65011712,c|=h.flags&65011712,h.return=n,h=h.sibling;else for(h=n.child;h!==null;)i|=h.lanes|h.childLanes,c|=h.subtreeFlags,c|=h.flags,h.return=n,h=h.sibling;return n.subtreeFlags|=c,n.childLanes=i,a}function XA(n,a,i){var c=a.pendingProps;switch(ff(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(a),null;case 1:return ct(a),null;case 3:return i=a.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),zr(Et),ae(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(ei(a)?Br(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,mf())),ct(a),null;case 26:var h=a.type,p=a.memoizedState;return n===null?(Br(a),p!==null?(ct(a),Dv(a,p)):(ct(a),ah(a,h,null,c,i))):p?p!==n.memoizedState?(Br(a),ct(a),Dv(a,p)):(ct(a),a.flags&=-16777217):(n=n.memoizedProps,n!==c&&Br(a),ct(a),ah(a,h,n,c,i)),null;case 27:if(Ee(a),i=Z.current,h=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&Br(a);else{if(!c){if(a.stateNode===null)throw Error(s(166));return ct(a),null}n=Y.current,ei(a)?hy(a):(n=Bb(h,c,i),a.stateNode=n,Br(a))}return ct(a),null;case 5:if(Ee(a),h=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&Br(a);else{if(!c){if(a.stateNode===null)throw Error(s(166));return ct(a),null}if(p=Y.current,ei(a))hy(a);else{var x=Bc(Z.current);switch(p){case 1:p=x.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=x.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=x.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=x.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=x.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof c.is=="string"?x.createElement("select",{is:c.is}):x.createElement("select"),c.multiple?p.multiple=!0:c.size&&(p.size=c.size);break;default:p=typeof c.is=="string"?x.createElement(h,{is:c.is}):x.createElement(h)}}p[It]=a,p[on]=c;e:for(x=a.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===a)break e;for(;x.sibling===null;){if(x.return===null||x.return===a)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}a.stateNode=p;e:switch(qt(p,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Br(a)}}return ct(a),ah(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,i),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&Br(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(s(166));if(n=Z.current,ei(a)){if(n=a.stateNode,i=a.memoizedProps,c=null,h=$t,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}n[It]=a,n=!!(n.nodeValue===i||c!==null&&c.suppressHydrationWarning===!0||kb(n.nodeValue,i)),n||pa(a,!0)}else n=Bc(n).createTextNode(c),n[It]=a,a.stateNode=n}return ct(a),null;case 31:if(i=a.memoizedState,n===null||n.memoizedState!==null){if(c=ei(a),i!==null){if(n===null){if(!c)throw Error(s(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[It]=a}else is(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;ct(a),n=!1}else i=mf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return a.flags&256?(Cn(a),a):(Cn(a),null);if((a.flags&128)!==0)throw Error(s(558))}return ct(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=ei(a),c!==null&&c.dehydrated!==null){if(n===null){if(!h)throw Error(s(318));if(h=a.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));h[It]=a}else is(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;ct(a),h=!1}else h=mf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return a.flags&256?(Cn(a),a):(Cn(a),null)}return Cn(a),(a.flags&128)!==0?(a.lanes=i,a):(i=c!==null,n=n!==null&&n.memoizedState!==null,i&&(c=a.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==h&&(c.flags|=2048)),i!==n&&i&&(a.child.flags|=8192),Ac(a,a.updateQueue),ct(a),null);case 4:return ae(),n===null&&Ah(a.stateNode.containerInfo),ct(a),null;case 10:return zr(a.type),ct(a),null;case 19:if(j(_t),c=a.memoizedState,c===null)return ct(a),null;if(h=(a.flags&128)!==0,p=c.rendering,p===null)if(h)ko(c,!1);else{if(bt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(p=hc(n),p!==null){for(a.flags|=128,ko(c,!1),n=p.updateQueue,a.updateQueue=n,Ac(a,n),a.subtreeFlags=0,n=i,i=a.child;i!==null;)ly(i,n),i=i.sibling;return I(_t,_t.current&1|2),He&&Lr(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&ht()>jc&&(a.flags|=128,h=!0,ko(c,!1),a.lanes=4194304)}else{if(!h)if(n=hc(p),n!==null){if(a.flags|=128,h=!0,n=n.updateQueue,a.updateQueue=n,Ac(a,n),ko(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!He)return ct(a),null}else 2*ht()-c.renderingStartTime>jc&&i!==536870912&&(a.flags|=128,h=!0,ko(c,!1),a.lanes=4194304);c.isBackwards?(p.sibling=a.child,a.child=p):(n=c.last,n!==null?n.sibling=p:a.child=p,c.last=p)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=ht(),n.sibling=null,i=_t.current,I(_t,h?i&1|2:i&1),He&&Lr(a,c.treeForkCount),n):(ct(a),null);case 22:case 23:return Cn(a),Tf(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(i&536870912)!==0&&(a.flags&128)===0&&(ct(a),a.subtreeFlags&6&&(a.flags|=8192)):ct(a),i=a.updateQueue,i!==null&&Ac(a,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==i&&(a.flags|=2048),n!==null&&j(cs),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),zr(Et),ct(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function JA(n,a){switch(ff(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return zr(Et),ae(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Ee(a),null;case 31:if(a.memoizedState!==null){if(Cn(a),a.alternate===null)throw Error(s(340));is()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(Cn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(s(340));is()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return j(_t),null;case 4:return ae(),null;case 10:return zr(a.type),null;case 22:case 23:return Cn(a),Tf(),n!==null&&j(cs),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return zr(Et),null;case 25:return null;default:return null}}function Lv(n,a){switch(ff(a),a.tag){case 3:zr(Et),ae();break;case 26:case 27:case 5:Ee(a);break;case 4:ae();break;case 31:a.memoizedState!==null&&Cn(a);break;case 13:Cn(a);break;case 19:j(_t);break;case 10:zr(a.type);break;case 22:case 23:Cn(a),Tf(),n!==null&&j(cs);break;case 24:zr(Et)}}function jo(n,a){try{var i=a.updateQueue,c=i!==null?i.lastEffect:null;if(c!==null){var h=c.next;i=h;do{if((i.tag&n)===n){c=void 0;var p=i.create,x=i.inst;c=p(),x.destroy=c}i=i.next}while(i!==h)}}catch(T){Qe(a,a.return,T)}}function _a(n,a,i){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var p=h.next;c=p;do{if((c.tag&n)===n){var x=c.inst,T=x.destroy;if(T!==void 0){x.destroy=void 0,h=a;var O=i,H=T;try{H()}catch(Q){Qe(h,O,Q)}}}c=c.next}while(c!==p)}}catch(Q){Qe(a,a.return,Q)}}function Pv(n){var a=n.updateQueue;if(a!==null){var i=n.stateNode;try{Ay(a,i)}catch(c){Qe(n,n.return,c)}}}function zv(n,a,i){i.props=ms(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(c){Qe(n,a,c)}}function Oo(n,a){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof i=="function"?n.refCleanup=i(c):i.current=c}}catch(h){Qe(n,a,h)}}function pr(n,a){var i=n.ref,c=n.refCleanup;if(i!==null)if(typeof c=="function")try{c()}catch(h){Qe(n,a,h)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(h){Qe(n,a,h)}else i.current=null}function Uv(n){var a=n.type,i=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&c.focus();break e;case"img":i.src?c.src=i.src:i.srcSet&&(c.srcset=i.srcSet)}}catch(h){Qe(n,n.return,h)}}function sh(n,a,i){try{var c=n.stateNode;bT(c,n.type,i,a),c[on]=a}catch(h){Qe(n,n.return,h)}}function Iv(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Na(n.type)||n.tag===4}function ih(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Iv(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Na(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function oh(n,a,i){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(n),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=Or));else if(c!==4&&(c===27&&Na(n.type)&&(i=n.stateNode,a=null),n=n.child,n!==null))for(oh(n,a,i),n=n.sibling;n!==null;)oh(n,a,i),n=n.sibling}function Tc(n,a,i){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?i.insertBefore(n,a):i.appendChild(n);else if(c!==4&&(c===27&&Na(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(Tc(n,a,i),n=n.sibling;n!==null;)Tc(n,a,i),n=n.sibling}function $v(n){var a=n.stateNode,i=n.memoizedProps;try{for(var c=n.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);qt(a,c,i),a[It]=n,a[on]=i}catch(p){Qe(n,n.return,p)}}var Hr=!1,Tt=!1,lh=!1,Bv=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function QA(n,a){if(n=n.containerInfo,Nh=Yc,n=Zg(n),ef(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var h=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{i.nodeType,p.nodeType}catch{i=null;break e}var x=0,T=-1,O=-1,H=0,Q=0,re=n,G=null;t:for(;;){for(var W;re!==i||h!==0&&re.nodeType!==3||(T=x+h),re!==p||c!==0&&re.nodeType!==3||(O=x+c),re.nodeType===3&&(x+=re.nodeValue.length),(W=re.firstChild)!==null;)G=re,re=W;for(;;){if(re===n)break t;if(G===i&&++H===h&&(T=x),G===p&&++Q===c&&(O=x),(W=re.nextSibling)!==null)break;re=G,G=re.parentNode}re=W}i=T===-1||O===-1?null:{start:T,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(kh={focusedElem:n,selectionRange:i},Yc=!1,Pt=a;Pt!==null;)if(a=Pt,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Pt=n;else for(;Pt!==null;){switch(a=Pt,p=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(i=0;i<n.length;i++)h=n[i],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&p!==null){n=void 0,i=a,h=p.memoizedProps,p=p.memoizedState,c=i.stateNode;try{var ve=ms(i.type,h);n=c.getSnapshotBeforeUpdate(ve,p),c.__reactInternalSnapshotBeforeUpdate=n}catch(Re){Qe(i,i.return,Re)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,i=n.nodeType,i===9)Mh(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Mh(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=a.sibling,n!==null){n.return=a.return,Pt=n;break}Pt=a.return}}function Hv(n,a,i){var c=i.flags;switch(i.tag){case 0:case 11:case 15:Vr(n,i),c&4&&jo(5,i);break;case 1:if(Vr(n,i),c&4)if(n=i.stateNode,a===null)try{n.componentDidMount()}catch(x){Qe(i,i.return,x)}else{var h=ms(i.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(h,a,n.__reactInternalSnapshotBeforeUpdate)}catch(x){Qe(i,i.return,x)}}c&64&&Pv(i),c&512&&Oo(i,i.return);break;case 3:if(Vr(n,i),c&64&&(n=i.updateQueue,n!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{Ay(n,a)}catch(x){Qe(i,i.return,x)}}break;case 27:a===null&&c&4&&$v(i);case 26:case 5:Vr(n,i),a===null&&c&4&&Uv(i),c&512&&Oo(i,i.return);break;case 12:Vr(n,i);break;case 31:Vr(n,i),c&4&&Gv(n,i);break;case 13:Vr(n,i),c&4&&Fv(n,i),c&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=oT.bind(null,i),TT(n,i))));break;case 22:if(c=i.memoizedState!==null||Hr,!c){a=a!==null&&a.memoizedState!==null||Tt,h=Hr;var p=Tt;Hr=c,(Tt=a)&&!p?Gr(n,i,(i.subtreeFlags&8772)!==0):Vr(n,i),Hr=h,Tt=p}break;case 30:break;default:Vr(n,i)}}function qv(n){var a=n.alternate;a!==null&&(n.alternate=null,qv(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&zd(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var ft=null,cn=!1;function qr(n,a,i){for(i=i.child;i!==null;)Vv(n,a,i),i=i.sibling}function Vv(n,a,i){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(fr,i)}catch{}switch(i.tag){case 26:Tt||pr(i,a),qr(n,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Tt||pr(i,a);var c=ft,h=cn;Na(i.type)&&(ft=i.stateNode,cn=!1),qr(n,a,i),Bo(i.stateNode),ft=c,cn=h;break;case 5:Tt||pr(i,a);case 6:if(c=ft,h=cn,ft=null,qr(n,a,i),ft=c,cn=h,ft!==null)if(cn)try{(ft.nodeType===9?ft.body:ft.nodeName==="HTML"?ft.ownerDocument.body:ft).removeChild(i.stateNode)}catch(p){Qe(i,a,p)}else try{ft.removeChild(i.stateNode)}catch(p){Qe(i,a,p)}break;case 18:ft!==null&&(cn?(n=ft,Pb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),xi(n)):Pb(ft,i.stateNode));break;case 4:c=ft,h=cn,ft=i.stateNode.containerInfo,cn=!0,qr(n,a,i),ft=c,cn=h;break;case 0:case 11:case 14:case 15:_a(2,i,a),Tt||_a(4,i,a),qr(n,a,i);break;case 1:Tt||(pr(i,a),c=i.stateNode,typeof c.componentWillUnmount=="function"&&zv(i,a,c)),qr(n,a,i);break;case 21:qr(n,a,i);break;case 22:Tt=(c=Tt)||i.memoizedState!==null,qr(n,a,i),Tt=c;break;default:qr(n,a,i)}}function Gv(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{xi(n)}catch(i){Qe(a,a.return,i)}}}function Fv(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{xi(n)}catch(i){Qe(a,a.return,i)}}function ZA(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new Bv),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new Bv),a;default:throw Error(s(435,n.tag))}}function Rc(n,a){var i=ZA(n);a.forEach(function(c){if(!i.has(c)){i.add(c);var h=lT.bind(null,n,c);c.then(h,h)}})}function un(n,a){var i=a.deletions;if(i!==null)for(var c=0;c<i.length;c++){var h=i[c],p=n,x=a,T=x;e:for(;T!==null;){switch(T.tag){case 27:if(Na(T.type)){ft=T.stateNode,cn=!1;break e}break;case 5:ft=T.stateNode,cn=!1;break e;case 3:case 4:ft=T.stateNode.containerInfo,cn=!0;break e}T=T.return}if(ft===null)throw Error(s(160));Vv(p,x,h),ft=null,cn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Kv(a,n),a=a.sibling}var Xn=null;function Kv(n,a){var i=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:un(a,n),dn(n),c&4&&(_a(3,n,n.return),jo(3,n),_a(5,n,n.return));break;case 1:un(a,n),dn(n),c&512&&(Tt||i===null||pr(i,i.return)),c&64&&Hr&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?c:i.concat(c))));break;case 26:var h=Xn;if(un(a,n),dn(n),c&512&&(Tt||i===null||pr(i,i.return)),c&4){var p=i!==null?i.memoizedState:null;if(c=n.memoizedState,i===null)if(c===null)if(n.stateNode===null){e:{c=n.type,i=n.memoizedProps,h=h.ownerDocument||h;t:switch(c){case"title":p=h.getElementsByTagName("title")[0],(!p||p[ao]||p[It]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(c),h.head.insertBefore(p,h.querySelector("head > title"))),qt(p,c,i),p[It]=n,Lt(p),c=p;break e;case"link":var x=Kb("link","href",h).get(c+(i.href||""));if(x){for(var T=0;T<x.length;T++)if(p=x[T],p.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&p.getAttribute("rel")===(i.rel==null?null:i.rel)&&p.getAttribute("title")===(i.title==null?null:i.title)&&p.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){x.splice(T,1);break t}}p=h.createElement(c),qt(p,c,i),h.head.appendChild(p);break;case"meta":if(x=Kb("meta","content",h).get(c+(i.content||""))){for(T=0;T<x.length;T++)if(p=x[T],p.getAttribute("content")===(i.content==null?null:""+i.content)&&p.getAttribute("name")===(i.name==null?null:i.name)&&p.getAttribute("property")===(i.property==null?null:i.property)&&p.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&p.getAttribute("charset")===(i.charSet==null?null:i.charSet)){x.splice(T,1);break t}}p=h.createElement(c),qt(p,c,i),h.head.appendChild(p);break;default:throw Error(s(468,c))}p[It]=n,Lt(p),c=p}n.stateNode=c}else Yb(h,n.type,n.stateNode);else n.stateNode=Fb(h,c,n.memoizedProps);else p!==c?(p===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):p.count--,c===null?Yb(h,n.type,n.stateNode):Fb(h,c,n.memoizedProps)):c===null&&n.stateNode!==null&&sh(n,n.memoizedProps,i.memoizedProps)}break;case 27:un(a,n),dn(n),c&512&&(Tt||i===null||pr(i,i.return)),i!==null&&c&4&&sh(n,n.memoizedProps,i.memoizedProps);break;case 5:if(un(a,n),dn(n),c&512&&(Tt||i===null||pr(i,i.return)),n.flags&32){h=n.stateNode;try{Vs(h,"")}catch(ve){Qe(n,n.return,ve)}}c&4&&n.stateNode!=null&&(h=n.memoizedProps,sh(n,h,i!==null?i.memoizedProps:h)),c&1024&&(lh=!0);break;case 6:if(un(a,n),dn(n),c&4){if(n.stateNode===null)throw Error(s(162));c=n.memoizedProps,i=n.stateNode;try{i.nodeValue=c}catch(ve){Qe(n,n.return,ve)}}break;case 3:if(Vc=null,h=Xn,Xn=Hc(a.containerInfo),un(a,n),Xn=h,dn(n),c&4&&i!==null&&i.memoizedState.isDehydrated)try{xi(a.containerInfo)}catch(ve){Qe(n,n.return,ve)}lh&&(lh=!1,Yv(n));break;case 4:c=Xn,Xn=Hc(n.stateNode.containerInfo),un(a,n),dn(n),Xn=c;break;case 12:un(a,n),dn(n);break;case 31:un(a,n),dn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Rc(n,c)));break;case 13:un(a,n),dn(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(kc=ht()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Rc(n,c)));break;case 22:h=n.memoizedState!==null;var O=i!==null&&i.memoizedState!==null,H=Hr,Q=Tt;if(Hr=H||h,Tt=Q||O,un(a,n),Tt=Q,Hr=H,dn(n),c&8192)e:for(a=n.stateNode,a._visibility=h?a._visibility&-2:a._visibility|1,h&&(i===null||O||Hr||Tt||ps(n)),i=null,a=n;;){if(a.tag===5||a.tag===26){if(i===null){O=i=a;try{if(p=O.stateNode,h)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{T=O.stateNode;var re=O.memoizedProps.style,G=re!=null&&re.hasOwnProperty("display")?re.display:null;T.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(ve){Qe(O,O.return,ve)}}}else if(a.tag===6){if(i===null){O=a;try{O.stateNode.nodeValue=h?"":O.memoizedProps}catch(ve){Qe(O,O.return,ve)}}}else if(a.tag===18){if(i===null){O=a;try{var W=O.stateNode;h?zb(W,!0):zb(O.stateNode,!1)}catch(ve){Qe(O,O.return,ve)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=n.updateQueue,c!==null&&(i=c.retryQueue,i!==null&&(c.retryQueue=null,Rc(n,i))));break;case 19:un(a,n),dn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Rc(n,c)));break;case 30:break;case 21:break;default:un(a,n),dn(n)}}function dn(n){var a=n.flags;if(a&2){try{for(var i,c=n.return;c!==null;){if(Iv(c)){i=c;break}c=c.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var h=i.stateNode,p=ih(n);Tc(n,p,h);break;case 5:var x=i.stateNode;i.flags&32&&(Vs(x,""),i.flags&=-33);var T=ih(n);Tc(n,T,x);break;case 3:case 4:var O=i.stateNode.containerInfo,H=ih(n);oh(n,H,O);break;default:throw Error(s(161))}}catch(Q){Qe(n,n.return,Q)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function Yv(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Yv(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function Vr(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Hv(n,a.alternate,a),a=a.sibling}function ps(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:_a(4,a,a.return),ps(a);break;case 1:pr(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&zv(a,a.return,i),ps(a);break;case 27:Bo(a.stateNode);case 26:case 5:pr(a,a.return),ps(a);break;case 22:a.memoizedState===null&&ps(a);break;case 30:ps(a);break;default:ps(a)}n=n.sibling}}function Gr(n,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,h=n,p=a,x=p.flags;switch(p.tag){case 0:case 11:case 15:Gr(h,p,i),jo(4,p);break;case 1:if(Gr(h,p,i),c=p,h=c.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(H){Qe(c,c.return,H)}if(c=p,h=c.updateQueue,h!==null){var T=c.stateNode;try{var O=h.shared.hiddenCallbacks;if(O!==null)for(h.shared.hiddenCallbacks=null,h=0;h<O.length;h++)Cy(O[h],T)}catch(H){Qe(c,c.return,H)}}i&&x&64&&Pv(p),Oo(p,p.return);break;case 27:$v(p);case 26:case 5:Gr(h,p,i),i&&c===null&&x&4&&Uv(p),Oo(p,p.return);break;case 12:Gr(h,p,i);break;case 31:Gr(h,p,i),i&&x&4&&Gv(h,p);break;case 13:Gr(h,p,i),i&&x&4&&Fv(h,p);break;case 22:p.memoizedState===null&&Gr(h,p,i),Oo(p,p.return);break;case 30:break;default:Gr(h,p,i)}a=a.sibling}}function ch(n,a){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&vo(i))}function uh(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&vo(n))}function Jn(n,a,i,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Wv(n,a,i,c),a=a.sibling}function Wv(n,a,i,c){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Jn(n,a,i,c),h&2048&&jo(9,a);break;case 1:Jn(n,a,i,c);break;case 3:Jn(n,a,i,c),h&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&vo(n)));break;case 12:if(h&2048){Jn(n,a,i,c),n=a.stateNode;try{var p=a.memoizedProps,x=p.id,T=p.onPostCommit;typeof T=="function"&&T(x,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(O){Qe(a,a.return,O)}}else Jn(n,a,i,c);break;case 31:Jn(n,a,i,c);break;case 13:Jn(n,a,i,c);break;case 23:break;case 22:p=a.stateNode,x=a.alternate,a.memoizedState!==null?p._visibility&2?Jn(n,a,i,c):Mo(n,a):p._visibility&2?Jn(n,a,i,c):(p._visibility|=2,ui(n,a,i,c,(a.subtreeFlags&10256)!==0||!1)),h&2048&&ch(x,a);break;case 24:Jn(n,a,i,c),h&2048&&uh(a.alternate,a);break;default:Jn(n,a,i,c)}}function ui(n,a,i,c,h){for(h=h&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var p=n,x=a,T=i,O=c,H=x.flags;switch(x.tag){case 0:case 11:case 15:ui(p,x,T,O,h),jo(8,x);break;case 23:break;case 22:var Q=x.stateNode;x.memoizedState!==null?Q._visibility&2?ui(p,x,T,O,h):Mo(p,x):(Q._visibility|=2,ui(p,x,T,O,h)),h&&H&2048&&ch(x.alternate,x);break;case 24:ui(p,x,T,O,h),h&&H&2048&&uh(x.alternate,x);break;default:ui(p,x,T,O,h)}a=a.sibling}}function Mo(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=n,c=a,h=c.flags;switch(c.tag){case 22:Mo(i,c),h&2048&&ch(c.alternate,c);break;case 24:Mo(i,c),h&2048&&uh(c.alternate,c);break;default:Mo(i,c)}a=a.sibling}}var Do=8192;function di(n,a,i){if(n.subtreeFlags&Do)for(n=n.child;n!==null;)Xv(n,a,i),n=n.sibling}function Xv(n,a,i){switch(n.tag){case 26:di(n,a,i),n.flags&Do&&n.memoizedState!==null&&IT(i,Xn,n.memoizedState,n.memoizedProps);break;case 5:di(n,a,i);break;case 3:case 4:var c=Xn;Xn=Hc(n.stateNode.containerInfo),di(n,a,i),Xn=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Do,Do=16777216,di(n,a,i),Do=c):di(n,a,i));break;default:di(n,a,i)}}function Jv(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Lo(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var c=a[i];Pt=c,Zv(c,n)}Jv(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Qv(n),n=n.sibling}function Qv(n){switch(n.tag){case 0:case 11:case 15:Lo(n),n.flags&2048&&_a(9,n,n.return);break;case 3:Lo(n);break;case 12:Lo(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Nc(n)):Lo(n);break;default:Lo(n)}}function Nc(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var c=a[i];Pt=c,Zv(c,n)}Jv(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:_a(8,a,a.return),Nc(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,Nc(a));break;default:Nc(a)}n=n.sibling}}function Zv(n,a){for(;Pt!==null;){var i=Pt;switch(i.tag){case 0:case 11:case 15:_a(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var c=i.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:vo(i.memoizedState.cache)}if(c=i.child,c!==null)c.return=i,Pt=c;else e:for(i=n;Pt!==null;){c=Pt;var h=c.sibling,p=c.return;if(qv(c),c===i){Pt=null;break e}if(h!==null){h.return=p,Pt=h;break e}Pt=p}}}var eT={getCacheForType:function(n){var a=Bt(Et),i=a.data.get(n);return i===void 0&&(i=n(),a.data.set(n,i)),i},cacheSignal:function(){return Bt(Et).controller.signal}},tT=typeof WeakMap=="function"?WeakMap:Map,We=0,at=null,ze=null,Ie=0,Je=0,An=null,Sa=!1,fi=!1,dh=!1,Fr=0,bt=0,Ea=0,gs=0,fh=0,Tn=0,hi=0,Po=null,fn=null,hh=!1,kc=0,eb=0,jc=1/0,Oc=null,Ca=null,Nt=0,Aa=null,mi=null,Kr=0,mh=0,ph=null,tb=null,zo=0,gh=null;function Rn(){return(We&2)!==0&&Ie!==0?Ie&-Ie:M.T!==null?_h():Ld()}function nb(){if(Tn===0)if((Ie&536870912)===0||He){var n=Ye;Ye<<=1,(Ye&3932160)===0&&(Ye=262144),Tn=n}else Tn=536870912;return n=En.current,n!==null&&(n.flags|=32),Tn}function hn(n,a,i){(n===at&&(Je===2||Je===9)||n.cancelPendingCommit!==null)&&(pi(n,0),Ta(n,Ie,Tn,!1)),mt(n,i),((We&2)===0||n!==at)&&(n===at&&((We&2)===0&&(gs|=i),bt===4&&Ta(n,Ie,Tn,!1)),gr(n))}function rb(n,a,i){if((We&6)!==0)throw Error(s(327));var c=!i&&(a&127)===0&&(a&n.expiredLanes)===0||dt(n,a),h=c?aT(n,a):vh(n,a,!0),p=c;do{if(h===0){fi&&!c&&Ta(n,a,0,!1);break}else{if(i=n.current.alternate,p&&!nT(i)){h=vh(n,a,!1),p=!1;continue}if(h===2){if(p=a,n.errorRecoveryDisabledLanes&p)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){a=x;e:{var T=n;h=Po;var O=T.current.memoizedState.isDehydrated;if(O&&(pi(T,x).flags|=256),x=vh(T,x,!1),x!==2){if(dh&&!O){T.errorRecoveryDisabledLanes|=p,gs|=p,h=4;break e}p=fn,fn=h,p!==null&&(fn===null?fn=p:fn.push.apply(fn,p))}h=x}if(p=!1,h!==2)continue}}if(h===1){pi(n,0),Ta(n,a,0,!0);break}e:{switch(c=n,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:Ta(c,a,Tn,!Sa);break e;case 2:fn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(h=kc+300-ht(),10<h)){if(Ta(c,a,Tn,!Sa),ke(c,0,!0)!==0)break e;Kr=a,c.timeoutHandle=Db(ab.bind(null,c,i,fn,Oc,hh,a,Tn,gs,hi,Sa,p,"Throttled",-0,0),h);break e}ab(c,i,fn,Oc,hh,a,Tn,gs,hi,Sa,p,null,-0,0)}}break}while(!0);gr(n)}function ab(n,a,i,c,h,p,x,T,O,H,Q,re,G,W){if(n.timeoutHandle=-1,re=a.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Or},Xv(a,p,re);var ve=(p&62914560)===p?kc-ht():(p&4194048)===p?eb-ht():0;if(ve=$T(re,ve),ve!==null){Kr=p,n.cancelPendingCommit=ve(fb.bind(null,n,a,p,i,c,h,x,T,O,Q,re,null,G,W)),Ta(n,p,x,!H);return}}fb(n,a,p,i,c,h,x,T,O)}function nT(n){for(var a=n;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var c=0;c<i.length;c++){var h=i[c],p=h.getSnapshot;h=h.value;try{if(!_n(p(),h))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ta(n,a,i,c){a&=~fh,a&=~gs,n.suspendedLanes|=a,n.pingedLanes&=~a,c&&(n.warmLanes|=a),c=n.expirationTimes;for(var h=a;0<h;){var p=31-Mt(h),x=1<<p;c[p]=-1,h&=~x}i!==0&&Za(n,i,a)}function Mc(){return(We&6)===0?(Uo(0),!1):!0}function yh(){if(ze!==null){if(Je===0)var n=ze.return;else n=ze,Pr=os=null,Mf(n),si=null,wo=0,n=ze;for(;n!==null;)Lv(n.alternate,n),n=n.return;ze=null}}function pi(n,a){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,_T(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Kr=0,yh(),at=n,ze=i=Dr(n.current,null),Ie=a,Je=0,An=null,Sa=!1,fi=dt(n,a),dh=!1,hi=Tn=fh=gs=Ea=bt=0,fn=Po=null,hh=!1,(a&8)!==0&&(a|=a&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=a;0<c;){var h=31-Mt(c),p=1<<h;a|=n[h],c&=~p}return Fr=a,ec(),i}function sb(n,a){Me=null,M.H=Ro,a===ai||a===lc?(a=xy(),Je=3):a===xf?(a=xy(),Je=4):Je=a===Wf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,An=a,ze===null&&(bt=1,_c(n,Pn(a,n.current)))}function ib(){var n=En.current;return n===null?!0:(Ie&4194048)===Ie?$n===null:(Ie&62914560)===Ie||(Ie&536870912)!==0?n===$n:!1}function ob(){var n=M.H;return M.H=Ro,n===null?Ro:n}function lb(){var n=M.A;return M.A=eT,n}function Dc(){bt=4,Sa||(Ie&4194048)!==Ie&&En.current!==null||(fi=!0),(Ea&134217727)===0&&(gs&134217727)===0||at===null||Ta(at,Ie,Tn,!1)}function vh(n,a,i){var c=We;We|=2;var h=ob(),p=lb();(at!==n||Ie!==a)&&(Oc=null,pi(n,a)),a=!1;var x=bt;e:do try{if(Je!==0&&ze!==null){var T=ze,O=An;switch(Je){case 8:yh(),x=6;break e;case 3:case 2:case 9:case 6:En.current===null&&(a=!0);var H=Je;if(Je=0,An=null,gi(n,T,O,H),i&&fi){x=0;break e}break;default:H=Je,Je=0,An=null,gi(n,T,O,H)}}rT(),x=bt;break}catch(Q){sb(n,Q)}while(!0);return a&&n.shellSuspendCounter++,Pr=os=null,We=c,M.H=h,M.A=p,ze===null&&(at=null,Ie=0,ec()),x}function rT(){for(;ze!==null;)cb(ze)}function aT(n,a){var i=We;We|=2;var c=ob(),h=lb();at!==n||Ie!==a?(Oc=null,jc=ht()+500,pi(n,a)):fi=dt(n,a);e:do try{if(Je!==0&&ze!==null){a=ze;var p=An;t:switch(Je){case 1:Je=0,An=null,gi(n,a,p,1);break;case 2:case 9:if(by(p)){Je=0,An=null,ub(a);break}a=function(){Je!==2&&Je!==9||at!==n||(Je=7),gr(n)},p.then(a,a);break e;case 3:Je=7;break e;case 4:Je=5;break e;case 7:by(p)?(Je=0,An=null,ub(a)):(Je=0,An=null,gi(n,a,p,7));break;case 5:var x=null;switch(ze.tag){case 26:x=ze.memoizedState;case 5:case 27:var T=ze;if(x?Wb(x):T.stateNode.complete){Je=0,An=null;var O=T.sibling;if(O!==null)ze=O;else{var H=T.return;H!==null?(ze=H,Lc(H)):ze=null}break t}}Je=0,An=null,gi(n,a,p,5);break;case 6:Je=0,An=null,gi(n,a,p,6);break;case 8:yh(),bt=6;break e;default:throw Error(s(462))}}sT();break}catch(Q){sb(n,Q)}while(!0);return Pr=os=null,M.H=c,M.A=h,We=i,ze!==null?0:(at=null,Ie=0,ec(),bt)}function sT(){for(;ze!==null&&!ot();)cb(ze)}function cb(n){var a=Mv(n.alternate,n,Fr);n.memoizedProps=n.pendingProps,a===null?Lc(n):ze=a}function ub(n){var a=n,i=a.alternate;switch(a.tag){case 15:case 0:a=Tv(i,a,a.pendingProps,a.type,void 0,Ie);break;case 11:a=Tv(i,a,a.pendingProps,a.type.render,a.ref,Ie);break;case 5:Mf(a);default:Lv(i,a),a=ze=ly(a,Fr),a=Mv(i,a,Fr)}n.memoizedProps=n.pendingProps,a===null?Lc(n):ze=a}function gi(n,a,i,c){Pr=os=null,Mf(a),si=null,wo=0;var h=a.return;try{if(KA(n,h,a,i,Ie)){bt=1,_c(n,Pn(i,n.current)),ze=null;return}}catch(p){if(h!==null)throw ze=h,p;bt=1,_c(n,Pn(i,n.current)),ze=null;return}a.flags&32768?(He||c===1?n=!0:fi||(Ie&536870912)!==0?n=!1:(Sa=n=!0,(c===2||c===9||c===3||c===6)&&(c=En.current,c!==null&&c.tag===13&&(c.flags|=16384))),db(a,n)):Lc(a)}function Lc(n){var a=n;do{if((a.flags&32768)!==0){db(a,Sa);return}n=a.return;var i=XA(a.alternate,a,Fr);if(i!==null){ze=i;return}if(a=a.sibling,a!==null){ze=a;return}ze=a=n}while(a!==null);bt===0&&(bt=5)}function db(n,a){do{var i=JA(n.alternate,n);if(i!==null){i.flags&=32767,ze=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(n=n.sibling,n!==null)){ze=n;return}ze=n=i}while(n!==null);bt=6,ze=null}function fb(n,a,i,c,h,p,x,T,O){n.cancelPendingCommit=null;do Pc();while(Nt!==0);if((We&6)!==0)throw Error(s(327));if(a!==null){if(a===n.current)throw Error(s(177));if(p=a.lanes|a.childLanes,p|=sf,rn(n,i,p,x,T,O),n===at&&(ze=at=null,Ie=0),mi=a,Aa=n,Kr=i,mh=p,ph=h,tb=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,cT(dr,function(){return yb(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=M.T,M.T=null,h=K.p,K.p=2,x=We,We|=4;try{QA(n,a,i)}finally{We=x,K.p=h,M.T=c}}Nt=1,hb(),mb(),pb()}}function hb(){if(Nt===1){Nt=0;var n=Aa,a=mi,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=M.T,M.T=null;var c=K.p;K.p=2;var h=We;We|=4;try{Kv(a,n);var p=kh,x=Zg(n.containerInfo),T=p.focusedElem,O=p.selectionRange;if(x!==T&&T&&T.ownerDocument&&Qg(T.ownerDocument.documentElement,T)){if(O!==null&&ef(T)){var H=O.start,Q=O.end;if(Q===void 0&&(Q=H),"selectionStart"in T)T.selectionStart=H,T.selectionEnd=Math.min(Q,T.value.length);else{var re=T.ownerDocument||document,G=re&&re.defaultView||window;if(G.getSelection){var W=G.getSelection(),ve=T.textContent.length,Re=Math.min(O.start,ve),tt=O.end===void 0?Re:Math.min(O.end,ve);!W.extend&&Re>tt&&(x=tt,tt=Re,Re=x);var U=Jg(T,Re),D=Jg(T,tt);if(U&&D&&(W.rangeCount!==1||W.anchorNode!==U.node||W.anchorOffset!==U.offset||W.focusNode!==D.node||W.focusOffset!==D.offset)){var B=re.createRange();B.setStart(U.node,U.offset),W.removeAllRanges(),Re>tt?(W.addRange(B),W.extend(D.node,D.offset)):(B.setEnd(D.node,D.offset),W.addRange(B))}}}}for(re=[],W=T;W=W.parentNode;)W.nodeType===1&&re.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<re.length;T++){var te=re[T];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Yc=!!Nh,kh=Nh=null}finally{We=h,K.p=c,M.T=i}}n.current=a,Nt=2}}function mb(){if(Nt===2){Nt=0;var n=Aa,a=mi,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=M.T,M.T=null;var c=K.p;K.p=2;var h=We;We|=4;try{Hv(n,a.alternate,a)}finally{We=h,K.p=c,M.T=i}}Nt=3}}function pb(){if(Nt===4||Nt===3){Nt=0,rt();var n=Aa,a=mi,i=Kr,c=tb;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Nt=5:(Nt=0,mi=Aa=null,gb(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(Ca=null),Yn(i),a=a.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(fr,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=M.T,h=K.p,K.p=2,M.T=null;try{for(var p=n.onRecoverableError,x=0;x<c.length;x++){var T=c[x];p(T.value,{componentStack:T.stack})}}finally{M.T=a,K.p=h}}(Kr&3)!==0&&Pc(),gr(n),h=n.pendingLanes,(i&261930)!==0&&(h&42)!==0?n===gh?zo++:(zo=0,gh=n):zo=0,Uo(0)}}function gb(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,vo(a)))}function Pc(){return hb(),mb(),pb(),yb()}function yb(){if(Nt!==5)return!1;var n=Aa,a=mh;mh=0;var i=Yn(Kr),c=M.T,h=K.p;try{K.p=32>i?32:i,M.T=null,i=ph,ph=null;var p=Aa,x=Kr;if(Nt=0,mi=Aa=null,Kr=0,(We&6)!==0)throw Error(s(331));var T=We;if(We|=4,Qv(p.current),Wv(p,p.current,x,i),We=T,Uo(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(fr,p)}catch{}return!0}finally{K.p=h,M.T=c,gb(n,a)}}function vb(n,a,i){a=Pn(i,a),a=Yf(n.stateNode,a,2),n=ba(n,a,2),n!==null&&(mt(n,2),gr(n))}function Qe(n,a,i){if(n.tag===3)vb(n,n,i);else for(;a!==null;){if(a.tag===3){vb(a,n,i);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ca===null||!Ca.has(c))){n=Pn(i,n),i=bv(2),c=ba(a,i,2),c!==null&&(wv(i,c,a,n),mt(c,2),gr(c));break}}a=a.return}}function bh(n,a,i){var c=n.pingCache;if(c===null){c=n.pingCache=new tT;var h=new Set;c.set(a,h)}else h=c.get(a),h===void 0&&(h=new Set,c.set(a,h));h.has(i)||(dh=!0,h.add(i),n=iT.bind(null,n,a,i),a.then(n,n))}function iT(n,a,i){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,at===n&&(Ie&i)===i&&(bt===4||bt===3&&(Ie&62914560)===Ie&&300>ht()-kc?(We&2)===0&&pi(n,0):fh|=i,hi===Ie&&(hi=0)),gr(n)}function bb(n,a){a===0&&(a=Xt()),n=as(n,a),n!==null&&(mt(n,a),gr(n))}function oT(n){var a=n.memoizedState,i=0;a!==null&&(i=a.retryLane),bb(n,i)}function lT(n,a){var i=0;switch(n.tag){case 31:case 13:var c=n.stateNode,h=n.memoizedState;h!==null&&(i=h.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(s(314))}c!==null&&c.delete(a),bb(n,i)}function cT(n,a){return cr(n,a)}var zc=null,yi=null,wh=!1,Uc=!1,xh=!1,Ra=0;function gr(n){n!==yi&&n.next===null&&(yi===null?zc=yi=n:yi=yi.next=n),Uc=!0,wh||(wh=!0,dT())}function Uo(n,a){if(!xh&&Uc){xh=!0;do for(var i=!1,c=zc;c!==null;){if(n!==0){var h=c.pendingLanes;if(h===0)var p=0;else{var x=c.suspendedLanes,T=c.pingedLanes;p=(1<<31-Mt(42|n)+1)-1,p&=h&~(x&~T),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(i=!0,Sb(c,p))}else p=Ie,p=ke(c,c===at?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||dt(c,p)||(i=!0,Sb(c,p));c=c.next}while(i);xh=!1}}function uT(){wb()}function wb(){Uc=wh=!1;var n=0;Ra!==0&&xT()&&(n=Ra);for(var a=ht(),i=null,c=zc;c!==null;){var h=c.next,p=xb(c,a);p===0?(c.next=null,i===null?zc=h:i.next=h,h===null&&(yi=i)):(i=c,(n!==0||(p&3)!==0)&&(Uc=!0)),c=h}Nt!==0&&Nt!==5||Uo(n),Ra!==0&&(Ra=0)}function xb(n,a){for(var i=n.suspendedLanes,c=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var x=31-Mt(p),T=1<<x,O=h[x];O===-1?((T&i)===0||(T&c)!==0)&&(h[x]=Dt(T,a)):O<=a&&(n.expiredLanes|=T),p&=~T}if(a=at,i=Ie,i=ke(n,n===a?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,i===0||n===a&&(Je===2||Je===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&Pe(c),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||dt(n,i)){if(a=i&-i,a===n.callbackPriority)return a;switch(c!==null&&Pe(c),Yn(i)){case 2:case 8:i=ur;break;case 32:i=dr;break;case 268435456:i=Fn;break;default:i=dr}return c=_b.bind(null,n),i=cr(i,c),n.callbackPriority=a,n.callbackNode=i,a}return c!==null&&c!==null&&Pe(c),n.callbackPriority=2,n.callbackNode=null,2}function _b(n,a){if(Nt!==0&&Nt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Pc()&&n.callbackNode!==i)return null;var c=Ie;return c=ke(n,n===at?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(rb(n,c,a),xb(n,ht()),n.callbackNode!=null&&n.callbackNode===i?_b.bind(null,n):null)}function Sb(n,a){if(Pc())return null;rb(n,a,!0)}function dT(){ST(function(){(We&6)!==0?cr(Nr,uT):wb()})}function _h(){if(Ra===0){var n=ni;n===0&&(n=Ge,Ge<<=1,(Ge&261888)===0&&(Ge=256)),Ra=n}return Ra}function Eb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Fl(""+n)}function Cb(n,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,n.id&&i.setAttribute("form",n.id),a.parentNode.insertBefore(i,a),n=new FormData(n),i.parentNode.removeChild(i),n}function fT(n,a,i,c,h){if(a==="submit"&&i&&i.stateNode===h){var p=Eb((h[on]||null).action),x=c.submitter;x&&(a=(a=x[on]||null)?Eb(a.formAction):x.getAttribute("formAction"),a!==null&&(p=a,x=null));var T=new Xl("action","action",null,c,h);n.push({event:T,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Ra!==0){var O=x?Cb(h,x):new FormData(h);Hf(i,{pending:!0,data:O,method:h.method,action:p},null,O)}}else typeof p=="function"&&(T.preventDefault(),O=x?Cb(h,x):new FormData(h),Hf(i,{pending:!0,data:O,method:h.method,action:p},p,O))},currentTarget:h}]})}}for(var Sh=0;Sh<af.length;Sh++){var Eh=af[Sh],hT=Eh.toLowerCase(),mT=Eh[0].toUpperCase()+Eh.slice(1);Wn(hT,"on"+mT)}Wn(ny,"onAnimationEnd"),Wn(ry,"onAnimationIteration"),Wn(ay,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(kA,"onTransitionRun"),Wn(jA,"onTransitionStart"),Wn(OA,"onTransitionCancel"),Wn(sy,"onTransitionEnd"),Hs("onMouseEnter",["mouseout","mouseover"]),Hs("onMouseLeave",["mouseout","mouseover"]),Hs("onPointerEnter",["pointerout","pointerover"]),Hs("onPointerLeave",["pointerout","pointerover"]),es("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),es("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),es("onBeforeInput",["compositionend","keypress","textInput","paste"]),es("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),es("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),es("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Io="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(" "),pT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Io));function Ab(n,a){a=(a&4)!==0;for(var i=0;i<n.length;i++){var c=n[i],h=c.event;c=c.listeners;e:{var p=void 0;if(a)for(var x=c.length-1;0<=x;x--){var T=c[x],O=T.instance,H=T.currentTarget;if(T=T.listener,O!==p&&h.isPropagationStopped())break e;p=T,h.currentTarget=H;try{p(h)}catch(Q){Zl(Q)}h.currentTarget=null,p=O}else for(x=0;x<c.length;x++){if(T=c[x],O=T.instance,H=T.currentTarget,T=T.listener,O!==p&&h.isPropagationStopped())break e;p=T,h.currentTarget=H;try{p(h)}catch(Q){Zl(Q)}h.currentTarget=null,p=O}}}}function Ue(n,a){var i=a[Pd];i===void 0&&(i=a[Pd]=new Set);var c=n+"__bubble";i.has(c)||(Tb(a,n,2,!1),i.add(c))}function Ch(n,a,i){var c=0;a&&(c|=4),Tb(i,n,c,a)}var Ic="_reactListening"+Math.random().toString(36).slice(2);function Ah(n){if(!n[Ic]){n[Ic]=!0,wg.forEach(function(i){i!=="selectionchange"&&(pT.has(i)||Ch(i,!1,n),Ch(i,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Ic]||(a[Ic]=!0,Ch("selectionchange",!1,a))}}function Tb(n,a,i,c){switch(n0(a)){case 2:var h=qT;break;case 8:h=VT;break;default:h=Bh}i=h.bind(null,a,i,n),h=void 0,!Gd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(h=!0),c?h!==void 0?n.addEventListener(a,i,{capture:!0,passive:h}):n.addEventListener(a,i,!0):h!==void 0?n.addEventListener(a,i,{passive:h}):n.addEventListener(a,i,!1)}function Th(n,a,i,c,h){var p=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var T=c.stateNode.containerInfo;if(T===h)break;if(x===4)for(x=c.return;x!==null;){var O=x.tag;if((O===3||O===4)&&x.stateNode.containerInfo===h)return;x=x.return}for(;T!==null;){if(x=Is(T),x===null)return;if(O=x.tag,O===5||O===6||O===26||O===27){c=p=x;continue e}T=T.parentNode}}c=c.return}Og(function(){var H=p,Q=qd(i),re=[];e:{var G=iy.get(n);if(G!==void 0){var W=Xl,ve=n;switch(n){case"keypress":if(Yl(i)===0)break e;case"keydown":case"keyup":W=lA;break;case"focusin":ve="focus",W=Wd;break;case"focusout":ve="blur",W=Wd;break;case"beforeblur":case"afterblur":W=Wd;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=Lg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=XC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=dA;break;case ny:case ry:case ay:W=ZC;break;case sy:W=hA;break;case"scroll":case"scrollend":W=YC;break;case"wheel":W=pA;break;case"copy":case"cut":case"paste":W=tA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=zg;break;case"toggle":case"beforetoggle":W=yA}var Re=(a&4)!==0,tt=!Re&&(n==="scroll"||n==="scrollend"),U=Re?G!==null?G+"Capture":null:G;Re=[];for(var D=H,B;D!==null;){var te=D;if(B=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||B===null||U===null||(te=io(D,U),te!=null&&Re.push($o(D,te,B))),tt)break;D=D.return}0<Re.length&&(G=new W(G,ve,null,i,Q),re.push({event:G,listeners:Re}))}}if((a&7)===0){e:{if(G=n==="mouseover"||n==="pointerover",W=n==="mouseout"||n==="pointerout",G&&i!==Hd&&(ve=i.relatedTarget||i.fromElement)&&(Is(ve)||ve[Us]))break e;if((W||G)&&(G=Q.window===Q?Q:(G=Q.ownerDocument)?G.defaultView||G.parentWindow:window,W?(ve=i.relatedTarget||i.toElement,W=H,ve=ve?Is(ve):null,ve!==null&&(tt=l(ve),Re=ve.tag,ve!==tt||Re!==5&&Re!==27&&Re!==6)&&(ve=null)):(W=null,ve=H),W!==ve)){if(Re=Lg,te="onMouseLeave",U="onMouseEnter",D="mouse",(n==="pointerout"||n==="pointerover")&&(Re=zg,te="onPointerLeave",U="onPointerEnter",D="pointer"),tt=W==null?G:so(W),B=ve==null?G:so(ve),G=new Re(te,D+"leave",W,i,Q),G.target=tt,G.relatedTarget=B,te=null,Is(Q)===H&&(Re=new Re(U,D+"enter",ve,i,Q),Re.target=B,Re.relatedTarget=tt,te=Re),tt=te,W&&ve)t:{for(Re=gT,U=W,D=ve,B=0,te=U;te;te=Re(te))B++;te=0;for(var Se=D;Se;Se=Re(Se))te++;for(;0<B-te;)U=Re(U),B--;for(;0<te-B;)D=Re(D),te--;for(;B--;){if(U===D||D!==null&&U===D.alternate){Re=U;break t}U=Re(U),D=Re(D)}Re=null}else Re=null;W!==null&&Rb(re,G,W,Re,!1),ve!==null&&tt!==null&&Rb(re,tt,ve,Re,!0)}}e:{if(G=H?so(H):window,W=G.nodeName&&G.nodeName.toLowerCase(),W==="select"||W==="input"&&G.type==="file")var Fe=Gg;else if(qg(G))if(Fg)Fe=TA;else{Fe=CA;var _e=EA}else W=G.nodeName,!W||W.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?H&&Bd(H.elementType)&&(Fe=Gg):Fe=AA;if(Fe&&(Fe=Fe(n,H))){Vg(re,Fe,i,Q);break e}_e&&_e(n,G,H),n==="focusout"&&H&&G.type==="number"&&H.memoizedProps.value!=null&&$d(G,"number",G.value)}switch(_e=H?so(H):window,n){case"focusin":(qg(_e)||_e.contentEditable==="true")&&(Ys=_e,tf=H,po=null);break;case"focusout":po=tf=Ys=null;break;case"mousedown":nf=!0;break;case"contextmenu":case"mouseup":case"dragend":nf=!1,ey(re,i,Q);break;case"selectionchange":if(NA)break;case"keydown":case"keyup":ey(re,i,Q)}var De;if(Jd)e:{switch(n){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else Ks?Bg(n,i)&&($e="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&($e="onCompositionStart");$e&&(Ug&&i.locale!=="ko"&&(Ks||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Ks&&(De=Mg()):(fa=Q,Fd="value"in fa?fa.value:fa.textContent,Ks=!0)),_e=$c(H,$e),0<_e.length&&($e=new Pg($e,n,null,i,Q),re.push({event:$e,listeners:_e}),De?$e.data=De:(De=Hg(i),De!==null&&($e.data=De)))),(De=bA?wA(n,i):xA(n,i))&&($e=$c(H,"onBeforeInput"),0<$e.length&&(_e=new Pg("onBeforeInput","beforeinput",null,i,Q),re.push({event:_e,listeners:$e}),_e.data=De)),fT(re,n,H,i,Q)}Ab(re,a)})}function $o(n,a,i){return{instance:n,listener:a,currentTarget:i}}function $c(n,a){for(var i=a+"Capture",c=[];n!==null;){var h=n,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=io(n,i),h!=null&&c.unshift($o(n,h,p)),h=io(n,a),h!=null&&c.push($o(n,h,p))),n.tag===3)return c;n=n.return}return[]}function gT(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Rb(n,a,i,c,h){for(var p=a._reactName,x=[];i!==null&&i!==c;){var T=i,O=T.alternate,H=T.stateNode;if(T=T.tag,O!==null&&O===c)break;T!==5&&T!==26&&T!==27||H===null||(O=H,h?(H=io(i,p),H!=null&&x.unshift($o(i,H,O))):h||(H=io(i,p),H!=null&&x.push($o(i,H,O)))),i=i.return}x.length!==0&&n.push({event:a,listeners:x})}var yT=/\r\n?/g,vT=/\u0000|\uFFFD/g;function Nb(n){return(typeof n=="string"?n:""+n).replace(yT,`
`).replace(vT,"")}function kb(n,a){return a=Nb(a),Nb(n)===a}function et(n,a,i,c,h,p){switch(i){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||Vs(n,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&Vs(n,""+c);break;case"className":Vl(n,"class",c);break;case"tabIndex":Vl(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Vl(n,i,c);break;case"style":kg(n,c,p);break;case"data":if(a!=="object"){Vl(n,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||i!=="href")){n.removeAttribute(i);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(i);break}c=Fl(""+c),n.setAttribute(i,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(i==="formAction"?(a!=="input"&&et(n,a,"name",h.name,h,null),et(n,a,"formEncType",h.formEncType,h,null),et(n,a,"formMethod",h.formMethod,h,null),et(n,a,"formTarget",h.formTarget,h,null)):(et(n,a,"encType",h.encType,h,null),et(n,a,"method",h.method,h,null),et(n,a,"target",h.target,h,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(i);break}c=Fl(""+c),n.setAttribute(i,c);break;case"onClick":c!=null&&(n.onclick=Or);break;case"onScroll":c!=null&&Ue("scroll",n);break;case"onScrollEnd":c!=null&&Ue("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(i=c.__html,i!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=i}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){n.removeAttribute("xlink:href");break}i=Fl(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,""+c):n.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":c===!0?n.setAttribute(i,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(i,c):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(i,c):n.removeAttribute(i);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(i):n.setAttribute(i,c);break;case"popover":Ue("beforetoggle",n),Ue("toggle",n),ql(n,"popover",c);break;case"xlinkActuate":jr(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":jr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":jr(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":jr(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":jr(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":jr(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":jr(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":jr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":jr(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":ql(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=FC.get(i)||i,ql(n,i,c))}}function Rh(n,a,i,c,h,p){switch(i){case"style":kg(n,c,p);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(i=c.__html,i!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=i}}break;case"children":typeof c=="string"?Vs(n,c):(typeof c=="number"||typeof c=="bigint")&&Vs(n,""+c);break;case"onScroll":c!=null&&Ue("scroll",n);break;case"onScrollEnd":c!=null&&Ue("scrollend",n);break;case"onClick":c!=null&&(n.onclick=Or);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xg.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(h=i.endsWith("Capture"),a=i.slice(2,h?i.length-7:void 0),p=n[on]||null,p=p!=null?p[i]:null,typeof p=="function"&&n.removeEventListener(a,p,h),typeof c=="function")){typeof p!="function"&&p!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(a,c,h);break e}i in n?n[i]=c:c===!0?n.setAttribute(i,""):ql(n,i,c)}}}function qt(n,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",n),Ue("load",n);var c=!1,h=!1,p;for(p in i)if(i.hasOwnProperty(p)){var x=i[p];if(x!=null)switch(p){case"src":c=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:et(n,a,p,x,i,null)}}h&&et(n,a,"srcSet",i.srcSet,i,null),c&&et(n,a,"src",i.src,i,null);return;case"input":Ue("invalid",n);var T=p=x=h=null,O=null,H=null;for(c in i)if(i.hasOwnProperty(c)){var Q=i[c];if(Q!=null)switch(c){case"name":h=Q;break;case"type":x=Q;break;case"checked":O=Q;break;case"defaultChecked":H=Q;break;case"value":p=Q;break;case"defaultValue":T=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(s(137,a));break;default:et(n,a,c,Q,i,null)}}Ag(n,p,T,O,H,x,h,!1);return;case"select":Ue("invalid",n),c=x=p=null;for(h in i)if(i.hasOwnProperty(h)&&(T=i[h],T!=null))switch(h){case"value":p=T;break;case"defaultValue":x=T;break;case"multiple":c=T;default:et(n,a,h,T,i,null)}a=p,i=x,n.multiple=!!c,a!=null?qs(n,!!c,a,!1):i!=null&&qs(n,!!c,i,!0);return;case"textarea":Ue("invalid",n),p=h=c=null;for(x in i)if(i.hasOwnProperty(x)&&(T=i[x],T!=null))switch(x){case"value":c=T;break;case"defaultValue":h=T;break;case"children":p=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(s(91));break;default:et(n,a,x,T,i,null)}Rg(n,c,h,p);return;case"option":for(O in i)if(i.hasOwnProperty(O)&&(c=i[O],c!=null))switch(O){case"selected":n.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:et(n,a,O,c,i,null)}return;case"dialog":Ue("beforetoggle",n),Ue("toggle",n),Ue("cancel",n),Ue("close",n);break;case"iframe":case"object":Ue("load",n);break;case"video":case"audio":for(c=0;c<Io.length;c++)Ue(Io[c],n);break;case"image":Ue("error",n),Ue("load",n);break;case"details":Ue("toggle",n);break;case"embed":case"source":case"link":Ue("error",n),Ue("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(H in i)if(i.hasOwnProperty(H)&&(c=i[H],c!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:et(n,a,H,c,i,null)}return;default:if(Bd(a)){for(Q in i)i.hasOwnProperty(Q)&&(c=i[Q],c!==void 0&&Rh(n,a,Q,c,i,void 0));return}}for(T in i)i.hasOwnProperty(T)&&(c=i[T],c!=null&&et(n,a,T,c,i,null))}function bT(n,a,i,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,x=null,T=null,O=null,H=null,Q=null;for(W in i){var re=i[W];if(i.hasOwnProperty(W)&&re!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":O=re;default:c.hasOwnProperty(W)||et(n,a,W,null,c,re)}}for(var G in c){var W=c[G];if(re=i[G],c.hasOwnProperty(G)&&(W!=null||re!=null))switch(G){case"type":p=W;break;case"name":h=W;break;case"checked":H=W;break;case"defaultChecked":Q=W;break;case"value":x=W;break;case"defaultValue":T=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(s(137,a));break;default:W!==re&&et(n,a,G,W,c,re)}}Id(n,x,T,O,H,Q,p,h);return;case"select":W=x=T=G=null;for(p in i)if(O=i[p],i.hasOwnProperty(p)&&O!=null)switch(p){case"value":break;case"multiple":W=O;default:c.hasOwnProperty(p)||et(n,a,p,null,c,O)}for(h in c)if(p=c[h],O=i[h],c.hasOwnProperty(h)&&(p!=null||O!=null))switch(h){case"value":G=p;break;case"defaultValue":T=p;break;case"multiple":x=p;default:p!==O&&et(n,a,h,p,c,O)}a=T,i=x,c=W,G!=null?qs(n,!!i,G,!1):!!c!=!!i&&(a!=null?qs(n,!!i,a,!0):qs(n,!!i,i?[]:"",!1));return;case"textarea":W=G=null;for(T in i)if(h=i[T],i.hasOwnProperty(T)&&h!=null&&!c.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:et(n,a,T,null,c,h)}for(x in c)if(h=c[x],p=i[x],c.hasOwnProperty(x)&&(h!=null||p!=null))switch(x){case"value":G=h;break;case"defaultValue":W=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&et(n,a,x,h,c,p)}Tg(n,G,W);return;case"option":for(var ve in i)if(G=i[ve],i.hasOwnProperty(ve)&&G!=null&&!c.hasOwnProperty(ve))switch(ve){case"selected":n.selected=!1;break;default:et(n,a,ve,null,c,G)}for(O in c)if(G=c[O],W=i[O],c.hasOwnProperty(O)&&G!==W&&(G!=null||W!=null))switch(O){case"selected":n.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:et(n,a,O,G,c,W)}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 Re in i)G=i[Re],i.hasOwnProperty(Re)&&G!=null&&!c.hasOwnProperty(Re)&&et(n,a,Re,null,c,G);for(H in c)if(G=c[H],W=i[H],c.hasOwnProperty(H)&&G!==W&&(G!=null||W!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(137,a));break;default:et(n,a,H,G,c,W)}return;default:if(Bd(a)){for(var tt in i)G=i[tt],i.hasOwnProperty(tt)&&G!==void 0&&!c.hasOwnProperty(tt)&&Rh(n,a,tt,void 0,c,G);for(Q in c)G=c[Q],W=i[Q],!c.hasOwnProperty(Q)||G===W||G===void 0&&W===void 0||Rh(n,a,Q,G,c,W);return}}for(var U in i)G=i[U],i.hasOwnProperty(U)&&G!=null&&!c.hasOwnProperty(U)&&et(n,a,U,null,c,G);for(re in c)G=c[re],W=i[re],!c.hasOwnProperty(re)||G===W||G==null&&W==null||et(n,a,re,G,c,W)}function jb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wT(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,i=performance.getEntriesByType("resource"),c=0;c<i.length;c++){var h=i[c],p=h.transferSize,x=h.initiatorType,T=h.duration;if(p&&T&&jb(x)){for(x=0,T=h.responseEnd,c+=1;c<i.length;c++){var O=i[c],H=O.startTime;if(H>T)break;var Q=O.transferSize,re=O.initiatorType;Q&&jb(re)&&(O=O.responseEnd,x+=Q*(O<T?1:(T-H)/(O-H)))}if(--c,a+=8*(p+x)/(h.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Nh=null,kh=null;function Bc(n){return n.nodeType===9?n:n.ownerDocument}function Ob(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Mb(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function jh(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Oh=null;function xT(){var n=window.event;return n&&n.type==="popstate"?n===Oh?!1:(Oh=n,!0):(Oh=null,!1)}var Db=typeof setTimeout=="function"?setTimeout:void 0,_T=typeof clearTimeout=="function"?clearTimeout:void 0,Lb=typeof Promise=="function"?Promise:void 0,ST=typeof queueMicrotask=="function"?queueMicrotask:typeof Lb<"u"?function(n){return Lb.resolve(null).then(n).catch(ET)}:Db;function ET(n){setTimeout(function(){throw n})}function Na(n){return n==="head"}function Pb(n,a){var i=a,c=0;do{var h=i.nextSibling;if(n.removeChild(i),h&&h.nodeType===8)if(i=h.data,i==="/$"||i==="/&"){if(c===0){n.removeChild(h),xi(a);return}c--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")c++;else if(i==="html")Bo(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,Bo(i);for(var p=i.firstChild;p;){var x=p.nextSibling,T=p.nodeName;p[ao]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&p.rel.toLowerCase()==="stylesheet"||i.removeChild(p),p=x}}else i==="body"&&Bo(n.ownerDocument.body);i=h}while(i);xi(a)}function zb(n,a){var i=n;n=0;do{var c=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),c&&c.nodeType===8)if(i=c.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=c}while(i)}function Mh(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Mh(i),zd(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function CT(n,a,i,c){for(;n.nodeType===1;){var h=i;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[ao])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(p=n.getAttribute("rel"),p==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(p!==h.rel||n.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||n.getAttribute("title")!==(h.title==null?null:h.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(p=n.getAttribute("src"),(p!==(h.src==null?null:h.src)||n.getAttribute("type")!==(h.type==null?null:h.type)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&n.getAttribute("name")===p)return n}else return n;if(n=Bn(n.nextSibling),n===null)break}return null}function AT(n,a,i){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Bn(n.nextSibling),n===null))return null;return n}function Ub(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Bn(n.nextSibling),n===null))return null;return n}function Dh(n){return n.data==="$?"||n.data==="$~"}function Lh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function TT(n,a){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||i.readyState!=="loading")a();else{var c=function(){a(),i.removeEventListener("DOMContentLoaded",c)};i.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function Bn(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Ph=null;function Ib(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(a===0)return Bn(n.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}n=n.nextSibling}return null}function $b(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return n;a--}else i!=="/$"&&i!=="/&"||a++}n=n.previousSibling}return null}function Bb(n,a,i){switch(a=Bc(i),n){case"html":if(n=a.documentElement,!n)throw Error(s(452));return n;case"head":if(n=a.head,!n)throw Error(s(453));return n;case"body":if(n=a.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function Bo(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);zd(n)}var Hn=new Map,Hb=new Set;function Hc(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Yr=K.d;K.d={f:RT,r:NT,D:kT,C:jT,L:OT,m:MT,X:LT,S:DT,M:PT};function RT(){var n=Yr.f(),a=Mc();return n||a}function NT(n){var a=$s(n);a!==null&&a.tag===5&&a.type==="form"?sv(a):Yr.r(n)}var vi=typeof document>"u"?null:document;function qb(n,a,i){var c=vi;if(c&&typeof a=="string"&&a){var h=Dn(a);h='link[rel="'+n+'"][href="'+h+'"]',typeof i=="string"&&(h+='[crossorigin="'+i+'"]'),Hb.has(h)||(Hb.add(h),n={rel:n,crossOrigin:i,href:a},c.querySelector(h)===null&&(a=c.createElement("link"),qt(a,"link",n),Lt(a),c.head.appendChild(a)))}}function kT(n){Yr.D(n),qb("dns-prefetch",n,null)}function jT(n,a){Yr.C(n,a),qb("preconnect",n,a)}function OT(n,a,i){Yr.L(n,a,i);var c=vi;if(c&&n&&a){var h='link[rel="preload"][as="'+Dn(a)+'"]';a==="image"&&i&&i.imageSrcSet?(h+='[imagesrcset="'+Dn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(h+='[imagesizes="'+Dn(i.imageSizes)+'"]')):h+='[href="'+Dn(n)+'"]';var p=h;switch(a){case"style":p=bi(n);break;case"script":p=wi(n)}Hn.has(p)||(n=g({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:n,as:a},i),Hn.set(p,n),c.querySelector(h)!==null||a==="style"&&c.querySelector(Ho(p))||a==="script"&&c.querySelector(qo(p))||(a=c.createElement("link"),qt(a,"link",n),Lt(a),c.head.appendChild(a)))}}function MT(n,a){Yr.m(n,a);var i=vi;if(i&&n){var c=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+Dn(c)+'"][href="'+Dn(n)+'"]',p=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=wi(n)}if(!Hn.has(p)&&(n=g({rel:"modulepreload",href:n},a),Hn.set(p,n),i.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(qo(p)))return}c=i.createElement("link"),qt(c,"link",n),Lt(c),i.head.appendChild(c)}}}function DT(n,a,i){Yr.S(n,a,i);var c=vi;if(c&&n){var h=Bs(c).hoistableStyles,p=bi(n);a=a||"default";var x=h.get(p);if(!x){var T={loading:0,preload:null};if(x=c.querySelector(Ho(p)))T.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":a},i),(i=Hn.get(p))&&zh(n,i);var O=x=c.createElement("link");Lt(O),qt(O,"link",n),O._p=new Promise(function(H,Q){O.onload=H,O.onerror=Q}),O.addEventListener("load",function(){T.loading|=1}),O.addEventListener("error",function(){T.loading|=2}),T.loading|=4,qc(x,a,c)}x={type:"stylesheet",instance:x,count:1,state:T},h.set(p,x)}}}function LT(n,a){Yr.X(n,a);var i=vi;if(i&&n){var c=Bs(i).hoistableScripts,h=wi(n),p=c.get(h);p||(p=i.querySelector(qo(h)),p||(n=g({src:n,async:!0},a),(a=Hn.get(h))&&Uh(n,a),p=i.createElement("script"),Lt(p),qt(p,"link",n),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function PT(n,a){Yr.M(n,a);var i=vi;if(i&&n){var c=Bs(i).hoistableScripts,h=wi(n),p=c.get(h);p||(p=i.querySelector(qo(h)),p||(n=g({src:n,async:!0,type:"module"},a),(a=Hn.get(h))&&Uh(n,a),p=i.createElement("script"),Lt(p),qt(p,"link",n),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function Vb(n,a,i,c){var h=(h=Z.current)?Hc(h):null;if(!h)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=bi(i.href),i=Bs(h).hoistableStyles,c=i.get(a),c||(c={type:"style",instance:null,count:0,state:null},i.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=bi(i.href);var p=Bs(h).hoistableStyles,x=p.get(n);if(x||(h=h.ownerDocument||h,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,x),(p=h.querySelector(Ho(n)))&&!p._p&&(x.instance=p,x.state.loading=5),Hn.has(n)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Hn.set(n,i),p||zT(h,n,i,x.state))),a&&c===null)throw Error(s(528,""));return x}if(a&&c!==null)throw Error(s(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=wi(i),i=Bs(h).hoistableScripts,c=i.get(a),c||(c={type:"script",instance:null,count:0,state:null},i.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function bi(n){return'href="'+Dn(n)+'"'}function Ho(n){return'link[rel="stylesheet"]['+n+"]"}function Gb(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function zT(n,a,i,c){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=n.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),qt(a,"link",i),Lt(a),n.head.appendChild(a))}function wi(n){return'[src="'+Dn(n)+'"]'}function qo(n){return"script[async]"+n}function Fb(n,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+Dn(i.href)+'"]');if(c)return a.instance=c,Lt(c),c;var h=g({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),Lt(c),qt(c,"style",h),qc(c,i.precedence,n),a.instance=c;case"stylesheet":h=bi(i.href);var p=n.querySelector(Ho(h));if(p)return a.state.loading|=4,a.instance=p,Lt(p),p;c=Gb(i),(h=Hn.get(h))&&zh(c,h),p=(n.ownerDocument||n).createElement("link"),Lt(p);var x=p;return x._p=new Promise(function(T,O){x.onload=T,x.onerror=O}),qt(p,"link",c),a.state.loading|=4,qc(p,i.precedence,n),a.instance=p;case"script":return p=wi(i.src),(h=n.querySelector(qo(p)))?(a.instance=h,Lt(h),h):(c=i,(h=Hn.get(p))&&(c=g({},i),Uh(c,h)),n=n.ownerDocument||n,h=n.createElement("script"),Lt(h),qt(h,"link",c),n.head.appendChild(h),a.instance=h);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,qc(c,i.precedence,n));return a.instance}function qc(n,a,i){for(var c=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,p=h,x=0;x<c.length;x++){var T=c[x];if(T.dataset.precedence===a)p=T;else if(p!==h)break}p?p.parentNode.insertBefore(n,p.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(n,a.firstChild))}function zh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function Uh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var Vc=null;function Kb(n,a,i){if(Vc===null){var c=new Map,h=Vc=new Map;h.set(i,c)}else h=Vc,c=h.get(i),c||(c=new Map,h.set(i,c));if(c.has(n))return c;for(c.set(n,null),i=i.getElementsByTagName(n),h=0;h<i.length;h++){var p=i[h];if(!(p[ao]||p[It]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(a)||"";x=n+x;var T=c.get(x);T?T.push(p):c.set(x,[p])}}return c}function Yb(n,a,i){n=n.ownerDocument||n,n.head.insertBefore(i,a==="title"?n.querySelector("head > title"):null)}function UT(n,a,i){if(i===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Wb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function IT(n,a,i,c){if(i.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var h=bi(c.href),p=a.querySelector(Ho(h));if(p){a=p._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=Gc.bind(n),a.then(n,n)),i.state.loading|=4,i.instance=p,Lt(p);return}p=a.ownerDocument||a,c=Gb(c),(h=Hn.get(h))&&zh(c,h),p=p.createElement("link"),Lt(p);var x=p;x._p=new Promise(function(T,O){x.onload=T,x.onerror=O}),qt(p,"link",c),i.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=Gc.bind(n),a.addEventListener("load",i),a.addEventListener("error",i))}}var Ih=0;function $T(n,a){return n.stylesheets&&n.count===0&&Kc(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var c=setTimeout(function(){if(n.stylesheets&&Kc(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+a);0<n.imgBytes&&Ih===0&&(Ih=62500*wT());var h=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Kc(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>Ih?50:800)+a);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function Gc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kc(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Fc=null;function Kc(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Fc=new Map,a.forEach(BT,n),Fc=null,Gc.call(n))}function BT(n,a){if(!(a.state.loading&4)){var i=Fc.get(n);if(i)var c=i.get(null);else{i=new Map,Fc.set(n,i);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var x=h[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(i.set(x.dataset.precedence,x),c=x)}c&&i.set(null,c)}h=a.instance,x=h.getAttribute("data-precedence"),p=i.get(x)||c,p===c&&i.set(null,h),i.set(x,h),this.count++,c=Gc.bind(this),h.addEventListener("load",c),h.addEventListener("error",c),p?p.parentNode.insertBefore(h,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(h,n.firstChild)),a.state.loading|=4}}var Vo={$$typeof:N,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function HT(n,a,i,c,h,p,x,T,O){this.tag=1,this.containerInfo=n,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=ua(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ua(0),this.hiddenUpdates=ua(null),this.identifierPrefix=c,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Xb(n,a,i,c,h,p,x,T,O,H,Q,re){return n=new HT(n,a,i,x,O,H,Q,re,T),a=1,p===!0&&(a|=24),p=Sn(3,null,null,a),n.current=p,p.stateNode=n,a=vf(),a.refCount++,n.pooledCache=a,a.refCount++,p.memoizedState={element:c,isDehydrated:i,cache:a},_f(p),n}function Jb(n){return n?(n=Js,n):Js}function Qb(n,a,i,c,h,p){h=Jb(h),c.context===null?c.context=h:c.pendingContext=h,c=va(a),c.payload={element:i},p=p===void 0?null:p,p!==null&&(c.callback=p),i=ba(n,c,a),i!==null&&(hn(i,n,a),_o(i,n,a))}function Zb(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<a?i:a}}function $h(n,a){Zb(n,a),(n=n.alternate)&&Zb(n,a)}function e0(n){if(n.tag===13||n.tag===31){var a=as(n,67108864);a!==null&&hn(a,n,67108864),$h(n,67108864)}}function t0(n){if(n.tag===13||n.tag===31){var a=Rn();a=zs(a);var i=as(n,a);i!==null&&hn(i,n,a),$h(n,a)}}var Yc=!0;function qT(n,a,i,c){var h=M.T;M.T=null;var p=K.p;try{K.p=2,Bh(n,a,i,c)}finally{K.p=p,M.T=h}}function VT(n,a,i,c){var h=M.T;M.T=null;var p=K.p;try{K.p=8,Bh(n,a,i,c)}finally{K.p=p,M.T=h}}function Bh(n,a,i,c){if(Yc){var h=Hh(c);if(h===null)Th(n,a,c,Wc,i),r0(n,c);else if(FT(h,n,a,i,c))c.stopPropagation();else if(r0(n,c),a&4&&-1<GT.indexOf(n)){for(;h!==null;){var p=$s(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=nn(p.pendingLanes);if(x!==0){var T=p;for(T.pendingLanes|=2,T.entangledLanes|=2;x;){var O=1<<31-Mt(x);T.entanglements[1]|=O,x&=~O}gr(p),(We&6)===0&&(jc=ht()+500,Uo(0))}}break;case 31:case 13:T=as(p,2),T!==null&&hn(T,p,2),Mc(),$h(p,2)}if(p=Hh(c),p===null&&Th(n,a,c,Wc,i),p===h)break;h=p}h!==null&&c.stopPropagation()}else Th(n,a,c,null,i)}}function Hh(n){return n=qd(n),qh(n)}var Wc=null;function qh(n){if(Wc=null,n=Is(n),n!==null){var a=l(n);if(a===null)n=null;else{var i=a.tag;if(i===13){if(n=u(a),n!==null)return n;n=null}else if(i===31){if(n=d(a),n!==null)return n;n=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return Wc=n,null}function n0(n){switch(n){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(no()){case Nr:return 2;case ur:return 8;case dr:case kr:return 32;case Fn:return 268435456;default:return 32}default:return 32}}var Vh=!1,ka=null,ja=null,Oa=null,Go=new Map,Fo=new Map,Ma=[],GT="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 r0(n,a){switch(n){case"focusin":case"focusout":ka=null;break;case"dragenter":case"dragleave":ja=null;break;case"mouseover":case"mouseout":Oa=null;break;case"pointerover":case"pointerout":Go.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fo.delete(a.pointerId)}}function Ko(n,a,i,c,h,p){return n===null||n.nativeEvent!==p?(n={blockedOn:a,domEventName:i,eventSystemFlags:c,nativeEvent:p,targetContainers:[h]},a!==null&&(a=$s(a),a!==null&&e0(a)),n):(n.eventSystemFlags|=c,a=n.targetContainers,h!==null&&a.indexOf(h)===-1&&a.push(h),n)}function FT(n,a,i,c,h){switch(a){case"focusin":return ka=Ko(ka,n,a,i,c,h),!0;case"dragenter":return ja=Ko(ja,n,a,i,c,h),!0;case"mouseover":return Oa=Ko(Oa,n,a,i,c,h),!0;case"pointerover":var p=h.pointerId;return Go.set(p,Ko(Go.get(p)||null,n,a,i,c,h)),!0;case"gotpointercapture":return p=h.pointerId,Fo.set(p,Ko(Fo.get(p)||null,n,a,i,c,h)),!0}return!1}function a0(n){var a=Is(n.target);if(a!==null){var i=l(a);if(i!==null){if(a=i.tag,a===13){if(a=u(i),a!==null){n.blockedOn=a,vg(n.priority,function(){t0(i)});return}}else if(a===31){if(a=d(i),a!==null){n.blockedOn=a,vg(n.priority,function(){t0(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Xc(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var i=Hh(n.nativeEvent);if(i===null){i=n.nativeEvent;var c=new i.constructor(i.type,i);Hd=c,i.target.dispatchEvent(c),Hd=null}else return a=$s(i),a!==null&&e0(a),n.blockedOn=i,!1;a.shift()}return!0}function s0(n,a,i){Xc(n)&&i.delete(a)}function KT(){Vh=!1,ka!==null&&Xc(ka)&&(ka=null),ja!==null&&Xc(ja)&&(ja=null),Oa!==null&&Xc(Oa)&&(Oa=null),Go.forEach(s0),Fo.forEach(s0)}function Jc(n,a){n.blockedOn===a&&(n.blockedOn=null,Vh||(Vh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,KT)))}var Qc=null;function i0(n){Qc!==n&&(Qc=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Qc===n&&(Qc=null);for(var a=0;a<n.length;a+=3){var i=n[a],c=n[a+1],h=n[a+2];if(typeof c!="function"){if(qh(c||i)===null)continue;break}var p=$s(i);p!==null&&(n.splice(a,3),a-=3,Hf(p,{pending:!0,data:h,method:i.method,action:c},c,h))}}))}function xi(n){function a(O){return Jc(O,n)}ka!==null&&Jc(ka,n),ja!==null&&Jc(ja,n),Oa!==null&&Jc(Oa,n),Go.forEach(a),Fo.forEach(a);for(var i=0;i<Ma.length;i++){var c=Ma[i];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Ma.length&&(i=Ma[0],i.blockedOn===null);)a0(i),i.blockedOn===null&&Ma.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(c=0;c<i.length;c+=3){var h=i[c],p=i[c+1],x=h[on]||null;if(typeof p=="function")x||i0(i);else if(x){var T=null;if(p&&p.hasAttribute("formAction")){if(h=p,x=p[on]||null)T=x.formAction;else if(qh(h)!==null)continue}else T=x.action;typeof T=="function"?i[c+1]=T:(i.splice(c,3),c-=3),i0(i)}}}function o0(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return h=x})},focusReset:"manual",scroll:"manual"})}function a(){h!==null&&(h(),h=null),c||setTimeout(i,20)}function i(){if(!c&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,h=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),h!==null&&(h(),h=null)}}}function Gh(n){this._internalRoot=n}Zc.prototype.render=Gh.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(s(409));var i=a.current,c=Rn();Qb(i,c,n,a,null,null)},Zc.prototype.unmount=Gh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;Qb(n.current,2,null,n,null,null),Mc(),a[Us]=null}};function Zc(n){this._internalRoot=n}Zc.prototype.unstable_scheduleHydration=function(n){if(n){var a=Ld();n={blockedOn:null,target:n,priority:a};for(var i=0;i<Ma.length&&a!==0&&a<Ma[i].priority;i++);Ma.splice(i,0,n),i===0&&a0(n)}};var l0=t.version;if(l0!=="19.2.6")throw Error(s(527,l0,"19.2.6"));K.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=m(a),n=n!==null?b(n):null,n=n===null?null:n.stateNode,n};var YT={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var eu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!eu.isDisabled&&eu.supportsFiber)try{fr=eu.inject(YT),Ut=eu}catch{}}return Wo.createRoot=function(n,a){if(!o(n))throw Error(s(299));var i=!1,c="",h=pv,p=gv,x=yv;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(p=a.onCaughtError),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),a=Xb(n,1,!1,null,null,i,c,null,h,p,x,o0),n[Us]=a.current,Ah(n),new Gh(a)},Wo.hydrateRoot=function(n,a,i){if(!o(n))throw Error(s(299));var c=!1,h="",p=pv,x=gv,T=yv,O=null;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onUncaughtError!==void 0&&(p=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(T=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),a=Xb(n,1,!0,a,i??null,c,h,O,p,x,T,o0),a.context=Jb(null),i=a.current,c=Rn(),c=zs(c),h=va(c),h.callback=null,ba(i,h,c),i=c,a.current.lanes=i,mt(a,i),gr(a),n[Us]=a.current,Ah(n),new Zc(a)},Wo.version="19.2.6",Wo}var v0;function aR(){if(v0)return Yh.exports;v0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Yh.exports=rR(),Yh.exports}var sR=aR();/**
* react-router v7.15.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/var b0="popstate";function w0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function iR(e={}){function t(s,o){var m;let l=(m=o.state)==null?void 0:m.masked,{pathname:u,search:d,hash:f}=l||s.location;return Rm("",{pathname:u,search:d,hash:f},o.state&&o.state.usr||null,o.state&&o.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,o){return typeof o=="string"?o:fl(o)}return lR(t,r,null,e)}function gt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Tr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function oR(){return Math.random().toString(36).substring(2,10)}function x0(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Rm(e,t,r=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ki(t):t,state:r,key:t&&t.key||s||oR(),mask:o}}function fl({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ki(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function lR(e,t,r,s={}){let{window:o=document.defaultView,v5Compat:l=!1}=s,u=o.history,d="POP",f=null,m=b();m==null&&(m=0,u.replaceState({...u.state,idx:m},""));function b(){return(u.state||{idx:null}).idx}function g(){d="POP";let A=b(),C=A==null?null:A-m;m=A,f&&f({action:d,location:S.location,delta:C})}function w(A,C){d="PUSH";let R=w0(A)?A:Rm(S.location,A,C);m=b()+1;let N=x0(R,m),P=S.createHref(R.mask||R);try{u.pushState(N,"",P)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;o.location.assign(P)}l&&f&&f({action:d,location:S.location,delta:1})}function _(A,C){d="REPLACE";let R=w0(A)?A:Rm(S.location,A,C);m=b();let N=x0(R,m),P=S.createHref(R.mask||R);u.replaceState(N,"",P),l&&f&&f({action:d,location:S.location,delta:0})}function E(A){return cR(A)}let S={get action(){return d},get location(){return e(o,u)},listen(A){if(f)throw new Error("A history only accepts one active listener");return o.addEventListener(b0,g),f=A,()=>{o.removeEventListener(b0,g),f=null}},createHref(A){return t(o,A)},createURL:E,encodeLocation(A){let C=E(A);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:w,replace:_,go(A){return u.go(A)}};return S}function cR(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),gt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:fl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function mx(e,t,r="/"){return uR(e,t,r,!1)}function uR(e,t,r,s,o){let l=typeof t=="string"?Ki(t):t,u=ta(l.pathname||"/",r);if(u==null)return null;let d=dR(e),f=null,m=SR(u);for(let b=0;f==null&&b<d.length;++b)f=xR(d[b],m,s);return f}function dR(e){let t=px(e);return fR(t),t}function px(e,t=[],r=[],s="",o=!1){let l=(u,d,f=o,m)=>{let b={relativePath:m===void 0?u.path||"":m,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&f)return;gt(b.relativePath.startsWith(s),`Absolute route path "${b.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(s.length)}let g=rr([s,b.relativePath]),w=r.concat(b);u.children&&u.children.length>0&&(gt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),px(u.children,t,w,g,f)),!(u.path==null&&!u.index)&&t.push({path:g,score:bR(g,u.index),routesMeta:w})};return e.forEach((u,d)=>{var f;if(u.path===""||!((f=u.path)!=null&&f.includes("?")))l(u,d);else for(let m of gx(u.path))l(u,d,!0,m)}),t}function gx(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,o=r.endsWith("?"),l=r.replace(/\?$/,"");if(s.length===0)return o?[l,""]:[l];let u=gx(s.join("/")),d=[];return d.push(...u.map(f=>f===""?l:[l,f].join("/"))),o&&d.push(...u),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function fR(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:wR(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var hR=/^:[\w-]+$/,mR=3,pR=2,gR=1,yR=10,vR=-2,_0=e=>e==="*";function bR(e,t){let r=e.split("/"),s=r.length;return r.some(_0)&&(s+=vR),t&&(s+=pR),r.filter(o=>!_0(o)).reduce((o,l)=>o+(hR.test(l)?mR:l===""?gR:yR),s)}function wR(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function xR(e,t,r=!1){let{routesMeta:s}=e,o={},l="/",u=[];for(let d=0;d<s.length;++d){let f=s[d],m=d===s.length-1,b=l==="/"?t:t.slice(l.length)||"/",g=zu({path:f.relativePath,caseSensitive:f.caseSensitive,end:m},b),w=f.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=zu({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},b)),!g)return null;Object.assign(o,g.params),u.push({params:o,pathname:rr([l,g.pathname]),pathnameBase:TR(rr([l,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(l=rr([l,g.pathnameBase]))}return u}function zu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=_R(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let l=o[0],u=l.replace(/(.)\/+$/,"$1"),d=o.slice(1);return{params:s.reduce((m,{paramName:b,isOptional:g},w)=>{if(b==="*"){let E=d[w]||"";u=l.slice(0,l.length-E.length).replace(/(.)\/+$/,"$1")}const _=d[w];return g&&!_?m[b]=void 0:m[b]=(_||"").replace(/%2F/g,"/"),m},{}),pathname:l,pathnameBase:u,pattern:e}}function _R(e,t=!1,r=!0){Tr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,m,b)=>{if(s.push({paramName:d,isOptional:f!=null}),f){let g=b.charAt(m+u.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function SR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Tr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ta(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var ER=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function CR(e,t="/"){let{pathname:r,search:s="",hash:o=""}=typeof e=="string"?Ki(e):e,l;return r?(r=vx(r),r.startsWith("/")?l=S0(r.substring(1),"/"):l=S0(r,t)):l=t,{pathname:l,search:RR(s),hash:NR(o)}}function S0(e,t){let r=Uu(t).split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function Qh(e,t,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function AR(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function yx(e){let t=AR(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function hp(e,t,r,s=!1){let o;typeof e=="string"?o=Ki(e):(o={...e},gt(!o.pathname||!o.pathname.includes("?"),Qh("?","pathname","search",o)),gt(!o.pathname||!o.pathname.includes("#"),Qh("#","pathname","hash",o)),gt(!o.search||!o.search.includes("#"),Qh("#","search","hash",o)));let l=e===""||o.pathname==="",u=l?"/":o.pathname,d;if(u==null)d=r;else{let g=t.length-1;if(!s&&u.startsWith("..")){let w=u.split("/");for(;w[0]==="..";)w.shift(),g-=1;o.pathname=w.join("/")}d=g>=0?t[g]:"/"}let f=CR(o,d),m=u&&u!=="/"&&u.endsWith("/"),b=(l||u===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(m||b)&&(f.pathname+="/"),f}var vx=e=>e.replace(/\/\/+/g,"/"),rr=e=>vx(e.join("/")),Uu=e=>e.replace(/\/+$/,""),TR=e=>Uu(e).replace(/^\/*/,"/"),RR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,NR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,kR=class{constructor(e,t,r,s=!1){this.status=e,this.statusText=t||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function jR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function OR(e){let t=e.map(r=>r.route.path).filter(Boolean);return rr(t)||"/"}var bx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wx(e,t){let r=e;if(typeof r!="string"||!ER.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,o=!1;if(bx)try{let l=new URL(window.location.href),u=r.startsWith("//")?new URL(l.protocol+r):new URL(r),d=ta(u.pathname,t);u.origin===l.origin&&d!=null?r=d+u.search+u.hash:o=!0}catch{Tr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var xx=["POST","PUT","PATCH","DELETE"];new Set(xx);var MR=["GET",...xx];new Set(MR);var Yi=v.createContext(null);Yi.displayName="DataRouter";var ld=v.createContext(null);ld.displayName="DataRouterState";var _x=v.createContext(!1);function DR(){return v.useContext(_x)}var Sx=v.createContext({isTransitioning:!1});Sx.displayName="ViewTransition";var LR=v.createContext(new Map);LR.displayName="Fetchers";var PR=v.createContext(null);PR.displayName="Await";var Gn=v.createContext(null);Gn.displayName="Navigation";var Tl=v.createContext(null);Tl.displayName="Location";var sa=v.createContext({outlet:null,matches:[],isDataRoute:!1});sa.displayName="Route";var mp=v.createContext(null);mp.displayName="RouteError";var Ex="REACT_ROUTER_ERROR",zR="REDIRECT",UR="ROUTE_ERROR_RESPONSE";function IR(e){if(e.startsWith(`${Ex}:${zR}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function $R(e){if(e.startsWith(`${Ex}:${UR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new kR(t.status,t.statusText,t.data)}catch{}}function BR(e,{relative:t}={}){gt(Rl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=v.useContext(Gn),{hash:o,pathname:l,search:u}=Nl(e,{relative:t}),d=l;return r!=="/"&&(d=l==="/"?r:rr([r,l])),s.createHref({pathname:d,search:u,hash:o})}function Rl(){return v.useContext(Tl)!=null}function ia(){return gt(Rl(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Tl).location}var Cx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ax(e){v.useContext(Gn).static||v.useLayoutEffect(e)}function HR(){let{isDataRoute:e}=v.useContext(sa);return e?tN():qR()}function qR(){gt(Rl(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Yi),{basename:t,navigator:r}=v.useContext(Gn),{matches:s}=v.useContext(sa),{pathname:o}=ia(),l=JSON.stringify(yx(s)),u=v.useRef(!1);return Ax(()=>{u.current=!0}),v.useCallback((f,m={})=>{if(Tr(u.current,Cx),!u.current)return;if(typeof f=="number"){r.go(f);return}let b=hp(f,JSON.parse(l),o,m.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:rr([t,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[t,r,l,o,e])}v.createContext(null);function Nl(e,{relative:t}={}){let{matches:r}=v.useContext(sa),{pathname:s}=ia(),o=JSON.stringify(yx(r));return v.useMemo(()=>hp(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function VR(e,t){return Tx(e,t)}function Tx(e,t,r){var A;gt(Rl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(Gn),{matches:o}=v.useContext(sa),l=o[o.length-1],u=l?l.params:{},d=l?l.pathname:"/",f=l?l.pathnameBase:"/",m=l&&l.route;{let C=m&&m.path||"";Nx(d,!m||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let b=ia(),g;if(t){let C=typeof t=="string"?Ki(t):t;gt(f==="/"||((A=C.pathname)==null?void 0:A.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=b;let w=g.pathname||"/",_=w;if(f!=="/"){let C=f.replace(/^\//,"").split("/");_="/"+w.replace(/^\//,"").split("/").slice(C.length).join("/")}let E=r&&r.state.matches.length?r.state.matches.map(C=>Object.assign(C,{route:r.manifest[C.route.id]||C.route})):mx(e,{pathname:_});Tr(m||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Tr(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=WR(E&&E.map(C=>Object.assign({},C,{params:Object.assign({},u,C.params),pathname:rr([f,s.encodeLocation?s.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:rr([f,s.encodeLocation?s.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),o,r);return t&&S?v.createElement(Tl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},S):S}function GR(){let e=eN(),t=jR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:l},"ErrorBoundary")," or"," ",v.createElement("code",{style:l},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),r?v.createElement("pre",{style:o},r):null,u)}var FR=v.createElement(GR,null),Rx=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=$R(e.digest);r&&(e=r)}let t=e!==void 0?v.createElement(sa.Provider,{value:this.props.routeContext},v.createElement(mp.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(KR,{error:e},t):t}};Rx.contextType=_x;var Zh=new WeakMap;function KR({children:e,error:t}){let{basename:r}=v.useContext(Gn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=IR(t.digest);if(s){let o=Zh.get(t);if(o)throw o;let l=wx(s.location,r);if(bx&&!Zh.get(t))if(l.isExternal||s.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw Zh.set(t,u),u}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function YR({routeContext:e,match:t,children:r}){let s=v.useContext(Yi);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(sa.Provider,{value:e},r)}function WR(e,t=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,l=s==null?void 0:s.errors;if(l!=null){let b=o.findIndex(g=>g.route.id&&(l==null?void 0:l[g.route.id])!==void 0);gt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),o=o.slice(0,Math.min(o.length,b+1))}let u=!1,d=-1;if(r&&s){u=s.renderFallback;for(let b=0;b<o.length;b++){let g=o[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=b),g.route.id){let{loaderData:w,errors:_}=s,E=g.route.loader&&!w.hasOwnProperty(g.route.id)&&(!_||_[g.route.id]===void 0);if(g.route.lazy||E){r.isStatic&&(u=!0),d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}}let f=r==null?void 0:r.onError,m=s&&f?(b,g)=>{var w,_;f(b,{location:s.location,params:((_=(w=s.matches)==null?void 0:w[0])==null?void 0:_.params)??{},pattern:OR(s.matches),errorInfo:g})}:void 0;return o.reduceRight((b,g,w)=>{let _,E=!1,S=null,A=null;s&&(_=l&&g.route.id?l[g.route.id]:void 0,S=g.route.errorElement||FR,u&&(d<0&&w===0?(Nx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,A=null):d===w&&(E=!0,A=g.route.hydrateFallbackElement||null)));let C=t.concat(o.slice(0,w+1)),R=()=>{let N;return _?N=S:E?N=A:g.route.Component?N=v.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=b,v.createElement(YR,{match:g,routeContext:{outlet:b,matches:C,isDataRoute:s!=null},children:N})};return s&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?v.createElement(Rx,{location:s.location,revalidation:s.revalidation,component:S,error:_,children:R(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:m}):R()},null)}function pp(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function XR(e){let t=v.useContext(Yi);return gt(t,pp(e)),t}function JR(e){let t=v.useContext(ld);return gt(t,pp(e)),t}function QR(e){let t=v.useContext(sa);return gt(t,pp(e)),t}function gp(e){let t=QR(e),r=t.matches[t.matches.length-1];return gt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function ZR(){return gp("useRouteId")}function eN(){var s;let e=v.useContext(mp),t=JR("useRouteError"),r=gp("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function tN(){let{router:e}=XR("useNavigate"),t=gp("useNavigate"),r=v.useRef(!1);return Ax(()=>{r.current=!0}),v.useCallback(async(o,l={})=>{Tr(r.current,Cx),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...l}))},[e,t])}var E0={};function Nx(e,t,r){!t&&!E0[e]&&(E0[e]=!0,Tr(!1,r))}v.memo(nN);function nN({routes:e,manifest:t,future:r,state:s,isStatic:o,onError:l}){return Tx(e,void 0,{manifest:t,state:s,isStatic:o,onError:l})}function kx(e){gt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function rN({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:o,static:l=!1,useTransitions:u}){gt(!Rl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=v.useMemo(()=>({basename:d,navigator:o,static:l,useTransitions:u,future:{}}),[d,o,l,u]);typeof r=="string"&&(r=Ki(r));let{pathname:m="/",search:b="",hash:g="",state:w=null,key:_="default",mask:E}=r,S=v.useMemo(()=>{let A=ta(m,d);return A==null?null:{location:{pathname:A,search:b,hash:g,state:w,key:_,mask:E},navigationType:s}},[d,m,b,g,w,_,s,E]);return Tr(S!=null,`<Router basename="${d}"> is not able to match the URL "${m}${b}${g}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:v.createElement(Gn.Provider,{value:f},v.createElement(Tl.Provider,{children:t,value:S}))}function aN({children:e,location:t}){return VR(Nm(e),t)}function Nm(e,t=[]){let r=[];return v.Children.forEach(e,(s,o)=>{if(!v.isValidElement(s))return;let l=[...t,o];if(s.type===v.Fragment){r.push.apply(r,Nm(s.props.children,l));return}gt(s.type===kx,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),gt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let u={id:s.props.id||l.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(u.children=Nm(s.props.children,l)),r.push(u)}),r}var Tu="get",Ru="application/x-www-form-urlencoded";function cd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function sN(e){return cd(e)&&e.tagName.toLowerCase()==="button"}function iN(e){return cd(e)&&e.tagName.toLowerCase()==="form"}function oN(e){return cd(e)&&e.tagName.toLowerCase()==="input"}function lN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function cN(e,t){return e.button===0&&(!t||t==="_self")&&!lN(e)}var tu=null;function uN(){if(tu===null)try{new FormData(document.createElement("form"),0),tu=!1}catch{tu=!0}return tu}var dN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function em(e){return e!=null&&!dN.has(e)?(Tr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ru}"`),null):e}function fN(e,t){let r,s,o,l,u;if(iN(e)){let d=e.getAttribute("action");s=d?ta(d,t):null,r=e.getAttribute("method")||Tu,o=em(e.getAttribute("enctype"))||Ru,l=new FormData(e)}else if(sN(e)||oN(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(s=f?ta(f,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Tu,o=em(e.getAttribute("formenctype"))||em(d.getAttribute("enctype"))||Ru,l=new FormData(d,e),!uN()){let{name:m,type:b,value:g}=e;if(b==="image"){let w=m?`${m}.`:"";l.append(`${w}x`,"0"),l.append(`${w}y`,"0")}else m&&l.append(m,g)}}else{if(cd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Tu,s=null,o=Ru,u=e}return l&&o==="text/plain"&&(u=l,l=void 0),{action:s,method:r.toLowerCase(),encType:o,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function yp(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function jx(e,t,r,s){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:t&&ta(o.pathname,t)==="/"?o.pathname=`${Uu(t)}/_root.${s}`:o.pathname=`${Uu(o.pathname)}.${s}`,o}async function hN(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function mN(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function pN(e,t,r){let s=await Promise.all(e.map(async o=>{let l=t.routes[o.route.id];if(l){let u=await hN(l,r);return u.links?u.links():[]}return[]}));return bN(s.flat(1).filter(mN).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function C0(e,t,r,s,o,l){let u=(f,m)=>r[m]?f.route.id!==r[m].route.id:!0,d=(f,m)=>{var b;return r[m].pathname!==f.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==f.params["*"]};return l==="assets"?t.filter((f,m)=>u(f,m)||d(f,m)):l==="data"?t.filter((f,m)=>{var g;let b=s.routes[f.route.id];if(!b||!b.hasLoader)return!1;if(u(f,m)||d(f,m))return!0;if(f.route.shouldRevalidate){let w=f.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function gN(e,t,{includeHydrateFallback:r}={}){return yN(e.map(s=>{let o=t.routes[s.route.id];if(!o)return[];let l=[o.module];return o.clientActionModule&&(l=l.concat(o.clientActionModule)),o.clientLoaderModule&&(l=l.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(l=l.concat(o.hydrateFallbackModule)),o.imports&&(l=l.concat(o.imports)),l}).flat(1))}function yN(e){return[...new Set(e)]}function vN(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function bN(e,t){let r=new Set;return new Set(t),e.reduce((s,o)=>{let l=JSON.stringify(vN(o));return r.has(l)||(r.add(l),s.push({key:l,link:o})),s},[])}function vp(){let e=v.useContext(Yi);return yp(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function wN(){let e=v.useContext(ld);return yp(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var bp=v.createContext(void 0);bp.displayName="FrameworkContext";function wp(){let e=v.useContext(bp);return yp(e,"You must render this element inside a <HydratedRouter> element"),e}function xN(e,t){let r=v.useContext(bp),[s,o]=v.useState(!1),[l,u]=v.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:m,onMouseLeave:b,onTouchStart:g}=t,w=v.useRef(null);v.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let S=C=>{C.forEach(R=>{u(R.isIntersecting)})},A=new IntersectionObserver(S,{threshold:.5});return w.current&&A.observe(w.current),()=>{A.disconnect()}}},[e]),v.useEffect(()=>{if(s){let S=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(S)}}},[s]);let _=()=>{o(!0)},E=()=>{o(!1),u(!1)};return r?e!=="intent"?[l,w,{}]:[l,w,{onFocus:Xo(d,_),onBlur:Xo(f,E),onMouseEnter:Xo(m,_),onMouseLeave:Xo(b,E),onTouchStart:Xo(g,_)}]:[!1,w,{}]}function Xo(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function _N({page:e,...t}){let r=DR(),{router:s}=vp(),o=v.useMemo(()=>mx(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?r?v.createElement(EN,{page:e,matches:o,...t}):v.createElement(CN,{page:e,matches:o,...t}):null}function SN(e){let{manifest:t,routeModules:r}=wp(),[s,o]=v.useState([]);return v.useEffect(()=>{let l=!1;return pN(e,t,r).then(u=>{l||o(u)}),()=>{l=!0}},[e,t,r]),s}function EN({page:e,matches:t,...r}){let s=ia(),{future:o}=wp(),{basename:l}=vp(),u=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let d=jx(e,l,o.unstable_trailingSlashAwareDataRequests,"rsc"),f=!1,m=[];for(let b of t)typeof b.route.shouldRevalidate=="function"?f=!0:m.push(b.route.id);return f&&m.length>0&&d.searchParams.set("_routes",m.join(",")),[d.pathname+d.search]},[l,o.unstable_trailingSlashAwareDataRequests,e,s,t]);return v.createElement(v.Fragment,null,u.map(d=>v.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function CN({page:e,matches:t,...r}){let s=ia(),{future:o,manifest:l,routeModules:u}=wp(),{basename:d}=vp(),{loaderData:f,matches:m}=wN(),b=v.useMemo(()=>C0(e,t,m,l,s,"data"),[e,t,m,l,s]),g=v.useMemo(()=>C0(e,t,m,l,s,"assets"),[e,t,m,l,s]),w=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let S=new Set,A=!1;if(t.forEach(R=>{var P;let N=l.routes[R.route.id];!N||!N.hasLoader||(!b.some(F=>F.route.id===R.route.id)&&R.route.id in f&&((P=u[R.route.id])!=null&&P.shouldRevalidate)||N.hasClientLoader?A=!0:S.add(R.route.id))}),S.size===0)return[];let C=jx(e,d,o.unstable_trailingSlashAwareDataRequests,"data");return A&&S.size>0&&C.searchParams.set("_routes",t.filter(R=>S.has(R.route.id)).map(R=>R.route.id).join(",")),[C.pathname+C.search]},[d,o.unstable_trailingSlashAwareDataRequests,f,s,l,b,t,e,u]),_=v.useMemo(()=>gN(g,l),[g,l]),E=SN(g);return v.createElement(v.Fragment,null,w.map(S=>v.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...r})),_.map(S=>v.createElement("link",{key:S,rel:"modulepreload",href:S,...r})),E.map(({key:S,link:A})=>v.createElement("link",{key:S,nonce:r.nonce,...A,crossOrigin:A.crossOrigin??r.crossOrigin})))}function AN(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var TN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{TN&&(window.__reactRouterVersion="7.15.1")}catch{}function RN({basename:e,children:t,useTransitions:r,window:s}){let o=v.useRef();o.current==null&&(o.current=iR({window:s,v5Compat:!0}));let l=o.current,[u,d]=v.useState({action:l.action,location:l.location}),f=v.useCallback(m=>{r===!1?d(m):v.startTransition(()=>d(m))},[r]);return v.useLayoutEffect(()=>l.listen(f),[l,f]),v.createElement(rN,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,useTransitions:r})}var Ox=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Mx=v.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:o,reloadDocument:l,replace:u,mask:d,state:f,target:m,to:b,preventScrollReset:g,viewTransition:w,defaultShouldRevalidate:_,...E},S){let{basename:A,navigator:C,useTransitions:R}=v.useContext(Gn),N=typeof b=="string"&&Ox.test(b),P=wx(b,A);b=P.to;let F=BR(b,{relative:o}),$=ia(),L=null;if(d){let fe=hp(d,[],$.mask?$.mask.pathname:"/",!0);A!=="/"&&(fe.pathname=fe.pathname==="/"?A:rr([A,fe.pathname])),L=C.createHref(fe)}let[q,ie,he]=xN(s,E),pe=ON(b,{replace:u,mask:d,state:f,target:m,preventScrollReset:g,relative:o,viewTransition:w,defaultShouldRevalidate:_,useTransitions:R});function oe(fe){t&&t(fe),fe.defaultPrevented||pe(fe)}let ue=!(P.isExternal||l),ce=v.createElement("a",{...E,...he,href:(ue?L:void 0)||P.absoluteURL||F,onClick:ue?oe:t,ref:AN(S,ie),target:m,"data-discover":!N&&r==="render"?"true":void 0});return q&&!N?v.createElement(v.Fragment,null,ce,v.createElement(_N,{page:F})):ce});Mx.displayName="Link";var NN=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:o=!1,style:l,to:u,viewTransition:d,children:f,...m},b){let g=Nl(u,{relative:m.relative}),w=ia(),_=v.useContext(ld),{navigator:E,basename:S}=v.useContext(Gn),A=_!=null&&zN(g)&&d===!0,C=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,R=w.pathname,N=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(R=R.toLowerCase(),N=N?N.toLowerCase():null,C=C.toLowerCase()),N&&S&&(N=ta(N,S)||N);const P=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let F=R===C||!o&&R.startsWith(C)&&R.charAt(P)==="/",$=N!=null&&(N===C||!o&&N.startsWith(C)&&N.charAt(C.length)==="/"),L={isActive:F,isPending:$,isTransitioning:A},q=F?t:void 0,ie;typeof s=="function"?ie=s(L):ie=[s,F?"active":null,$?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let he=typeof l=="function"?l(L):l;return v.createElement(Mx,{...m,"aria-current":q,className:ie,ref:b,style:he,to:u,viewTransition:d},typeof f=="function"?f(L):f)});NN.displayName="NavLink";var kN=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:o,state:l,method:u=Tu,action:d,onSubmit:f,relative:m,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:w,..._},E)=>{let{useTransitions:S}=v.useContext(Gn),A=LN(),C=PN(d,{relative:m}),R=u.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&Ox.test(d),P=F=>{if(f&&f(F),F.defaultPrevented)return;F.preventDefault();let $=F.nativeEvent.submitter,L=($==null?void 0:$.getAttribute("formmethod"))||u,q=()=>A($||F.currentTarget,{fetcherKey:t,method:L,navigate:r,replace:o,state:l,relative:m,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:w});S&&r!==!1?v.startTransition(()=>q()):q()};return v.createElement("form",{ref:E,method:R,action:C,onSubmit:s?f:P,..._,"data-discover":!N&&e==="render"?"true":void 0})});kN.displayName="Form";function jN(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Dx(e){let t=v.useContext(Yi);return gt(t,jN(e)),t}function ON(e,{target:t,replace:r,mask:s,state:o,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:m}={}){let b=HR(),g=ia(),w=Nl(e,{relative:u});return v.useCallback(_=>{if(cN(_,t)){_.preventDefault();let E=r!==void 0?r:fl(g)===fl(w),S=()=>b(e,{replace:E,mask:s,state:o,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f});m?v.startTransition(()=>S()):S()}},[g,b,w,r,s,o,t,e,l,u,d,f,m])}var MN=0,DN=()=>`__${String(++MN)}__`;function LN(){let{router:e}=Dx("useSubmit"),{basename:t}=v.useContext(Gn),r=ZR(),s=e.fetch,o=e.navigate;return v.useCallback(async(l,u={})=>{let{action:d,method:f,encType:m,formData:b,body:g}=fN(l,t);if(u.navigate===!1){let w=u.fetcherKey||DN();await s(w,r,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:b,body:g,formMethod:u.method||f,formEncType:u.encType||m,flushSync:u.flushSync})}else await o(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:b,body:g,formMethod:u.method||f,formEncType:u.encType||m,replace:u.replace,state:u.state,fromRouteId:r,flushSync:u.flushSync,viewTransition:u.viewTransition})},[s,o,t,r])}function PN(e,{relative:t}={}){let{basename:r}=v.useContext(Gn),s=v.useContext(sa);gt(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),l={...Nl(e||".",{relative:t})},u=ia();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),f=d.getAll("index");if(f.some(b=>b==="")){d.delete("index"),f.filter(g=>g).forEach(g=>d.append("index",g));let b=d.toString();l.search=b?`?${b}`:""}}return(!e||e===".")&&o.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(l.pathname=l.pathname==="/"?r:rr([r,l.pathname])),fl(l)}function zN(e,{relative:t}={}){let r=v.useContext(Sx);gt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Dx("useViewTransitionState"),o=Nl(e,{relative:t});if(!r.isTransitioning)return!1;let l=ta(r.currentLocation.pathname,s)||r.currentLocation.pathname,u=ta(r.nextLocation.pathname,s)||r.nextLocation.pathname;return zu(o.pathname,u)!=null||zu(o.pathname,l)!=null}var kl=hx();const Lx=fx(kl);var Sr=function(){return Sr=Object.assign||function(t){for(var r,s=1,o=arguments.length;s<o;s++){r=arguments[s];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[l]=r[l])}return t},Sr.apply(this,arguments)};function Wi(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(r[s[o]]=e[s[o]]);return r}function UN(e,t,r,s){function o(l){return l instanceof r?l:new r(function(u){u(l)})}return new(r||(r=Promise))(function(l,u){function d(b){try{m(s.next(b))}catch(g){u(g)}}function f(b){try{m(s.throw(b))}catch(g){u(g)}}function m(b){b.done?l(b.value):o(b.value).then(d,f)}m((s=s.apply(e,t||[])).next())})}function IN(e,t,r){if(r||arguments.length===2)for(var s=0,o=t.length,l;s<o;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}const $N=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class xp extends Error{constructor(t,r="FunctionsError",s){super(t),this.name=r,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class BN extends xp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class A0 extends xp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class T0 extends xp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var km;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(km||(km={}));class HN{constructor(t,{headers:r={},customFetch:s,region:o=km.Any}={}){this.url=t,this.headers=r,this.region=o,this.fetch=$N(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return UN(this,arguments,void 0,function*(r,s={}){var o;let l,u;try{const{headers:d,method:f,body:m,signal:b,timeout:g}=s;let w={},{region:_}=s;_||(_=this.region);const E=new URL(`${this.url}/${r}`);_&&_!=="any"&&(w["x-region"]=_,E.searchParams.set("forceFunctionRegion",_));let S;m&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",S=m):typeof m=="string"?(w["Content-Type"]="text/plain",S=m):typeof FormData<"u"&&m instanceof FormData?S=m:(w["Content-Type"]="application/json",S=JSON.stringify(m)):m&&typeof m!="string"&&!(typeof Blob<"u"&&m instanceof Blob)&&!(m instanceof ArrayBuffer)&&!(typeof FormData<"u"&&m instanceof FormData)?S=JSON.stringify(m):S=m;let A=b;g&&(u=new AbortController,l=setTimeout(()=>u.abort(),g),b?(A=u.signal,b.addEventListener("abort",()=>u.abort())):A=u.signal);const C=yield this.fetch(E.toString(),{method:f||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),d),body:S,signal:A}).catch(F=>{throw new BN(F)}),R=C.headers.get("x-relay-error");if(R&&R==="true")throw new A0(C);if(!C.ok)throw new T0(C);let N=((o=C.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),P;return N==="application/json"?P=yield C.json():N==="application/octet-stream"||N==="application/pdf"?P=yield C.blob():N==="text/event-stream"?P=C:N==="multipart/form-data"?P=yield C.formData():P=yield C.text(),{data:P,error:null,response:C}}catch(d){return{data:null,error:d,response:d instanceof T0||d instanceof A0?d.context:void 0}}finally{l&&clearTimeout(l)}})}}const Px=3,R0=e=>Math.min(1e3*2**e,3e4),qN=[520,503],zx=["GET","HEAD","OPTIONS"];var VN=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function N0(e,t){return new Promise(r=>{if(t!=null&&t.aborted){r();return}const s=setTimeout(()=>{t==null||t.removeEventListener("abort",o),r()},e);function o(){clearTimeout(s),r()}t==null||t.addEventListener("abort",o)})}function GN(e,t,r,s){return!(!s||r>=Px||!zx.includes(e)||!qN.includes(t))}var FN=class{constructor(e){var t,r,s,o,l;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(s=e.shouldStripNulls)!==null&&s!==void 0?s:!1,this.urlLengthLimit=(o=e.urlLengthLimit)!==null&&o!==void 0?o:8e3,this.retryEnabled=(l=e.retry)!==null&&l!==void 0?l:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const 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 s=this.fetch;let l=(async()=>{let u=0;for(;;){const m=new Headers(r.headers);u>0&&m.set("X-Retry-Count",String(u));let b;try{b=await s(r.url.toString(),{method:r.method,headers:m,body:JSON.stringify(r.body,(g,w)=>typeof w=="bigint"?w.toString():w),signal:r.signal})}catch(g){if((g==null?void 0:g.name)==="AbortError"||(g==null?void 0:g.code)==="ABORT_ERR"||!zx.includes(r.method))throw g;if(r.retryEnabled&&u<Px){const w=R0(u);u++,await N0(w,r.signal);continue}throw g}if(GN(r.method,b.status,u,r.retryEnabled)){var d,f;const g=(d=(f=b.headers)===null||f===void 0?void 0:f.get("Retry-After"))!==null&&d!==void 0?d:null,w=g!==null?Math.max(0,parseInt(g,10)||0)*1e3:R0(u);await b.text(),u++,await N0(w,r.signal);continue}return await r.processResponse(b)}})();return this.shouldThrowOnError||(l=l.catch(u=>{var d;let f="",m="",b="";const g=u==null?void 0:u.cause;if(g){var w,_,E,S;const R=(w=g==null?void 0:g.message)!==null&&w!==void 0?w:"",N=(_=g==null?void 0:g.code)!==null&&_!==void 0?_:"";f=`${(E=u==null?void 0:u.name)!==null&&E!==void 0?E:"FetchError"}: ${u==null?void 0:u.message}`,f+=`
Caused by: ${(S=g==null?void 0:g.name)!==null&&S!==void 0?S:"Error"}: ${R}`,N&&(f+=` (${N})`),g!=null&&g.stack&&(f+=`
${g.stack}`)}else{var A;f=(A=u==null?void 0:u.stack)!==null&&A!==void 0?A:""}const C=this.url.toString().length;return(u==null?void 0:u.name)==="AbortError"||(u==null?void 0:u.code)==="ABORT_ERR"?(b="",m="Request was aborted (timeout or manual cancellation)",C>this.urlLengthLimit&&(m+=`. Note: Your request URL is ${C} 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.`)):((g==null?void 0:g.name)==="HeadersOverflowError"||(g==null?void 0:g.code)==="UND_ERR_HEADERS_OVERFLOW")&&(b="",m="HTTP headers exceeded server limits (typically 16KB)",C>this.urlLengthLimit&&(m+=`. Your request URL is ${C} 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:f,hint:m,code:b},data:null,count:null,status:0,statusText:""}})),l.then(e,t)}async processResponse(e){var t=this;let r=null,s=null,o=null,l=e.status,u=e.statusText;if(e.ok){var d,f;if(t.method!=="HEAD"){var m;const w=await e.text();w===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((m=t.headers.get("Accept"))===null||m===void 0)&&m.includes("application/vnd.pgrst.plan+text"))?s=w:s=JSON.parse(w))}const b=(d=t.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),g=(f=e.headers.get("content-range"))===null||f===void 0?void 0:f.split("/");b&&g&&g.length>1&&(o=parseInt(g[1])),t.isMaybeSingle&&Array.isArray(s)&&(s.length>1?(r={code:"PGRST116",details:`Results contain ${s.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},s=null,o=null,l=406,u="Not Acceptable"):s.length===1?s=s[0]:s=null)}else{const b=await e.text();try{r=JSON.parse(b),Array.isArray(r)&&e.status===404&&(s=[],r=null,l=200,u="OK")}catch{e.status===404&&b===""?(l=204,u="No Content"):r={message:b}}if(r&&t.shouldThrowOnError)throw new VN(r)}return{success:r===null,error:r,data:s,count:o,status:l,statusText:u}}returns(){return this}overrideTypes(){return this}},KN=class extends FN{select(e){let t=!1;const r=(e??"*").split("").map(s=>/\s/.test(s)&&!t?"":(s==='"'&&(t=!t),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:o=s}={}){const l=o?`${o}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const o=typeof s>"u"?"offset":`${s}.offset`,l=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(l,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:o=!1,format:l="text"}={}){var u;const d=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,o?"wal":null].filter(Boolean).join("|"),f=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${l}; for="${f}"; options=${d};`),l==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const k0=new RegExp("[,()]");var Oi=class extends KN{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(s=>typeof s=="string"&&k0.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(s=>typeof s=="string"&&k0.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let o="";s==="plain"?o="pl":s==="phrase"?o="ph":s==="websearch"&&(o="w");const l=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${o}fts${l}.${t}`),this}match(e){return Object.entries(e).filter(([t,r])=>r!==void 0).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},YN=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:o=8e3,retry:l}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=o,this.retry=l}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=t??{},o=r?"HEAD":"GET";let l=!1;const u=(e??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:d,headers:f}=this.cloneRequestState();return d.searchParams.set("select",u),s&&f.append("Prefer",`count=${s}`),new Oi({method:o,url:d,headers:f,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const o="POST",{url:l,headers:u}=this.cloneRequestState();if(t&&u.append("Prefer",`count=${t}`),r||u.append("Prefer","missing=default"),Array.isArray(e)){const d=e.reduce((f,m)=>f.concat(Object.keys(m)),[]);if(d.length>0){const f=[...new Set(d)].map(m=>`"${m}"`);l.searchParams.set("columns",f.join(","))}}return new Oi({method:o,url:l,headers:u,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:o=!0}={}){var l;const u="POST",{url:d,headers:f}=this.cloneRequestState();if(f.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&d.searchParams.set("on_conflict",t),s&&f.append("Prefer",`count=${s}`),o||f.append("Prefer","missing=default"),Array.isArray(e)){const m=e.reduce((b,g)=>b.concat(Object.keys(g)),[]);if(m.length>0){const b=[...new Set(m)].map(g=>`"${g}"`);d.searchParams.set("columns",b.join(","))}}return new Oi({method:u,url:d,headers:f,schema:this.schema,body:e,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const s="PATCH",{url:o,headers:l}=this.cloneRequestState();return t&&l.append("Prefer",`count=${t}`),new Oi({method:s,url:o,headers:l,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const r="DELETE",{url:s,headers:o}=this.cloneRequestState();return e&&o.append("Prefer",`count=${e}`),new Oi({method:r,url:s,headers:o,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function hl(e){"@babel/helpers - typeof";return hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hl(e)}function WN(e,t){if(hl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(hl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function XN(e){var t=WN(e,"string");return hl(t)=="symbol"?t:t+""}function JN(e,t,r){return(t=XN(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,s)}return r}function nu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?j0(Object(r),!0).forEach(function(s){JN(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var QN=class Ux{constructor(t,{headers:r={},schema:s,fetch:o,timeout:l,urlLengthLimit:u=8e3,retry:d}={}){this.url=t,this.headers=new Headers(r),this.schemaName=s,this.urlLengthLimit=u;const f=o??globalThis.fetch;l!==void 0&&l>0?this.fetch=(m,b)=>{const g=new AbortController,w=setTimeout(()=>g.abort(),l),_=b==null?void 0:b.signal;if(_){if(_.aborted)return clearTimeout(w),f(m,b);const E=()=>{clearTimeout(w),g.abort()};return _.addEventListener("abort",E,{once:!0}),f(m,nu(nu({},b),{},{signal:g.signal})).finally(()=>{clearTimeout(w),_.removeEventListener("abort",E)})}return f(m,nu(nu({},b),{},{signal:g.signal})).finally(()=>clearTimeout(w))}:this.fetch=f,this.retry=d}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new YN(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new Ux(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,r={},{head:s=!1,get:o=!1,count:l}={}){var u;let d;const f=new URL(`${this.url}/rpc/${t}`);let m;const b=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(b)),g=s&&Object.values(r).some(b);g?(d="POST",m=r):s||o?(d=s?"HEAD":"GET",Object.entries(r).filter(([_,E])=>E!==void 0).map(([_,E])=>[_,Array.isArray(E)?`{${E.join(",")}}`:`${E}`]).forEach(([_,E])=>{f.searchParams.append(_,E)})):(d="POST",m=r);const w=new Headers(this.headers);return g?w.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&w.set("Prefer",`count=${l}`),new Oi({method:d,url:f,headers:w,schema:this.schemaName,body:m,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class ZN{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const s=typeof global<"u"?global:void 0;if(s&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const o=globalThis.process;if(o){const l=o.versions;if(l&&l.node){const u=l.node,d=parseInt(u.replace(/^v/,"").split(".")[0]);return d>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${d} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${d} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
import ws from "ws"
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let r=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(r+=`
Suggested solution: ${t.workaround}`),new Error(r)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const ek="2.106.2",tk=`realtime-js/${ek}`,nk="1.0.0",Ix="2.0.0",rk=Ix,ak=1e4,sk=100,$a={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},$x={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},jm={connecting:"connecting",closing:"closing",closed:"closed"};class ik{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,r){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return r(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var r;return this._isArrayBuffer((r=t.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var r,s;const o=(s=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var r,s;const o=(s=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:{},u=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(t,r,s){var o,l;const u=t.topic,d=(o=t.ref)!==null&&o!==void 0?o:"",f=(l=t.join_ref)!==null&&l!==void 0?l:"",m=t.payload.event,b=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},g=Object.keys(b).length===0?"":JSON.stringify(b);if(f.length>255)throw new Error(`joinRef length ${f.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(m.length>255)throw new Error(`userEvent length ${m.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+f.length+d.length+u.length+m.length+g.length,_=new ArrayBuffer(this.HEADER_LENGTH+w);let E=new DataView(_),S=0;E.setUint8(S++,this.KINDS.userBroadcastPush),E.setUint8(S++,f.length),E.setUint8(S++,d.length),E.setUint8(S++,u.length),E.setUint8(S++,m.length),E.setUint8(S++,g.length),E.setUint8(S++,r),Array.from(f,C=>E.setUint8(S++,C.charCodeAt(0))),Array.from(d,C=>E.setUint8(S++,C.charCodeAt(0))),Array.from(u,C=>E.setUint8(S++,C.charCodeAt(0))),Array.from(m,C=>E.setUint8(S++,C.charCodeAt(0))),Array.from(g,C=>E.setUint8(S++,C.charCodeAt(0)));var A=new Uint8Array(_.byteLength+s.byteLength);return A.set(new Uint8Array(_),0),A.set(new Uint8Array(s),_.byteLength),A.buffer}decode(t,r){if(this._isArrayBuffer(t)){let s=this._binaryDecode(t);return r(s)}if(typeof t=="string"){const s=JSON.parse(t),[o,l,u,d,f]=s;return r({join_ref:o,ref:l,topic:u,event:d,payload:f})}return r({})}_binaryDecode(t){const r=new DataView(t),s=r.getUint8(0),o=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,o)}}_decodeUserBroadcast(t,r,s){const o=r.getUint8(1),l=r.getUint8(2),u=r.getUint8(3),d=r.getUint8(4);let f=this.HEADER_LENGTH+4;const m=s.decode(t.slice(f,f+o));f=f+o;const b=s.decode(t.slice(f,f+l));f=f+l;const g=s.decode(t.slice(f,f+u));f=f+u;const w=t.slice(f,t.byteLength),_=d===this.JSON_ENCODING?JSON.parse(s.decode(w)):w,E={type:this.BROADCAST_EVENT,event:b,payload:_};return u>0&&(E.meta=JSON.parse(g)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:E}}_isArrayBuffer(t){var r;return t instanceof ArrayBuffer||((r=t==null?void 0:t.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(t,r){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([s])=>r.includes(s)))}}var st;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(st||(st={}));const O0=(e,t,r={})=>{var s;const o=(s=r.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((l,u)=>(l[u]=ok(u,e,t,o),l),{}):{}},ok=(e,t,r,s)=>{const o=t.find(d=>d.name===e),l=o==null?void 0:o.type,u=r[e];return l&&!s.includes(l)?Bx(l,u):Om(u)},Bx=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return dk(t,r)}switch(e){case st.bool:return lk(t);case st.float4:case st.float8:case st.int2:case st.int4:case st.int8:case st.numeric:case st.oid:return ck(t);case st.json:case st.jsonb:return uk(t);case st.timestamp:return fk(t);case st.abstime:case st.date:case st.daterange:case st.int4range:case st.int8range:case st.money:case st.reltime:case st.text:case st.time:case st.timestamptz:case st.timetz:case st.tsrange:case st.tstzrange:return Om(t);default:return Om(t)}},Om=e=>e,lk=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},ck=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},uk=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},dk=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,s=e[r];if(e[0]==="{"&&s==="}"){let l;const u=e.slice(1,r);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(d=>Bx(t,d))}return e},fk=e=>typeof e=="string"?e.replace(" ","T"):e,Hx=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var sl=e=>typeof e=="function"?e:function(){return e},hk=typeof self<"u"?self:null,Mi=typeof window<"u"?window:null,xr=hk||Mi||globalThis,mk="2.0.0",pk=1e4,gk=1e3,_r={connecting:0,open:1,closing:2,closed:3},mn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Qr={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Mm={longpoll:"longpoll",websocket:"websocket"},yk={complete:4},Dm="base64url.bearer.phx.",ru=class{constructor(e,t,r,s){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},qx=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},vk=class{constructor(e,t,r){this.state=mn.closed,this.topic=e,this.params=sl(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ru(this,Qr.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new qx(()=>{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=mn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",s=>{this.state=mn.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=mn.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=mn.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 ru(this,Qr.leave,sl({}),this.timeout).send(),this.state=mn.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Qr.reply,(s,o)=>{this.trigger(this.replyEventName(o),s)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=mn.closed,this.bindings=[]}onClose(e){this.on(Qr.close,e)}onError(e){return this.on(Qr.error,t=>e(t))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter(r=>!(r.event===e&&(typeof t>"u"||t===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new ru(this,e,function(){return t},r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=mn.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Qr.close,"leave")},r=new ru(this,Qr.leave,sl({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,s){return this.topic!==e?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=mn.joining,this.joinPush.resend(e))}trigger(e,t,r,s){let o=this.onMessage(e,t,r,s);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let l=this.bindings.filter(u=>u.event===e&&this.filterBindings(u,t,r));for(let u=0;u<l.length;u++)l[u].callback(o,r,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===mn.closed}isErrored(){return this.state===mn.errored}isJoined(){return this.state===mn.joined}isJoining(){return this.state===mn.joining}isLeaving(){return this.state===mn.leaving}},Iu=class{static request(e,t,r,s,o,l,u){if(xr.XDomainRequest){let d=new xr.XDomainRequest;return this.xdomainRequest(d,e,t,s,o,l,u)}else if(xr.XMLHttpRequest){let d=new xr.XMLHttpRequest;return this.xhrRequest(d,e,t,r,s,o,l,u)}else{if(xr.fetch&&xr.AbortController)return this.fetchRequest(e,t,r,s,o,l,u);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,r,s,o,l,u){let d={method:e,headers:r,body:s},f=null;return o&&(f=new AbortController,setTimeout(()=>f.abort(),o),d.signal=f.signal),xr.fetch(t,d).then(m=>m.text()).then(m=>this.parseJSON(m)).then(m=>u&&u(m)).catch(m=>{m.name==="AbortError"&&l?l():u&&u(null)}),f}static xdomainRequest(e,t,r,s,o,l,u){return e.timeout=o,e.open(t,r),e.onload=()=>{let d=this.parseJSON(e.responseText);u&&u(d)},l&&(e.ontimeout=l),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,r,s,o,l,u,d){e.open(t,r,!0),e.timeout=l;for(let[f,m]of Object.entries(s))e.setRequestHeader(f,m);return e.onerror=()=>d&&d(null),e.onreadystatechange=()=>{if(e.readyState===yk.complete&&d){let f=this.parseJSON(e.responseText);d(f)}},u&&(e.ontimeout=u),e.send(o),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let o=t?`${t}[${s}]`:s,l=e[s];typeof l=="object"?r.push(this.serialize(l,o)):r.push(encodeURIComponent(o)+"="+encodeURIComponent(l))}return r.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},bk=e=>{let t="",r=new Uint8Array(e),s=r.byteLength;for(let o=0;o<s;o++)t+=String.fromCharCode(r[o]);return btoa(t)},_i=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(Dm)&&(this.authToken=atob(t[1].slice(Dm.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=_r.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Mm.websocket),"$1/"+Mm.longpoll)}endpointURL(){return Iu.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=_r.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===_r.open||this.readyState===_r.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:r,token:s,messages:o}=t;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=s}else r=0;switch(r){case 200:o.forEach(l=>{setTimeout(()=>this.onmessage({data:l}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=_r.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(e){typeof e!="string"&&(e=bk(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,r){for(let o of this.reqs)o.abort();this.readyState=_r.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,r,s,o){let l,u=()=>{this.reqs.delete(l),s()};l=Iu.request(e,this.endpointURL(),t,r,this.timeout,u,d=>{this.reqs.delete(l),this.isActive()&&o(d)}),this.reqs.add(l)}},wk=class tl{constructor(t,r={}){let s=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(s.state,o=>{let{onJoin:l,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel.joinRef(),this.state=tl.syncState(this.state,o,l,u),this.pendingDiffs.forEach(f=>{this.state=tl.syncDiff(this.state,f,l,u)}),this.pendingDiffs=[],d()}),this.channel.on(s.diff,o=>{let{onJoin:l,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=tl.syncDiff(this.state,o,l,u),d())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return tl.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,r,s,o){let l=this.clone(t),u={},d={};return this.map(l,(f,m)=>{r[f]||(d[f]=m)}),this.map(r,(f,m)=>{let b=l[f];if(b){let g=m.metas.map(S=>S.phx_ref),w=b.metas.map(S=>S.phx_ref),_=m.metas.filter(S=>w.indexOf(S.phx_ref)<0),E=b.metas.filter(S=>g.indexOf(S.phx_ref)<0);_.length>0&&(u[f]=m,u[f].metas=_),E.length>0&&(d[f]=this.clone(b),d[f].metas=E)}else u[f]=m}),this.syncDiff(l,{joins:u,leaves:d},s,o)}static syncDiff(t,r,s,o){let{joins:l,leaves:u}=this.clone(r);return s||(s=function(){}),o||(o=function(){}),this.map(l,(d,f)=>{let m=t[d];if(t[d]=this.clone(f),m){let b=t[d].metas.map(w=>w.phx_ref),g=m.metas.filter(w=>b.indexOf(w.phx_ref)<0);t[d].metas.unshift(...g)}s(d,m,f)}),this.map(u,(d,f)=>{let m=t[d];if(!m)return;let b=f.metas.map(g=>g.phx_ref);m.metas=m.metas.filter(g=>b.indexOf(g.phx_ref)<0),o(d,m,f),m.metas.length===0&&delete t[d]}),t}static list(t,r){return r||(r=function(s,o){return o}),this.map(t,(s,o)=>r(s,o))}static map(t,r){return Object.getOwnPropertyNames(t).map(s=>r(s,t[s]))}static clone(t){return JSON.parse(JSON.stringify(t))}},au={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,s,o,l,u]=JSON.parse(e);return t({join_ref:r,ref:s,topic:o,event:l,payload:u})}},binaryEncode(e){let{join_ref:t,ref:r,event:s,topic:o,payload:l}=e,u=this.META_LENGTH+t.length+r.length+o.length+s.length,d=new ArrayBuffer(this.HEADER_LENGTH+u),f=new DataView(d),m=0;f.setUint8(m++,this.KINDS.push),f.setUint8(m++,t.length),f.setUint8(m++,r.length),f.setUint8(m++,o.length),f.setUint8(m++,s.length),Array.from(t,g=>f.setUint8(m++,g.charCodeAt(0))),Array.from(r,g=>f.setUint8(m++,g.charCodeAt(0))),Array.from(o,g=>f.setUint8(m++,g.charCodeAt(0))),Array.from(s,g=>f.setUint8(m++,g.charCodeAt(0)));var b=new Uint8Array(d.byteLength+l.byteLength);return b.set(new Uint8Array(d),0),b.set(new Uint8Array(l),d.byteLength),b.buffer},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,r){let s=t.getUint8(1),o=t.getUint8(2),l=t.getUint8(3),u=this.HEADER_LENGTH+this.META_LENGTH-1,d=r.decode(e.slice(u,u+s));u=u+s;let f=r.decode(e.slice(u,u+o));u=u+o;let m=r.decode(e.slice(u,u+l));u=u+l;let b=e.slice(u,e.byteLength);return{join_ref:d,ref:null,topic:f,event:m,payload:b}},decodeReply(e,t,r){let s=t.getUint8(1),o=t.getUint8(2),l=t.getUint8(3),u=t.getUint8(4),d=this.HEADER_LENGTH+this.META_LENGTH,f=r.decode(e.slice(d,d+s));d=d+s;let m=r.decode(e.slice(d,d+o));d=d+o;let b=r.decode(e.slice(d,d+l));d=d+l;let g=r.decode(e.slice(d,d+u));d=d+u;let w=e.slice(d,e.byteLength),_={status:g,response:w};return{join_ref:f,ref:m,topic:b,event:Qr.reply,payload:_}},decodeBroadcast(e,t,r){let s=t.getUint8(1),o=t.getUint8(2),l=this.HEADER_LENGTH+2,u=r.decode(e.slice(l,l+s));l=l+s;let d=r.decode(e.slice(l,l+o));l=l+o;let f=e.slice(l,e.byteLength);return{join_ref:null,ref:null,topic:u,event:d,payload:f}}},xk=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||pk,this.transport=t.transport||xr.WebSocket||_i,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=xr&&xr.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=au.encode.bind(au),this.defaultDecoder=au.decode.bind(au),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==_i?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;Mi&&Mi.addEventListener&&(Mi.addEventListener("pagehide",o=>{this.conn&&(this.disconnect(),s=this.connectClock)}),Mi.addEventListener("pageshow",o=>{s===this.connectClock&&(s=null,this.connect())}),Mi.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=o=>t.rejoinAfterMs?t.rejoinAfterMs(o):[1e3,2e3,5e3][o-1]||1e4,this.reconnectAfterMs=o=>t.reconnectAfterMs?t.reconnectAfterMs(o):[10,50,100,150,200,250,500,1e3,2e3][o-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(o,l,u)=>{console.log(`${o}: ${l}`,u)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=sl(t.params||{}),this.endPoint=`${e}/${Mm.websocket}`,this.vsn=t.vsn||mk,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new qx(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return _i}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Iu.appendParams(Iu.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=sl(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==_i?this.connectWithFallback(_i,this.longPollFallbackMs):this.transportConnect())}log(e,t,r){this.logger&&this.logger(e,t,r)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(o=>{o.ref===t&&(this.off([s]),e(Date.now()-r))});return!0}transportName(e){switch(e){case _i:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${Dm}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let r=!1,s=!0,o,l,u=this.transportName(e),d=f=>{this.log("transport",`falling back to ${u}...`,f),this.off([o,l]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${u}`))return d("memorized");this.fallbackTimer=setTimeout(d,t),l=this.onError(f=>{this.log("transport","error",f),s&&!r&&(clearTimeout(this.fallbackTimer),d(f))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!s){let f=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${f}`,"true"),this.log("transport",`established ${f} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(d,t),this.ping(f=>{this.log("transport","connected to primary after",f),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),gk,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();const s=this.conn;this.waitForBufferDone(s,()=>{t?s.close(t,r||""):s.close(),this.waitForSocketClosed(s,()=>{this.conn===s&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,r=1){if(r===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,r+1)},150*r)}waitForSocketClosed(e,t,r=1){if(r===5||e.readyState===_r.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,r+1)},150*r)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",e,t,r),(t===this.transport||r>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Qr.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case _r.connecting:return"connecting";case _r.open:return"open";case _r.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([r])=>e.indexOf(r)===-1)}channel(e,t={}){let r=new vk(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:s,ref:o,join_ref:l}=e;this.log("push",`${t} ${r} (${l}, ${o})`,s)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:r,event:s,payload:o,ref:l,join_ref:u}=t;if(l&&l===this.pendingHeartbeatRef){const d=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(o.status==="ok"?"ok":"error",d)}catch(f){this.log("error","error in heartbeat callback",f)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${o.status||""} ${r} ${s} ${l&&"("+l+")"||""}`.trim(),o);for(let d=0;d<this.channels.length;d++){const f=this.channels[d];f.isMember(r,s,o,u)&&f.trigger(s,o,l,u)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,s])=>{try{s(...t)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class il{constructor(t,r){const s=Sk(r);this.presence=new wk(t.getChannel(),s),this.presence.onJoin((o,l,u)=>{const d=il.onJoinPayload(o,l,u);t.getChannel().trigger("presence",d)}),this.presence.onLeave((o,l,u)=>{const d=il.onLeavePayload(o,l,u);t.getChannel().trigger("presence",d)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return il.transformState(this.presence.state)}static transformState(t){return t=_k(t),Object.getOwnPropertyNames(t).reduce((r,s)=>{const o=t[s];return r[s]=Nu(o),r},{})}static onJoinPayload(t,r,s){const o=M0(r),l=Nu(s);return{event:"join",key:t,currentPresences:o,newPresences:l}}static onLeavePayload(t,r,s){const o=M0(r),l=Nu(s);return{event:"leave",key:t,currentPresences:o,leftPresences:l}}}function Nu(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function _k(e){return JSON.parse(JSON.stringify(e))}function Sk(e){return(e==null?void 0:e.events)&&{events:e.events}}function M0(e){return e!=null&&e.metas?Nu(e):[]}var D0;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(D0||(D0={}));class Ek{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new il(this.channel.channelAdapter,r)}}function Ck(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const r=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${r}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class Ak{constructor(t,r,s){const o=Tk(s);this.channel=t.getSocket().channel(r,o),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,r){return this.channel.on(t,r)}off(t,r){this.channel.off(t,r)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,r,s){let o;try{o=this.channel.push(t,r,s)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>sk){const l=this.channel.pushBuffer.shift();l.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${l.event}`,l.payload())}return o}updateJoinPayload(t){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),t)}canPush(){return this.socket.isConnected()&&this.state===$a.joined}isJoined(){return this.state===$a.joined}isJoining(){return this.state===$a.joining}isClosed(){return this.state===$a.closed}isLeaving(){return this.state===$a.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function Tk(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var L0;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(L0||(L0={}));var Ui;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Ui||(Ui={}));var Zr;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Zr||(Zr={}));class ol{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,r={config:{}},s){var o,l;if(this.topic=t,this.params=r,this.socket=s,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Ak(this.socket.socketAdapter,t,this.params),this.presence=new Ek(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Hx(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((l=(o=this.params.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,r=this.timeout){var s,o,l;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:f}}=this.params,m=(o=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(_=>_.filter))!==null&&o!==void 0?o:[],b=!!this.bindings[Ui.PRESENCE]&&this.bindings[Ui.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,g={},w={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:b}),postgres_changes:m,private:f};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(_=>{t==null||t(Zr.CHANNEL_ERROR,Ck(_))}),this._onClose(()=>t==null?void 0:t(Zr.CLOSED)),this.updateJoinPayload(Object.assign({config:w},g)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:_})=>{if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){t==null||t(Zr.SUBSCRIBED);return}this._updatePostgresBindings(_,t)}).receive("error",_=>{this.state=$a.errored;const E=Object.values(_).join(", ")||"error";t==null||t(Zr.CHANNEL_ERROR,new Error(E,{cause:_}))}).receive("timeout",()=>{t==null||t(Zr.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var s;const o=this.bindings.postgres_changes,l=(s=o==null?void 0:o.length)!==null&&s!==void 0?s:0,u=[];for(let d=0;d<l;d++){const f=o[d],{filter:{event:m,schema:b,table:g,filter:w}}=f,_=t&&t[d];if(_&&_.event===m&&ol.isFilterValueEqual(_.schema,b)&&ol.isFilterValueEqual(_.table,g)&&ol.isFilterValueEqual(_.filter,w))u.push(Object.assign(Object.assign({},f),{id:_.id}));else{this.unsubscribe(),this.state=$a.errored,r==null||r(Zr.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=u,this.state!=$a.errored&&r&&r(Zr.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,s){const o=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),l=t===Ui.PRESENCE||t===Ui.POSTGRES_CHANGES;if(o&&l)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,r,s)}async httpSend(t,r,s={}){var o;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:r,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(o=s.timeout)!==null&&o!==void 0?o:this.timeout);if(d.status===202)return{success:!0};let f=d.statusText;try{const m=await d.json();f=m.error||m.message||f}catch{}return Promise.reject(new Error(f))}async send(t,r={}){var s,o;if(!this.channelAdapter.canPush()&&t.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:l,payload:u}=t,d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const f={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:l,payload:u,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,f,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);return await((o=m.body)===null||o===void 0?void 0:o.cancel()),m.ok?"ok":"error"}catch(m){return m instanceof Error&&m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,f;const m=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((f=(d=(u=this.params)===null||u===void 0?void 0:u.config)===null||d===void 0?void 0:d.broadcast)===null||f===void 0)&&f.ack)&&l("ok"),m.receive("ok",()=>l("ok")),m.receive("error",()=>l("error")),m.receive("timeout",()=>l("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,r,s){const o=new AbortController,l=setTimeout(()=>o.abort(),s),u=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:o.signal}));return clearTimeout(l),u}_on(t,r,s){const o=t.toLocaleLowerCase(),l=this.channelAdapter.on(t,s),u={type:o,filter:r,callback:s,ref:l};return this.bindings[o]?this.bindings[o].push(u):this.bindings[o]=[u],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,r,s)=>{var o,l,u,d,f,m,b;const g=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(g,s))return!1;const w=(o=this.bindings[g])===null||o===void 0?void 0:o.find(_=>_.ref===t.ref);if(!w)return!0;if(["broadcast","presence","postgres_changes"].includes(g))if("id"in w){const _=w.id,E=(l=w.filter)===null||l===void 0?void 0:l.event;return _&&((u=r.ids)===null||u===void 0?void 0:u.includes(_))&&(E==="*"||(E==null?void 0:E.toLocaleLowerCase())===((d=r.data)===null||d===void 0?void 0:d.type.toLocaleLowerCase()))}else{const _=(m=(f=w==null?void 0:w.filter)===null||f===void 0?void 0:f.event)===null||m===void 0?void 0:m.toLocaleLowerCase();return _==="*"||_===((b=r==null?void 0:r.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return w.type.toLocaleLowerCase()===g})}_notThisChannelEvent(t,r){const{close:s,error:o,leave:l,join:u}=$x;return r&&[s,o,l,u].includes(t)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,r,s)=>{if(typeof r=="object"&&"ids"in r){const o=r.data,{schema:l,table:u,commit_timestamp:d,type:f,errors:m}=o;return Object.assign(Object.assign({},{schema:l,table:u,commit_timestamp:d,eventType:f,new:{},old:{},errors:m}),this._getPayloadRecords(o))}return r})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in t.bindings)for(const s of t.bindings[r])this._on(s.type,s.filter,s.callback)}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=O0(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=O0(t.columns,t.old_record)),r}}class Rk{constructor(t,r){this.socket=new xk(t,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,r,s,o=1e4){return new Promise(l=>{setTimeout(()=>l("timeout"),o),this.socket.disconnect(()=>{t(),l("ok")},r,s)})}push(t){this.socket.push(t)}log(t,r,s){this.socket.log(t,r,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==jm.connecting}isDisconnecting(){return this.socket.connectionState()==jm.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const P0={HEARTBEAT_INTERVAL:25e3},Nk=[1e3,2e3,5e3,1e4],kk=1e4;function jk(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var r;return(r=Array.from(e.keys())[t])!==null&&r!==void 0?r:null},removeItem(t){e.delete(t)},setItem(t,r){e.set(t,String(r))}}}function Ok(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return jk()}const Mk=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class Dk{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,r){var s;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 ik,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=l=>l?(...u)=>l(...u):(...u)=>fetch(...u),!(!((s=r==null?void 0:r.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const o=this._initializeOptions(r);this.socketAdapter=new Rk(t,o),this.httpEndpoint=Hx(t),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const r=t.message;throw r.includes("Node.js")?new Error(`${r}
To use Realtime in Node.js, you need to provide a WebSocket implementation:
Option 1: Use Node.js 22+ which has native WebSocket support
Option 2: Install and provide the "ws" package:
npm install ws
import ws from "ws"
const client = new RealtimeClient(url, {
...options,
transport: ws
})`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,r)}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return r==="ok"&&t.teardown(),r}async removeAllChannels(){const t=this.channels.map(async s=>{const o=await s.unsubscribe();return s.teardown(),o}),r=await Promise.all(t);return await this.disconnect(),r}log(t,r,s){this.socketAdapter.log(t,r,s)}connectionState(){return this.socketAdapter.connectionState()||jm.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const s=`realtime:${t}`,o=this.getChannels().find(l=>l.topic===s);if(o)return o;{const l=new ol(`realtime:${t}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(l),l}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}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(t=null){let r,s=!1;if(t)r=t,s=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),r=this.accessTokenValue}else r=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(o=>{const l={access_token:r,version:tk};r&&o.updateJoinPayload(l),o.joinedOnce&&o.channelAdapter.isJoined()&&o.channelAdapter.push($x.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${t}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(r,s)=>{r=="sent"&&this._setAuthSafely(),t&&t(r,s)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let r;if(t)r=t;else{const s=new Blob([Mk],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_initializeOptions(t){var r,s,o,l,u,d,f,m,b,g,w,_;this.worker=(r=t==null?void 0:t.worker)!==null&&r!==void 0?r:!1,this.accessToken=(s=t==null?void 0:t.accessToken)!==null&&s!==void 0?s:null;const E={};E.timeout=(o=t==null?void 0:t.timeout)!==null&&o!==void 0?o:ak,E.heartbeatIntervalMs=(l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:P0.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(u=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&u!==void 0?u:2*((d=t==null?void 0:t.heartbeatIntervalMs)!==null&&d!==void 0?d:P0.HEARTBEAT_INTERVAL),E.transport=(f=t==null?void 0:t.transport)!==null&&f!==void 0?f:ZN.getWebSocketConstructor(),E.params=t==null?void 0:t.params,E.logger=t==null?void 0:t.logger,E.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),E.sessionStorage=(m=t==null?void 0:t.sessionStorage)!==null&&m!==void 0?m:Ok(),E.reconnectAfterMs=(b=t==null?void 0:t.reconnectAfterMs)!==null&&b!==void 0?b:(R=>Nk[R-1]||kk);let S,A;const C=(g=t==null?void 0:t.vsn)!==null&&g!==void 0?g:rk;switch(C){case nk:S=(R,N)=>N(JSON.stringify(R)),A=(R,N)=>N(JSON.parse(R));break;case Ix:S=this.serializer.encode.bind(this.serializer),A=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${E.vsn}`)}if(E.vsn=C,E.encode=(w=t==null?void 0:t.encode)!==null&&w!==void 0?w:S,E.decode=(_=t==null?void 0:t.decode)!==null&&_!==void 0?_:A,E.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,E.params=Object.assign(Object.assign({},E.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,E.autoSendHeartbeat=!this.worker}return E}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var ml=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((r=t.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Lk(e,t,r){const s=new URL(t,e);if(r)for(const[o,l]of Object.entries(r))l!==void 0&&s.searchParams.set(o,l);return s.toString()}async function Pk(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function zk(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:o,body:l,headers:u}){const d=Lk(e.baseUrl,s,o),f=await Pk(e.auth),m=await t(d,{method:r,headers:{...l?{"Content-Type":"application/json"}:{},...f,...u},body:l?JSON.stringify(l):void 0}),b=await m.text(),g=(m.headers.get("content-type")||"").includes("application/json"),w=g&&b?JSON.parse(b):b;if(!m.ok){const _=g?w:void 0,E=_==null?void 0:_.error;throw new ml((E==null?void 0:E.message)??`Request failed with status ${m.status}`,{status:m.status,icebergType:E==null?void 0:E.type,icebergCode:E==null?void 0:E.code,details:_})}return{status:m.status,headers:m.headers,data:w}}}}function su(e){return e.join("")}var Uk=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:su(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(s=>({namespace:s}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${su(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${su(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${su(e.namespace)}`}),!0}catch(t){if(t instanceof ml&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof ml&&r.status===409)return;throw r}}};function Si(e){return e.join("")}var Ik=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Si(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Si(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Si(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Si(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Si(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Si(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof ml&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof ml&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},$k=class{constructor(e){var s;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=zk({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(s=e.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new Uk(this.client,t),this.tableOps=new Ik(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}function Bk(e,t){if(pl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(pl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hk(e){var t=Bk(e,"string");return pl(t)=="symbol"?t:t+""}function qk(e,t,r){return(t=Hk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,s)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?z0(Object(r),!0).forEach(function(s){qk(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var ud=class extends Error{constructor(e,t="storage",r,s){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function dd(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Lm=class extends ud{constructor(e,t,r,s="storage"){super(e,s,t,r),this.name=s==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return Ne({},super.toJSON())}},Vx=class extends ud{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function $u(e,t,r){const s=Ne({},e),o=t.toLowerCase();for(const l of Object.keys(s))l.toLowerCase()===o&&delete s[l];return s[o]=r,s}function Vk(e){const t={};for(const[r,s]of Object.entries(e))t[r.toLowerCase()]=s;return t}const Gk=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Fk=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Pm=e=>{if(Array.isArray(e))return e.map(r=>Pm(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,s])=>{const o=r.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));t[o]=Pm(s)}),t},Kk=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),U0=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const r=t.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(e)},Yk=async(e,t,r,s)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const o=e;let l=parseInt(String(o.status),10);Number.isFinite(l)||(l=500),o.json().then(u=>{const d=(u==null?void 0:u.statusCode)||(u==null?void 0:u.code)||l+"";t(new Lm(U0(u),l,d,s))}).catch(()=>{const u=l+"";t(new Lm(o.statusText||`HTTP ${l} error`,l,u,s))})}else t(new Vx(U0(e),e,s))},Wk=(e,t,r,s)=>{const o={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!s)return Ne(Ne({},o),r);if(Fk(s)){var l;const u=(t==null?void 0:t.headers)||{};let d;for(const[f,m]of Object.entries(u))f.toLowerCase()==="content-type"&&(d=m);o.headers=$u(u,"Content-Type",(l=d)!==null&&l!==void 0?l:"application/json"),o.body=JSON.stringify(s)}else o.body=s;return t!=null&&t.duplex&&(o.duplex=t.duplex),Ne(Ne({},o),r)};async function Jo(e,t,r,s,o,l,u){return new Promise((d,f)=>{e(r,Wk(t,s,o,l)).then(m=>{if(!m.ok)throw m;if(s!=null&&s.noResolveJson)return m;if(u==="vectors"){const b=m.headers.get("content-type");if(m.headers.get("content-length")==="0"||m.status===204)return{};if(!b||!b.includes("application/json"))return{}}return m.json()}).then(m=>d(m)).catch(m=>Yk(m,f,s,u))})}function Gx(e="storage"){return{get:async(t,r,s,o)=>Jo(t,"GET",r,s,o,void 0,e),post:async(t,r,s,o,l)=>Jo(t,"POST",r,o,l,s,e),put:async(t,r,s,o,l)=>Jo(t,"PUT",r,o,l,s,e),head:async(t,r,s,o)=>Jo(t,"HEAD",r,Ne(Ne({},s),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,s,o,l)=>Jo(t,"DELETE",r,o,l,s,e)}}const Xk=Gx("storage"),{get:gl,post:er,put:zm,head:Jk,remove:_p}=Xk,kn=Gx("vectors");var Xi=class{constructor(e,t={},r,s="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=Vk(t),this.fetch=Gk(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=$u(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(dd(r))return{data:null,error:r};throw r}}};let Fx;Fx=Symbol.toStringTag;var Qk=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Fx]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(dd(t))return{data:null,error:t};throw t}}};let Kx;Kx=Symbol.toStringTag;var Zk=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Kx]="BlobDownloadBuilder",this.promise=null}asStream(){return new Qk(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(dd(t))return{data:null,error:t};throw t}}};const ej={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},I0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var tj=class extends Xi{constructor(e,t={},r,s){super(e,t,s,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,s){var o=this;return o.handleOperation(async()=>{let l;const u=Ne(Ne({},I0),s);let d=Ne(Ne({},o.headers),e==="POST"&&{"x-upsert":String(u.upsert)});const f=u.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),f&&l.append("metadata",o.encodeMetadata(f)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),f&&!l.has("metadata")&&l.append("metadata",o.encodeMetadata(f))):(l=r,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,f&&(d["x-metadata"]=o.toBase64(o.encodeMetadata(f))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),s!=null&&s.headers)for(const[w,_]of Object.entries(s.headers))d=$u(d,w,_);const m=o._removeEmptyFolders(t),b=o._getFinalPath(m),g=await(e=="PUT"?zm:er)(o.fetch,`${o.url}/object/${b}`,l,Ne({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}));return{path:m,id:g.Id,fullPath:g.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,s){var o=this;const l=o._removeEmptyFolders(e),u=o._getFinalPath(l),d=new URL(o.url+`/object/upload/sign/${u}`);return d.searchParams.set("token",t),o.handleOperation(async()=>{let f;const m=Ne(Ne({},I0),s);let b=Ne(Ne({},o.headers),{"x-upsert":String(m.upsert)});const g=m.metadata;if(typeof Blob<"u"&&r instanceof Blob?(f=new FormData,f.append("cacheControl",m.cacheControl),g&&f.append("metadata",o.encodeMetadata(g)),f.append("",r)):typeof FormData<"u"&&r instanceof FormData?(f=r,f.has("cacheControl")||f.append("cacheControl",m.cacheControl),g&&!f.has("metadata")&&f.append("metadata",o.encodeMetadata(g))):(f=r,b["cache-control"]=`max-age=${m.cacheControl}`,b["content-type"]=m.contentType,g&&(b["x-metadata"]=o.toBase64(o.encodeMetadata(g))),(typeof ReadableStream<"u"&&f instanceof ReadableStream||f&&typeof f=="object"&&"pipe"in f&&typeof f.pipe=="function")&&!m.duplex&&(m.duplex="half")),s!=null&&s.headers)for(const[w,_]of Object.entries(s.headers))b=$u(b,w,_);return{path:l,fullPath:(await zm(o.fetch,d.toString(),f,Ne({headers:b},m!=null&&m.duplex?{duplex:m.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e);const o=Ne({},r.headers);t!=null&&t.upsert&&(o["x-upsert"]="true");const l=await er(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:o}),u=new URL(r.url+l.url),d=u.searchParams.get("token");if(!d)throw new ud("No token returned by API");return{signedUrl:u.toString(),path:e,token:d}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var s=this;return s.handleOperation(async()=>await er(s.fetch,`${s.url}/object/move`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers}))}async copy(e,t,r){var s=this;return s.handleOperation(async()=>({path:(await er(s.fetch,`${s.url}/object/copy`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers})).Key}))}async createSignedUrl(e,t,r){var s=this;return s.handleOperation(async()=>{let o=s._getFinalPath(e);const l=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let u=await er(s.fetch,`${s.url}/object/sign/${o}`,Ne({expiresIn:t},l?{transform:r.transform}:{}),{headers:s.headers});const d=new URLSearchParams;r!=null&&r.download&&d.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&d.set("cacheNonce",String(r.cacheNonce));const f=d.toString();return{signedUrl:encodeURI(`${s.url}${u.signedURL}${f?`&${f}`:""}`)}})}async createSignedUrls(e,t,r){var s=this;return s.handleOperation(async()=>{const o=await er(s.fetch,`${s.url}/object/sign/${s.bucketId}`,{expiresIn:t,paths:e},{headers:s.headers}),l=new URLSearchParams;r!=null&&r.download&&l.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&l.set("cacheNonce",String(r.cacheNonce));const u=l.toString();return o.map(d=>Ne(Ne({},d),{},{signedUrl:d.signedURL?encodeURI(`${s.url}${d.signedURL}${u?`&${u}`:""}`):null}))})}download(e,t,r){const s=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(o,t.transform),(t==null?void 0:t.cacheNonce)!=null&&o.set("cacheNonce",String(t.cacheNonce));const l=o.toString(),u=this._getFinalPath(e),d=()=>gl(this.fetch,`${this.url}/${s}/${u}${l?`?${l}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Zk(d,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>Pm(await gl(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await Jk(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(o){if(t.shouldThrowOnError)throw o;if(dd(o)){var s;const l=o instanceof Lm?o.status:o instanceof Vx?(s=o.originalError)===null||s===void 0?void 0:s.status:void 0;if(l!==void 0&&[400,404].includes(l))return{data:!1,error:o}}throw o}}getPublicUrl(e,t){const r=this._getFinalPath(e),s=new URLSearchParams;t!=null&&t.download&&s.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const o=s.toString(),l=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await _p(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,r){var s=this;return s.handleOperation(async()=>{const o=Ne(Ne(Ne({},ej),t),{},{prefix:e||""});return await er(s.fetch,`${s.url}/object/list/${s.bucketId}`,o,{headers:s.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const s=Ne({},e);return await er(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,s,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const nj="2.106.2",jl={"X-Client-Info":`storage-js/${nj}`};var rj=class extends Xi{constructor(e,t={},r,s){const o=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));const l=o.href.replace(/\/$/,""),u=Ne(Ne({},jl),t);super(l,u,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await gl(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await gl(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await er(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await zm(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await er(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _p(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},aj=class extends Xi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},jl),t);super(s,o,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await er(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&r.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&r.set("sortOrder",e.sortOrder),e!=null&&e.search&&r.set("search",e.search);const s=r.toString(),o=s?`${t.url}/bucket?${s}`:`${t.url}/bucket`;return await gl(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _p(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Kk(e))throw new ud("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new $k({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{get(o,l){const u=o[l];return typeof u!="function"?u:async(...d)=>{try{return{data:await u.apply(o,d),error:null}}catch(f){if(s)throw f;return{data:null,error:f}}}}})}},sj=class extends Xi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},jl),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await kn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await kn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},ij=class extends Xi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},jl),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},oj=class extends Xi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},jl),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await kn.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},lj=class extends oj{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new cj(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},cj=class extends sj{constructor(e,t,r,s){super(e,t,s),this.vectorBucketName=r}async createIndex(e){var t=()=>super.createIndex,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,r=this;return t().call(r,r.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,r=this;return t().call(r,r.vectorBucketName,e)}index(e){return new uj(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},uj=class extends ij{constructor(e,t,r,s,o){super(e,t,o),this.vectorBucketName=r,this.indexName=s}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,Ne(Ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},dj=class extends rj{constructor(e,t={},r,s){super(e,t,r,s)}from(e){return new tj(this.url,this.headers,e,this.fetch)}get vectors(){return new lj(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new aj(this.url+"/iceberg",this.headers,this.fetch)}};const Yx="2.106.2",Di=30*1e3,Um=3,tm=Um*Di,fj="http://localhost:9999",hj="supabase.auth.token",mj={"X-Client-Info":`gotrue-js/${Yx}`},Im="X-Supabase-Api-Version",Wx={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},pj=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,gj=600*1e3;class Vi extends Error{constructor(t,r,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=s}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function de(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class yj extends Vi{constructor(t,r,s){super(t,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function vj(e){return de(e)&&e.name==="AuthApiError"}class tr extends Vi{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class oa extends Vi{constructor(t,r,s,o){super(t,s,o),this.name=r,this.status=s}}class zt extends oa{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function iu(e){return de(e)&&e.name==="AuthSessionMissingError"}class Ei extends oa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ou extends oa{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class lu extends oa{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function bj(e){return de(e)&&e.name==="AuthImplicitGrantRedirectError"}class $0 extends oa{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class wj extends oa{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 $m extends oa{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function nm(e){return de(e)&&e.name==="AuthRetryableFetchError"}class B0 extends oa{constructor(t,r,s){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Bm extends oa{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Bu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),H0=`
\r=`.split(""),xj=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<H0.length;t+=1)e[H0[t].charCodeAt(0)]=-2;for(let t=0;t<Bu.length;t+=1)e[Bu[t].charCodeAt(0)]=t;return e})();function q0(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;r(Bu[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;r(Bu[s]),t.queuedBits-=6}}function Xx(e,t,r){const s=xj[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function V0(e){const t=[],r=u=>{t.push(String.fromCodePoint(u))},s={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{Ej(u,s,r)};for(let u=0;u<e.length;u+=1)Xx(e.charCodeAt(u),o,l);return t.join("")}function _j(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function Sj(e,t){for(let r=0;r<e.length;r+=1){let s=e.charCodeAt(r);if(s>55295&&s<=56319){const o=(s-55296)*1024&65535;s=(e.charCodeAt(r+1)-56320&65535|o)+65536,r+=1}_j(s,t)}}function Ej(e,t,r){if(t.utf8seq===0){if(e<=127){r(e);return}for(let s=1;s<6;s+=1)if((e>>7-s&1)===0){t.utf8seq=s;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&r(t.codepoint)}}function Bi(e){const t=[],r={queue:0,queuedBits:0},s=o=>{t.push(o)};for(let o=0;o<e.length;o+=1)Xx(e.charCodeAt(o),r,s);return new Uint8Array(t)}function Cj(e){const t=[];return Sj(e,r=>t.push(r)),new Uint8Array(t)}function _s(e){const t=[],r={queue:0,queuedBits:0},s=o=>{t.push(o)};return e.forEach(o=>q0(o,r,s)),q0(null,r,s),t.join("")}function Aj(e){return Math.round(Date.now()/1e3)+e}function Tj(){return Symbol("auth-callback")}const Gt=()=>typeof window<"u"&&typeof document<"u",ys={tested:!1,writable:!1},Jx=()=>{if(!Gt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ys.tested)return ys.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),ys.tested=!0,ys.writable=!0}catch{ys.tested=!0,ys.writable=!1}return ys.writable};function Rj(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((o,l)=>{t[l]=o})}catch{}return r.searchParams.forEach((s,o)=>{t[o]=s}),t}const Qx=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Nj=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Li=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},vs=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},Vt=async(e,t)=>{await e.removeItem(t)};class fd{constructor(){this.promise=new fd.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}fd.promiseConstructor=Promise;function cu(e){const t=e.split(".");if(t.length!==3)throw new Bm("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!pj.test(t[s]))throw new Bm("JWT not in base64url format");return{header:JSON.parse(V0(t[0])),payload:JSON.parse(V0(t[1])),signature:Bi(t[2]),raw:{header:t[0],payload:t[1]}}}async function kj(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function jj(e,t){return new Promise((s,o)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await e(l);if(!t(l,null,u)){s(u);return}}catch(u){if(!t(l,u)){o(u);return}}})()})}function Oj(e){return("0"+e.toString(16)).substr(-2)}function Mj(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let o="";for(let l=0;l<56;l++)o+=r.charAt(Math.floor(Math.random()*s));return o}return crypto.getRandomValues(t),Array.from(t,Oj).join("")}async function Dj(e){const r=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",r),o=new Uint8Array(s);return Array.from(o).map(l=>String.fromCharCode(l)).join("")}async function Lj(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const r=await Dj(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ci(e,t,r=!1){const s=Mj();let o=s;r&&(o+="/recovery"),await Li(e,`${t}-code-verifier`,o);const l=await Lj(s);return[l,s===l?"plain":"s256"]}const Pj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function zj(e){const t=e.headers.get(Im);if(!t||!t.match(Pj))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Uj(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Ij(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const $j=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Wr(e){if(!$j.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Qn(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function rm(){const e={};return new Proxy(e,{get:(t,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Bj(e,t){return new Proxy(e,{get:(r,s,o)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const l=s.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,s,o)}return!t.value&&typeof s=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(r,s,o)}})}function G0(e){return JSON.parse(JSON.stringify(e))}const xs=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},Hj=[502,503,504,520,521,522,523,524,530];async function F0(e){var t;if(!Nj(e))throw new $m(xs(e),0);if(Hj.includes(e.status))throw new $m(xs(e),e.status);let r;try{r=await e.json()}catch(l){throw new tr(xs(l),l)}let s;const o=zj(e);if(o&&o.getTime()>=Wx["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?s=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(s=r.error_code),s){if(s==="weak_password")throw new B0(xs(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new zt}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((l,u)=>l&&typeof u=="string",!0))throw new B0(xs(r),e.status,r.weak_password.reasons);throw new yj(xs(r),e.status||500,s)}const qj=(e,t,r,s)=>{const o={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),o.body=JSON.stringify(s),Object.assign(Object.assign({},o),r))};async function be(e,t,r,s){var o;const l=Object.assign({},s==null?void 0:s.headers);l[Im]||(l[Im]=Wx["2024-01-01"].name),s!=null&&s.jwt&&(l.Authorization=`Bearer ${s.jwt}`);const u=(o=s==null?void 0:s.query)!==null&&o!==void 0?o:{};s!=null&&s.redirectTo&&(u.redirect_to=s.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",f=await Vj(e,t,r+d,{headers:l,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(f):{data:Object.assign({},f),error:null}}async function Vj(e,t,r,s,o,l){const u=qj(t,s,o,l);let d;try{d=await e(r,Object.assign({},u))}catch(f){throw console.error(f),new $m(xs(f),0)}if(d.ok||await F0(d),s!=null&&s.noResolveJson)return d;try{return await d.json()}catch(f){await F0(f)}}function qn(e){var t;let r=null;Kj(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=Aj(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:typeof(e==null?void 0:e.id)=="string"?e:null;return{data:{session:r,user:s},error:null}}function K0(e){const t=qn(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,s)=>r&&typeof s=="string",!0)&&(t.data.weak_password=e.weak_password),t}function Ba(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Gj(e){return{data:e,error:null}}function Fj(e){const{action_link:t,email_otp:r,hashed_token:s,redirect_to:o,verification_type:l}=e,u=Wi(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:t,email_otp:r,hashed_token:s,redirect_to:o,verification_type:l},f=Object.assign({},u);return{data:{properties:d,user:f},error:null}}function Y0(e){return e}function Kj(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const am=["global","local","others"];class Yj{_encodePathSegment(t){if(t==="."||t==="..")throw new Vi("Invalid path segment");return encodeURIComponent(t)}constructor({url:t="",headers:r={},fetch:s,experimental:o}){this.url=t,this.headers=r,this.fetch=Qx(s),this.experimental=o??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,r=am[0]){if(am.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${am.join(", ")}`);try{return await be(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(de(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,r={}){try{return await be(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ba})}catch(s){if(de(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:r}=t,s=Wi(t,["options"]),o=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(o.new_email=s==null?void 0:s.newEmail,delete o.newEmail),await be(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:Fj,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(de(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await be(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Ba})}catch(r){if(de(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,s,o,l,u,d,f;try{const m={nextPage:null,lastPage:0,total:0},b=await be(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(l=(o=t==null?void 0:t.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:Y0});if(b.error)throw b.error;const g=await b.json(),w=(u=b.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(f=(d=b.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&f!==void 0?f:[];return _.length>0&&(_.forEach(E=>{const S=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(E.split(";")[1].split("=")[1]);m[`${A}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},g),m),error:null}}catch(m){if(de(m))return{data:{users:[]},error:m};throw m}}async getUserById(t){Wr(t);try{return await be(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Ba})}catch(r){if(de(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){Wr(t);try{return await be(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Ba})}catch(s){if(de(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,r=!1){Wr(t);try{return await be(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ba})}catch(s){if(de(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){Wr(t.userId);try{const{data:r,error:s}=await be(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:r,error:s}}catch(r){if(de(r))return{data:null,error:r};throw r}}async _deleteFactor(t){Wr(t.userId),Wr(t.id);try{return{data:await be(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(de(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,s,o,l,u,d,f;try{const m={nextPage:null,lastPage:0,total:0},b=await be(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(l=(o=t==null?void 0:t.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:Y0});if(b.error)throw b.error;const g=await b.json(),w=(u=b.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(f=(d=b.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&f!==void 0?f:[];return _.length>0&&(_.forEach(E=>{const S=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(E.split(";")[1].split("=")[1]);m[`${A}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},g),m),error:null}}catch(m){if(de(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(t){try{return await be(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(de(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{const r=this._encodePathSegment(t);return await be(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(de(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{const s=this._encodePathSegment(t);return await be(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${s}`,{body:r,headers:this.headers,xform:o=>({data:o,error:null})})}catch(s){if(de(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{const r=this._encodePathSegment(t);return await be(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(de(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{const r=this._encodePathSegment(t);return await be(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(de(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await be(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:s=>{var o;return{data:{providers:(o=s==null?void 0:s.providers)!==null&&o!==void 0?o:[]},error:null}}})}catch(r){if(de(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await be(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(de(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{const r=this._encodePathSegment(t);return await be(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(de(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{const s=this._encodePathSegment(t);return await be(this.fetch,"PUT",`${this.url}/admin/custom-providers/${s}`,{body:r,headers:this.headers,xform:o=>({data:o,error:null})})}catch(s){if(de(s))return{data:null,error:s};throw s}}async _deleteCustomProvider(t){try{const r=this._encodePathSegment(t);return await be(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(de(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){Qn(this.experimental),Wr(t.userId);try{return await be(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(de(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){Qn(this.experimental),Wr(t.userId),Wr(t.passkeyId);try{return await be(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(de(r))return{data:null,error:r};throw r}}}function W0(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const yr={debug:!!(globalThis&&Jx()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Zx extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class X0 extends Zx{}async function Wj(e,t,r){yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;let o;t>0&&(o=setTimeout(()=>{s.abort(),yr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async l=>{if(l){clearTimeout(o),yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,l.name);try{return await r()}finally{yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,l.name)}}else{if(t===0)throw yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new X0(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(yr.debug)try{const u=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(u,null," "))}catch(u){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",u)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(o),await r()}})}catch(l){if(t>0&&clearTimeout(o),l!==null&&typeof l=="object"&&"name"in l&&l.name==="AbortError"&&t>0){if(s.signal.aborted)return yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async u=>{if(u){yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,u.name);try{return await r()}finally{yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,u.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw yr.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new X0(`Lock "${e}" was released because another request stole it`)}throw l}}function Xj(){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 e_(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Jj(e){return parseInt(e,16)}function Qj(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function Zj(e){var t;const{chainId:r,domain:s,expirationTime:o,issuedAt:l=new Date,nonce:u,notBefore:d,requestId:f,resources:m,scheme:b,uri:g,version:w}=e;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!s)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(!g)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const _=e_(e.address),E=b?`${b}://${s}`:s,S=e.statement?`${e.statement}
`:"",A=`${E} wants you to sign in with your Ethereum account:
${_}
${S}`;let C=`URI: ${g}
Version: ${w}
Chain ID: ${r}${u?`
Nonce: ${u}`:""}
Issued At: ${l.toISOString()}`;if(o&&(C+=`
Expiration Time: ${o.toISOString()}`),d&&(C+=`
Not Before: ${d.toISOString()}`),f&&(C+=`
Request ID: ${f}`),m){let R=`
Resources:`;for(const N of m){if(!N||typeof N!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${N}`);R+=`
- ${N}`}C+=R}return`${A}
${C}`}class Rt extends Error{constructor({message:t,code:r,cause:s,name:o}){var l;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(l=o??(s instanceof Error?s.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Hu extends Rt{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function eO({error:e,options:t}){var r,s,o;const{publicKey:l}=t;if(!l)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Rt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=l.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Rt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((s=l.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Rt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((o=l.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new Rt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new Rt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Rt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return l.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new Rt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Rt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const u=window.location.hostname;if(t_(u)){if(l.rp.id!==u)return new Rt({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Rt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new Rt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new Rt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Rt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function tO({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Rt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Rt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(t_(s)){if(r.rpId!==s)return new Rt({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Rt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Rt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Rt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class nO{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const Hm=new nO;function J0(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:s}=e,o=Wi(e,["challenge","user","excludeCredentials"]),l=Bi(t).buffer,u=Object.assign(Object.assign({},r),{id:Bi(r.id).buffer}),d=Object.assign(Object.assign({},o),{challenge:l,user:u});if(s&&s.length>0){d.excludeCredentials=new Array(s.length);for(let f=0;f<s.length;f++){const m=s[f];d.excludeCredentials[f]=Object.assign(Object.assign({},m),{id:Bi(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function Q0(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,s=Wi(e,["challenge","allowCredentials"]),o=Bi(t).buffer,l=Object.assign(Object.assign({},s),{challenge:o});if(r&&r.length>0){l.allowCredentials=new Array(r.length);for(let u=0;u<r.length;u++){const d=r[u];l.allowCredentials[u]=Object.assign(Object.assign({},d),{id:Bi(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function Z0(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:_s(new Uint8Array(e.response.attestationObject)),clientDataJSON:_s(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function ew(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,s=e.getClientExtensionResults(),o=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:_s(new Uint8Array(o.authenticatorData)),clientDataJSON:_s(new Uint8Array(o.clientDataJSON)),signature:_s(new Uint8Array(o.signature)),userHandle:o.userHandle?_s(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function t_(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function qu(){var e,t;return!!(Gt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function n_(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Hu("Browser returned unexpected credential type",t)}:{data:null,error:new Hu("Empty credential response",t)}}catch(t){return{data:null,error:eO({error:t,options:e})}}}async function r_(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Hu("Browser returned unexpected credential type",t)}:{data:null,error:new Hu("Empty credential response",t)}}catch(t){return{data:null,error:tO({error:t,options:e})}}}const rO={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},aO={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Vu(...e){const t=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),r=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),s={};for(const o of e)if(o)for(const l in o){const u=o[l];if(u!==void 0)if(Array.isArray(u))s[l]=u;else if(r(u))s[l]=u;else if(t(u)){const d=s[l];t(d)?s[l]=Vu(d,u):s[l]=Vu(u)}else s[l]=u}return s}function sO(e,t){return Vu(rO,e,t||{})}function iO(e,t){return Vu(aO,e,t||{})}class oO{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:s,signal:o},l){var u;try{const{data:d,error:f}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!d)return{data:null,error:f};const m=o??Hm.createNewAbortSignal();if(d.webauthn.type==="create"){const{user:b}=d.webauthn.credential_options.publicKey;if(!b.name){const g=s;if(g)b.name=`${b.id}:${g}`;else{const _=(await this.client.getUser()).data.user,E=((u=_==null?void 0:_.user_metadata)===null||u===void 0?void 0:u.name)||(_==null?void 0:_.email)||(_==null?void 0:_.id)||"User";b.name=`${b.id}:${E}`}}b.displayName||(b.displayName=b.name)}switch(d.webauthn.type){case"create":{const b=sO(d.webauthn.credential_options.publicKey,l==null?void 0:l.create),{data:g,error:w}=await n_({publicKey:b,signal:m});return g?{data:{factorId:t,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}case"request":{const b=iO(d.webauthn.credential_options.publicKey,l==null?void 0:l.request),{data:g,error:w}=await r_(Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:b,signal:m}));return g?{data:{factorId:t,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}}}catch(d){return de(d)?{data:null,error:d}:{data:null,error:new tr("Unexpected error in challenge",d)}}}async _verify({challengeId:t,factorId:r,webauthn:s}){return this.client.mfa.verify({factorId:r,challengeId:t,webauthn:s})}async _authenticate({factorId:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!r)return{data:null,error:new Vi("rpId is required for WebAuthn authentication")};try{if(!qu())return{data:null,error:new tr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:s},signal:o},{request:l});if(!u)return{data:null,error:d};const{webauthn:f}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:f.type,rpId:r,rpOrigins:s,credential_response:f.credential_response}})}catch(u){return de(u)?{data:null,error:u}:{data:null,error:new tr("Unexpected error in authenticate",u)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!r)return{data:null,error:new Vi("rpId is required for WebAuthn registration")};try{if(!qu())return{data:null,error:new tr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(b=>{var g;return(g=b.data)===null||g===void 0?void 0:g.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===t&&w.status!=="unverified")}).then(b=>b?this.client.mfa.unenroll({factorId:b==null?void 0:b.id}):void 0),{data:null,error:d};const{data:f,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:o},{create:l});return f?this._verify({factorId:u.id,challengeId:f.challengeId,webauthn:{rpId:r,rpOrigins:s,type:f.webauthn.type,credential_response:f.webauthn.credential_response}}):{data:null,error:m}}catch(u){return de(u)?{data:null,error:u}:{data:null,error:new tr("Unexpected error in register",u)}}}}Xj();const lO={url:fj,storageKey:hj,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:mj,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function tw(e,t,r){return await r()}const Ai={};class yl{get jwks(){var t,r;return(r=(t=Ai[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Ai[this.storageKey]=Object.assign(Object.assign({},Ai[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Ai[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ai[this.storageKey]=Object.assign(Object.assign({},Ai[this.storageKey]),{cachedAt:t})}constructor(t){var r,s,o,l;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const u=Object.assign(Object.assign({},lO),t);if(this.storageKey=u.storageKey,this.instanceID=(r=yl.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,yl.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!u.debug,typeof u.debug=="function"&&(this.logger=u.debug),this.instanceID>0&&Gt()){const d=`${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(d),this.logDebugMessages&&console.trace(d)}if(this.persistSession=u.persistSession,this.autoRefreshToken=u.autoRefreshToken,this.experimental=(s=u.experimental)!==null&&s!==void 0?s:{},this.admin=new Yj({url:u.url,headers:u.headers,fetch:u.fetch,experimental:this.experimental}),this.url=u.url,this.headers=u.headers,this.fetch=Qx(u.fetch),this.lock=u.lock||tw,this.detectSessionInUrl=u.detectSessionInUrl,this.flowType=u.flowType,this.hasCustomAuthorizationHeader=u.hasCustomAuthorizationHeader,this.throwOnError=u.throwOnError,this.lockAcquireTimeout=u.lockAcquireTimeout,u.lock?this.lock=u.lock:this.persistSession&&Gt()&&(!((o=globalThis==null?void 0:globalThis.navigator)===null||o===void 0)&&o.locks)?this.lock=Wj:this.lock=tw,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 oO(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?(u.storage?this.storage=u.storage:Jx()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=W0(this.memoryStorage)),u.userStorage&&(this.userStorage=u.userStorage)):(this.memoryStorage={},this.storage=W0(this.memoryStorage)),Gt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(d){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",d)}(l=this.broadcastChannel)===null||l===void 0||l.addEventListener("message",async d=>{this._debug("received broadcast notification from other tab or client",d);try{await this._notifyAllSubscribers(d.data.event,d.data.session,!1)}catch(f){this._debug("#broadcastChannel","error",f)}})}u.skipAutoInitialize||this.initialize().catch(d=>{this._debug("#initialize()","error",d)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Yx}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let r={},s="none";if(Gt()&&(r=Rj(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),Gt()&&this.detectSessionInUrl&&s!=="none"){const{data:o,error:l}=await this._getSessionFromURL(r,s);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),bj(l)){const f=(t=l.details)===null||t===void 0?void 0:t.code;if(f==="identity_already_exists"||f==="identity_not_found"||f==="single_identity_not_deletable")return{error:l}}return{error:l}}const{session:u,redirectType:d}=o;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(r){return de(r)?this._returnResult({error:r}):this._returnResult({error:new tr("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,s,o;try{const l=await be(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(o=t==null?void 0:t.options)===null||o===void 0?void 0:o.captchaToken}},xform:qn}),{data:u,error:d}=l;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const f=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",f)),this._returnResult({data:{user:m,session:f},error:null})}catch(l){if(de(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(t){var r,s,o;try{let l;if("email"in t){const{email:b,password:g,options:w}=t;let _=null,E=null;this.flowType==="pkce"&&([_,E]=await Ci(this.storage,this.storageKey)),l=await be(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w==null?void 0:w.emailRedirectTo,body:{email:b,password:g,data:(r=w==null?void 0:w.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken},code_challenge:_,code_challenge_method:E},xform:qn})}else if("phone"in t){const{phone:b,password:g,options:w}=t;l=await be(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:b,password:g,data:(s=w==null?void 0:w.data)!==null&&s!==void 0?s:{},channel:(o=w==null?void 0:w.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken}},xform:qn})}else throw new ou("You must provide either an email or phone number and a password");const{data:u,error:d}=l;if(d||!u)return await Vt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const f=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",f)),this._returnResult({data:{user:m,session:f},error:null})}catch(l){if(await Vt(this.storage,`${this.storageKey}-code-verifier`),de(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(t){try{let r;if("email"in t){const{email:l,password:u,options:d}=t;r=await be(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:K0})}else if("phone"in t){const{phone:l,password:u,options:d}=t;r=await be(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:K0})}else throw new ou("You must provide either an email or phone number and a password");const{data:s,error:o}=r;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!s||!s.session||!s.user){const l=new Ei;return this._returnResult({data:{user:null,session:null},error:l})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:o})}catch(r){if(de(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,s,o,l;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(s=t.options)===null||s===void 0?void 0:s.scopes,queryParams:(o=t.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(l=t.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:r}=t;switch(r){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(t){var r,s,o,l,u,d,f,m,b,g,w;let _,E;if("message"in t)_=t.message,E=t.signature;else{const{chain:S,wallet:A,statement:C,options:R}=t;let N;if(Gt())if(typeof A=="object")N=A;else{const ie=window;if("ethereum"in ie&&typeof ie.ethereum=="object"&&"request"in ie.ethereum&&typeof ie.ethereum.request=="function")N=ie.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 A!="object"||!(R!=null&&R.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=A}const P=new URL((r=R==null?void 0:R.url)!==null&&r!==void 0?r:window.location.href),F=await N.request({method:"eth_requestAccounts"}).then(ie=>ie).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!F||F.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const $=e_(F[0]);let L=(s=R==null?void 0:R.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!L){const ie=await N.request({method:"eth_chainId"});L=Jj(ie)}const q={domain:P.host,address:$,statement:C,uri:P.href,version:"1",chainId:L,nonce:(o=R==null?void 0:R.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(u=(l=R==null?void 0:R.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=R==null?void 0:R.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(f=R==null?void 0:R.signInWithEthereum)===null||f===void 0?void 0:f.notBefore,requestId:(m=R==null?void 0:R.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(b=R==null?void 0:R.signInWithEthereum)===null||b===void 0?void 0:b.resources};_=Zj(q),E=await N.request({method:"personal_sign",params:[Qj(_),$]})}try{const{data:S,error:A}=await be(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:E},!((g=t.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(w=t.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:qn});if(A)throw A;if(!S||!S.session||!S.user){const C=new Ei;return this._returnResult({data:{user:null,session:null},error:C})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:A})}catch(S){if(de(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(t){var r,s,o,l,u,d,f,m,b,g,w,_;let E,S;if("message"in t)E=t.message,S=t.signature;else{const{chain:A,wallet:C,statement:R,options:N}=t;let P;if(Gt())if(typeof C=="object")P=C;else{const $=window;if("solana"in $&&typeof $.solana=="object"&&("signIn"in $.solana&&typeof $.solana.signIn=="function"||"signMessage"in $.solana&&typeof $.solana.signMessage=="function"))P=$.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 C!="object"||!(N!=null&&N.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=C}const F=new URL((r=N==null?void 0:N.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in P&&P.signIn){const $=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N==null?void 0:N.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),R?{statement:R}:null));let L;if(Array.isArray($)&&$[0]&&typeof $[0]=="object")L=$[0];else if($&&typeof $=="object"&&"signedMessage"in $&&"signature"in $)L=$;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in L&&"signature"in L&&(typeof L.signedMessage=="string"||L.signedMessage instanceof Uint8Array)&&L.signature instanceof Uint8Array)E=typeof L.signedMessage=="string"?L.signedMessage:new TextDecoder().decode(L.signedMessage),S=L.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${F.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...R?["",R,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(o=(s=N==null?void 0:N.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((l=N==null?void 0:N.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((u=N==null?void 0:N.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((d=N==null?void 0:N.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((f=N==null?void 0:N.signInWithSolana)===null||f===void 0)&&f.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((m=N==null?void 0:N.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((g=(b=N==null?void 0:N.signInWithSolana)===null||b===void 0?void 0:b.resources)===null||g===void 0)&&g.length?["Resources",...N.signInWithSolana.resources.map(L=>`- ${L}`)]:[]].join(`
`);const $=await P.signMessage(new TextEncoder().encode(E),"utf8");if(!$||!($ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=$}}try{const{data:A,error:C}=await be(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:_s(S)},!((w=t.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=t.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:qn});if(C)throw C;if(!A||!A.session||!A.user){const R=new Ei;return this._returnResult({data:{user:null,session:null},error:R})}return A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),this._returnResult({data:Object.assign({},A),error:C})}catch(A){if(de(A))return this._returnResult({data:{user:null,session:null},error:A});throw A}}async _exchangeCodeForSession(t){const r=await vs(this.storage,`${this.storageKey}-code-verifier`),[s,o]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new wj;const{data:l,error:u}=await be(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:qn});if(await Vt(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Ei;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers(o==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l.session)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:o??null}),error:u})}catch(l){if(await Vt(this.storage,`${this.storageKey}-code-verifier`),de(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(t){try{const{options:r,provider:s,token:o,access_token:l,nonce:u}=t,d=await be(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:o,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:qn}),{data:f,error:m}=d;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!f||!f.session||!f.user){const b=new Ei;return this._returnResult({data:{user:null,session:null},error:b})}return f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("SIGNED_IN",f.session)),this._returnResult({data:f,error:m})}catch(r){if(de(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,s,o,l,u;try{if("email"in t){const{email:d,options:f}=t;let m=null,b=null;this.flowType==="pkce"&&([m,b]=await Ci(this.storage,this.storageKey));const{error:g}=await be(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},create_user:(s=f==null?void 0:f.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:m,code_challenge_method:b},redirectTo:f==null?void 0:f.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:g})}if("phone"in t){const{phone:d,options:f}=t,{data:m,error:b}=await be(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(o=f==null?void 0:f.data)!==null&&o!==void 0?o:{},create_user:(l=f==null?void 0:f.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},channel:(u=f==null?void 0:f.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m==null?void 0:m.message_id},error:b})}throw new ou("You must provide either an email or phone number.")}catch(d){if(await Vt(this.storage,`${this.storageKey}-code-verifier`),de(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(t){var r,s;try{let o,l;"options"in t&&(o=(r=t.options)===null||r===void 0?void 0:r.redirectTo,l=(s=t.options)===null||s===void 0?void 0:s.captchaToken);const{data:u,error:d}=await be(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:l}}),redirectTo:o,xform:qn});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const f=u.session,m=u.user;return f!=null&&f.access_token&&(await this._saveSession(f),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",f)),this._returnResult({data:{user:m,session:f},error:null})}catch(o){if(de(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(t){var r,s,o,l,u;try{let d=null,f=null;this.flowType==="pkce"&&([d,f]=await Ci(this.storage,this.storageKey));const m=await be(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&s!==void 0?s:void 0}),!((o=t==null?void 0:t.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:f}),headers:this.headers,xform:Gj});return!((l=m.data)===null||l===void 0)&&l.url&&Gt()&&!(!((u=t.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await Vt(this.storage,`${this.storageKey}-code-verifier`),de(d))return this._returnResult({data:null,error:d});throw d}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;if(s)throw s;if(!r)throw new zt;const{error:o}=await be(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(t){if(de(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:s,type:o,options:l}=t,{error:u}=await be(this.fetch,"POST",r,{headers:this.headers,body:{email:s,type:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in t){const{phone:s,type:o,options:l}=t,{data:u,error:d}=await be(this.fetch,"POST",r,{headers:this.headers,body:{phone:s,type:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new ou("You must provide either an email or phone number and a type")}catch(r){if(de(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await s,await r()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=r();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const r=await vs(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const s=t.expires_at?t.expires_at*1e3-Date.now()<tm:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){const u=await vs(this.userStorage,this.storageKey+"-user");u!=null&&u.user?t.user=u.user:t.user=rm()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};t.user=Bj(t.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:o,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(t){try{return t?await be(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Ba}):await this._useSession(async r=>{var s,o,l;const{data:u,error:d}=r;if(d)throw d;return!(!((s=u.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new zt}:await be(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(o=u.session)===null||o===void 0?void 0:o.access_token)!==null&&l!==void 0?l:void 0,xform:Ba})})}catch(r){if(de(r))return iu(r)&&(await this._removeSession(),await Vt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async s=>{const{data:o,error:l}=s;if(l)throw l;if(!o.session)throw new zt;const u=o.session;let d=null,f=null;this.flowType==="pkce"&&t.email!=null&&([d,f]=await Ci(this.storage,this.storageKey));const{data:m,error:b}=await be(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:d,code_challenge_method:f}),jwt:u.access_token,xform:Ba});if(b)throw b;return u.user=m.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(s){if(await Vt(this.storage,`${this.storageKey}-code-verifier`),de(s))return this._returnResult({data:{user:null},error:s});throw s}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new zt;const r=Date.now()/1e3;let s=r,o=!0,l=null;const{payload:u}=cu(t.access_token);if(u.exp&&(s=u.exp,o=s<=r),o){const{data:d,error:f}=await this._callRefreshToken(t.refresh_token);if(f)return this._returnResult({data:{user:null,session:null},error:f});if(!d)return{data:{user:null,session:null},error:null};l=d}else{const{data:d,error:f}=await this._getUser(t.access_token);if(f)return this._returnResult({data:{user:null,session:null},error:f});l={access_token:t.access_token,refresh_token:t.refresh_token,user:d.user,token_type:"bearer",expires_in:s-r,expires_at:s},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(r){if(de(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var s;if(!t){const{data:u,error:d}=r;if(d)throw d;t=(s=u.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new zt;const{data:o,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(de(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var s;try{if(!Gt())throw new lu("No browser detected.");if(t.error||t.error_description||t.error_code)throw new lu(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new $0("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new lu("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new $0("No code detected.");const{data:N,error:P}=await this._exchangeCodeForSession(t.code);if(P)throw P;const F=new URL(window.location.href);return F.searchParams.delete("code"),window.history.replaceState(window.history.state,"",F.toString()),{data:{session:N.session,redirectType:(s=N.redirectType)!==null&&s!==void 0?s:null},error:null}}const{provider_token:o,provider_refresh_token:l,access_token:u,refresh_token:d,expires_in:f,expires_at:m,token_type:b}=t;if(!u||!f||!d||!b)throw new lu("No session defined in URL");const g=Math.round(Date.now()/1e3),w=parseInt(f);let _=g+w;m&&(_=parseInt(m));const E=_-g;E*1e3<=Di&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${E}s, should have been closer to ${w}s`);const S=_-w;g-S>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",S,_,g):g-S<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",S,_,g);const{data:A,error:C}=await this._getUser(u);if(C)throw C;const R={provider_token:o,provider_refresh_token:l,access_token:u,expires_in:w,expires_at:_,refresh_token:d,token_type:b,user:A.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:R,redirectType:t.type},error:null})}catch(o){if(de(o))return this._returnResult({data:{session:null,redirectType:null},error:o});throw o}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const r=await vs(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var s;const{data:o,error:l}=r;if(l&&!iu(l))return this._returnResult({error:l});const u=(s=o.session)===null||s===void 0?void 0:s.access_token;if(u){const{error:d}=await this.admin.signOut(u,t);if(d&&!(vj(d)&&(d.status===404||d.status===401||d.status===403)||iu(d)))return this._returnResult({error:d})}return t!=="others"&&(await this._removeSession(),await Vt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=Tj(),s={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,s),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:s}}}async _emitInitialSession(t){return await this._useSession(async r=>{var s,o;try{const{data:{session:l},error:u}=r;if(u)throw u;await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",t,"session",l)}catch(l){await((o=this.stateChangeEmitters.get(t))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",l),iu(l)?console.warn(l):console.error(l)}})}async resetPasswordForEmail(t,r={}){let s=null,o=null;this.flowType==="pkce"&&([s,o]=await Ci(this.storage,this.storageKey,!0));try{return await be(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:o,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(l){if(await Vt(this.storage,`${this.storageKey}-code-verifier`),de(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var t;try{const{data:r,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var r;try{const{data:s,error:o}=await this._useSession(async l=>{var u,d,f,m,b;const{data:g,error:w}=l;if(w)throw w;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(u=t.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=t.options)===null||d===void 0?void 0:d.scopes,queryParams:(f=t.options)===null||f===void 0?void 0:f.queryParams,skipBrowserRedirect:!0});return await be(this.fetch,"GET",_,{headers:this.headers,jwt:(b=(m=g.session)===null||m===void 0?void 0:m.access_token)!==null&&b!==void 0?b:void 0})});if(o)throw o;return Gt()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),this._returnResult({data:{provider:t.provider,url:s==null?void 0:s.url},error:null})}catch(s){if(de(s))return this._returnResult({data:{provider:t.provider,url:null},error:s});throw s}}async linkIdentityIdToken(t){return await this._useSession(async r=>{var s;try{const{error:o,data:{session:l}}=r;if(o)throw o;const{options:u,provider:d,token:f,access_token:m,nonce:b}=t,g=await be(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=l==null?void 0:l.access_token)!==null&&s!==void 0?s:void 0,body:{provider:d,id_token:f,access_token:m,nonce:b,link_identity:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:qn}),{data:w,error:_}=g;return _?this._returnResult({data:{user:null,session:null},error:_}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new Ei}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:_}))}catch(o){if(await Vt(this.storage,`${this.storageKey}-code-verifier`),de(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var s,o;const{data:l,error:u}=r;if(u)throw u;return await be(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(o=(s=l.session)===null||s===void 0?void 0:s.access_token)!==null&&o!==void 0?o:void 0})})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(t){const r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{const s=Date.now();return await jj(async o=>(o>0&&await kj(200*Math.pow(2,o-1)),this._debug(r,"refreshing attempt",o),await be(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:qn})),(o,l)=>{const u=200*Math.pow(2,o);return l&&nm(l)&&Date.now()+u-s<Di})}catch(s){if(this._debug(r,"error",s),de(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){const s=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",s),Gt()&&!r.skipBrowserRedirect&&window.location.assign(s),{data:{provider:t,url:s},error:null}}async _recoverAndRefresh(){var t,r;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const o=await vs(this.storage,this.storageKey);if(o&&this.userStorage){let u=await vs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:o.user},await Li(this.userStorage,this.storageKey+"-user",u)),o.user=(t=u==null?void 0:u.user)!==null&&t!==void 0?t:rm()}else if(o&&!o.user&&!o.user){const u=await vs(this.storage,this.storageKey+"-user");u&&(u!=null&&u.user)?(o.user=u.user,await Vt(this.storage,this.storageKey+"-user"),await Li(this.storage,this.storageKey,o)):o.user=rm()}if(this._debug(s,"session from storage",o),!this._isValidSession(o)){this._debug(s,"session is not valid"),o!==null&&await this._removeSession();return}const l=((r=o.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<tm;if(this._debug(s,`session has${l?"":" not"} expired with margin of ${tm}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),nm(u)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",u),await this._removeSession()))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:d}=await this._getUser(o.access_token);!d&&(u!=null&&u.user)?(o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(s,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(s,"error",o),console.error(o);return}finally{this._debug(s,"end")}}async _callRefreshToken(t){var r,s;if(!t)throw new zt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new fd;const{data:l,error:u}=await this._refreshAccessToken(t);if(u)throw u;if(!l.session)throw new zt;await this._saveSession(l.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",l.session);const d={data:l.session,error:null};return this.refreshingDeferred.resolve(d),d}catch(l){if(this._debug(o,"error",l),de(l)){const u={data:null,error:l};return nm(l)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(u),u}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(l),l}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(t,r,s=!0){const o=`#_notifyAllSubscribers(${t})`;this._debug(o,"begin",r,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:t,session:r});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(t,r)}catch(f){l.push(f)}});if(await Promise.all(u),l.length>0){for(let d=0;d<l.length;d+=1)console.error(l[d]);throw l[0]}}finally{this._debug(o,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Vt(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},t),s=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&r.user&&await Li(this.userStorage,this.storageKey+"-user",{user:r.user});const o=Object.assign({},r);delete o.user;const l=G0(o);await Li(this.storage,this.storageKey,l)}else{const o=G0(r);await Li(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Vt(this.storage,this.storageKey),await Vt(this.storage,this.storageKey+"-code-verifier"),await Vt(this.storage,this.storageKey+"-user"),this.userStorage&&await Vt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Gt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Di);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async r=>{const{data:{session:s}}=r;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((s.expires_at*1e3-t)/Di);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${Di}ms, refresh threshold is ${Um} ticks`),o<=Um&&await this._callRefreshToken(s.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof Zx)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Gt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,r,s){const o=[`provider=${encodeURIComponent(r)}`];if(s!=null&&s.redirectTo&&o.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&o.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[l,u]=await Ci(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});o.push(d.toString())}if(s!=null&&s.queryParams){const l=new URLSearchParams(s.queryParams);o.push(l.toString())}return s!=null&&s.skipBrowserRedirect&&o.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${o.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var s;const{data:o,error:l}=r;return l?this._returnResult({data:null,error:l}):await be(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token})})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var s,o;const{data:l,error:u}=r;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:f,error:m}=await be(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(s=l==null?void 0:l.session)===null||s===void 0?void 0:s.access_token});return m?this._returnResult({data:null,error:m}):(t.factorType==="totp"&&f.type==="totp"&&(!((o=f==null?void 0:f.totp)===null||o===void 0)&&o.qr_code)&&(f.totp.qr_code=`data:image/svg+xml;utf-8,${f.totp.qr_code}`),this._returnResult({data:f,error:null}))})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:o,error:l}=r;if(l)return this._returnResult({data:null,error:l});const u=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Z0(t.webauthn.credential_response):ew(t.webauthn.credential_response)})}:{code:t.code}),{data:d,error:f}=await be(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:u,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});return f?this._returnResult({data:null,error:f}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+d.expires_in},d)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",d),this._returnResult({data:d,error:f}))})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:o,error:l}=r;if(l)return this._returnResult({data:null,error:l});const u=await be(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});if(u.error)return u;const{data:d}=u;if(d.type!=="webauthn")return{data:d,error:null};switch(d.webauthn.type){case"create":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:J0(d.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:Q0(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(t){const{data:r,error:s}=await this._challenge({factorId:t.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:s}=await this.getUser();if(s)return{data:null,error:s};const o={all:[],phone:[],totp:[],webauthn:[]};for(const l of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])o.all.push(l),l.status==="verified"&&o[l.factor_type].push(l);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,s,o,l;if(t)try{const{payload:_}=cu(t);let E=null;_.aal&&(E=_.aal);let S=E;const{data:{user:A},error:C}=await this.getUser(t);if(C)return this._returnResult({data:null,error:C});((s=(r=A==null?void 0:A.factors)===null||r===void 0?void 0:r.filter(P=>P.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(S="aal2");const N=_.amr||[];return{data:{currentLevel:E,nextLevel:S,currentAuthenticationMethods:N},error:null}}catch(_){if(de(_))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:f}=cu(u.access_token);let m=null;f.aal&&(m=f.aal);let b=m;((l=(o=u.user.factors)===null||o===void 0?void 0:o.filter(_=>_.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(b="aal2");const w=f.amr||[];return{data:{currentLevel:m,nextLevel:b,currentAuthenticationMethods:w},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;return o?this._returnResult({data:null,error:o}):s?await be(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:s.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new zt})})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:o},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new zt});const u=await be(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&Gt()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(s){if(de(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:o},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new zt});const u=await be(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&Gt()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(s){if(de(s))return this._returnResult({data:null,error:s});throw s}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;return s?this._returnResult({data:null,error:s}):r?await be(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new zt})})}catch(t){if(de(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;return o?this._returnResult({data:null,error:o}):s?(await be(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new zt})})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(t,r={keys:[]}){let s=r.keys.find(d=>d.kid===t);if(s)return s;const o=Date.now();if(s=this.jwks.keys.find(d=>d.kid===t),s&&this.jwks_cached_at+gj>o)return s;const{data:l,error:u}=await be(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=o,s=l.keys.find(d=>d.kid===t),!s)?null:s}async getClaims(t,r={}){try{let s=t;if(!s){const{data:_,error:E}=await this.getSession();if(E||!_.session)return this._returnResult({data:null,error:E});s=_.session.access_token}const{header:o,payload:l,signature:u,raw:{header:d,payload:f}}=cu(s);r!=null&&r.allowExpired||Uj(l.exp);const m=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!m){const{error:_}=await this.getUser(s);if(_)throw _;return{data:{claims:l,header:o,signature:u},error:null}}const b=Ij(o.alg),g=await crypto.subtle.importKey("jwk",m,b,!0,["verify"]);if(!await crypto.subtle.verify(b,g,u,Cj(`${d}.${f}`)))throw new Bm("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(s){if(de(s))return this._returnResult({data:null,error:s});throw s}}async signInWithPasskey(t){var r,s,o;Qn(this.experimental);try{if(!qu())return this._returnResult({data:null,error:new tr("Browser does not support WebAuthn",null)});const{data:l,error:u}=await this._startPasskeyAuthentication({options:{captchaToken:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}});if(u||!l)return this._returnResult({data:null,error:u});const d=Q0(l.options),f=(o=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&o!==void 0?o:Hm.createNewAbortSignal(),{data:m,error:b}=await r_({publicKey:d,signal:f});if(b||!m)return this._returnResult({data:null,error:b??new tr("WebAuthn ceremony failed",null)});const g=ew(m);return this._verifyPasskeyAuthentication({challengeId:l.challenge_id,credential:g})}catch(l){if(de(l))return this._returnResult({data:null,error:l});throw l}}async registerPasskey(t){var r,s;Qn(this.experimental);try{if(!qu())return this._returnResult({data:null,error:new tr("Browser does not support WebAuthn",null)});const{data:o,error:l}=await this._startPasskeyRegistration();if(l||!o)return this._returnResult({data:null,error:l});const u=J0(o.options),d=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:Hm.createNewAbortSignal(),{data:f,error:m}=await n_({publicKey:u,signal:d});if(m||!f)return this._returnResult({data:null,error:m??new tr("WebAuthn ceremony failed",null)});const b=Z0(f);return this._verifyPasskeyRegistration({challengeId:o.challenge_id,credential:b})}catch(o){if(de(o))return this._returnResult({data:null,error:o});throw o}}async _startPasskeyRegistration(){Qn(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new zt});const{data:o,error:l}=await be(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return l?this._returnResult({data:null,error:l}):this._returnResult({data:o,error:null})})}catch(t){if(de(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){Qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new zt});const{data:l,error:u}=await be(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:l,error:null})})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;Qn(this.experimental);try{const{data:s,error:o}=await be(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:s,error:null})}catch(s){if(de(s))return this._returnResult({data:null,error:s});throw s}}async _verifyPasskeyAuthentication(t){Qn(this.experimental);try{const{data:r,error:s}=await be(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:qn});return s?this._returnResult({data:null,error:s}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){Qn(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new zt});const{data:o,error:l}=await be(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:u=>({data:u,error:null})});return l?this._returnResult({data:null,error:l}):this._returnResult({data:o,error:null})})}catch(t){if(de(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){Qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new zt});const{data:l,error:u}=await be(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:t.friendlyName}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:l,error:null})})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){Qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!s)return this._returnResult({data:null,error:new zt});const{error:l}=await be(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return l?this._returnResult({data:null,error:l}):this._returnResult({data:null,error:null})})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}}yl.nextInstanceID={};const cO=yl,uO="2.106.2";let nl="";typeof Deno<"u"?nl="deno":typeof document<"u"?nl="web":typeof navigator<"u"&&navigator.product==="ReactNative"?nl="react-native":nl="node";const dO={"X-Client-Info":`supabase-js-${nl}/${uO}`},fO={headers:dO},hO={schema:"public"},mO={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},pO={},gO={enabled:!1,respectSamplingDecision:!0};function yO(e,t,r,s){function o(l){return l instanceof r?l:new r(function(u){u(l)})}return new(r||(r=Promise))(function(l,u){function d(b){try{m(s.next(b))}catch(g){u(g)}}function f(b){try{m(s.throw(b))}catch(g){u(g)}}function m(b){b.done?l(b.value):o(b.value).then(d,f)}m((s=s.apply(e,[])).next())})}let sm=null;const vO="@opentelemetry/api";function bO(){return sm===null&&(sm=import(vO).catch(()=>null)),sm}function wO(){return yO(this,void 0,void 0,function*(){try{const e=yield bO();if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const r=t.traceparent;return r?{traceparent:r,tracestate:t.tracestate,baggage:t.baggage}:null}catch{return null}})}function xO(e){if(!e||typeof e!="string")return null;const t=e.split("-");if(t.length!==4)return null;const[r,s,o,l]=t;if(r.length!==2||s.length!==32||o.length!==16||l.length!==2)return null;const u=/^[0-9a-f]+$/i;return!u.test(r)||!u.test(s)||!u.test(o)||!u.test(l)||s==="00000000000000000000000000000000"||o==="0000000000000000"?null:{version:r,traceId:s,parentId:o,traceFlags:l,isSampled:(parseInt(l,16)&1)===1}}function _O(e,t){if(!e||!t||t.length===0)return!1;let r;if(e instanceof URL)r=e;else try{r=new URL(e)}catch{return!1}for(const s of t)try{if(typeof s=="string"){if(SO(r.hostname,s))return!0}else if(s instanceof RegExp){if(s.test(r.hostname))return!0}else if(typeof s=="function"&&s(r))return!0}catch{continue}return!1}function SO(e,t){if(t===e)return!0;if(t.startsWith("*.")){const r=t.slice(2);if(e.endsWith(r)&&(e===r||e.endsWith("."+r)))return!0}return!1}function EO(e){const t=[];try{const r=new URL(e);t.push(r.hostname)}catch{}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function vl(e){"@babel/helpers - typeof";return vl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vl(e)}function CO(e,t){if(vl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(vl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function AO(e){var t=CO(e,"string");return vl(t)=="symbol"?t:t+""}function TO(e,t,r){return(t=AO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,s)}return r}function wt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nw(Object(r),!0).forEach(function(s){TO(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nw(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const RO=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),NO=()=>Headers,kO=(e,t,r,s,o)=>{const l=RO(s),u=NO(),d=(o==null?void 0:o.enabled)===!0,f=(o==null?void 0:o.respectSamplingDecision)!==!1,m=d?EO(t):null;return async(b,g)=>{var w;const _=(w=await r())!==null&&w!==void 0?w:e;let E=new u(g==null?void 0:g.headers);if(E.has("apikey")||E.set("apikey",e),E.has("Authorization")||E.set("Authorization",`Bearer ${_}`),m){const S=await jO(b,m,f);S&&(S.traceparent&&!E.has("traceparent")&&E.set("traceparent",S.traceparent),S.tracestate&&!E.has("tracestate")&&E.set("tracestate",S.tracestate),S.baggage&&!E.has("baggage")&&E.set("baggage",S.baggage))}return l(b,wt(wt({},g),{},{headers:E}))}};async function jO(e,t,r){if(!_O(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const s=await wO();if(!s||!s.traceparent)return null;if(r){const o=xO(s.traceparent);if(o&&!o.isSampled)return null}return s}function rw(e){return typeof e=="boolean"?{enabled:e}:e}function OO(e){return e.endsWith("/")?e:e+"/"}function MO(e,t){var r,s,o,l,u,d;const{db:f,auth:m,realtime:b,global:g}=e,{db:w,auth:_,realtime:E,global:S}=t,A=rw(e.tracePropagation),C=rw(t.tracePropagation),R={db:wt(wt({},w),f),auth:wt(wt({},_),m),realtime:wt(wt({},E),b),storage:{},global:wt(wt(wt({},S),g),{},{headers:wt(wt({},(r=S==null?void 0:S.headers)!==null&&r!==void 0?r:{}),(s=g==null?void 0:g.headers)!==null&&s!==void 0?s:{})}),tracePropagation:{enabled:(o=(l=A==null?void 0:A.enabled)!==null&&l!==void 0?l:C==null?void 0:C.enabled)!==null&&o!==void 0?o:!1,respectSamplingDecision:(u=(d=A==null?void 0:A.respectSamplingDecision)!==null&&d!==void 0?d:C==null?void 0:C.respectSamplingDecision)!==null&&u!==void 0?u:!0},accessToken:async()=>""};return e.accessToken?R.accessToken=e.accessToken:delete R.accessToken,R}function DO(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(OO(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var LO=class extends cO{constructor(e){super(e)}},PO=class{constructor(e,t,r){var s,o;this.supabaseUrl=e,this.supabaseKey=t;const l=DO(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const u=`sb-${l.hostname.split(".")[0]}-auth-token`,d={db:hO,realtime:pO,auth:wt(wt({},mO),{},{storageKey:u}),global:fO,tracePropagation:gO},f=MO(r??{},d);if(this.settings=f,this.storageKey=(s=f.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(o=f.global.headers)!==null&&o!==void 0?o:{},f.accessToken)this.accessToken=f.accessToken,this.auth=new Proxy({},{get:(b,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} is not possible`)}});else{var m;this.auth=this._initSupabaseAuthClient((m=f.auth)!==null&&m!==void 0?m:{},this.headers,f.global.fetch)}this.fetch=kO(t,e,this._getAccessToken.bind(this),f.global.fetch,f.tracePropagation),this.realtime=this._initRealtimeClient(wt({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},f.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(b=>this.realtime.setAuth(b)).catch(b=>console.warn("Failed to set initial Realtime auth token:",b)),this.rest=new QN(new URL("rest/v1",l).href,{headers:this.headers,schema:f.db.schema,fetch:this.fetch,timeout:f.db.timeout,urlLengthLimit:f.db.urlLengthLimit}),this.storage=new dj(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new HN(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,r;if(e.accessToken)return await e.accessToken();const{data:s}=await e.auth.getSession();return(t=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:o,storageKey:l,flowType:u,lock:d,debug:f,throwOnError:m,experimental:b,lockAcquireTimeout:g,skipAutoInitialize:w},_,E){const S={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new LO({url:this.authUrl.href,headers:wt(wt({},S),_),storageKey:l,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:o,flowType:u,lock:d,debug:f,throwOnError:m,experimental:b,fetch:E,lockAcquireTimeout:g,skipAutoInitialize:w,hasCustomAuthorizationHeader:Object.keys(this.headers).some(A=>A.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Dk(this.realtimeUrl.href,wt(wt({},e),{},{params:wt(wt({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const zO=(e,t,r)=>new PO(e,t,r);function UO(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const r=t.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}UO()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const IO={BASE_URL:"/tablero-cdc/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_SUPABASE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE",VITE_SUPABASE_URL:"https://dbit.digitalcompass.agency",VITE_WEBHOOK_URL:"https://agenteit.digitalcompass.agency/webhook/tablero-cdc-sync-proyecto"},$O=["VITE_SUPABASE_URL","VITE_SUPABASE_ANON_KEY"],aw=$O.filter(e=>!IO[e]);if(aw.length>0)throw new Error(`Faltan variables de entorno de Supabase. Revisa tu archivo .env.
Variables faltantes: ${aw.join(", ")}`);const qe=zO("https://dbit.digitalcompass.agency","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE",{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),a_="gomezleemarketing.com",hd="gmarrero@gomezleemarketing.com",BO="jgomez@gomezleemarketing.com",s_="iaracena@gomezleemarketing.com",HO=[hd,s_],qO=[hd,BO,s_],VO=[hd,"iaracena@gomezleemarketing.com"];function GO(e){return e?e.toLowerCase().endsWith(`@${a_}`):!1}function FO(){return typeof window>"u"?"/tablero-cdc/":new URL("/tablero-cdc/",window.location.origin).toString()}function KO(e){var o;const t=e.user_metadata||{},r=t.full_name||t.name||t.display_name||((o=e.email)==null?void 0:o.split("@")[0])||null,s=t.avatar_url||t.picture||null;return{id:e.id,uid:e.id,email:e.email??null,displayName:r,photoURL:s,raw:e}}const i_=v.createContext(null);function YO({children:e}){var S;const[t,r]=v.useState(null),[s,o]=v.useState(!0),[l,u]=v.useState(null),d=v.useCallback(async A=>{if(!A){r(null);return}if(!GO(A.email)){await qe.auth.signOut(),r(null),u("Solo se permite acceso con correos corporativos de GomezLee Marketing.");return}r(KO(A)),u(null)},[]);v.useEffect(()=>{let A=!0;qe.auth.getSession().then(async({data:R,error:N})=>{var P;if(A){if(N){console.error("Error al recuperar sesión de Supabase:",N),r(null),u("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo.");return}await d(((P=R.session)==null?void 0:P.user)??null)}}).catch(R=>{A&&(console.error("Error inesperado al recuperar sesión:",R),r(null),u("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo."))}).finally(()=>{A&&o(!1)});const{data:C}=qe.auth.onAuthStateChange((R,N)=>{d((N==null?void 0:N.user)??null),o(!1)});return()=>{A=!1,C.subscription.unsubscribe()}},[d]);const f=v.useCallback(async()=>{u(null);const{error:A}=await qe.auth.signInWithOAuth({provider:"google",options:{redirectTo:FO(),queryParams:{prompt:"select_account",hd:a_}}});A&&(console.error("Error al iniciar sesión con Google:",A),u("No se pudo iniciar sesión. Intenta de nuevo."))},[]),m=v.useCallback(async()=>{const{error:A}=await qe.auth.signOut();if(A){console.error("Error al cerrar sesión:",A),u("No se pudo cerrar sesión. Intenta de nuevo.");return}r(null),u(null)},[]),b=((S=t==null?void 0:t.email)==null?void 0:S.toLowerCase())||"",g=v.useMemo(()=>b===hd,[b]),w=v.useMemo(()=>HO.includes(b),[b]),_=v.useMemo(()=>VO.includes(b),[b]),E=v.useMemo(()=>qO.includes(b),[b]);return y.jsx(i_.Provider,{value:{user:t,loading:s,error:l,isGerardo:g,canDeleteProjects:_,canManageInternalPricing:w,canControlPricingSummary:E,loginWithGoogle:f,logout:m},children:e})}function Ol(){const e=v.useContext(i_);if(!e)throw new Error("useAuth debe usarse dentro de <AuthProvider>");return e}/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const o_=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const WO=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const XO=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase());/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sw=e=>{const t=XO(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var JO={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.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const QO=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZO=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:o="",children:l,iconNode:u,...d},f)=>v.createElement("svg",{ref:f,...JO,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:o_("lucide",o),...!l&&!QO(d)&&{"aria-hidden":"true"},...d},[...u.map(([m,b])=>v.createElement(m,b)),...Array.isArray(l)?l:[l]]));/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ve=(e,t)=>{const r=v.forwardRef(({className:s,...o},l)=>v.createElement(ZO,{ref:l,iconNode:t,className:o_(`lucide-${WO(sw(e))}`,`lucide-${e}`,s),...o}));return r.displayName=sw(e),r};/**
* @license lucide-react v0.575.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=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],t2=Ve("calculator",e2);/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const n2=[["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"}]],r2=Ve("calendar",n2);/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const a2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ts=Ve("check",a2);/**
* @license lucide-react v0.575.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=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Sp=Ve("chevron-down",s2);/**
* @license lucide-react v0.575.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:"m15 18-6-6 6-6",key:"1wnfg3"}]],o2=Ve("chevron-left",i2);/**
* @license lucide-react v0.575.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:"m9 18 6-6-6-6",key:"mthhwq"}]],l_=Ve("chevron-right",l2);/**
* @license lucide-react v0.575.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:"m18 15-6-6-6 6",key:"153udz"}]],u2=Ve("chevron-up",c2);/**
* @license lucide-react v0.575.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=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],c_=Ve("chevrons-up-down",d2);/**
* @license lucide-react v0.575.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=[["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"}]],Gu=Ve("circle-alert",f2);/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const h2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],m2=Ve("circle-check",h2);/**
* @license lucide-react v0.575.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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],g2=Ve("circle",p2);/**
* @license lucide-react v0.575.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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],v2=Ve("clock-3",y2);/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const b2=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Ep=Ve("dollar-sign",b2);/**
* @license lucide-react v0.575.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:"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"}]],x2=Ve("external-link",w2);/**
* @license lucide-react v0.575.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:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],S2=Ve("eye-off",_2);/**
* @license lucide-react v0.575.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:"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"}]],C2=Ve("eye",E2);/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const A2=[["path",{d:"M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6",key:"g5mvt7"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14 20 2 2 4-4",key:"15kota"}]],T2=Ve("file-check-corner",A2);/**
* @license lucide-react v0.575.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:"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"}]],N2=Ve("history",R2);/**
* @license lucide-react v0.575.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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],j2=Ve("info",k2);/**
* @license lucide-react v0.575.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=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Cp=Ve("layout-grid",O2);/**
* @license lucide-react v0.575.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:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],D2=Ve("link-2",M2);/**
* @license lucide-react v0.575.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:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],P2=Ve("link",L2);/**
* @license lucide-react v0.575.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:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ha=Ve("loader-circle",z2);/**
* @license lucide-react v0.575.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=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],I2=Ve("lock",U2);/**
* @license lucide-react v0.575.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:"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"}]],B2=Ve("log-out",$2);/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H2=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],q2=Ve("map-pin",H2);/**
* @license lucide-react v0.575.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:"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 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],G2=Ve("message-square-plus",V2);/**
* @license lucide-react v0.575.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:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bl=Ve("plus",F2);/**
* @license lucide-react v0.575.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:"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"}]],Y2=Ve("refresh-cw",K2);/**
* @license lucide-react v0.575.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:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Fu=Ve("search",W2);/**
* @license lucide-react v0.575.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:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],J2=Ve("sliders-horizontal",X2);/**
* @license lucide-react v0.575.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:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],iw=Ve("tag",Q2);/**
* @license lucide-react v0.575.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:"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"}]],u_=Ve("trash-2",Z2);/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eM=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],tM=Ve("user",eM);/**
* @license lucide-react v0.575.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],wl=Ve("x",nM);function ow(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function en(...e){return t=>{let r=!1;const s=e.map(o=>{const l=ow(o,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let o=0;o<s.length;o++){const l=s[o];typeof l=="function"?l():ow(e[o],null)}}}}function Xe(...e){return v.useCallback(en(...e),e)}var rM=Symbol.for("react.lazy"),Ku=fp[" use ".trim().toString()];function aM(e){return typeof e=="object"&&e!==null&&"then"in e}function d_(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===rM&&"_payload"in e&&aM(e._payload)}function md(e){const t=iM(e),r=v.forwardRef((s,o)=>{let{children:l,...u}=s;d_(l)&&typeof Ku=="function"&&(l=Ku(l._payload));const d=v.Children.toArray(l),f=d.find(lM);if(f){const m=f.props.children,b=d.map(g=>g===f?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return y.jsx(t,{...u,ref:o,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return y.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}var sM=md("Slot");function iM(e){const t=v.forwardRef((r,s)=>{let{children:o,...l}=r;if(d_(o)&&typeof Ku=="function"&&(o=Ku(o._payload)),v.isValidElement(o)){const u=uM(o),d=cM(l,o.props);return o.type!==v.Fragment&&(d.ref=s?en(s,u):u),v.cloneElement(o,d)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var oM=Symbol("radix.slottable");function lM(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===oM}function cM(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const f=l(...d);return o(...d),f}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function uM(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function f_(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=f_(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function h_(){for(var e,t,r=0,s="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=f_(e))&&(s&&(s+=" "),s+=t);return s}const lw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cw=h_,Ap=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return cw(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:o,defaultVariants:l}=t,u=Object.keys(o).map(m=>{const b=r==null?void 0:r[m],g=l==null?void 0:l[m];if(b===null)return null;const w=lw(b)||lw(g);return o[m][w]}),d=r&&Object.entries(r).reduce((m,b)=>{let[g,w]=b;return w===void 0||(m[g]=w),m},{}),f=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((m,b)=>{let{class:g,className:w,..._}=b;return Object.entries(_).every(E=>{let[S,A]=E;return Array.isArray(A)?A.includes({...l,...d}[S]):{...l,...d}[S]===A})?[...m,g,w]:m},[]);return cw(e,u,f,r==null?void 0:r.class,r==null?void 0:r.className)},dM=(e,t)=>{const r=new Array(e.length+t.length);for(let s=0;s<e.length;s++)r[s]=e[s];for(let s=0;s<t.length;s++)r[e.length+s]=t[s];return r},fM=(e,t)=>({classGroupId:e,validator:t}),m_=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Yu="-",uw=[],hM="arbitrary..",mM=e=>{const t=gM(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return pM(u);const d=u.split(Yu),f=d[0]===""&&d.length>1?1:0;return p_(d,f,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const f=s[u],m=r[u];return f?m?dM(m,f):f:m||uw}return r[u]||uw}}},p_=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],l=r.nextPart.get(o);if(l){const m=p_(e,t+1,l);if(m)return m}const u=r.validators;if(u===null)return;const d=t===0?e.join(Yu):e.slice(t).join(Yu),f=u.length;for(let m=0;m<f;m++){const b=u[m];if(b.validator(d))return b.classGroupId}},pM=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),s=t.slice(0,r);return s?hM+s:void 0})(),gM=e=>{const{theme:t,classGroups:r}=e;return yM(r,t)},yM=(e,t)=>{const r=m_();for(const s in e){const o=e[s];Tp(o,r,s,t)}return r},Tp=(e,t,r,s)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];vM(u,t,r,s)}},vM=(e,t,r,s)=>{if(typeof e=="string"){bM(e,t,r);return}if(typeof e=="function"){wM(e,t,r,s);return}xM(e,t,r,s)},bM=(e,t,r)=>{const s=e===""?t:g_(t,e);s.classGroupId=r},wM=(e,t,r,s)=>{if(_M(e)){Tp(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(fM(r,e))},xM=(e,t,r,s)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[d,f]=o[u];Tp(f,g_(t,d),r,s)}},g_=(e,t)=>{let r=e;const s=t.split(Yu),o=s.length;for(let l=0;l<o;l++){const u=s[l];let d=r.nextPart.get(u);d||(d=m_(),r.nextPart.set(u,d)),r=d}return r},_M=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,SM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const o=(l,u)=>{r[l]=u,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=s[l])!==void 0)return o(l,u),u},set(l,u){l in r?r[l]=u:o(l,u)}}},qm="!",dw=":",EM=[],fw=(e,t,r,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:o}),CM=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=o=>{const l=[];let u=0,d=0,f=0,m;const b=o.length;for(let S=0;S<b;S++){const A=o[S];if(u===0&&d===0){if(A===dw){l.push(o.slice(f,S)),f=S+1;continue}if(A==="/"){m=S;continue}}A==="["?u++:A==="]"?u--:A==="("?d++:A===")"&&d--}const g=l.length===0?o:o.slice(f);let w=g,_=!1;g.endsWith(qm)?(w=g.slice(0,-1),_=!0):g.startsWith(qm)&&(w=g.slice(1),_=!0);const E=m&&m>f?m-f:void 0;return fw(l,_,w,E)};if(t){const o=t+dw,l=s;s=u=>u.startsWith(o)?l(u.slice(o.length)):fw(EM,!1,u,void 0,!0)}if(r){const o=s;s=l=>r({className:l,parseClassName:o})}return s},AM=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let o=[];for(let l=0;l<r.length;l++){const u=r[l],d=u[0]==="[",f=t.has(u);d||f?(o.length>0&&(o.sort(),s.push(...o),o=[]),s.push(u)):o.push(u)}return o.length>0&&(o.sort(),s.push(...o)),s}},TM=e=>({cache:SM(e.cacheSize),parseClassName:CM(e),sortModifiers:AM(e),postfixLookupClassGroupIds:RM(e),...mM(e)}),RM=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let s=0;s<r.length;s++)t[r[s]]=!0;return t},NM=/\s+/,kM=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,d=[],f=e.trim().split(NM);let m="";for(let b=f.length-1;b>=0;b-=1){const g=f[b],{isExternal:w,modifiers:_,hasImportantModifier:E,baseClassName:S,maybePostfixModifierPosition:A}=r(g);if(w){m=g+(m.length>0?" "+m:m);continue}let C=!!A,R;if(C){const L=S.substring(0,A);R=s(L);const q=R&&u[R]?s(S):void 0;q&&q!==R&&(R=q,C=!1)}else R=s(S);if(!R){if(!C){m=g+(m.length>0?" "+m:m);continue}if(R=s(S),!R){m=g+(m.length>0?" "+m:m);continue}C=!1}const N=_.length===0?"":_.length===1?_[0]:l(_).join(":"),P=E?N+qm:N,F=P+R;if(d.indexOf(F)>-1)continue;d.push(F);const $=o(R,C);for(let L=0;L<$.length;++L){const q=$[L];d.push(P+q)}m=g+(m.length>0?" "+m:m)}return m},jM=(...e)=>{let t=0,r,s,o="";for(;t<e.length;)(r=e[t++])&&(s=y_(r))&&(o&&(o+=" "),o+=s);return o},y_=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=y_(e[s]))&&(r&&(r+=" "),r+=t);return r},OM=(e,...t)=>{let r,s,o,l;const u=f=>{const m=t.reduce((b,g)=>g(b),e());return r=TM(m),s=r.cache.get,o=r.cache.set,l=d,d(f)},d=f=>{const m=s(f);if(m)return m;const b=kM(f,r);return o(f,b),b};return l=u,(...f)=>l(jM(...f))},MM=[],kt=e=>{const t=r=>r[e]||MM;return t.isThemeGetter=!0,t},v_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,b_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,DM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,LM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,IM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,La=e=>DM.test(e),Le=e=>!!e&&!Number.isNaN(Number(e)),vr=e=>!!e&&Number.isInteger(Number(e)),im=e=>e.endsWith("%")&&Le(e.slice(0,-1)),Xr=e=>LM.test(e),w_=()=>!0,$M=e=>PM.test(e)&&!zM.test(e),Rp=()=>!1,BM=e=>UM.test(e),HM=e=>IM.test(e),qM=e=>!ge(e)&&!ye(e),VM=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),GM=e=>Ya(e,S_,Rp),ge=e=>v_.test(e),bs=e=>Ya(e,E_,$M),hw=e=>Ya(e,ZM,Le),FM=e=>Ya(e,A_,w_),KM=e=>Ya(e,C_,Rp),mw=e=>Ya(e,x_,Rp),YM=e=>Ya(e,__,HM),uu=e=>Ya(e,T_,BM),ye=e=>b_.test(e),Qo=e=>Ds(e,E_),WM=e=>Ds(e,C_),pw=e=>Ds(e,x_),XM=e=>Ds(e,S_),JM=e=>Ds(e,__),du=e=>Ds(e,T_,!0),QM=e=>Ds(e,A_,!0),Ya=(e,t,r)=>{const s=v_.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Ds=(e,t,r=!1)=>{const s=b_.exec(e);return s?s[1]?t(s[1]):r:!1},x_=e=>e==="position"||e==="percentage",__=e=>e==="image"||e==="url",S_=e=>e==="length"||e==="size"||e==="bg-size",E_=e=>e==="length",ZM=e=>e==="number",C_=e=>e==="family-name",A_=e=>e==="number"||e==="weight",T_=e=>e==="shadow",eD=()=>{const e=kt("color"),t=kt("font"),r=kt("text"),s=kt("font-weight"),o=kt("tracking"),l=kt("leading"),u=kt("breakpoint"),d=kt("container"),f=kt("spacing"),m=kt("radius"),b=kt("shadow"),g=kt("inset-shadow"),w=kt("text-shadow"),_=kt("drop-shadow"),E=kt("blur"),S=kt("perspective"),A=kt("aspect"),C=kt("ease"),R=kt("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...P(),ye,ge],$=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],q=()=>[ye,ge,f],ie=()=>[La,"full","auto",...q()],he=()=>[vr,"none","subgrid",ye,ge],pe=()=>["auto",{span:["full",vr,ye,ge]},vr,ye,ge],oe=()=>[vr,"auto",ye,ge],ue=()=>["auto","min","max","fr",ye,ge],ce=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],fe=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...q()],K=()=>[La,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],J=()=>[La,"screen","full","dvw","lvw","svw","min","max","fit",...q()],ne=()=>[La,"screen","full","lh","dvh","lvh","svh","min","max","fit",...q()],X=()=>[e,ye,ge],k=()=>[...P(),pw,mw,{position:[ye,ge]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",XM,GM,{size:[ye,ge]}],Y=()=>[im,Qo,bs],V=()=>["","none","full",m,ye,ge],Z=()=>["",Le,Qo,bs],z=()=>["solid","dashed","dotted","double"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Le,im,pw,mw],xe=()=>["","none",E,ye,ge],Ee=()=>["none",Le,ye,ge],Te=()=>["none",Le,ye,ge],nt=()=>[Le,ye,ge],Be=()=>[La,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xr],breakpoint:[Xr],color:[w_],container:[Xr],"drop-shadow":[Xr],ease:["in","out","in-out"],font:[qM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xr],shadow:[Xr],spacing:["px",Le],text:[Xr],"text-shadow":[Xr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",La,ge,ye,A]}],container:["container"],"container-type":[{"@container":["","normal","size",ye,ge]}],"container-named":[VM],columns:[{columns:[Le,ge,ye,d]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:F()}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ie()}],"inset-x":[{"inset-x":ie()}],"inset-y":[{"inset-y":ie()}],start:[{"inset-s":ie(),start:ie()}],end:[{"inset-e":ie(),end:ie()}],"inset-bs":[{"inset-bs":ie()}],"inset-be":[{"inset-be":ie()}],top:[{top:ie()}],right:[{right:ie()}],bottom:[{bottom:ie()}],left:[{left:ie()}],visibility:["visible","invisible","collapse"],z:[{z:[vr,"auto",ye,ge]}],basis:[{basis:[La,"full","auto",d,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Le,La,"auto","initial","none",ge]}],grow:[{grow:["",Le,ye,ge]}],shrink:[{shrink:["",Le,ye,ge]}],order:[{order:[vr,"first","last","none",ye,ge]}],"grid-cols":[{"grid-cols":he()}],"col-start-end":[{col:pe()}],"col-start":[{"col-start":oe()}],"col-end":[{"col-end":oe()}],"grid-rows":[{"grid-rows":he()}],"row-start-end":[{row:pe()}],"row-start":[{"row-start":oe()}],"row-end":[{"row-end":oe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...ce(),"normal"]}],"justify-items":[{"justify-items":[...fe(),"normal"]}],"justify-self":[{"justify-self":["auto",...fe()]}],"align-content":[{content:["normal",...ce()]}],"align-items":[{items:[...fe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...fe(),{baseline:["","last"]}]}],"place-content":[{"place-content":ce()}],"place-items":[{"place-items":[...fe(),"baseline"]}],"place-self":[{"place-self":["auto",...fe()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pbs:[{pbs:q()}],pbe:[{pbe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...ne()]}],"min-block-size":[{"min-block":["auto",...ne()]}],"max-block-size":[{"max-block":["none",...ne()]}],w:[{w:[d,"screen",...K()]}],"min-w":[{"min-w":[d,"screen","none",...K()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Qo,bs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,QM,FM]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",im,ge]}],"font-family":[{font:[WM,KM,t]}],"font-features":[{"font-features":[ge]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ye,ge]}],"line-clamp":[{"line-clamp":[Le,"none",ye,hw]}],leading:[{leading:[l,...q()]}],"list-image":[{"list-image":["none",ye,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:X()}],"text-color":[{text:X()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:[Le,"from-font","auto",ye,bs]}],"text-decoration-color":[{decoration:X()}],"underline-offset":[{"underline-offset":[Le,"auto",ye,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"tab-size":[{tab:[vr,ye,ge]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,ge]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},vr,ye,ge],radial:["",ye,ge],conic:[vr,ye,ge]},JM,YM]}],"bg-color":[{bg:X()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:X()}],"gradient-via":[{via:X()}],"gradient-to":[{to:X()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...z(),"hidden","none"]}],"divide-style":[{divide:[...z(),"hidden","none"]}],"border-color":[{border:X()}],"border-color-x":[{"border-x":X()}],"border-color-y":[{"border-y":X()}],"border-color-s":[{"border-s":X()}],"border-color-e":[{"border-e":X()}],"border-color-bs":[{"border-bs":X()}],"border-color-be":[{"border-be":X()}],"border-color-t":[{"border-t":X()}],"border-color-r":[{"border-r":X()}],"border-color-b":[{"border-b":X()}],"border-color-l":[{"border-l":X()}],"divide-color":[{divide:X()}],"outline-style":[{outline:[...z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Le,ye,ge]}],"outline-w":[{outline:["",Le,Qo,bs]}],"outline-color":[{outline:X()}],shadow:[{shadow:["","none",b,du,uu]}],"shadow-color":[{shadow:X()}],"inset-shadow":[{"inset-shadow":["none",g,du,uu]}],"inset-shadow-color":[{"inset-shadow":X()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:X()}],"ring-offset-w":[{"ring-offset":[Le,bs]}],"ring-offset-color":[{"ring-offset":X()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":X()}],"text-shadow":[{"text-shadow":["none",w,du,uu]}],"text-shadow-color":[{"text-shadow":X()}],opacity:[{opacity:[Le,ye,ge]}],"mix-blend":[{"mix-blend":[...ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Le]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":X()}],"mask-image-linear-to-color":[{"mask-linear-to":X()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":X()}],"mask-image-t-to-color":[{"mask-t-to":X()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":X()}],"mask-image-r-to-color":[{"mask-r-to":X()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":X()}],"mask-image-b-to-color":[{"mask-b-to":X()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":X()}],"mask-image-l-to-color":[{"mask-l-to":X()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":X()}],"mask-image-x-to-color":[{"mask-x-to":X()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":X()}],"mask-image-y-to-color":[{"mask-y-to":X()}],"mask-image-radial":[{"mask-radial":[ye,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":X()}],"mask-image-radial-to-color":[{"mask-radial-to":X()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":P()}],"mask-image-conic-pos":[{"mask-conic":[Le]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":X()}],"mask-image-conic-to-color":[{"mask-conic-to":X()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,ge]}],filter:[{filter:["","none",ye,ge]}],blur:[{blur:xe()}],brightness:[{brightness:[Le,ye,ge]}],contrast:[{contrast:[Le,ye,ge]}],"drop-shadow":[{"drop-shadow":["","none",_,du,uu]}],"drop-shadow-color":[{"drop-shadow":X()}],grayscale:[{grayscale:["",Le,ye,ge]}],"hue-rotate":[{"hue-rotate":[Le,ye,ge]}],invert:[{invert:["",Le,ye,ge]}],saturate:[{saturate:[Le,ye,ge]}],sepia:[{sepia:["",Le,ye,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,ge]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Le,ye,ge]}],"backdrop-contrast":[{"backdrop-contrast":[Le,ye,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Le,ye,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Le,ye,ge]}],"backdrop-invert":[{"backdrop-invert":["",Le,ye,ge]}],"backdrop-opacity":[{"backdrop-opacity":[Le,ye,ge]}],"backdrop-saturate":[{"backdrop-saturate":[Le,ye,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",Le,ye,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Le,"initial",ye,ge]}],ease:[{ease:["linear","initial",C,ye,ge]}],delay:[{delay:[Le,ye,ge]}],animate:[{animate:["none",R,ye,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ye,ge]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:nt()}],"skew-x":[{"skew-x":nt()}],"skew-y":[{"skew-y":nt()}],transform:[{transform:[ye,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Be()}],"translate-x":[{"translate-x":Be()}],"translate-y":[{"translate-y":Be()}],"translate-z":[{"translate-z":Be()}],"translate-none":["translate-none"],zoom:[{zoom:[vr,ye,ge]}],accent:[{accent:X()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:X()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ye,ge]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":X()}],"scrollbar-track-color":[{"scrollbar-track":X()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mbs":[{"scroll-mbs":q()}],"scroll-mbe":[{"scroll-mbe":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pbs":[{"scroll-pbs":q()}],"scroll-pbe":[{"scroll-pbe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye,ge]}],fill:[{fill:["none",...X()]}],"stroke-w":[{stroke:[Le,Qo,bs,hw]}],stroke:[{stroke:["none",...X()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},tD=OM(eD);function Ae(...e){return tD(h_(e))}const nD=Ap("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ut=v.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,...o},l)=>{const u=s?sM:"button";return y.jsx(u,{className:Ae(nD({variant:t,size:r,className:e})),ref:l,...o})});ut.displayName="Button";function rD(){const{loginWithGoogle:e,error:t,loading:r}=Ol();return y.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:y.jsxs("div",{className:"w-full max-w-sm",children:[y.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[y.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary flex items-center justify-center shadow-lg",children:y.jsx(Cp,{className:"w-7 h-7 text-primary-foreground"})}),y.jsx("div",{className:"text-center leading-tight",children:y.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Tablero CDC"})})]}),y.jsxs("div",{className:"bg-card border border-border rounded-2xl p-8 shadow-sm",children:[y.jsxs(ut,{onClick:e,disabled:r,className:"w-full gap-2.5 h-10 rounded-full font-medium",children:[y.jsxs("svg",{"aria-hidden":"true",className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Entrar con Google"]}),t&&y.jsx("div",{className:"mt-4 rounded-lg bg-destructive/10 border border-destructive/20 px-4 py-3",children:y.jsx("p",{className:"text-sm text-destructive text-center leading-snug",children:t})})]}),y.jsxs("p",{className:"text-center text-xs text-muted-foreground mt-6",children:["Solo acceso para usuarios ",y.jsx("span",{className:"font-medium",children:"@gomezleemarketing.com"})]})]})})}const jn=v.forwardRef(({className:e,type:t,...r},s)=>y.jsx("input",{type:t,className:Ae("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...r}));jn.displayName="Input";function we(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function aD(e,t){const r=v.createContext(t),s=l=>{const{children:u,...d}=l,f=v.useMemo(()=>d,Object.values(d));return y.jsx(r.Provider,{value:f,children:u})};s.displayName=e+"Provider";function o(l){const u=v.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[s,o]}function la(e,t=[]){let r=[];function s(l,u){const d=v.createContext(u),f=r.length;r=[...r,u];const m=g=>{var C;const{scope:w,children:_,...E}=g,S=((C=w==null?void 0:w[e])==null?void 0:C[f])||d,A=v.useMemo(()=>E,Object.values(E));return y.jsx(S.Provider,{value:A,children:_})};m.displayName=l+"Provider";function b(g,w){var S;const _=((S=w==null?void 0:w[e])==null?void 0:S[f])||d,E=v.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,b]}const o=()=>{const l=r.map(u=>v.createContext(u));return function(d){const f=(d==null?void 0:d[e])||l;return v.useMemo(()=>({[`__scope${e}`]:{...d,[e]:f}}),[d,f])}};return o.scopeName=e,[s,sD(o,...t)]}function sD(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=s.reduce((d,{useScope:f,scopeName:m})=>{const g=f(l)[`__scope${m}`];return{...d,...g}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var jt=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},iD=fp[" useInsertionEffect ".trim().toString()]||jt;function Rs({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[o,l,u]=oD({defaultProp:t,onChange:r}),d=e!==void 0,f=d?e:o;{const b=v.useRef(e!==void 0);v.useEffect(()=>{const g=b.current;g!==d&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=d},[d,s])}const m=v.useCallback(b=>{var g;if(d){const w=lD(b)?b(e):b;w!==e&&((g=u.current)==null||g.call(u,w))}else l(b)},[d,e,l,u]);return[f,m]}function oD({defaultProp:e,onChange:t}){const[r,s]=v.useState(e),o=v.useRef(r),l=v.useRef(t);return iD(()=>{l.current=t},[t]),v.useEffect(()=>{var u;o.current!==r&&((u=l.current)==null||u.call(l,r),o.current=r)},[r,o]),[r,s,l]}function lD(e){return typeof e=="function"}function cD(e){const t=uD(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(fD);if(f){const m=f.props.children,b=d.map(g=>g===f?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return y.jsx(t,{...u,ref:o,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return y.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function uD(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=mD(o),d=hD(l,o.props);return o.type!==v.Fragment&&(d.ref=s?en(s,u):u),v.cloneElement(o,d)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dD=Symbol("radix.slottable");function fD(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dD}function hD(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const f=l(...d);return o(...d),f}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function mD(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var pD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],je=pD.reduce((e,t)=>{const r=cD(`Primitive.${t}`),s=v.forwardRef((o,l)=>{const{asChild:u,...d}=o,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function R_(e,t){e&&kl.flushSync(()=>e.dispatchEvent(t))}function gw(e){const t=gD(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(vD);if(f){const m=f.props.children,b=d.map(g=>g===f?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return y.jsx(t,{...u,ref:o,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return y.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function gD(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=wD(o),d=bD(l,o.props);return o.type!==v.Fragment&&(d.ref=s?en(s,u):u),v.cloneElement(o,d)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yD=Symbol("radix.slottable");function vD(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yD}function bD(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const f=l(...d);return o(...d),f}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function wD(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Np(e){const t=e+"CollectionProvider",[r,s]=la(t),[o,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:A,children:C}=S,R=le.useRef(null),N=le.useRef(new Map).current;return y.jsx(o,{scope:A,itemMap:N,collectionRef:R,children:C})};u.displayName=t;const d=e+"CollectionSlot",f=gw(d),m=le.forwardRef((S,A)=>{const{scope:C,children:R}=S,N=l(d,C),P=Xe(A,N.collectionRef);return y.jsx(f,{ref:P,children:R})});m.displayName=d;const b=e+"CollectionItemSlot",g="data-radix-collection-item",w=gw(b),_=le.forwardRef((S,A)=>{const{scope:C,children:R,...N}=S,P=le.useRef(null),F=Xe(A,P),$=l(b,C);return le.useEffect(()=>($.itemMap.set(P,{ref:P,...N}),()=>void $.itemMap.delete(P))),y.jsx(w,{[g]:"",ref:F,children:R})});_.displayName=b;function E(S){const A=l(e+"CollectionConsumer",S);return le.useCallback(()=>{const R=A.collectionRef.current;if(!R)return[];const N=Array.from(R.querySelectorAll(`[${g}]`));return Array.from(A.itemMap.values()).sort(($,L)=>N.indexOf($.ref.current)-N.indexOf(L.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:u,Slot:m,ItemSlot:_},E,s]}var xD=v.createContext(void 0);function kp(e){const t=v.useContext(xD);return e||t||"ltr"}function ar(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)},[])}function _D(e,t=globalThis==null?void 0:globalThis.document){const r=ar(e);v.useEffect(()=>{const s=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var SD="DismissableLayer",Vm="dismissableLayer.update",ED="dismissableLayer.pointerDownOutside",CD="dismissableLayer.focusOutside",yw,N_=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ml=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...f}=e,m=v.useContext(N_),[b,g]=v.useState(null),w=(b==null?void 0:b.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=v.useState({}),E=Xe(t,L=>g(L)),S=Array.from(m.layers),[A]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),C=S.indexOf(A),R=b?S.indexOf(b):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,P=R>=C,F=RD(L=>{const q=L.target,ie=[...m.branches].some(he=>he.contains(q));!P||ie||(o==null||o(L),u==null||u(L),L.defaultPrevented||d==null||d())},w),$=ND(L=>{const q=L.target;[...m.branches].some(he=>he.contains(q))||(l==null||l(L),u==null||u(L),L.defaultPrevented||d==null||d())},w);return _D(L=>{R===m.layers.size-1&&(s==null||s(L),!L.defaultPrevented&&d&&(L.preventDefault(),d()))},w),v.useEffect(()=>{if(b)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(yw=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(b)),m.layers.add(b),vw(),()=>{r&&m.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=yw)}},[b,w,r,m]),v.useEffect(()=>()=>{b&&(m.layers.delete(b),m.layersWithOutsidePointerEventsDisabled.delete(b),vw())},[b,m]),v.useEffect(()=>{const L=()=>_({});return document.addEventListener(Vm,L),()=>document.removeEventListener(Vm,L)},[]),y.jsx(je.div,{...f,ref:E,style:{pointerEvents:N?P?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,$.onFocusCapture),onBlurCapture:we(e.onBlurCapture,$.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,F.onPointerDownCapture)})});Ml.displayName=SD;var AD="DismissableLayerBranch",TD=v.forwardRef((e,t)=>{const r=v.useContext(N_),s=v.useRef(null),o=Xe(t,s);return v.useEffect(()=>{const l=s.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),y.jsx(je.div,{...e,ref:o})});TD.displayName=AD;function RD(e,t=globalThis==null?void 0:globalThis.document){const r=ar(e),s=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const l=d=>{if(d.target&&!s.current){let f=function(){k_(ED,r,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=f,t.addEventListener("click",o.current,{once:!0})):f()}else t.removeEventListener("click",o.current);s.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function ND(e,t=globalThis==null?void 0:globalThis.document){const r=ar(e),s=v.useRef(!1);return v.useEffect(()=>{const o=l=>{l.target&&!s.current&&k_(CD,r,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function vw(){const e=new CustomEvent(Vm);document.dispatchEvent(e)}function k_(e,t,r,{discrete:s}){const o=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),s?R_(o,l):o.dispatchEvent(l)}var om=0;function pd(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??bw()),document.body.insertAdjacentElement("beforeend",e[1]??bw()),om++,()=>{om===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),om--}},[])}function bw(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var lm="focusScope.autoFocusOnMount",cm="focusScope.autoFocusOnUnmount",ww={bubbles:!1,cancelable:!0},kD="FocusScope",Dl=v.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...u}=e,[d,f]=v.useState(null),m=ar(o),b=ar(l),g=v.useRef(null),w=Xe(t,S=>f(S)),_=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(s){let S=function(N){if(_.paused||!d)return;const P=N.target;d.contains(P)?g.current=P:Ua(g.current,{select:!0})},A=function(N){if(_.paused||!d)return;const P=N.relatedTarget;P!==null&&(d.contains(P)||Ua(g.current,{select:!0}))},C=function(N){if(document.activeElement===document.body)for(const F of N)F.removedNodes.length>0&&Ua(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",A);const R=new MutationObserver(C);return d&&R.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",A),R.disconnect()}}},[s,d,_.paused]),v.useEffect(()=>{if(d){_w.add(_);const S=document.activeElement;if(!d.contains(S)){const C=new CustomEvent(lm,ww);d.addEventListener(lm,m),d.dispatchEvent(C),C.defaultPrevented||(jD(PD(j_(d)),{select:!0}),document.activeElement===S&&Ua(d))}return()=>{d.removeEventListener(lm,m),setTimeout(()=>{const C=new CustomEvent(cm,ww);d.addEventListener(cm,b),d.dispatchEvent(C),C.defaultPrevented||Ua(S??document.body,{select:!0}),d.removeEventListener(cm,b),_w.remove(_)},0)}}},[d,m,b,_]);const E=v.useCallback(S=>{if(!r&&!s||_.paused)return;const A=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,C=document.activeElement;if(A&&C){const R=S.currentTarget,[N,P]=OD(R);N&&P?!S.shiftKey&&C===P?(S.preventDefault(),r&&Ua(N,{select:!0})):S.shiftKey&&C===N&&(S.preventDefault(),r&&Ua(P,{select:!0})):C===R&&S.preventDefault()}},[r,s,_.paused]);return y.jsx(je.div,{tabIndex:-1,...u,ref:w,onKeyDown:E})});Dl.displayName=kD;function jD(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(Ua(s,{select:t}),document.activeElement!==r)return}function OD(e){const t=j_(e),r=xw(t,e),s=xw(t.reverse(),e);return[r,s]}function j_(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function xw(e,t){for(const r of e)if(!MD(r,{upTo:t}))return r}function MD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function DD(e){return e instanceof HTMLInputElement&&"select"in e}function Ua(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&DD(e)&&t&&e.select()}}var _w=LD();function LD(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Sw(e,t),e.unshift(t)},remove(t){var r;e=Sw(e,t),(r=e[0])==null||r.resume()}}}function Sw(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function PD(e){return e.filter(t=>t.tagName!=="A")}var zD=fp[" useId ".trim().toString()]||(()=>{}),UD=0;function Qt(e){const[t,r]=v.useState(zD());return jt(()=>{r(s=>s??String(UD++))},[e]),t?`radix-${t}`:""}const ID=["top","right","bottom","left"],Ga=Math.min,Nn=Math.max,Wu=Math.round,fu=Math.floor,Cr=e=>({x:e,y:e}),$D={left:"right",right:"left",bottom:"top",top:"bottom"};function Gm(e,t,r){return Nn(e,Ga(t,r))}function na(e,t){return typeof e=="function"?e(t):e}function ra(e){return e.split("-")[0]}function Ji(e){return e.split("-")[1]}function jp(e){return e==="x"?"y":"x"}function Op(e){return e==="y"?"height":"width"}function Er(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Mp(e){return jp(Er(e))}function BD(e,t,r){r===void 0&&(r=!1);const s=Ji(e),o=Mp(e),l=Op(o);let u=o==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=Xu(u)),[u,Xu(u)]}function HD(e){const t=Xu(e);return[Fm(e),t,Fm(t)]}function Fm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ew=["left","right"],Cw=["right","left"],qD=["top","bottom"],VD=["bottom","top"];function GD(e,t,r){switch(e){case"top":case"bottom":return r?t?Cw:Ew:t?Ew:Cw;case"left":case"right":return t?qD:VD;default:return[]}}function FD(e,t,r,s){const o=Ji(e);let l=GD(ra(e),r==="start",s);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(Fm)))),l}function Xu(e){const t=ra(e);return $D[t]+e.slice(t.length)}function KD(e){return{top:0,right:0,bottom:0,left:0,...e}}function O_(e){return typeof e!="number"?KD(e):{top:e,right:e,bottom:e,left:e}}function Ju(e){const{x:t,y:r,width:s,height:o}=e;return{width:s,height:o,top:r,left:t,right:t+s,bottom:r+o,x:t,y:r}}function Aw(e,t,r){let{reference:s,floating:o}=e;const l=Er(t),u=Mp(t),d=Op(u),f=ra(t),m=l==="y",b=s.x+s.width/2-o.width/2,g=s.y+s.height/2-o.height/2,w=s[d]/2-o[d]/2;let _;switch(f){case"top":_={x:b,y:s.y-o.height};break;case"bottom":_={x:b,y:s.y+s.height};break;case"right":_={x:s.x+s.width,y:g};break;case"left":_={x:s.x-o.width,y:g};break;default:_={x:s.x,y:s.y}}switch(Ji(t)){case"start":_[u]-=w*(r&&m?-1:1);break;case"end":_[u]+=w*(r&&m?-1:1);break}return _}async function YD(e,t){var r;t===void 0&&(t={});const{x:s,y:o,platform:l,rects:u,elements:d,strategy:f}=e,{boundary:m="clippingAncestors",rootBoundary:b="viewport",elementContext:g="floating",altBoundary:w=!1,padding:_=0}=na(t,e),E=O_(_),A=d[w?g==="floating"?"reference":"floating":g],C=Ju(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(A)))==null||r?A:A.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:m,rootBoundary:b,strategy:f})),R=g==="floating"?{x:s,y:o,width:u.floating.width,height:u.floating.height}:u.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),P=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},F=Ju(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:R,offsetParent:N,strategy:f}):R);return{top:(C.top-F.top+E.top)/P.y,bottom:(F.bottom-C.bottom+E.bottom)/P.y,left:(C.left-F.left+E.left)/P.x,right:(F.right-C.right+E.right)/P.x}}const WD=50,XD=async(e,t,r)=>{const{placement:s="bottom",strategy:o="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:YD},f=await(u.isRTL==null?void 0:u.isRTL(t));let m=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:b,y:g}=Aw(m,s,f),w=s,_=0;const E={};for(let S=0;S<l.length;S++){const A=l[S];if(!A)continue;const{name:C,fn:R}=A,{x:N,y:P,data:F,reset:$}=await R({x:b,y:g,initialPlacement:s,placement:w,strategy:o,middlewareData:E,rects:m,platform:d,elements:{reference:e,floating:t}});b=N??b,g=P??g,E[C]={...E[C],...F},$&&_<WD&&(_++,typeof $=="object"&&($.placement&&(w=$.placement),$.rects&&(m=$.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):$.rects),{x:b,y:g}=Aw(m,w,f)),S=-1)}return{x:b,y:g,placement:w,strategy:o,middlewareData:E}},JD=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:o,rects:l,platform:u,elements:d,middlewareData:f}=t,{element:m,padding:b=0}=na(e,t)||{};if(m==null)return{};const g=O_(b),w={x:r,y:s},_=Mp(o),E=Op(_),S=await u.getDimensions(m),A=_==="y",C=A?"top":"left",R=A?"bottom":"right",N=A?"clientHeight":"clientWidth",P=l.reference[E]+l.reference[_]-w[_]-l.floating[E],F=w[_]-l.reference[_],$=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m));let L=$?$[N]:0;(!L||!await(u.isElement==null?void 0:u.isElement($)))&&(L=d.floating[N]||l.floating[E]);const q=P/2-F/2,ie=L/2-S[E]/2-1,he=Ga(g[C],ie),pe=Ga(g[R],ie),oe=he,ue=L-S[E]-pe,ce=L/2-S[E]/2+q,fe=Gm(oe,ce,ue),M=!f.arrow&&Ji(o)!=null&&ce!==fe&&l.reference[E]/2-(ce<oe?he:pe)-S[E]/2<0,K=M?ce<oe?ce-oe:ce-ue:0;return{[_]:w[_]+K,data:{[_]:fe,centerOffset:ce-fe-K,...M&&{alignmentOffset:K}},reset:M}}}),QD=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:o,middlewareData:l,rects:u,initialPlacement:d,platform:f,elements:m}=t,{mainAxis:b=!0,crossAxis:g=!0,fallbackPlacements:w,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:S=!0,...A}=na(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const C=ra(o),R=Er(d),N=ra(d)===d,P=await(f.isRTL==null?void 0:f.isRTL(m.floating)),F=w||(N||!S?[Xu(d)]:HD(d)),$=E!=="none";!w&&$&&F.push(...FD(d,S,E,P));const L=[d,...F],q=await f.detectOverflow(t,A),ie=[];let he=((s=l.flip)==null?void 0:s.overflows)||[];if(b&&ie.push(q[C]),g){const ce=BD(o,u,P);ie.push(q[ce[0]],q[ce[1]])}if(he=[...he,{placement:o,overflows:ie}],!ie.every(ce=>ce<=0)){var pe,oe;const ce=(((pe=l.flip)==null?void 0:pe.index)||0)+1,fe=L[ce];if(fe&&(!(g==="alignment"?R!==Er(fe):!1)||he.every(J=>Er(J.placement)===R?J.overflows[0]>0:!0)))return{data:{index:ce,overflows:he},reset:{placement:fe}};let M=(oe=he.filter(K=>K.overflows[0]<=0).sort((K,J)=>K.overflows[1]-J.overflows[1])[0])==null?void 0:oe.placement;if(!M)switch(_){case"bestFit":{var ue;const K=(ue=he.filter(J=>{if($){const ne=Er(J.placement);return ne===R||ne==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(ne=>ne>0).reduce((ne,X)=>ne+X,0)]).sort((J,ne)=>J[1]-ne[1])[0])==null?void 0:ue[0];K&&(M=K);break}case"initialPlacement":M=d;break}if(o!==M)return{reset:{placement:M}}}return{}}}};function Tw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rw(e){return ID.some(t=>e[t]>=0)}const ZD=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:o="referenceHidden",...l}=na(e,t);switch(o){case"referenceHidden":{const u=await s.detectOverflow(t,{...l,elementContext:"reference"}),d=Tw(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Rw(d)}}}case"escaped":{const u=await s.detectOverflow(t,{...l,altBoundary:!0}),d=Tw(u,r.floating);return{data:{escapedOffsets:d,escaped:Rw(d)}}}default:return{}}}}},M_=new Set(["left","top"]);async function eL(e,t){const{placement:r,platform:s,elements:o}=e,l=await(s.isRTL==null?void 0:s.isRTL(o.floating)),u=ra(r),d=Ji(r),f=Er(r)==="y",m=M_.has(u)?-1:1,b=l&&f?-1:1,g=na(t,e);let{mainAxis:w,crossAxis:_,alignmentAxis:E}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof E=="number"&&(_=d==="end"?E*-1:E),f?{x:_*b,y:w*m}:{x:w*m,y:_*b}}const tL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:o,y:l,placement:u,middlewareData:d}=t,f=await eL(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:o+f.x,y:l+f.y,data:{...f,placement:u}}}}},nL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:o,platform:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:f={fn:C=>{let{x:R,y:N}=C;return{x:R,y:N}}},...m}=na(e,t),b={x:r,y:s},g=await l.detectOverflow(t,m),w=Er(ra(o)),_=jp(w);let E=b[_],S=b[w];if(u){const C=_==="y"?"top":"left",R=_==="y"?"bottom":"right",N=E+g[C],P=E-g[R];E=Gm(N,E,P)}if(d){const C=w==="y"?"top":"left",R=w==="y"?"bottom":"right",N=S+g[C],P=S-g[R];S=Gm(N,S,P)}const A=f.fn({...t,[_]:E,[w]:S});return{...A,data:{x:A.x-r,y:A.y-s,enabled:{[_]:u,[w]:d}}}}}},rL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:o,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:f=!0,crossAxis:m=!0}=na(e,t),b={x:r,y:s},g=Er(o),w=jp(g);let _=b[w],E=b[g];const S=na(d,t),A=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(f){const N=w==="y"?"height":"width",P=l.reference[w]-l.floating[N]+A.mainAxis,F=l.reference[w]+l.reference[N]-A.mainAxis;_<P?_=P:_>F&&(_=F)}if(m){var C,R;const N=w==="y"?"width":"height",P=M_.has(ra(o)),F=l.reference[g]-l.floating[N]+(P&&((C=u.offset)==null?void 0:C[g])||0)+(P?0:A.crossAxis),$=l.reference[g]+l.reference[N]+(P?0:((R=u.offset)==null?void 0:R[g])||0)-(P?A.crossAxis:0);E<F?E=F:E>$&&(E=$)}return{[w]:_,[g]:E}}}},aL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:o,rects:l,platform:u,elements:d}=t,{apply:f=()=>{},...m}=na(e,t),b=await u.detectOverflow(t,m),g=ra(o),w=Ji(o),_=Er(o)==="y",{width:E,height:S}=l.floating;let A,C;g==="top"||g==="bottom"?(A=g,C=w===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,A=w==="end"?"top":"bottom");const R=S-b.top-b.bottom,N=E-b.left-b.right,P=Ga(S-b[A],R),F=Ga(E-b[C],N),$=!t.middlewareData.shift;let L=P,q=F;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(q=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(L=R),$&&!w){const he=Nn(b.left,0),pe=Nn(b.right,0),oe=Nn(b.top,0),ue=Nn(b.bottom,0);_?q=E-2*(he!==0||pe!==0?he+pe:Nn(b.left,b.right)):L=S-2*(oe!==0||ue!==0?oe+ue:Nn(b.top,b.bottom))}await f({...t,availableWidth:q,availableHeight:L});const ie=await u.getDimensions(d.floating);return E!==ie.width||S!==ie.height?{reset:{rects:!0}}:{}}}};function gd(){return typeof window<"u"}function Qi(e){return D_(e)?(e.nodeName||"").toLowerCase():"#document"}function On(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rr(e){var t;return(t=(D_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function D_(e){return gd()?e instanceof Node||e instanceof On(e).Node:!1}function sr(e){return gd()?e instanceof Element||e instanceof On(e).Element:!1}function ca(e){return gd()?e instanceof HTMLElement||e instanceof On(e).HTMLElement:!1}function Nw(e){return!gd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof On(e).ShadowRoot}function Ll(e){const{overflow:t,overflowX:r,overflowY:s,display:o}=ir(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&o!=="inline"&&o!=="contents"}function sL(e){return/^(table|td|th)$/.test(Qi(e))}function yd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const iL=/transform|translate|scale|rotate|perspective|filter/,oL=/paint|layout|strict|content/,ws=e=>!!e&&e!=="none";let um;function Dp(e){const t=sr(e)?ir(e):e;return ws(t.transform)||ws(t.translate)||ws(t.scale)||ws(t.rotate)||ws(t.perspective)||!Lp()&&(ws(t.backdropFilter)||ws(t.filter))||iL.test(t.willChange||"")||oL.test(t.contain||"")}function lL(e){let t=Fa(e);for(;ca(t)&&!Gi(t);){if(Dp(t))return t;if(yd(t))return null;t=Fa(t)}return null}function Lp(){return um==null&&(um=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),um}function Gi(e){return/^(html|body|#document)$/.test(Qi(e))}function ir(e){return On(e).getComputedStyle(e)}function vd(e){return sr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Fa(e){if(Qi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Nw(e)&&e.host||Rr(e);return Nw(t)?t.host:t}function L_(e){const t=Fa(e);return Gi(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&Ll(t)?t:L_(t)}function xl(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=L_(e),l=o===((s=e.ownerDocument)==null?void 0:s.body),u=On(o);if(l){const d=Km(u);return t.concat(u,u.visualViewport||[],Ll(o)?o:[],d&&r?xl(d):[])}else return t.concat(o,xl(o,[],r))}function Km(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function P_(e){const t=ir(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=ca(e),l=o?e.offsetWidth:r,u=o?e.offsetHeight:s,d=Wu(r)!==l||Wu(s)!==u;return d&&(r=l,s=u),{width:r,height:s,$:d}}function Pp(e){return sr(e)?e:e.contextElement}function Hi(e){const t=Pp(e);if(!ca(t))return Cr(1);const r=t.getBoundingClientRect(),{width:s,height:o,$:l}=P_(t);let u=(l?Wu(r.width):r.width)/s,d=(l?Wu(r.height):r.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const cL=Cr(0);function z_(e){const t=On(e);return!Lp()||!t.visualViewport?cL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uL(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==On(e)?!1:t}function Ns(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),l=Pp(e);let u=Cr(1);t&&(s?sr(s)&&(u=Hi(s)):u=Hi(e));const d=uL(l,r,s)?z_(l):Cr(0);let f=(o.left+d.x)/u.x,m=(o.top+d.y)/u.y,b=o.width/u.x,g=o.height/u.y;if(l){const w=On(l),_=s&&sr(s)?On(s):s;let E=w,S=Km(E);for(;S&&s&&_!==E;){const A=Hi(S),C=S.getBoundingClientRect(),R=ir(S),N=C.left+(S.clientLeft+parseFloat(R.paddingLeft))*A.x,P=C.top+(S.clientTop+parseFloat(R.paddingTop))*A.y;f*=A.x,m*=A.y,b*=A.x,g*=A.y,f+=N,m+=P,E=On(S),S=Km(E)}}return Ju({width:b,height:g,x:f,y:m})}function bd(e,t){const r=vd(e).scrollLeft;return t?t.left+r:Ns(Rr(e)).left+r}function U_(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-bd(e,r),o=r.top+t.scrollTop;return{x:s,y:o}}function dL(e){let{elements:t,rect:r,offsetParent:s,strategy:o}=e;const l=o==="fixed",u=Rr(s),d=t?yd(t.floating):!1;if(s===u||d&&l)return r;let f={scrollLeft:0,scrollTop:0},m=Cr(1);const b=Cr(0),g=ca(s);if((g||!g&&!l)&&((Qi(s)!=="body"||Ll(u))&&(f=vd(s)),g)){const _=Ns(s);m=Hi(s),b.x=_.x+s.clientLeft,b.y=_.y+s.clientTop}const w=u&&!g&&!l?U_(u,f):Cr(0);return{width:r.width*m.x,height:r.height*m.y,x:r.x*m.x-f.scrollLeft*m.x+b.x+w.x,y:r.y*m.y-f.scrollTop*m.y+b.y+w.y}}function fL(e){return Array.from(e.getClientRects())}function hL(e){const t=Rr(e),r=vd(e),s=e.ownerDocument.body,o=Nn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=Nn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-r.scrollLeft+bd(e);const d=-r.scrollTop;return ir(s).direction==="rtl"&&(u+=Nn(t.clientWidth,s.clientWidth)-o),{width:o,height:l,x:u,y:d}}const kw=25;function mL(e,t){const r=On(e),s=Rr(e),o=r.visualViewport;let l=s.clientWidth,u=s.clientHeight,d=0,f=0;if(o){l=o.width,u=o.height;const b=Lp();(!b||b&&t==="fixed")&&(d=o.offsetLeft,f=o.offsetTop)}const m=bd(s);if(m<=0){const b=s.ownerDocument,g=b.body,w=getComputedStyle(g),_=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,E=Math.abs(s.clientWidth-g.clientWidth-_);E<=kw&&(l-=E)}else m<=kw&&(l+=m);return{width:l,height:u,x:d,y:f}}function pL(e,t){const r=Ns(e,!0,t==="fixed"),s=r.top+e.clientTop,o=r.left+e.clientLeft,l=ca(e)?Hi(e):Cr(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,f=o*l.x,m=s*l.y;return{width:u,height:d,x:f,y:m}}function jw(e,t,r){let s;if(t==="viewport")s=mL(e,r);else if(t==="document")s=hL(Rr(e));else if(sr(t))s=pL(t,r);else{const o=z_(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ju(s)}function I_(e,t){const r=Fa(e);return r===t||!sr(r)||Gi(r)?!1:ir(r).position==="fixed"||I_(r,t)}function gL(e,t){const r=t.get(e);if(r)return r;let s=xl(e,[],!1).filter(d=>sr(d)&&Qi(d)!=="body"),o=null;const l=ir(e).position==="fixed";let u=l?Fa(e):e;for(;sr(u)&&!Gi(u);){const d=ir(u),f=Dp(u);!f&&d.position==="fixed"&&(o=null),(l?!f&&!o:!f&&d.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ll(u)&&!f&&I_(e,u))?s=s.filter(b=>b!==u):o=d,u=Fa(u)}return t.set(e,s),s}function yL(e){let{element:t,boundary:r,rootBoundary:s,strategy:o}=e;const u=[...r==="clippingAncestors"?yd(t)?[]:gL(t,this._c):[].concat(r),s],d=jw(t,u[0],o);let f=d.top,m=d.right,b=d.bottom,g=d.left;for(let w=1;w<u.length;w++){const _=jw(t,u[w],o);f=Nn(_.top,f),m=Ga(_.right,m),b=Ga(_.bottom,b),g=Nn(_.left,g)}return{width:m-g,height:b-f,x:g,y:f}}function vL(e){const{width:t,height:r}=P_(e);return{width:t,height:r}}function bL(e,t,r){const s=ca(t),o=Rr(t),l=r==="fixed",u=Ns(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const f=Cr(0);function m(){f.x=bd(o)}if(s||!s&&!l)if((Qi(t)!=="body"||Ll(o))&&(d=vd(t)),s){const _=Ns(t,!0,l,t);f.x=_.x+t.clientLeft,f.y=_.y+t.clientTop}else o&&m();l&&!s&&o&&m();const b=o&&!s&&!l?U_(o,d):Cr(0),g=u.left+d.scrollLeft-f.x-b.x,w=u.top+d.scrollTop-f.y-b.y;return{x:g,y:w,width:u.width,height:u.height}}function dm(e){return ir(e).position==="static"}function Ow(e,t){if(!ca(e)||ir(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Rr(e)===r&&(r=r.ownerDocument.body),r}function $_(e,t){const r=On(e);if(yd(e))return r;if(!ca(e)){let o=Fa(e);for(;o&&!Gi(o);){if(sr(o)&&!dm(o))return o;o=Fa(o)}return r}let s=Ow(e,t);for(;s&&sL(s)&&dm(s);)s=Ow(s,t);return s&&Gi(s)&&dm(s)&&!Dp(s)?r:s||lL(e)||r}const wL=async function(e){const t=this.getOffsetParent||$_,r=this.getDimensions,s=await r(e.floating);return{reference:bL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function xL(e){return ir(e).direction==="rtl"}const _L={convertOffsetParentRelativeRectToViewportRelativeRect:dL,getDocumentElement:Rr,getClippingRect:yL,getOffsetParent:$_,getElementRects:wL,getClientRects:fL,getDimensions:vL,getScale:Hi,isElement:sr,isRTL:xL};function B_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function SL(e,t){let r=null,s;const o=Rr(e);function l(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function u(d,f){d===void 0&&(d=!1),f===void 0&&(f=1),l();const m=e.getBoundingClientRect(),{left:b,top:g,width:w,height:_}=m;if(d||t(),!w||!_)return;const E=fu(g),S=fu(o.clientWidth-(b+w)),A=fu(o.clientHeight-(g+_)),C=fu(b),N={rootMargin:-E+"px "+-S+"px "+-A+"px "+-C+"px",threshold:Nn(0,Ga(1,f))||1};let P=!0;function F($){const L=$[0].intersectionRatio;if(L!==f){if(!P)return u();L?u(!1,L):s=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!B_(m,e.getBoundingClientRect())&&u(),P=!1}try{r=new IntersectionObserver(F,{...N,root:o.ownerDocument})}catch{r=new IntersectionObserver(F,N)}r.observe(e)}return u(!0),l}function EL(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:f=!1}=s,m=Pp(e),b=o||l?[...m?xl(m):[],...t?xl(t):[]]:[];b.forEach(C=>{o&&C.addEventListener("scroll",r,{passive:!0}),l&&C.addEventListener("resize",r)});const g=m&&d?SL(m,r):null;let w=-1,_=null;u&&(_=new ResizeObserver(C=>{let[R]=C;R&&R.target===m&&_&&t&&(_.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var N;(N=_)==null||N.observe(t)})),r()}),m&&!f&&_.observe(m),t&&_.observe(t));let E,S=f?Ns(e):null;f&&A();function A(){const C=Ns(e);S&&!B_(S,C)&&r(),S=C,E=requestAnimationFrame(A)}return r(),()=>{var C;b.forEach(R=>{o&&R.removeEventListener("scroll",r),l&&R.removeEventListener("resize",r)}),g==null||g(),(C=_)==null||C.disconnect(),_=null,f&&cancelAnimationFrame(E)}}const CL=tL,AL=nL,TL=QD,RL=aL,NL=ZD,Mw=JD,kL=rL,jL=(e,t,r)=>{const s=new Map,o={platform:_L,...r},l={...o.platform,_c:s};return XD(e,t,{...o,platform:l})};var OL=typeof document<"u",ML=function(){},ku=OL?v.useLayoutEffect:ML;function Qu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!Qu(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=r;s--!==0;){const l=o[s];if(!(l==="_owner"&&e.$$typeof)&&!Qu(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function H_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dw(e,t){const r=H_(e);return Math.round(t*r)/r}function fm(e){const t=v.useRef(e);return ku(()=>{t.current=e}),t}function DL(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:o,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:f,open:m}=e,[b,g]=v.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[w,_]=v.useState(s);Qu(w,s)||_(s);const[E,S]=v.useState(null),[A,C]=v.useState(null),R=v.useCallback(J=>{J!==$.current&&($.current=J,S(J))},[]),N=v.useCallback(J=>{J!==L.current&&(L.current=J,C(J))},[]),P=l||E,F=u||A,$=v.useRef(null),L=v.useRef(null),q=v.useRef(b),ie=f!=null,he=fm(f),pe=fm(o),oe=fm(m),ue=v.useCallback(()=>{if(!$.current||!L.current)return;const J={placement:t,strategy:r,middleware:w};pe.current&&(J.platform=pe.current),jL($.current,L.current,J).then(ne=>{const X={...ne,isPositioned:oe.current!==!1};ce.current&&!Qu(q.current,X)&&(q.current=X,kl.flushSync(()=>{g(X)}))})},[w,t,r,pe,oe]);ku(()=>{m===!1&&q.current.isPositioned&&(q.current.isPositioned=!1,g(J=>({...J,isPositioned:!1})))},[m]);const ce=v.useRef(!1);ku(()=>(ce.current=!0,()=>{ce.current=!1}),[]),ku(()=>{if(P&&($.current=P),F&&(L.current=F),P&&F){if(he.current)return he.current(P,F,ue);ue()}},[P,F,ue,he,ie]);const fe=v.useMemo(()=>({reference:$,floating:L,setReference:R,setFloating:N}),[R,N]),M=v.useMemo(()=>({reference:P,floating:F}),[P,F]),K=v.useMemo(()=>{const J={position:r,left:0,top:0};if(!M.floating)return J;const ne=Dw(M.floating,b.x),X=Dw(M.floating,b.y);return d?{...J,transform:"translate("+ne+"px, "+X+"px)",...H_(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ne,top:X}},[r,d,M.floating,b.x,b.y]);return v.useMemo(()=>({...b,update:ue,refs:fe,elements:M,floatingStyles:K}),[b,ue,fe,M,K])}const LL=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:o}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?Mw({element:s.current,padding:o}).fn(r):{}:s?Mw({element:s,padding:o}).fn(r):{}}}},PL=(e,t)=>{const r=CL(e);return{name:r.name,fn:r.fn,options:[e,t]}},zL=(e,t)=>{const r=AL(e);return{name:r.name,fn:r.fn,options:[e,t]}},UL=(e,t)=>({fn:kL(e).fn,options:[e,t]}),IL=(e,t)=>{const r=TL(e);return{name:r.name,fn:r.fn,options:[e,t]}},$L=(e,t)=>{const r=RL(e);return{name:r.name,fn:r.fn,options:[e,t]}},BL=(e,t)=>{const r=NL(e);return{name:r.name,fn:r.fn,options:[e,t]}},HL=(e,t)=>{const r=LL(e);return{name:r.name,fn:r.fn,options:[e,t]}};var qL="Arrow",q_=v.forwardRef((e,t)=>{const{children:r,width:s=10,height:o=5,...l}=e;return y.jsx(je.svg,{...l,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:y.jsx("polygon",{points:"0,0 30,0 15,10"})})});q_.displayName=qL;var VL=q_;function V_(e){const[t,r]=v.useState(void 0);return jt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const l=o[0];let u,d;if("borderBoxSize"in l){const f=l.borderBoxSize,m=Array.isArray(f)?f[0]:f;u=m.inlineSize,d=m.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}var zp="Popper",[G_,Zi]=la(zp),[GL,F_]=G_(zp),K_=e=>{const{__scopePopper:t,children:r}=e,[s,o]=v.useState(null);return y.jsx(GL,{scope:t,anchor:s,onAnchorChange:o,children:r})};K_.displayName=zp;var Y_="PopperAnchor",W_=v.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...o}=e,l=F_(Y_,r),u=v.useRef(null),d=Xe(t,u),f=v.useRef(null);return v.useEffect(()=>{const m=f.current;f.current=(s==null?void 0:s.current)||u.current,m!==f.current&&l.onAnchorChange(f.current)}),s?null:y.jsx(je.div,{...o,ref:d})});W_.displayName=Y_;var Up="PopperContent",[FL,KL]=G_(Up),X_=v.forwardRef((e,t)=>{var z,ee,ae,xe,Ee,Te;const{__scopePopper:r,side:s="bottom",sideOffset:o=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:f=!0,collisionBoundary:m=[],collisionPadding:b=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:_="optimized",onPlaced:E,...S}=e,A=F_(Up,r),[C,R]=v.useState(null),N=Xe(t,nt=>R(nt)),[P,F]=v.useState(null),$=V_(P),L=($==null?void 0:$.width)??0,q=($==null?void 0:$.height)??0,ie=s+(l!=="center"?"-"+l:""),he=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},pe=Array.isArray(m)?m:[m],oe=pe.length>0,ue={padding:he,boundary:pe.filter(WL),altBoundary:oe},{refs:ce,floatingStyles:fe,placement:M,isPositioned:K,middlewareData:J}=DL({strategy:"fixed",placement:ie,whileElementsMounted:(...nt)=>EL(...nt,{animationFrame:_==="always"}),elements:{reference:A.anchor},middleware:[PL({mainAxis:o+q,alignmentAxis:u}),f&&zL({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?UL():void 0,...ue}),f&&IL({...ue}),$L({...ue,apply:({elements:nt,rects:Be,availableWidth:Kt,availableHeight:Yt})=>{const{width:Ot,height:wn}=Be.reference,yt=nt.floating.style;yt.setProperty("--radix-popper-available-width",`${Kt}px`),yt.setProperty("--radix-popper-available-height",`${Yt}px`),yt.setProperty("--radix-popper-anchor-width",`${Ot}px`),yt.setProperty("--radix-popper-anchor-height",`${wn}px`)}}),P&&HL({element:P,padding:d}),XL({arrowWidth:L,arrowHeight:q}),w&&BL({strategy:"referenceHidden",...ue})]}),[ne,X]=Z_(M),k=ar(E);jt(()=>{K&&(k==null||k())},[K,k]);const j=(z=J.arrow)==null?void 0:z.x,I=(ee=J.arrow)==null?void 0:ee.y,Y=((ae=J.arrow)==null?void 0:ae.centerOffset)!==0,[V,Z]=v.useState();return jt(()=>{C&&Z(window.getComputedStyle(C).zIndex)},[C]),y.jsx("div",{ref:ce.setFloating,"data-radix-popper-content-wrapper":"",style:{...fe,transform:K?fe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(xe=J.transformOrigin)==null?void 0:xe.x,(Ee=J.transformOrigin)==null?void 0:Ee.y].join(" "),...((Te=J.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:y.jsx(FL,{scope:r,placedSide:ne,onArrowChange:F,arrowX:j,arrowY:I,shouldHideArrow:Y,children:y.jsx(je.div,{"data-side":ne,"data-align":X,...S,ref:N,style:{...S.style,animation:K?void 0:"none"}})})})});X_.displayName=Up;var J_="PopperArrow",YL={top:"bottom",right:"left",bottom:"top",left:"right"},Q_=v.forwardRef(function(t,r){const{__scopePopper:s,...o}=t,l=KL(J_,s),u=YL[l.placedSide];return y.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:y.jsx(VL,{...o,ref:r,style:{...o.style,display:"block"}})})});Q_.displayName=J_;function WL(e){return e!==null}var XL=e=>({name:"transformOrigin",options:e,fn(t){var A,C,R;const{placement:r,rects:s,middlewareData:o}=t,u=((A=o.arrow)==null?void 0:A.centerOffset)!==0,d=u?0:e.arrowWidth,f=u?0:e.arrowHeight,[m,b]=Z_(r),g={start:"0%",center:"50%",end:"100%"}[b],w=(((C=o.arrow)==null?void 0:C.x)??0)+d/2,_=(((R=o.arrow)==null?void 0:R.y)??0)+f/2;let E="",S="";return m==="bottom"?(E=u?g:`${w}px`,S=`${-f}px`):m==="top"?(E=u?g:`${w}px`,S=`${s.floating.height+f}px`):m==="right"?(E=`${-f}px`,S=u?g:`${_}px`):m==="left"&&(E=`${s.floating.width+f}px`,S=u?g:`${_}px`),{data:{x:E,y:S}}}});function Z_(e){const[t,r="center"]=e.split("-");return[t,r]}var Ip=K_,wd=W_,$p=X_,Bp=Q_,JL="Portal",Pl=v.forwardRef((e,t)=>{var d;const{container:r,...s}=e,[o,l]=v.useState(!1);jt(()=>l(!0),[]);const u=r||o&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?Lx.createPortal(y.jsx(je.div,{...s,ref:t}),u):null});Pl.displayName=JL;function QL(e,t){return v.useReducer((r,s)=>t[r][s]??r,e)}var or=e=>{const{present:t,children:r}=e,s=ZL(t),o=typeof r=="function"?r({present:s.isPresent}):v.Children.only(r),l=Xe(s.ref,e5(o));return typeof r=="function"||s.isPresent?v.cloneElement(o,{ref:l}):null};or.displayName="Presence";function ZL(e){const[t,r]=v.useState(),s=v.useRef(null),o=v.useRef(e),l=v.useRef("none"),u=e?"mounted":"unmounted",[d,f]=QL(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const m=hu(s.current);l.current=d==="mounted"?m:"none"},[d]),jt(()=>{const m=s.current,b=o.current;if(b!==e){const w=l.current,_=hu(m);e?f("MOUNT"):_==="none"||(m==null?void 0:m.display)==="none"?f("UNMOUNT"):f(b&&w!==_?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),jt(()=>{if(t){let m;const b=t.ownerDocument.defaultView??window,g=_=>{const S=hu(s.current).includes(CSS.escape(_.animationName));if(_.target===t&&S&&(f("ANIMATION_END"),!o.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",m=b.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},w=_=>{_.target===t&&(l.current=hu(s.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{b.clearTimeout(m),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:v.useCallback(m=>{s.current=m?getComputedStyle(m):null,r(m)},[])}}function hu(e){return(e==null?void 0:e.animationName)||"none"}function e5(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var hm="rovingFocusGroup.onEntryFocus",t5={bubbles:!1,cancelable:!0},zl="RovingFocusGroup",[Ym,eS,n5]=Np(zl),[r5,tS]=la(zl,[n5]),[a5,s5]=r5(zl),nS=v.forwardRef((e,t)=>y.jsx(Ym.Provider,{scope:e.__scopeRovingFocusGroup,children:y.jsx(Ym.Slot,{scope:e.__scopeRovingFocusGroup,children:y.jsx(i5,{...e,ref:t})})}));nS.displayName=zl;var i5=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:o=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:f,onEntryFocus:m,preventScrollOnEntryFocus:b=!1,...g}=e,w=v.useRef(null),_=Xe(t,w),E=kp(l),[S,A]=Rs({prop:u,defaultProp:d??null,onChange:f,caller:zl}),[C,R]=v.useState(!1),N=ar(m),P=eS(r),F=v.useRef(!1),[$,L]=v.useState(0);return v.useEffect(()=>{const q=w.current;if(q)return q.addEventListener(hm,N),()=>q.removeEventListener(hm,N)},[N]),y.jsx(a5,{scope:r,orientation:s,dir:E,loop:o,currentTabStopId:S,onItemFocus:v.useCallback(q=>A(q),[A]),onItemShiftTab:v.useCallback(()=>R(!0),[]),onFocusableItemAdd:v.useCallback(()=>L(q=>q+1),[]),onFocusableItemRemove:v.useCallback(()=>L(q=>q-1),[]),children:y.jsx(je.div,{tabIndex:C||$===0?-1:0,"data-orientation":s,...g,ref:_,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{F.current=!0}),onFocus:we(e.onFocus,q=>{const ie=!F.current;if(q.target===q.currentTarget&&ie&&!C){const he=new CustomEvent(hm,t5);if(q.currentTarget.dispatchEvent(he),!he.defaultPrevented){const pe=P().filter(M=>M.focusable),oe=pe.find(M=>M.active),ue=pe.find(M=>M.id===S),fe=[oe,ue,...pe].filter(Boolean).map(M=>M.ref.current);sS(fe,b)}}F.current=!1}),onBlur:we(e.onBlur,()=>R(!1))})})}),rS="RovingFocusGroupItem",aS=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:o=!1,tabStopId:l,children:u,...d}=e,f=Qt(),m=l||f,b=s5(rS,r),g=b.currentTabStopId===m,w=eS(r),{onFocusableItemAdd:_,onFocusableItemRemove:E,currentTabStopId:S}=b;return v.useEffect(()=>{if(s)return _(),()=>E()},[s,_,E]),y.jsx(Ym.ItemSlot,{scope:r,id:m,focusable:s,active:o,children:y.jsx(je.span,{tabIndex:g?0:-1,"data-orientation":b.orientation,...d,ref:t,onMouseDown:we(e.onMouseDown,A=>{s?b.onItemFocus(m):A.preventDefault()}),onFocus:we(e.onFocus,()=>b.onItemFocus(m)),onKeyDown:we(e.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){b.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const C=c5(A,b.orientation,b.dir);if(C!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let N=w().filter(P=>P.focusable).map(P=>P.ref.current);if(C==="last")N.reverse();else if(C==="prev"||C==="next"){C==="prev"&&N.reverse();const P=N.indexOf(A.currentTarget);N=b.loop?u5(N,P+1):N.slice(P+1)}setTimeout(()=>sS(N))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:S!=null}):u})})});aS.displayName=rS;var o5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function l5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function c5(e,t,r){const s=l5(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return o5[s]}function sS(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function u5(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var d5=nS,f5=aS;function h5(e){const t=m5(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(g5);if(f){const m=f.props.children,b=d.map(g=>g===f?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return y.jsx(t,{...u,ref:o,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return y.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function m5(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=v5(o),d=y5(l,o.props);return o.type!==v.Fragment&&(d.ref=s?en(s,u):u),v.cloneElement(o,d)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var p5=Symbol("radix.slottable");function g5(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===p5}function y5(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const f=l(...d);return o(...d),f}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function v5(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var b5=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ti=new WeakMap,mu=new WeakMap,pu={},mm=0,iS=function(e){return e&&(e.host||iS(e.parentNode))},w5=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=iS(r);return s&&e.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},x5=function(e,t,r,s){var o=w5(t,Array.isArray(e)?e:[e]);pu[r]||(pu[r]=new WeakMap);var l=pu[r],u=[],d=new Set,f=new Set(o),m=function(g){!g||d.has(g)||(d.add(g),m(g.parentNode))};o.forEach(m);var b=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(w){if(d.has(w))b(w);else try{var _=w.getAttribute(s),E=_!==null&&_!=="false",S=(Ti.get(w)||0)+1,A=(l.get(w)||0)+1;Ti.set(w,S),l.set(w,A),u.push(w),S===1&&E&&mu.set(w,!0),A===1&&w.setAttribute(r,"true"),E||w.setAttribute(s,"true")}catch(C){console.error("aria-hidden: cannot operate on ",w,C)}})};return b(t),d.clear(),mm++,function(){u.forEach(function(g){var w=Ti.get(g)-1,_=l.get(g)-1;Ti.set(g,w),l.set(g,_),w||(mu.has(g)||g.removeAttribute(s),mu.delete(g)),_||g.removeAttribute(r)}),mm--,mm||(Ti=new WeakMap,Ti=new WeakMap,mu=new WeakMap,pu={})}},xd=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=b5(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),x5(s,o,r,"aria-hidden")):function(){return null}},ju="right-scroll-bar-position",Ou="width-before-scroll-bar",_5="with-scroll-bars-hidden",S5="--removed-body-scroll-bar-size";function pm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function E5(e,t){var r=v.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var o=r.value;o!==s&&(r.value=s,r.callback(s,o))}}}})[0];return r.callback=t,r.facade}var C5=typeof window<"u"?v.useLayoutEffect:v.useEffect,Lw=new WeakMap;function A5(e,t){var r=E5(null,function(s){return e.forEach(function(o){return pm(o,s)})});return C5(function(){var s=Lw.get(r);if(s){var o=new Set(s),l=new Set(e),u=r.current;o.forEach(function(d){l.has(d)||pm(d,null)}),l.forEach(function(d){o.has(d)||pm(d,u)})}Lw.set(r,e)},[e]),r}function T5(e){return e}function R5(e,t){t===void 0&&(t=T5);var r=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(l){var u=t(l,s);return r.push(u),function(){r=r.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(s=!0;r.length;){var u=r;r=[],u.forEach(l)}r={push:function(d){return l(d)},filter:function(){return r}}},assignMedium:function(l){s=!0;var u=[];if(r.length){var d=r;r=[],d.forEach(l),u=r}var f=function(){var b=u;u=[],b.forEach(l)},m=function(){return Promise.resolve().then(f)};m(),r={push:function(b){u.push(b),m()},filter:function(b){return u=u.filter(b),r}}}};return o}function N5(e){e===void 0&&(e={});var t=R5(null);return t.options=Sr({async:!0,ssr:!1},e),t}var oS=function(e){var t=e.sideCar,r=Wi(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return v.createElement(s,Sr({},r))};oS.isSideCarExport=!0;function k5(e,t){return e.useMedium(t),oS}var lS=N5(),gm=function(){},_d=v.forwardRef(function(e,t){var r=v.useRef(null),s=v.useState({onScrollCapture:gm,onWheelCapture:gm,onTouchMoveCapture:gm}),o=s[0],l=s[1],u=e.forwardProps,d=e.children,f=e.className,m=e.removeScrollBar,b=e.enabled,g=e.shards,w=e.sideCar,_=e.noRelative,E=e.noIsolation,S=e.inert,A=e.allowPinchZoom,C=e.as,R=C===void 0?"div":C,N=e.gapMode,P=Wi(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=w,$=A5([r,t]),L=Sr(Sr({},P),o);return v.createElement(v.Fragment,null,b&&v.createElement(F,{sideCar:lS,removeScrollBar:m,shards:g,noRelative:_,noIsolation:E,inert:S,setCallbacks:l,allowPinchZoom:!!A,lockRef:r,gapMode:N}),u?v.cloneElement(v.Children.only(d),Sr(Sr({},L),{ref:$})):v.createElement(R,Sr({},L,{className:f,ref:$}),d))});_d.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_d.classNames={fullWidth:Ou,zeroRight:ju};var j5=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function O5(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=j5();return t&&e.setAttribute("nonce",t),e}function M5(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function D5(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var L5=function(){var e=0,t=null;return{add:function(r){e==0&&(t=O5())&&(M5(t,r),D5(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},P5=function(){var e=L5();return function(t,r){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},cS=function(){var e=P5(),t=function(r){var s=r.styles,o=r.dynamic;return e(s,o),null};return t},z5={left:0,top:0,right:0,gap:0},ym=function(e){return parseInt(e||"",10)||0},U5=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[ym(r),ym(s),ym(o)]},I5=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return z5;var t=U5(e),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-r+t[2]-t[0])}},$5=cS(),qi="data-scroll-locked",B5=function(e,t,r,s){var o=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
.`.concat(_5,` {
overflow: hidden `).concat(s,`;
padding-right: `).concat(d,"px ").concat(s,`;
}
body[`).concat(qi,`] {
overflow: hidden `).concat(s,`;
overscroll-behavior: contain;
`).concat([t&&"position: relative ".concat(s,";"),r==="margin"&&`
padding-left: `.concat(o,`px;
padding-top: `).concat(l,`px;
padding-right: `).concat(u,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(d,"px ").concat(s,`;
`),r==="padding"&&"padding-right: ".concat(d,"px ").concat(s,";")].filter(Boolean).join(""),`
}
.`).concat(ju,` {
right: `).concat(d,"px ").concat(s,`;
}
.`).concat(Ou,` {
margin-right: `).concat(d,"px ").concat(s,`;
}
.`).concat(ju," .").concat(ju,` {
right: 0 `).concat(s,`;
}
.`).concat(Ou," .").concat(Ou,` {
margin-right: 0 `).concat(s,`;
}
body[`).concat(qi,`] {
`).concat(S5,": ").concat(d,`px;
}
`)},Pw=function(){var e=parseInt(document.body.getAttribute(qi)||"0",10);return isFinite(e)?e:0},H5=function(){v.useEffect(function(){return document.body.setAttribute(qi,(Pw()+1).toString()),function(){var e=Pw()-1;e<=0?document.body.removeAttribute(qi):document.body.setAttribute(qi,e.toString())}},[])},q5=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;H5();var l=v.useMemo(function(){return I5(o)},[o]);return v.createElement($5,{styles:B5(l,!t,o,r?"":"!important")})},Wm=!1;if(typeof window<"u")try{var gu=Object.defineProperty({},"passive",{get:function(){return Wm=!0,!0}});window.addEventListener("test",gu,gu),window.removeEventListener("test",gu,gu)}catch{Wm=!1}var Ri=Wm?{passive:!1}:!1,V5=function(e){return e.tagName==="TEXTAREA"},uS=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!V5(e)&&r[t]==="visible")},G5=function(e){return uS(e,"overflowY")},F5=function(e){return uS(e,"overflowX")},zw=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=dS(e,s);if(o){var l=fS(e,s),u=l[1],d=l[2];if(u>d)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},K5=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},Y5=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},dS=function(e,t){return e==="v"?G5(t):F5(t)},fS=function(e,t){return e==="v"?K5(t):Y5(t)},W5=function(e,t){return e==="h"&&t==="rtl"?-1:1},X5=function(e,t,r,s,o){var l=W5(e,window.getComputedStyle(t).direction),u=l*s,d=r.target,f=t.contains(d),m=!1,b=u>0,g=0,w=0;do{if(!d)break;var _=fS(e,d),E=_[0],S=_[1],A=_[2],C=S-A-l*E;(E||C)&&dS(e,d)&&(g+=C,w+=E);var R=d.parentNode;d=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!f&&d!==document.body||f&&(t.contains(d)||t===d));return(b&&Math.abs(g)<1||!b&&Math.abs(w)<1)&&(m=!0),m},yu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Uw=function(e){return[e.deltaX,e.deltaY]},Iw=function(e){return e&&"current"in e?e.current:e},J5=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Q5=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},Z5=0,Ni=[];function e3(e){var t=v.useRef([]),r=v.useRef([0,0]),s=v.useRef(),o=v.useState(Z5++)[0],l=v.useState(cS)[0],u=v.useRef(e);v.useEffect(function(){u.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var S=IN([e.lockRef.current],(e.shards||[]).map(Iw),!0).filter(Boolean);return S.forEach(function(A){return A.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),S.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var d=v.useCallback(function(S,A){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var C=yu(S),R=r.current,N="deltaX"in S?S.deltaX:R[0]-C[0],P="deltaY"in S?S.deltaY:R[1]-C[1],F,$=S.target,L=Math.abs(N)>Math.abs(P)?"h":"v";if("touches"in S&&L==="h"&&$.type==="range")return!1;var q=window.getSelection(),ie=q&&q.anchorNode,he=ie?ie===$||ie.contains($):!1;if(he)return!1;var pe=zw(L,$);if(!pe)return!0;if(pe?F=L:(F=L==="v"?"h":"v",pe=zw(L,$)),!pe)return!1;if(!s.current&&"changedTouches"in S&&(N||P)&&(s.current=F),!F)return!0;var oe=s.current||F;return X5(oe,A,S,oe==="h"?N:P)},[]),f=v.useCallback(function(S){var A=S;if(!(!Ni.length||Ni[Ni.length-1]!==l)){var C="deltaY"in A?Uw(A):yu(A),R=t.current.filter(function(F){return F.name===A.type&&(F.target===A.target||A.target===F.shadowParent)&&J5(F.delta,C)})[0];if(R&&R.should){A.cancelable&&A.preventDefault();return}if(!R){var N=(u.current.shards||[]).map(Iw).filter(Boolean).filter(function(F){return F.contains(A.target)}),P=N.length>0?d(A,N[0]):!u.current.noIsolation;P&&A.cancelable&&A.preventDefault()}}},[]),m=v.useCallback(function(S,A,C,R){var N={name:S,delta:A,target:C,should:R,shadowParent:t3(C)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(P){return P!==N})},1)},[]),b=v.useCallback(function(S){r.current=yu(S),s.current=void 0},[]),g=v.useCallback(function(S){m(S.type,Uw(S),S.target,d(S,e.lockRef.current))},[]),w=v.useCallback(function(S){m(S.type,yu(S),S.target,d(S,e.lockRef.current))},[]);v.useEffect(function(){return Ni.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:w}),document.addEventListener("wheel",f,Ri),document.addEventListener("touchmove",f,Ri),document.addEventListener("touchstart",b,Ri),function(){Ni=Ni.filter(function(S){return S!==l}),document.removeEventListener("wheel",f,Ri),document.removeEventListener("touchmove",f,Ri),document.removeEventListener("touchstart",b,Ri)}},[]);var _=e.removeScrollBar,E=e.inert;return v.createElement(v.Fragment,null,E?v.createElement(l,{styles:Q5(o)}):null,_?v.createElement(q5,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function t3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const n3=k5(lS,e3);var Ul=v.forwardRef(function(e,t){return v.createElement(_d,Sr({},e,{ref:t,sideCar:n3}))});Ul.classNames=_d.classNames;var Xm=["Enter"," "],r3=["ArrowDown","PageUp","Home"],hS=["ArrowUp","PageDown","End"],a3=[...r3,...hS],s3={ltr:[...Xm,"ArrowRight"],rtl:[...Xm,"ArrowLeft"]},i3={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Il="Menu",[_l,o3,l3]=Np(Il),[Ls,mS]=la(Il,[l3,Zi,tS]),Sd=Zi(),pS=tS(),[c3,Ps]=Ls(Il),[u3,$l]=Ls(Il),gS=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:o,onOpenChange:l,modal:u=!0}=e,d=Sd(t),[f,m]=v.useState(null),b=v.useRef(!1),g=ar(l),w=kp(o);return v.useEffect(()=>{const _=()=>{b.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>b.current=!1;return document.addEventListener("keydown",_,{capture:!0}),()=>{document.removeEventListener("keydown",_,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),y.jsx(Ip,{...d,children:y.jsx(c3,{scope:t,open:r,onOpenChange:g,content:f,onContentChange:m,children:y.jsx(u3,{scope:t,onClose:v.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:b,dir:w,modal:u,children:s})})})};gS.displayName=Il;var d3="MenuAnchor",Hp=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,o=Sd(r);return y.jsx(wd,{...o,...s,ref:t})});Hp.displayName=d3;var qp="MenuPortal",[f3,yS]=Ls(qp,{forceMount:void 0}),vS=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:o}=e,l=Ps(qp,t);return y.jsx(f3,{scope:t,forceMount:r,children:y.jsx(or,{present:r||l.open,children:y.jsx(Pl,{asChild:!0,container:o,children:s})})})};vS.displayName=qp;var Vn="MenuContent",[h3,Vp]=Ls(Vn),bS=v.forwardRef((e,t)=>{const r=yS(Vn,e.__scopeMenu),{forceMount:s=r.forceMount,...o}=e,l=Ps(Vn,e.__scopeMenu),u=$l(Vn,e.__scopeMenu);return y.jsx(_l.Provider,{scope:e.__scopeMenu,children:y.jsx(or,{present:s||l.open,children:y.jsx(_l.Slot,{scope:e.__scopeMenu,children:u.modal?y.jsx(m3,{...o,ref:t}):y.jsx(p3,{...o,ref:t})})})})}),m3=v.forwardRef((e,t)=>{const r=Ps(Vn,e.__scopeMenu),s=v.useRef(null),o=Xe(t,s);return v.useEffect(()=>{const l=s.current;if(l)return xd(l)},[]),y.jsx(Gp,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:we(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),p3=v.forwardRef((e,t)=>{const r=Ps(Vn,e.__scopeMenu);return y.jsx(Gp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),g3=h5("MenuContent.ScrollLock"),Gp=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:f,onEscapeKeyDown:m,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:w,onDismiss:_,disableOutsideScroll:E,...S}=e,A=Ps(Vn,r),C=$l(Vn,r),R=Sd(r),N=pS(r),P=o3(r),[F,$]=v.useState(null),L=v.useRef(null),q=Xe(t,L,A.onContentChange),ie=v.useRef(0),he=v.useRef(""),pe=v.useRef(0),oe=v.useRef(null),ue=v.useRef("right"),ce=v.useRef(0),fe=E?Ul:v.Fragment,M=E?{as:g3,allowPinchZoom:!0}:void 0,K=ne=>{var z,ee;const X=he.current+ne,k=P().filter(ae=>!ae.disabled),j=document.activeElement,I=(z=k.find(ae=>ae.ref.current===j))==null?void 0:z.textValue,Y=k.map(ae=>ae.textValue),V=R3(Y,X,I),Z=(ee=k.find(ae=>ae.textValue===V))==null?void 0:ee.ref.current;(function ae(xe){he.current=xe,window.clearTimeout(ie.current),xe!==""&&(ie.current=window.setTimeout(()=>ae(""),1e3))})(X),Z&&setTimeout(()=>Z.focus())};v.useEffect(()=>()=>window.clearTimeout(ie.current),[]),pd();const J=v.useCallback(ne=>{var k,j;return ue.current===((k=oe.current)==null?void 0:k.side)&&k3(ne,(j=oe.current)==null?void 0:j.area)},[]);return y.jsx(h3,{scope:r,searchRef:he,onItemEnter:v.useCallback(ne=>{J(ne)&&ne.preventDefault()},[J]),onItemLeave:v.useCallback(ne=>{var X;J(ne)||((X=L.current)==null||X.focus(),$(null))},[J]),onTriggerLeave:v.useCallback(ne=>{J(ne)&&ne.preventDefault()},[J]),pointerGraceTimerRef:pe,onPointerGraceIntentChange:v.useCallback(ne=>{oe.current=ne},[]),children:y.jsx(fe,{...M,children:y.jsx(Dl,{asChild:!0,trapped:o,onMountAutoFocus:we(l,ne=>{var X;ne.preventDefault(),(X=L.current)==null||X.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:y.jsx(Ml,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:w,onDismiss:_,children:y.jsx(d5,{asChild:!0,...N,dir:C.dir,orientation:"vertical",loop:s,currentTabStopId:F,onCurrentTabStopIdChange:$,onEntryFocus:we(f,ne=>{C.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:y.jsx($p,{role:"menu","aria-orientation":"vertical","data-state":LS(A.open),"data-radix-menu-content":"",dir:C.dir,...R,...S,ref:q,style:{outline:"none",...S.style},onKeyDown:we(S.onKeyDown,ne=>{const k=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,j=ne.ctrlKey||ne.altKey||ne.metaKey,I=ne.key.length===1;k&&(ne.key==="Tab"&&ne.preventDefault(),!j&&I&&K(ne.key));const Y=L.current;if(ne.target!==Y||!a3.includes(ne.key))return;ne.preventDefault();const Z=P().filter(z=>!z.disabled).map(z=>z.ref.current);hS.includes(ne.key)&&Z.reverse(),A3(Z)}),onBlur:we(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(ie.current),he.current="")}),onPointerMove:we(e.onPointerMove,Sl(ne=>{const X=ne.target,k=ce.current!==ne.clientX;if(ne.currentTarget.contains(X)&&k){const j=ne.clientX>ce.current?"right":"left";ue.current=j,ce.current=ne.clientX}}))})})})})})})});bS.displayName=Vn;var y3="MenuGroup",Fp=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{role:"group",...s,ref:t})});Fp.displayName=y3;var v3="MenuLabel",wS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{...s,ref:t})});wS.displayName=v3;var Zu="MenuItem",$w="menu.itemSelect",Ed=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...o}=e,l=v.useRef(null),u=$l(Zu,e.__scopeMenu),d=Vp(Zu,e.__scopeMenu),f=Xe(t,l),m=v.useRef(!1),b=()=>{const g=l.current;if(!r&&g){const w=new CustomEvent($w,{bubbles:!0,cancelable:!0});g.addEventListener($w,_=>s==null?void 0:s(_),{once:!0}),R_(g,w),w.defaultPrevented?m.current=!1:u.onClose()}};return y.jsx(xS,{...o,ref:f,disabled:r,onClick:we(e.onClick,b),onPointerDown:g=>{var w;(w=e.onPointerDown)==null||w.call(e,g),m.current=!0},onPointerUp:we(e.onPointerUp,g=>{var w;m.current||(w=g.currentTarget)==null||w.click()}),onKeyDown:we(e.onKeyDown,g=>{const w=d.searchRef.current!=="";r||w&&g.key===" "||Xm.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});Ed.displayName=Zu;var xS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:o,...l}=e,u=Vp(Zu,r),d=pS(r),f=v.useRef(null),m=Xe(t,f),[b,g]=v.useState(!1),[w,_]=v.useState("");return v.useEffect(()=>{const E=f.current;E&&_((E.textContent??"").trim())},[l.children]),y.jsx(_l.ItemSlot,{scope:r,disabled:s,textValue:o??w,children:y.jsx(f5,{asChild:!0,...d,focusable:!s,children:y.jsx(je.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:m,onPointerMove:we(e.onPointerMove,Sl(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:we(e.onPointerLeave,Sl(E=>u.onItemLeave(E))),onFocus:we(e.onFocus,()=>g(!0)),onBlur:we(e.onBlur,()=>g(!1))})})})}),b3="MenuCheckboxItem",_S=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...o}=e;return y.jsx(TS,{scope:e.__scopeMenu,checked:r,children:y.jsx(Ed,{role:"menuitemcheckbox","aria-checked":ed(r)?"mixed":r,...o,ref:t,"data-state":Yp(r),onSelect:we(o.onSelect,()=>s==null?void 0:s(ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});_S.displayName=b3;var SS="MenuRadioGroup",[w3,x3]=Ls(SS,{value:void 0,onValueChange:()=>{}}),ES=v.forwardRef((e,t)=>{const{value:r,onValueChange:s,...o}=e,l=ar(s);return y.jsx(w3,{scope:e.__scopeMenu,value:r,onValueChange:l,children:y.jsx(Fp,{...o,ref:t})})});ES.displayName=SS;var CS="MenuRadioItem",AS=v.forwardRef((e,t)=>{const{value:r,...s}=e,o=x3(CS,e.__scopeMenu),l=r===o.value;return y.jsx(TS,{scope:e.__scopeMenu,checked:l,children:y.jsx(Ed,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":Yp(l),onSelect:we(s.onSelect,()=>{var u;return(u=o.onValueChange)==null?void 0:u.call(o,r)},{checkForDefaultPrevented:!1})})})});AS.displayName=CS;var Kp="MenuItemIndicator",[TS,_3]=Ls(Kp,{checked:!1}),RS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...o}=e,l=_3(Kp,r);return y.jsx(or,{present:s||ed(l.checked)||l.checked===!0,children:y.jsx(je.span,{...o,ref:t,"data-state":Yp(l.checked)})})});RS.displayName=Kp;var S3="MenuSeparator",NS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});NS.displayName=S3;var E3="MenuArrow",kS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,o=Sd(r);return y.jsx(Bp,{...o,...s,ref:t})});kS.displayName=E3;var C3="MenuSub",[GI,jS]=Ls(C3),rl="MenuSubTrigger",OS=v.forwardRef((e,t)=>{const r=Ps(rl,e.__scopeMenu),s=$l(rl,e.__scopeMenu),o=jS(rl,e.__scopeMenu),l=Vp(rl,e.__scopeMenu),u=v.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:f}=l,m={__scopeMenu:e.__scopeMenu},b=v.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return v.useEffect(()=>b,[b]),v.useEffect(()=>{const g=d.current;return()=>{window.clearTimeout(g),f(null)}},[d,f]),y.jsx(Hp,{asChild:!0,...m,children:y.jsx(xS,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":LS(r.open),...e,ref:en(t,o.onTriggerChange),onClick:g=>{var w;(w=e.onClick)==null||w.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:we(e.onPointerMove,Sl(g=>{l.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),b()},100))})),onPointerLeave:we(e.onPointerLeave,Sl(g=>{var _,E;b();const w=(_=r.content)==null?void 0:_.getBoundingClientRect();if(w){const S=(E=r.content)==null?void 0:E.dataset.side,A=S==="right",C=A?-5:5,R=w[A?"left":"right"],N=w[A?"right":"left"];l.onPointerGraceIntentChange({area:[{x:g.clientX+C,y:g.clientY},{x:R,y:w.top},{x:N,y:w.top},{x:N,y:w.bottom},{x:R,y:w.bottom}],side:S}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(g),g.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:we(e.onKeyDown,g=>{var _;const w=l.searchRef.current!=="";e.disabled||w&&g.key===" "||s3[s.dir].includes(g.key)&&(r.onOpenChange(!0),(_=r.content)==null||_.focus(),g.preventDefault())})})})});OS.displayName=rl;var MS="MenuSubContent",DS=v.forwardRef((e,t)=>{const r=yS(Vn,e.__scopeMenu),{forceMount:s=r.forceMount,...o}=e,l=Ps(Vn,e.__scopeMenu),u=$l(Vn,e.__scopeMenu),d=jS(MS,e.__scopeMenu),f=v.useRef(null),m=Xe(t,f);return y.jsx(_l.Provider,{scope:e.__scopeMenu,children:y.jsx(or,{present:s||l.open,children:y.jsx(_l.Slot,{scope:e.__scopeMenu,children:y.jsx(Gp,{id:d.contentId,"aria-labelledby":d.triggerId,...o,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:b=>{var g;u.isUsingKeyboardRef.current&&((g=f.current)==null||g.focus()),b.preventDefault()},onCloseAutoFocus:b=>b.preventDefault(),onFocusOutside:we(e.onFocusOutside,b=>{b.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:we(e.onEscapeKeyDown,b=>{u.onClose(),b.preventDefault()}),onKeyDown:we(e.onKeyDown,b=>{var _;const g=b.currentTarget.contains(b.target),w=i3[u.dir].includes(b.key);g&&w&&(l.onOpenChange(!1),(_=d.trigger)==null||_.focus(),b.preventDefault())})})})})})});DS.displayName=MS;function LS(e){return e?"open":"closed"}function ed(e){return e==="indeterminate"}function Yp(e){return ed(e)?"indeterminate":e?"checked":"unchecked"}function A3(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function T3(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function R3(e,t,r){const o=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=T3(e,Math.max(l,0));o.length===1&&(u=u.filter(m=>m!==r));const f=u.find(m=>m.toLowerCase().startsWith(o.toLowerCase()));return f!==r?f:void 0}function N3(e,t){const{x:r,y:s}=e;let o=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],f=t[u],m=d.x,b=d.y,g=f.x,w=f.y;b>s!=w>s&&r<(g-m)*(s-b)/(w-b)+m&&(o=!o)}return o}function k3(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return N3(r,t)}function Sl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var j3=gS,O3=Hp,M3=vS,D3=bS,L3=Fp,P3=wS,z3=Ed,U3=_S,I3=ES,$3=AS,B3=RS,H3=NS,q3=kS,V3=OS,G3=DS,Cd="DropdownMenu",[F3]=la(Cd,[mS]),tn=mS(),[K3,PS]=F3(Cd),zS=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:o,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,f=tn(t),m=v.useRef(null),[b,g]=Rs({prop:o,defaultProp:l??!1,onChange:u,caller:Cd});return y.jsx(K3,{scope:t,triggerId:Qt(),triggerRef:m,contentId:Qt(),open:b,onOpenChange:g,onOpenToggle:v.useCallback(()=>g(w=>!w),[g]),modal:d,children:y.jsx(j3,{...f,open:b,onOpenChange:g,dir:s,modal:d,children:r})})};zS.displayName=Cd;var US="DropdownMenuTrigger",IS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...o}=e,l=PS(US,r),u=tn(r);return y.jsx(O3,{asChild:!0,...u,children:y.jsx(je.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...o,ref:en(t,l.triggerRef),onPointerDown:we(e.onPointerDown,d=>{!s&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:we(e.onKeyDown,d=>{s||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});IS.displayName=US;var Y3="DropdownMenuPortal",$S=e=>{const{__scopeDropdownMenu:t,...r}=e,s=tn(t);return y.jsx(M3,{...s,...r})};$S.displayName=Y3;var BS="DropdownMenuContent",HS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=PS(BS,r),l=tn(r),u=v.useRef(!1);return y.jsx(D3,{id:o.contentId,"aria-labelledby":o.triggerId,...l,...s,ref:t,onCloseAutoFocus:we(e.onCloseAutoFocus,d=>{var f;u.current||(f=o.triggerRef.current)==null||f.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:we(e.onInteractOutside,d=>{const f=d.detail.originalEvent,m=f.button===0&&f.ctrlKey===!0,b=f.button===2||m;(!o.modal||b)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});HS.displayName=BS;var W3="DropdownMenuGroup",X3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(L3,{...o,...s,ref:t})});X3.displayName=W3;var J3="DropdownMenuLabel",qS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(P3,{...o,...s,ref:t})});qS.displayName=J3;var Q3="DropdownMenuItem",VS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(z3,{...o,...s,ref:t})});VS.displayName=Q3;var Z3="DropdownMenuCheckboxItem",GS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(U3,{...o,...s,ref:t})});GS.displayName=Z3;var eP="DropdownMenuRadioGroup",tP=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(I3,{...o,...s,ref:t})});tP.displayName=eP;var nP="DropdownMenuRadioItem",FS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx($3,{...o,...s,ref:t})});FS.displayName=nP;var rP="DropdownMenuItemIndicator",KS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(B3,{...o,...s,ref:t})});KS.displayName=rP;var aP="DropdownMenuSeparator",YS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(H3,{...o,...s,ref:t})});YS.displayName=aP;var sP="DropdownMenuArrow",iP=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(q3,{...o,...s,ref:t})});iP.displayName=sP;var oP="DropdownMenuSubTrigger",WS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(V3,{...o,...s,ref:t})});WS.displayName=oP;var lP="DropdownMenuSubContent",XS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(G3,{...o,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});XS.displayName=lP;var cP=zS,uP=IS,dP=$S,JS=HS,QS=qS,ZS=VS,eE=GS,tE=FS,nE=KS,rE=YS,aE=WS,sE=XS;const fP=cP,hP=uP,mP=v.forwardRef(({className:e,inset:t,children:r,...s},o)=>y.jsxs(aE,{ref:o,className:Ae("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...s,children:[r,y.jsx(l_,{className:"ml-auto"})]}));mP.displayName=aE.displayName;const pP=v.forwardRef(({className:e,...t},r)=>y.jsx(sE,{ref:r,className:Ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)",e),...t}));pP.displayName=sE.displayName;const iE=v.forwardRef(({className:e,sideOffset:t=4,...r},s)=>y.jsx(dP,{children:y.jsx(JS,{ref:s,sideOffset:t,className:Ae("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)",e),...r})}));iE.displayName=JS.displayName;const oE=v.forwardRef(({className:e,inset:t,...r},s)=>y.jsx(ZS,{ref:s,className:Ae("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...r}));oE.displayName=ZS.displayName;const gP=v.forwardRef(({className:e,children:t,checked:r,...s},o)=>y.jsxs(eE,{ref:o,className:Ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[y.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:y.jsx(nE,{children:y.jsx(Ts,{className:"h-4 w-4"})})}),t]}));gP.displayName=eE.displayName;const yP=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(tE,{ref:s,className:Ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[y.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:y.jsx(nE,{children:y.jsx(g2,{className:"h-2 w-2 fill-current"})})}),t]}));yP.displayName=tE.displayName;const vP=v.forwardRef(({className:e,inset:t,...r},s)=>y.jsx(QS,{ref:s,className:Ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));vP.displayName=QS.displayName;const lE=v.forwardRef(({className:e,...t},r)=>y.jsx(rE,{ref:r,className:Ae("-mx-1 my-1 h-px bg-muted",e),...t}));lE.displayName=rE.displayName;function bP(e,t=[]){let r=[];function s(l,u){const d=v.createContext(u);d.displayName=l+"Context";const f=r.length;r=[...r,u];const m=g=>{var C;const{scope:w,children:_,...E}=g,S=((C=w==null?void 0:w[e])==null?void 0:C[f])||d,A=v.useMemo(()=>E,Object.values(E));return y.jsx(S.Provider,{value:A,children:_})};m.displayName=l+"Provider";function b(g,w){var S;const _=((S=w==null?void 0:w[e])==null?void 0:S[f])||d,E=v.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,b]}const o=()=>{const l=r.map(u=>v.createContext(u));return function(d){const f=(d==null?void 0:d[e])||l;return v.useMemo(()=>({[`__scope${e}`]:{...d,[e]:f}}),[d,f])}};return o.scopeName=e,[s,wP(o,...t)]}function wP(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=s.reduce((d,{useScope:f,scopeName:m})=>{const g=f(l)[`__scope${m}`];return{...d,...g}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var xP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wp=xP.reduce((e,t)=>{const r=md(`Primitive.${t}`),s=v.forwardRef((o,l)=>{const{asChild:u,...d}=o,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),vm={exports:{}},bm={};/**
* @license React
* use-sync-external-store-shim.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 Bw;function _P(){if(Bw)return bm;Bw=1;var e=od();function t(g,w){return g===w&&(g!==0||1/g===1/w)||g!==g&&w!==w}var r=typeof Object.is=="function"?Object.is:t,s=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function d(g,w){var _=w(),E=s({inst:{value:_,getSnapshot:w}}),S=E[0].inst,A=E[1];return l(function(){S.value=_,S.getSnapshot=w,f(S)&&A({inst:S})},[g,_,w]),o(function(){return f(S)&&A({inst:S}),g(function(){f(S)&&A({inst:S})})},[g]),u(_),_}function f(g){var w=g.getSnapshot;g=g.value;try{var _=w();return!r(g,_)}catch{return!0}}function m(g,w){return w()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:d;return bm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,bm}var Hw;function SP(){return Hw||(Hw=1,vm.exports=_P()),vm.exports}var EP=SP();function CP(){return EP.useSyncExternalStore(AP,()=>!0,()=>!1)}function AP(){return()=>{}}var Xp="Avatar",[TP]=bP(Xp),[RP,cE]=TP(Xp),uE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[o,l]=v.useState("idle");return y.jsx(RP,{scope:r,imageLoadingStatus:o,onImageLoadingStatusChange:l,children:y.jsx(Wp.span,{...s,ref:t})})});uE.displayName=Xp;var dE="AvatarImage",fE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:o=()=>{},...l}=e,u=cE(dE,r),d=NP(s,l),f=ar(m=>{o(m),u.onImageLoadingStatusChange(m)});return jt(()=>{d!=="idle"&&f(d)},[d,f]),d==="loaded"?y.jsx(Wp.img,{...l,ref:t,src:s}):null});fE.displayName=dE;var hE="AvatarFallback",mE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...o}=e,l=cE(hE,r),[u,d]=v.useState(s===void 0);return v.useEffect(()=>{if(s!==void 0){const f=window.setTimeout(()=>d(!0),s);return()=>window.clearTimeout(f)}},[s]),u&&l.imageLoadingStatus!=="loaded"?y.jsx(Wp.span,{...o,ref:t}):null});mE.displayName=hE;function qw(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function NP(e,{referrerPolicy:t,crossOrigin:r}){const s=CP(),o=v.useRef(null),l=s?(o.current||(o.current=new window.Image),o.current):null,[u,d]=v.useState(()=>qw(l,e));return jt(()=>{d(qw(l,e))},[l,e]),jt(()=>{const f=g=>()=>{d(g)};if(!l)return;const m=f("loaded"),b=f("error");return l.addEventListener("load",m),l.addEventListener("error",b),t&&(l.referrerPolicy=t),typeof r=="string"&&(l.crossOrigin=r),()=>{l.removeEventListener("load",m),l.removeEventListener("error",b)}},[l,r,t]),u}var pE=uE,gE=fE,yE=mE;const vE=v.forwardRef(({className:e,...t},r)=>y.jsx(pE,{ref:r,className:Ae("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));vE.displayName=pE.displayName;const bE=v.forwardRef(({className:e,...t},r)=>y.jsx(gE,{ref:r,className:Ae("aspect-square h-full w-full",e),...t}));bE.displayName=gE.displayName;const wE=v.forwardRef(({className:e,...t},r)=>y.jsx(yE,{ref:r,className:Ae("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));wE.displayName=yE.displayName;const kP=Ap("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Cs({className:e,variant:t,...r}){return y.jsx("div",{className:Ae(kP({variant:t}),e),...r})}const jP=["Ascenda","Bacardí","Bayer","Benedicto Wong","Big Cola","BMI","Casio","CDC","Colgate","Cordiflex","Diageo","Estelar","Estrella Azul","GLM","In Drive","Mars","Microsoft","Molino Criollo","Naicom","Nestlé","P&G","Pepsico","RRHH","Taco Bell","Us Meat","Vozez","Whirlpool","Little Caesars","Intcomex","Cemix","Súper Xtra","Grupo AJE","Varios","KitchenAid","Maytag","Across","Claro","Bruni","Volt","InDrive","TrueShore","Coca Cola","Más Móvil","US Rice","Café Indio","Café Maya","Jack Daniels","GLM Digital","Compass","Starbucks","Skechers","Ron Bermudez","Nature´s Heart","Larimart","Motorola","Bajaj - Pulsar","Xelet Media","Philip Morris","Malher","Carnation","La Lechera"].sort(),Jp={CDC:"Marrero",Colombia:"J. Fernando","Costa Rica":"Poul","El Salvador":"Christian",Estelar:"Pablo",Guatemala:"Gerardo",Honduras:"Lucy",Jamaica:"Liz",Latam:"JL",Mexico:"Poul",Nicaragua:"Poul",OCI:"Liz",Panama:"Gabriel","Puerto Rico":"Liz","Republica Dominicana":"Liz",RRHH:"Maximo",Trinidad:"Liz",Venezuela:"Jose Fer",Vozez:"Nathalia","GLM Digital":"Lil",IQM:"Lil"},OP=Object.keys(Jp).sort(),MP=["Carnation","GLM RRHH","La Lechera","Malher","US Meat","Coffee Mate y Nescafé","Nestum y Nido","Whirlpool","Motorola","Philip Morris","US Meat Guatemala","KitKat, Crunch, Choco Trío","Colgate","Kit Kat","UMA","Purina","Maggi e Ideal","Nestlé","Jimador","Multimarcas","Maggi","Covo","El Machetazo","Grupo Bocel","Supply Chain","Carnation y La Lechera","GLM Administración","Nestlé Bice","GLM","Nescafé","Idea, Qué Rico y Maggi","EY","Nesquik","Maggi, Ketchup, Qué Rico","Ideal","Claro Empresas","Nido","Presto","Nestlé RD","GLM Colombia","Motorola RD","GLM Caribe","Mandino","Coffee Mate","GLM Latam","RRHH RD","Philip Morris TT","GLM RD","Smirnoff","Kaspersky","US Pork","Qué Rico y Maggi","Claro y Motorola","Sedal","Maytag","Qué Rico, Maggi y Ketchup","Multimarca","Aviva y Princesa","KitchenAid","Enredé","Ascenda","Lipton Té","Heiniken","Oral B","Aafresh","IQOS","Natures Heart"],DP=["Aprobado","No aprobado","Stand by","Aprobado /no ejecutado","Pre aprobado","On going","Sin respuesta"],Jm=[{id:"blue",name:"Azul",hex:"#4285F4"},{id:"red",name:"Rojo",hex:"#EA4335"},{id:"yellow",name:"Amarillo",hex:"#FBBC04"},{id:"green",name:"Verde",hex:"#34A853"},{id:"purple",name:"Morado",hex:"#A142F4"},{id:"teal",name:"Turquesa",hex:"#00ACC1"},{id:"orange",name:"Naranja",hex:"#FB8C00"},{id:"pink",name:"Rosa",hex:"#E91E63"},{id:"indigo",name:"Índigo",hex:"#3F51B5"},{id:"gray",name:"Gris",hex:"#5F6368"}],LP=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];function xE(e){var t;return((t=Jm.find(r=>r.id===e))==null?void 0:t.hex)??Jm[0].hex}function PP({project:e,onClick:t}){const r=!!e.status,{isGerardo:s}=Ol(),o=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t())};return y.jsxs("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:o,className:Ae("group block text-left w-full rounded-2xl bg-card overflow-hidden p-0 ring-1 ring-border cursor-pointer","transition-all duration-200 hover:-translate-y-0.5","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r&&"opacity-65 hover:opacity-90"),style:{boxShadow:r?"0 1px 2px oklch(0.5 0.02 280 / 0.04)":"var(--shadow-soft)"},onMouseEnter:l=>{r||(l.currentTarget.style.boxShadow="var(--shadow-hover)")},onMouseLeave:l=>{l.currentTarget.style.boxShadow=r?"0 1px 2px oklch(0.5 0.02 280 / 0.04)":"var(--shadow-soft)"},children:[y.jsx("div",{className:"min-h-14 rounded-t-2xl px-4 py-3",style:{backgroundColor:r?"#9AA0A6":xE(e.color)},children:y.jsx("h3",{className:"text-white font-semibold text-sm leading-snug line-clamp-2 drop-shadow-sm",children:e.nombre||"Sin título"})}),y.jsxs("div",{className:"p-4 space-y-2.5",children:[y.jsx(vu,{icon:y.jsx(iw,{className:"w-3.5 h-3.5"}),label:"Cliente",value:e.cliente}),y.jsx(vu,{icon:y.jsx(iw,{className:"w-3.5 h-3.5"}),label:"Marca",value:e.marca}),y.jsx(vu,{icon:y.jsx(q2,{className:"w-3.5 h-3.5"}),label:"País",value:e.bu}),y.jsx(vu,{icon:y.jsx(tM,{className:"w-3.5 h-3.5"}),label:"Solicita",value:e.solicitante}),y.jsxs("div",{className:"flex items-center justify-between pt-2 mt-2 border-t border-border/70",children:[y.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[e.propuestaLinks.length>0&&y.jsxs("span",{className:"flex items-center gap-1",title:"Propuestas",children:[y.jsx(D2,{className:"w-3 h-3"})," ",e.propuestaLinks.length]}),e.afLinks.length>0&&y.jsxs("span",{className:"flex items-center gap-1",title:"Artes finales",children:[y.jsx(T2,{className:"w-3 h-3"})," AF·",e.afLinks.length]})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&e.monto!=null&&y.jsxs("span",{className:"text-[11px] font-medium text-foreground/70",children:["$",e.monto.toLocaleString()]}),e.status&&y.jsxs(Cs,{variant:"secondary",className:Ae("text-[10px] px-1.5 py-0 h-5 font-medium",e.status==="Aprobado"&&"bg-emerald-100 text-emerald-800 hover:bg-emerald-100",e.status==="No aprobado"&&"bg-red-100 text-red-800 hover:bg-red-100"),children:[e.status==="Aprobado"&&y.jsx(m2,{className:"w-2.5 h-2.5 mr-0.5"}),e.status]})]})]})]})]})}function vu({icon:e,label:t,value:r}){return y.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[y.jsx("span",{className:"text-muted-foreground mt-0.5 flex-shrink-0",children:e}),y.jsx("span",{className:"text-muted-foreground w-14 flex-shrink-0",children:t}),y.jsx("span",{className:"text-foreground font-medium truncate",children:r||"—"})]})}function zP(e){const t=UP(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find($P);if(f){const m=f.props.children,b=d.map(g=>g===f?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return y.jsx(t,{...u,ref:o,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return y.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function UP(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=HP(o),d=BP(l,o.props);return o.type!==v.Fragment&&(d.ref=s?en(s,u):u),v.cloneElement(o,d)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var IP=Symbol("radix.slottable");function $P(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===IP}function BP(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const f=l(...d);return o(...d),f}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function HP(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Ad="Dialog",[_E]=la(Ad),[qP,lr]=_E(Ad),SE=e=>{const{__scopeDialog:t,children:r,open:s,defaultOpen:o,onOpenChange:l,modal:u=!0}=e,d=v.useRef(null),f=v.useRef(null),[m,b]=Rs({prop:s,defaultProp:o??!1,onChange:l,caller:Ad});return y.jsx(qP,{scope:t,triggerRef:d,contentRef:f,contentId:Qt(),titleId:Qt(),descriptionId:Qt(),open:m,onOpenChange:b,onOpenToggle:v.useCallback(()=>b(g=>!g),[b]),modal:u,children:r})};SE.displayName=Ad;var EE="DialogTrigger",VP=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(EE,r),l=Xe(t,o.triggerRef);return y.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":eg(o.open),...s,ref:l,onClick:we(e.onClick,o.onOpenToggle)})});VP.displayName=EE;var Qp="DialogPortal",[GP,CE]=_E(Qp,{forceMount:void 0}),AE=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:o}=e,l=lr(Qp,t);return y.jsx(GP,{scope:t,forceMount:r,children:v.Children.map(s,u=>y.jsx(or,{present:r||l.open,children:y.jsx(Pl,{asChild:!0,container:o,children:u})}))})};AE.displayName=Qp;var td="DialogOverlay",TE=v.forwardRef((e,t)=>{const r=CE(td,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,l=lr(td,e.__scopeDialog);return l.modal?y.jsx(or,{present:s||l.open,children:y.jsx(KP,{...o,ref:t})}):null});TE.displayName=td;var FP=zP("DialogOverlay.RemoveScroll"),KP=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(td,r);return y.jsx(Ul,{as:FP,allowPinchZoom:!0,shards:[o.contentRef],children:y.jsx(je.div,{"data-state":eg(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ks="DialogContent",RE=v.forwardRef((e,t)=>{const r=CE(ks,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,l=lr(ks,e.__scopeDialog);return y.jsx(or,{present:s||l.open,children:l.modal?y.jsx(YP,{...o,ref:t}):y.jsx(WP,{...o,ref:t})})});RE.displayName=ks;var YP=v.forwardRef((e,t)=>{const r=lr(ks,e.__scopeDialog),s=v.useRef(null),o=Xe(t,r.contentRef,s);return v.useEffect(()=>{const l=s.current;if(l)return xd(l)},[]),y.jsx(NE,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:we(e.onFocusOutside,l=>l.preventDefault())})}),WP=v.forwardRef((e,t)=>{const r=lr(ks,e.__scopeDialog),s=v.useRef(!1),o=v.useRef(!1);return y.jsx(NE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var u,d;(u=e.onCloseAutoFocus)==null||u.call(e,l),l.defaultPrevented||(s.current||(d=r.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:l=>{var f,m;(f=e.onInteractOutside)==null||f.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;((m=r.triggerRef.current)==null?void 0:m.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),NE=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,...u}=e,d=lr(ks,r),f=v.useRef(null),m=Xe(t,f);return pd(),y.jsxs(y.Fragment,{children:[y.jsx(Dl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:y.jsx(Ml,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":eg(d.open),...u,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),y.jsxs(y.Fragment,{children:[y.jsx(XP,{titleId:d.titleId}),y.jsx(QP,{contentRef:f,descriptionId:d.descriptionId})]})]})}),Zp="DialogTitle",kE=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(Zp,r);return y.jsx(je.h2,{id:o.titleId,...s,ref:t})});kE.displayName=Zp;var jE="DialogDescription",OE=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(jE,r);return y.jsx(je.p,{id:o.descriptionId,...s,ref:t})});OE.displayName=jE;var ME="DialogClose",DE=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(ME,r);return y.jsx(je.button,{type:"button",...s,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});DE.displayName=ME;function eg(e){return e?"open":"closed"}var LE="DialogTitleWarning",[FI,PE]=aD(LE,{contentName:ks,titleName:Zp,docsSlug:"dialog"}),XP=({titleId:e})=>{const t=PE(LE),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},JP="DialogDescriptionWarning",QP=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${PE(JP).contentName}}.`;return v.useEffect(()=>{var l;const o=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},zE=SE,UE=AE,tg=TE,ng=RE,IE=kE,$E=OE,ZP=DE;const e4=zE,t4=UE,BE=v.forwardRef(({className:e,...t},r)=>y.jsx(tg,{ref:r,className:Ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));BE.displayName=tg.displayName;const HE=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(t4,{children:[y.jsx(BE,{}),y.jsxs(ng,{ref:s,className:Ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",e),...r,children:[t,y.jsxs(ZP,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background cursor-pointer transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[y.jsx(wl,{className:"h-4 w-4"}),y.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));HE.displayName=ng.displayName;const qE=({className:e,...t})=>y.jsx("div",{className:Ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});qE.displayName="DialogHeader";const VE=({className:e,...t})=>y.jsx("div",{className:Ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});VE.displayName="DialogFooter";const GE=v.forwardRef(({className:e,...t},r)=>y.jsx(IE,{ref:r,className:Ae("text-lg font-semibold leading-none tracking-tight",e),...t}));GE.displayName=IE.displayName;const FE=v.forwardRef(({className:e,...t},r)=>y.jsx($E,{ref:r,className:Ae("text-sm text-muted-foreground",e),...t}));FE.displayName=$E.displayName;var n4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],r4=n4.reduce((e,t)=>{const r=md(`Primitive.${t}`),s=v.forwardRef((o,l)=>{const{asChild:u,...d}=o,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),a4="Label",KE=v.forwardRef((e,t)=>y.jsx(r4.label,{...e,ref:t,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));KE.displayName=a4;var YE=KE;const s4=Ap("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=v.forwardRef(({className:e,...t},r)=>y.jsx(YE,{ref:r,className:Ae(s4(),e),...t}));xt.displayName=YE.displayName;const nd=v.forwardRef(({className:e,...t},r)=>y.jsx("textarea",{className:Ae("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));nd.displayName="Textarea";function WE(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Td="Checkbox",[i4]=la(Td),[o4,rg]=i4(Td);function l4(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:o,disabled:l,form:u,name:d,onCheckedChange:f,required:m,value:b="on",internal_do_not_use_render:g}=e,[w,_]=Rs({prop:r,defaultProp:o??!1,onChange:f,caller:Td}),[E,S]=v.useState(null),[A,C]=v.useState(null),R=v.useRef(!1),N=E?!!u||!!E.closest("form"):!0,P={checked:w,disabled:l,setChecked:_,control:E,setControl:S,name:d,form:u,value:b,hasConsumerStoppedPropagationRef:R,required:m,defaultChecked:Va(o)?!1:o,isFormControl:N,bubbleInput:A,setBubbleInput:C};return y.jsx(o4,{scope:t,...P,children:c4(g)?g(P):s})}var XE="CheckboxTrigger",JE=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},o)=>{const{control:l,value:u,disabled:d,checked:f,required:m,setControl:b,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:_,bubbleInput:E}=rg(XE,e),S=Xe(o,b),A=v.useRef(f);return v.useEffect(()=>{const C=l==null?void 0:l.form;if(C){const R=()=>g(A.current);return C.addEventListener("reset",R),()=>C.removeEventListener("reset",R)}},[l,g]),y.jsx(je.button,{type:"button",role:"checkbox","aria-checked":Va(f)?"mixed":f,"aria-required":m,"data-state":n1(f),"data-disabled":d?"":void 0,disabled:d,value:u,...s,ref:S,onKeyDown:we(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:we(r,C=>{g(R=>Va(R)?!0:!R),E&&_&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})})});JE.displayName=XE;var ag=v.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:s,checked:o,defaultChecked:l,required:u,disabled:d,value:f,onCheckedChange:m,form:b,...g}=e;return y.jsx(l4,{__scopeCheckbox:r,checked:o,defaultChecked:l,disabled:d,required:u,onCheckedChange:m,name:s,form:b,value:f,internal_do_not_use_render:({isFormControl:w})=>y.jsxs(y.Fragment,{children:[y.jsx(JE,{...g,ref:t,__scopeCheckbox:r}),w&&y.jsx(t1,{__scopeCheckbox:r})]})})});ag.displayName=Td;var QE="CheckboxIndicator",ZE=v.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...o}=e,l=rg(QE,r);return y.jsx(or,{present:s||Va(l.checked)||l.checked===!0,children:y.jsx(je.span,{"data-state":n1(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});ZE.displayName=QE;var e1="CheckboxBubbleInput",t1=v.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:l,defaultChecked:u,required:d,disabled:f,name:m,value:b,form:g,bubbleInput:w,setBubbleInput:_}=rg(e1,e),E=Xe(r,_),S=WE(l),A=V_(s);v.useEffect(()=>{const R=w;if(!R)return;const N=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(N,"checked").set,$=!o.current;if(S!==l&&F){const L=new Event("click",{bubbles:$});R.indeterminate=Va(l),F.call(R,Va(l)?!1:l),R.dispatchEvent(L)}},[w,S,l,o]);const C=v.useRef(Va(l)?!1:l);return y.jsx(je.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??C.current,required:d,disabled:f,name:m,value:b,form:g,...t,tabIndex:-1,ref:E,style:{...t.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});t1.displayName=e1;function c4(e){return typeof e=="function"}function Va(e){return e==="indeterminate"}function n1(e){return Va(e)?"indeterminate":e?"checked":"unchecked"}const r1=v.forwardRef(({className:e,...t},r)=>y.jsx(ag,{ref:r,className:Ae("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:y.jsx(ZE,{className:Ae("grid place-content-center text-current"),children:y.jsx(Ts,{className:"h-4 w-4"})})}));r1.displayName=ag.displayName;function Vw(e,[t,r]){return Math.min(r,Math.max(t,e))}function u4(e){const t=d4(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(h4);if(f){const m=f.props.children,b=d.map(g=>g===f?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return y.jsx(t,{...u,ref:o,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return y.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function d4(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=p4(o),d=m4(l,o.props);return o.type!==v.Fragment&&(d.ref=s?en(s,u):u),v.cloneElement(o,d)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var f4=Symbol("radix.slottable");function h4(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===f4}function m4(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const f=l(...d);return o(...d),f}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function p4(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var a1=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),g4="VisuallyHidden",y4=v.forwardRef((e,t)=>y.jsx(je.span,{...e,ref:t,style:{...a1,...e.style}}));y4.displayName=g4;var v4=[" ","Enter","ArrowUp","ArrowDown"],b4=[" ","Enter"],js="Select",[Rd,Nd,w4]=Np(js),[eo]=la(js,[w4,Zi]),kd=Zi(),[x4,Wa]=eo(js),[_4,S4]=eo(js),s1=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:f,dir:m,name:b,autoComplete:g,disabled:w,required:_,form:E}=e,S=kd(t),[A,C]=v.useState(null),[R,N]=v.useState(null),[P,F]=v.useState(!1),$=kp(m),[L,q]=Rs({prop:s,defaultProp:o??!1,onChange:l,caller:js}),[ie,he]=Rs({prop:u,defaultProp:d,onChange:f,caller:js}),pe=v.useRef(null),oe=A?E||!!A.closest("form"):!0,[ue,ce]=v.useState(new Set),fe=Array.from(ue).map(M=>M.props.value).join(";");return y.jsx(Ip,{...S,children:y.jsxs(x4,{required:_,scope:t,trigger:A,onTriggerChange:C,valueNode:R,onValueNodeChange:N,valueNodeHasChildren:P,onValueNodeHasChildrenChange:F,contentId:Qt(),value:ie,onValueChange:he,open:L,onOpenChange:q,dir:$,triggerPointerDownPosRef:pe,disabled:w,children:[y.jsx(Rd.Provider,{scope:t,children:y.jsx(_4,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(M=>{ce(K=>new Set(K).add(M))},[]),onNativeOptionRemove:v.useCallback(M=>{ce(K=>{const J=new Set(K);return J.delete(M),J})},[]),children:r})}),oe?y.jsxs(N1,{"aria-hidden":!0,required:_,tabIndex:-1,name:b,autoComplete:g,value:ie,onChange:M=>he(M.target.value),disabled:w,form:E,children:[ie===void 0?y.jsx("option",{value:""}):null,Array.from(ue)]},fe):null]})})};s1.displayName=js;var i1="SelectTrigger",o1=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...o}=e,l=kd(r),u=Wa(i1,r),d=u.disabled||s,f=Xe(t,u.onTriggerChange),m=Nd(r),b=v.useRef("touch"),[g,w,_]=j1(S=>{const A=m().filter(N=>!N.disabled),C=A.find(N=>N.value===u.value),R=O1(A,S,C);R!==void 0&&u.onValueChange(R.value)}),E=S=>{d||(u.onOpenChange(!0),_()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return y.jsx(wd,{asChild:!0,...l,children:y.jsx(je.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":k1(u.value)?"":void 0,...o,ref:f,onClick:we(o.onClick,S=>{S.currentTarget.focus(),b.current!=="mouse"&&E(S)}),onPointerDown:we(o.onPointerDown,S=>{b.current=S.pointerType;const A=S.target;A.hasPointerCapture(S.pointerId)&&A.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(E(S),S.preventDefault())}),onKeyDown:we(o.onKeyDown,S=>{const A=g.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&w(S.key),!(A&&S.key===" ")&&v4.includes(S.key)&&(E(),S.preventDefault())})})})});o1.displayName=i1;var l1="SelectValue",c1=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,children:l,placeholder:u="",...d}=e,f=Wa(l1,r),{onValueNodeHasChildrenChange:m}=f,b=l!==void 0,g=Xe(t,f.onValueNodeChange);return jt(()=>{m(b)},[m,b]),y.jsx(je.span,{...d,ref:g,style:{pointerEvents:"none"},children:k1(f.value)?y.jsx(y.Fragment,{children:u}):l})});c1.displayName=l1;var E4="SelectIcon",u1=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...o}=e;return y.jsx(je.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});u1.displayName=E4;var C4="SelectPortal",d1=e=>y.jsx(Pl,{asChild:!0,...e});d1.displayName=C4;var Os="SelectContent",f1=v.forwardRef((e,t)=>{const r=Wa(Os,e.__scopeSelect),[s,o]=v.useState();if(jt(()=>{o(new DocumentFragment)},[]),!r.open){const l=s;return l?kl.createPortal(y.jsx(h1,{scope:e.__scopeSelect,children:y.jsx(Rd.Slot,{scope:e.__scopeSelect,children:y.jsx("div",{children:e.children})})}),l):null}return y.jsx(m1,{...e,ref:t})});f1.displayName=Os;var Zn=10,[h1,Xa]=eo(Os),A4="SelectContentImpl",T4=u4("SelectContent.RemoveScroll"),m1=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:f,align:m,alignOffset:b,arrowPadding:g,collisionBoundary:w,collisionPadding:_,sticky:E,hideWhenDetached:S,avoidCollisions:A,...C}=e,R=Wa(Os,r),[N,P]=v.useState(null),[F,$]=v.useState(null),L=Xe(t,z=>P(z)),[q,ie]=v.useState(null),[he,pe]=v.useState(null),oe=Nd(r),[ue,ce]=v.useState(!1),fe=v.useRef(!1);v.useEffect(()=>{if(N)return xd(N)},[N]),pd();const M=v.useCallback(z=>{const[ee,...ae]=oe().map(Te=>Te.ref.current),[xe]=ae.slice(-1),Ee=document.activeElement;for(const Te of z)if(Te===Ee||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===ee&&F&&(F.scrollTop=0),Te===xe&&F&&(F.scrollTop=F.scrollHeight),Te==null||Te.focus(),document.activeElement!==Ee))return},[oe,F]),K=v.useCallback(()=>M([q,N]),[M,q,N]);v.useEffect(()=>{ue&&K()},[ue,K]);const{onOpenChange:J,triggerPointerDownPosRef:ne}=R;v.useEffect(()=>{if(N){let z={x:0,y:0};const ee=xe=>{var Ee,Te;z={x:Math.abs(Math.round(xe.pageX)-(((Ee=ne.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Te=ne.current)==null?void 0:Te.y)??0))}},ae=xe=>{z.x<=10&&z.y<=10?xe.preventDefault():N.contains(xe.target)||J(!1),document.removeEventListener("pointermove",ee),ne.current=null};return ne.current!==null&&(document.addEventListener("pointermove",ee),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ee),document.removeEventListener("pointerup",ae,{capture:!0})}}},[N,J,ne]),v.useEffect(()=>{const z=()=>J(!1);return window.addEventListener("blur",z),window.addEventListener("resize",z),()=>{window.removeEventListener("blur",z),window.removeEventListener("resize",z)}},[J]);const[X,k]=j1(z=>{const ee=oe().filter(Ee=>!Ee.disabled),ae=ee.find(Ee=>Ee.ref.current===document.activeElement),xe=O1(ee,z,ae);xe&&setTimeout(()=>xe.ref.current.focus())}),j=v.useCallback((z,ee,ae)=>{const xe=!fe.current&&!ae;(R.value!==void 0&&R.value===ee||xe)&&(ie(z),xe&&(fe.current=!0))},[R.value]),I=v.useCallback(()=>N==null?void 0:N.focus(),[N]),Y=v.useCallback((z,ee,ae)=>{const xe=!fe.current&&!ae;(R.value!==void 0&&R.value===ee||xe)&&pe(z)},[R.value]),V=s==="popper"?Qm:p1,Z=V===Qm?{side:d,sideOffset:f,align:m,alignOffset:b,arrowPadding:g,collisionBoundary:w,collisionPadding:_,sticky:E,hideWhenDetached:S,avoidCollisions:A}:{};return y.jsx(h1,{scope:r,content:N,viewport:F,onViewportChange:$,itemRefCallback:j,selectedItem:q,onItemLeave:I,itemTextRefCallback:Y,focusSelectedItem:K,selectedItemText:he,position:s,isPositioned:ue,searchRef:X,children:y.jsx(Ul,{as:T4,allowPinchZoom:!0,children:y.jsx(Dl,{asChild:!0,trapped:R.open,onMountAutoFocus:z=>{z.preventDefault()},onUnmountAutoFocus:we(o,z=>{var ee;(ee=R.trigger)==null||ee.focus({preventScroll:!0}),z.preventDefault()}),children:y.jsx(Ml,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:z=>z.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:y.jsx(V,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:z=>z.preventDefault(),...C,...Z,onPlaced:()=>ce(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:we(C.onKeyDown,z=>{const ee=z.ctrlKey||z.altKey||z.metaKey;if(z.key==="Tab"&&z.preventDefault(),!ee&&z.key.length===1&&k(z.key),["ArrowUp","ArrowDown","Home","End"].includes(z.key)){let xe=oe().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(z.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(z.key)){const Ee=z.target,Te=xe.indexOf(Ee);xe=xe.slice(Te+1)}setTimeout(()=>M(xe)),z.preventDefault()}})})})})})})});m1.displayName=A4;var R4="SelectItemAlignedPosition",p1=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...o}=e,l=Wa(Os,r),u=Xa(Os,r),[d,f]=v.useState(null),[m,b]=v.useState(null),g=Xe(t,L=>b(L)),w=Nd(r),_=v.useRef(!1),E=v.useRef(!0),{viewport:S,selectedItem:A,selectedItemText:C,focusSelectedItem:R}=u,N=v.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&m&&S&&A&&C){const L=l.trigger.getBoundingClientRect(),q=m.getBoundingClientRect(),ie=l.valueNode.getBoundingClientRect(),he=C.getBoundingClientRect();if(l.dir!=="rtl"){const Ee=he.left-q.left,Te=ie.left-Ee,nt=L.left-Te,Be=L.width+nt,Kt=Math.max(Be,q.width),Yt=window.innerWidth-Zn,Ot=Vw(Te,[Zn,Math.max(Zn,Yt-Kt)]);d.style.minWidth=Be+"px",d.style.left=Ot+"px"}else{const Ee=q.right-he.right,Te=window.innerWidth-ie.right-Ee,nt=window.innerWidth-L.right-Te,Be=L.width+nt,Kt=Math.max(Be,q.width),Yt=window.innerWidth-Zn,Ot=Vw(Te,[Zn,Math.max(Zn,Yt-Kt)]);d.style.minWidth=Be+"px",d.style.right=Ot+"px"}const pe=w(),oe=window.innerHeight-Zn*2,ue=S.scrollHeight,ce=window.getComputedStyle(m),fe=parseInt(ce.borderTopWidth,10),M=parseInt(ce.paddingTop,10),K=parseInt(ce.borderBottomWidth,10),J=parseInt(ce.paddingBottom,10),ne=fe+M+ue+J+K,X=Math.min(A.offsetHeight*5,ne),k=window.getComputedStyle(S),j=parseInt(k.paddingTop,10),I=parseInt(k.paddingBottom,10),Y=L.top+L.height/2-Zn,V=oe-Y,Z=A.offsetHeight/2,z=A.offsetTop+Z,ee=fe+M+z,ae=ne-ee;if(ee<=Y){const Ee=pe.length>0&&A===pe[pe.length-1].ref.current;d.style.bottom="0px";const Te=m.clientHeight-S.offsetTop-S.offsetHeight,nt=Math.max(V,Z+(Ee?I:0)+Te+K),Be=ee+nt;d.style.height=Be+"px"}else{const Ee=pe.length>0&&A===pe[0].ref.current;d.style.top="0px";const nt=Math.max(Y,fe+S.offsetTop+(Ee?j:0)+Z)+ae;d.style.height=nt+"px",S.scrollTop=ee-Y+S.offsetTop}d.style.margin=`${Zn}px 0`,d.style.minHeight=X+"px",d.style.maxHeight=oe+"px",s==null||s(),requestAnimationFrame(()=>_.current=!0)}},[w,l.trigger,l.valueNode,d,m,S,A,C,l.dir,s]);jt(()=>N(),[N]);const[P,F]=v.useState();jt(()=>{m&&F(window.getComputedStyle(m).zIndex)},[m]);const $=v.useCallback(L=>{L&&E.current===!0&&(N(),R==null||R(),E.current=!1)},[N,R]);return y.jsx(k4,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:_,onScrollButtonChange:$,children:y.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:y.jsx(je.div,{...o,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});p1.displayName=R4;var N4="SelectPopperPosition",Qm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:o=Zn,...l}=e,u=kd(r);return y.jsx($p,{...u,...l,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Qm.displayName=N4;var[k4,sg]=eo(Os,{}),Zm="SelectViewport",g1=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...o}=e,l=Xa(Zm,r),u=sg(Zm,r),d=Xe(t,l.onViewportChange),f=v.useRef(0);return y.jsxs(y.Fragment,{children:[y.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),y.jsx(Rd.Slot,{scope:r,children:y.jsx(je.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:we(o.onScroll,m=>{const b=m.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=u;if(w!=null&&w.current&&g){const _=Math.abs(f.current-b.scrollTop);if(_>0){const E=window.innerHeight-Zn*2,S=parseFloat(g.style.minHeight),A=parseFloat(g.style.height),C=Math.max(S,A);if(C<E){const R=C+_,N=Math.min(E,R),P=R-N;g.style.height=N+"px",g.style.bottom==="0px"&&(b.scrollTop=P>0?P:0,g.style.justifyContent="flex-end")}}}f.current=b.scrollTop})})})]})});g1.displayName=Zm;var y1="SelectGroup",[j4,O4]=eo(y1),M4=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=Qt();return y.jsx(j4,{scope:r,id:o,children:y.jsx(je.div,{role:"group","aria-labelledby":o,...s,ref:t})})});M4.displayName=y1;var v1="SelectLabel",b1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=O4(v1,r);return y.jsx(je.div,{id:o.id,...s,ref:t})});b1.displayName=v1;var rd="SelectItem",[D4,w1]=eo(rd),x1=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:o=!1,textValue:l,...u}=e,d=Wa(rd,r),f=Xa(rd,r),m=d.value===s,[b,g]=v.useState(l??""),[w,_]=v.useState(!1),E=Xe(t,R=>{var N;return(N=f.itemRefCallback)==null?void 0:N.call(f,R,s,o)}),S=Qt(),A=v.useRef("touch"),C=()=>{o||(d.onValueChange(s),d.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return y.jsx(D4,{scope:r,value:s,disabled:o,textId:S,isSelected:m,onItemTextChange:v.useCallback(R=>{g(N=>N||((R==null?void 0:R.textContent)??"").trim())},[]),children:y.jsx(Rd.ItemSlot,{scope:r,value:s,disabled:o,textValue:b,children:y.jsx(je.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":m&&w,"data-state":m?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:E,onFocus:we(u.onFocus,()=>_(!0)),onBlur:we(u.onBlur,()=>_(!1)),onClick:we(u.onClick,()=>{A.current!=="mouse"&&C()}),onPointerUp:we(u.onPointerUp,()=>{A.current==="mouse"&&C()}),onPointerDown:we(u.onPointerDown,R=>{A.current=R.pointerType}),onPointerMove:we(u.onPointerMove,R=>{var N;A.current=R.pointerType,o?(N=f.onItemLeave)==null||N.call(f):A.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(u.onPointerLeave,R=>{var N;R.currentTarget===document.activeElement&&((N=f.onItemLeave)==null||N.call(f))}),onKeyDown:we(u.onKeyDown,R=>{var P;((P=f.searchRef)==null?void 0:P.current)!==""&&R.key===" "||(b4.includes(R.key)&&C(),R.key===" "&&R.preventDefault())})})})})});x1.displayName=rd;var al="SelectItemText",_1=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,...l}=e,u=Wa(al,r),d=Xa(al,r),f=w1(al,r),m=S4(al,r),[b,g]=v.useState(null),w=Xe(t,C=>g(C),f.onItemTextChange,C=>{var R;return(R=d.itemTextRefCallback)==null?void 0:R.call(d,C,f.value,f.disabled)}),_=b==null?void 0:b.textContent,E=v.useMemo(()=>y.jsx("option",{value:f.value,disabled:f.disabled,children:_},f.value),[f.disabled,f.value,_]),{onNativeOptionAdd:S,onNativeOptionRemove:A}=m;return jt(()=>(S(E),()=>A(E)),[S,A,E]),y.jsxs(y.Fragment,{children:[y.jsx(je.span,{id:f.textId,...l,ref:w}),f.isSelected&&u.valueNode&&!u.valueNodeHasChildren?kl.createPortal(l.children,u.valueNode):null]})});_1.displayName=al;var S1="SelectItemIndicator",E1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return w1(S1,r).isSelected?y.jsx(je.span,{"aria-hidden":!0,...s,ref:t}):null});E1.displayName=S1;var ep="SelectScrollUpButton",C1=v.forwardRef((e,t)=>{const r=Xa(ep,e.__scopeSelect),s=sg(ep,e.__scopeSelect),[o,l]=v.useState(!1),u=Xe(t,s.onScrollButtonChange);return jt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=f.scrollTop>0;l(m)};const f=r.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?y.jsx(T1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=r;d&&f&&(d.scrollTop=d.scrollTop-f.offsetHeight)}}):null});C1.displayName=ep;var tp="SelectScrollDownButton",A1=v.forwardRef((e,t)=>{const r=Xa(tp,e.__scopeSelect),s=sg(tp,e.__scopeSelect),[o,l]=v.useState(!1),u=Xe(t,s.onScrollButtonChange);return jt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=f.scrollHeight-f.clientHeight,b=Math.ceil(f.scrollTop)<m;l(b)};const f=r.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?y.jsx(T1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=r;d&&f&&(d.scrollTop=d.scrollTop+f.offsetHeight)}}):null});A1.displayName=tp;var T1=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...o}=e,l=Xa("SelectScrollButton",r),u=v.useRef(null),d=Nd(r),f=v.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return v.useEffect(()=>()=>f(),[f]),jt(()=>{var b;const m=d().find(g=>g.ref.current===document.activeElement);(b=m==null?void 0:m.ref.current)==null||b.scrollIntoView({block:"nearest"})},[d]),y.jsx(je.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:we(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(s,50))}),onPointerMove:we(o.onPointerMove,()=>{var m;(m=l.onItemLeave)==null||m.call(l),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:we(o.onPointerLeave,()=>{f()})})}),L4="SelectSeparator",R1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return y.jsx(je.div,{"aria-hidden":!0,...s,ref:t})});R1.displayName=L4;var np="SelectArrow",P4=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=kd(r),l=Wa(np,r),u=Xa(np,r);return l.open&&u.position==="popper"?y.jsx(Bp,{...o,...s,ref:t}):null});P4.displayName=np;var z4="SelectBubbleInput",N1=v.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const o=v.useRef(null),l=Xe(s,o),u=WE(t);return v.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLSelectElement.prototype,b=Object.getOwnPropertyDescriptor(f,"value").set;if(u!==t&&b){const g=new Event("change",{bubbles:!0});b.call(d,t),d.dispatchEvent(g)}},[u,t]),y.jsx(je.select,{...r,style:{...a1,...r.style},ref:l,defaultValue:t})});N1.displayName=z4;function k1(e){return e===""||e===void 0}function j1(e){const t=ar(e),r=v.useRef(""),s=v.useRef(0),o=v.useCallback(u=>{const d=r.current+u;t(d),(function f(m){r.current=m,window.clearTimeout(s.current),m!==""&&(s.current=window.setTimeout(()=>f(""),1e3))})(d)},[t]),l=v.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,o,l]}function O1(e,t,r){const o=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=U4(e,Math.max(l,0));o.length===1&&(u=u.filter(m=>m!==r));const f=u.find(m=>m.textValue.toLowerCase().startsWith(o.toLowerCase()));return f!==r?f:void 0}function U4(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var I4=s1,M1=o1,$4=c1,B4=u1,H4=d1,D1=f1,q4=g1,L1=b1,P1=x1,V4=_1,G4=E1,z1=C1,U1=A1,I1=R1;const F4=I4,K4=$4,$1=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(M1,{ref:s,className:Ae("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background cursor-pointer data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,y.jsx(B4,{asChild:!0,children:y.jsx(Sp,{className:"h-4 w-4 opacity-50"})})]}));$1.displayName=M1.displayName;const B1=v.forwardRef(({className:e,...t},r)=>y.jsx(z1,{ref:r,className:Ae("flex cursor-default items-center justify-center py-1",e),...t,children:y.jsx(u2,{className:"h-4 w-4"})}));B1.displayName=z1.displayName;const H1=v.forwardRef(({className:e,...t},r)=>y.jsx(U1,{ref:r,className:Ae("flex cursor-default items-center justify-center py-1",e),...t,children:y.jsx(Sp,{className:"h-4 w-4"})}));H1.displayName=U1.displayName;const q1=v.forwardRef(({className:e,children:t,position:r="popper",...s},o)=>y.jsx(H4,{children:y.jsxs(D1,{ref:o,className:Ae("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...s,children:[y.jsx(B1,{}),y.jsx(q4,{className:Ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),y.jsx(H1,{})]})}));q1.displayName=D1.displayName;const Y4=v.forwardRef(({className:e,...t},r)=>y.jsx(L1,{ref:r,className:Ae("px-2 py-1.5 text-sm font-semibold",e),...t}));Y4.displayName=L1.displayName;const rp=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(P1,{ref:s,className:Ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[y.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:y.jsx(G4,{children:y.jsx(Ts,{className:"h-4 w-4"})})}),y.jsx(V4,{children:t})]}));rp.displayName=P1.displayName;const W4=v.forwardRef(({className:e,...t},r)=>y.jsx(I1,{ref:r,className:Ae("-mx-1 my-1 h-px bg-muted",e),...t}));W4.displayName=I1.displayName;var X4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],J4=X4.reduce((e,t)=>{const r=md(`Primitive.${t}`),s=v.forwardRef((o,l)=>{const{asChild:u,...d}=o,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Q4="Separator",Gw="horizontal",Z4=["horizontal","vertical"],V1=v.forwardRef((e,t)=>{const{decorative:r,orientation:s=Gw,...o}=e,l=ez(s)?s:Gw,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return y.jsx(J4.div,{"data-orientation":l,...d,...o,ref:t})});V1.displayName=Q4;function ez(e){return Z4.includes(e)}var G1=V1;const Ii=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},o)=>y.jsx(G1,{ref:o,decorative:r,orientation:t,className:Ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Ii.displayName=G1.displayName;function tz({value:e,onChange:t}){return y.jsx("div",{className:"flex flex-wrap gap-2",children:Jm.map(r=>y.jsx("button",{type:"button",onClick:()=>t(r.id),title:r.name,className:Ae("w-9 h-9 rounded-full flex items-center justify-center transition-all ring-offset-2 ring-offset-background hover:scale-110",e===r.id&&"ring-2 ring-foreground/40 scale-110"),style:{backgroundColor:r.hex},children:e===r.id&&y.jsx(Ts,{className:"w-4 h-4 text-white drop-shadow"})},r.id))})}function Fw({label:e,prefix:t,links:r,onChange:s,readOnly:o,emptyText:l}){const[u,d]=v.useState(""),f=()=>{const g=u.trim();g&&(s([...r,g]),d(""))},m=(g,w)=>s(r.map((_,E)=>E===g?w:_)),b=g=>s(r.filter((w,_)=>_!==g));return y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsxs("span",{className:"text-sm font-medium text-foreground",children:[e," ",t&&y.jsxs("span",{className:"text-xs text-muted-foreground font-normal",children:["(",t,")"]})]}),y.jsx("span",{className:"text-xs text-muted-foreground",children:r.length})]}),r.length===0&&y.jsx("p",{className:"text-xs text-muted-foreground italic px-1",children:l??"Sin links aún"}),y.jsx("div",{className:"space-y-1.5",children:r.map((g,w)=>y.jsxs("div",{className:"group flex items-center gap-1.5",children:[y.jsxs("div",{className:"flex-shrink-0 w-7 h-7 rounded-md bg-accent flex items-center justify-center text-[10px] font-semibold text-accent-foreground",children:[t??"·",w+1]}),o?y.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",className:"flex-1 text-sm text-primary hover:underline truncate flex items-center gap-1.5 py-1.5 px-2 rounded-md hover:bg-accent/60 transition-colors",children:[y.jsx(P2,{className:"w-3.5 h-3.5 flex-shrink-0"}),y.jsx("span",{className:"truncate",children:g}),y.jsx(x2,{className:"w-3 h-3 flex-shrink-0 opacity-60"})]}):y.jsxs(y.Fragment,{children:[y.jsx(jn,{value:g,onChange:_=>m(w,_.target.value),placeholder:"https://…",className:"h-9 text-sm"}),y.jsx(ut,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>b(w),children:y.jsx(wl,{className:"w-4 h-4"})})]})]},w))}),!o&&y.jsxs("div",{className:"flex gap-1.5 pt-1",children:[y.jsx(jn,{value:u,onChange:g=>d(g.target.value),onKeyDown:g=>g.key==="Enter"&&(g.preventDefault(),f()),placeholder:"Pegar link y Enter",className:"h-9 text-sm"}),y.jsxs(ut,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-9",children:[y.jsx(bl,{className:"w-4 h-4 mr-1"})," Añadir"]})]})]})}var Kw=1,nz=.9,rz=.8,az=.17,wm=.1,xm=.999,sz=.9999,iz=.99,oz=/[\\\/_+.#"@\[\(\{&]/,lz=/[\\\/_+.#"@\[\(\{&]/g,cz=/[\s-]/,F1=/[\s-]/g;function ap(e,t,r,s,o,l,u){if(l===t.length)return o===e.length?Kw:iz;var d=`${o},${l}`;if(u[d]!==void 0)return u[d];for(var f=s.charAt(l),m=r.indexOf(f,o),b=0,g,w,_,E;m>=0;)g=ap(e,t,r,s,m+1,l+1,u),g>b&&(m===o?g*=Kw:oz.test(e.charAt(m-1))?(g*=rz,_=e.slice(o,m-1).match(lz),_&&o>0&&(g*=Math.pow(xm,_.length))):cz.test(e.charAt(m-1))?(g*=nz,E=e.slice(o,m-1).match(F1),E&&o>0&&(g*=Math.pow(xm,E.length))):(g*=az,o>0&&(g*=Math.pow(xm,m-o))),e.charAt(m)!==t.charAt(l)&&(g*=sz)),(g<wm&&r.charAt(m-1)===s.charAt(l+1)||s.charAt(l+1)===s.charAt(l)&&r.charAt(m-1)!==s.charAt(l))&&(w=ap(e,t,r,s,m+1,l+2,u),w*wm>g&&(g=w*wm)),g>b&&(b=g),m=r.indexOf(f,m+1);return u[d]=b,b}function Yw(e){return e.toLowerCase().replace(F1," ")}function uz(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,ap(e,t,Yw(e),Yw(t),0,0,{})}var Zo='[cmdk-group=""]',_m='[cmdk-group-items=""]',dz='[cmdk-group-heading=""]',K1='[cmdk-item=""]',Ww=`${K1}:not([aria-disabled="true"])`,sp="cmdk-item-select",Pi="data-value",fz=(e,t,r)=>uz(e,t,r),Y1=v.createContext(void 0),Bl=()=>v.useContext(Y1),W1=v.createContext(void 0),ig=()=>v.useContext(W1),X1=v.createContext(void 0),J1=v.forwardRef((e,t)=>{let r=zi(()=>{var j,I;return{search:"",value:(I=(j=e.value)!=null?j:e.defaultValue)!=null?I:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=zi(()=>new Set),o=zi(()=>new Map),l=zi(()=>new Map),u=zi(()=>new Set),d=Q1(e),{label:f,children:m,value:b,onValueChange:g,filter:w,shouldFilter:_,loop:E,disablePointerSelection:S=!1,vimBindings:A=!0,...C}=e,R=Qt(),N=Qt(),P=Qt(),F=v.useRef(null),$=Sz();Ms(()=>{if(b!==void 0){let j=b.trim();r.current.value=j,L.emit()}},[b]),Ms(()=>{$(6,ue)},[]);let L=v.useMemo(()=>({subscribe:j=>(u.current.add(j),()=>u.current.delete(j)),snapshot:()=>r.current,setState:(j,I,Y)=>{var V,Z,z,ee;if(!Object.is(r.current[j],I)){if(r.current[j]=I,j==="search")oe(),he(),$(1,pe);else if(j==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ae=document.getElementById(P);ae?ae.focus():(V=document.getElementById(R))==null||V.focus()}if($(7,()=>{var ae;r.current.selectedItemId=(ae=ce())==null?void 0:ae.id,L.emit()}),Y||$(5,ue),((Z=d.current)==null?void 0:Z.value)!==void 0){let ae=I??"";(ee=(z=d.current).onValueChange)==null||ee.call(z,ae);return}}L.emit()}},emit:()=>{u.current.forEach(j=>j())}}),[]),q=v.useMemo(()=>({value:(j,I,Y)=>{var V;I!==((V=l.current.get(j))==null?void 0:V.value)&&(l.current.set(j,{value:I,keywords:Y}),r.current.filtered.items.set(j,ie(I,Y)),$(2,()=>{he(),L.emit()}))},item:(j,I)=>(s.current.add(j),I&&(o.current.has(I)?o.current.get(I).add(j):o.current.set(I,new Set([j]))),$(3,()=>{oe(),he(),r.current.value||pe(),L.emit()}),()=>{l.current.delete(j),s.current.delete(j),r.current.filtered.items.delete(j);let Y=ce();$(4,()=>{oe(),(Y==null?void 0:Y.getAttribute("id"))===j&&pe(),L.emit()})}),group:j=>(o.current.has(j)||o.current.set(j,new Set),()=>{l.current.delete(j),o.current.delete(j)}),filter:()=>d.current.shouldFilter,label:f||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:R,inputId:P,labelId:N,listInnerRef:F}),[]);function ie(j,I){var Y,V;let Z=(V=(Y=d.current)==null?void 0:Y.filter)!=null?V:fz;return j?Z(j,r.current.search,I):0}function he(){if(!r.current.search||d.current.shouldFilter===!1)return;let j=r.current.filtered.items,I=[];r.current.filtered.groups.forEach(V=>{let Z=o.current.get(V),z=0;Z.forEach(ee=>{let ae=j.get(ee);z=Math.max(ae,z)}),I.push([V,z])});let Y=F.current;fe().sort((V,Z)=>{var z,ee;let ae=V.getAttribute("id"),xe=Z.getAttribute("id");return((z=j.get(xe))!=null?z:0)-((ee=j.get(ae))!=null?ee:0)}).forEach(V=>{let Z=V.closest(_m);Z?Z.appendChild(V.parentElement===Z?V:V.closest(`${_m} > *`)):Y.appendChild(V.parentElement===Y?V:V.closest(`${_m} > *`))}),I.sort((V,Z)=>Z[1]-V[1]).forEach(V=>{var Z;let z=(Z=F.current)==null?void 0:Z.querySelector(`${Zo}[${Pi}="${encodeURIComponent(V[0])}"]`);z==null||z.parentElement.appendChild(z)})}function pe(){let j=fe().find(Y=>Y.getAttribute("aria-disabled")!=="true"),I=j==null?void 0:j.getAttribute(Pi);L.setState("value",I||void 0)}function oe(){var j,I,Y,V;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=s.current.size;return}r.current.filtered.groups=new Set;let Z=0;for(let z of s.current){let ee=(I=(j=l.current.get(z))==null?void 0:j.value)!=null?I:"",ae=(V=(Y=l.current.get(z))==null?void 0:Y.keywords)!=null?V:[],xe=ie(ee,ae);r.current.filtered.items.set(z,xe),xe>0&&Z++}for(let[z,ee]of o.current)for(let ae of ee)if(r.current.filtered.items.get(ae)>0){r.current.filtered.groups.add(z);break}r.current.filtered.count=Z}function ue(){var j,I,Y;let V=ce();V&&(((j=V.parentElement)==null?void 0:j.firstChild)===V&&((Y=(I=V.closest(Zo))==null?void 0:I.querySelector(dz))==null||Y.scrollIntoView({block:"nearest"})),V.scrollIntoView({block:"nearest"}))}function ce(){var j;return(j=F.current)==null?void 0:j.querySelector(`${K1}[aria-selected="true"]`)}function fe(){var j;return Array.from(((j=F.current)==null?void 0:j.querySelectorAll(Ww))||[])}function M(j){let I=fe()[j];I&&L.setState("value",I.getAttribute(Pi))}function K(j){var I;let Y=ce(),V=fe(),Z=V.findIndex(ee=>ee===Y),z=V[Z+j];(I=d.current)!=null&&I.loop&&(z=Z+j<0?V[V.length-1]:Z+j===V.length?V[0]:V[Z+j]),z&&L.setState("value",z.getAttribute(Pi))}function J(j){let I=ce(),Y=I==null?void 0:I.closest(Zo),V;for(;Y&&!V;)Y=j>0?xz(Y,Zo):_z(Y,Zo),V=Y==null?void 0:Y.querySelector(Ww);V?L.setState("value",V.getAttribute(Pi)):K(j)}let ne=()=>M(fe().length-1),X=j=>{j.preventDefault(),j.metaKey?ne():j.altKey?J(1):K(1)},k=j=>{j.preventDefault(),j.metaKey?M(0):j.altKey?J(-1):K(-1)};return v.createElement(je.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:j=>{var I;(I=C.onKeyDown)==null||I.call(C,j);let Y=j.nativeEvent.isComposing||j.keyCode===229;if(!(j.defaultPrevented||Y))switch(j.key){case"n":case"j":{A&&j.ctrlKey&&X(j);break}case"ArrowDown":{X(j);break}case"p":case"k":{A&&j.ctrlKey&&k(j);break}case"ArrowUp":{k(j);break}case"Home":{j.preventDefault(),M(0);break}case"End":{j.preventDefault(),ne();break}case"Enter":{j.preventDefault();let V=ce();if(V){let Z=new Event(sp);V.dispatchEvent(Z)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:q.inputId,id:q.labelId,style:Cz},f),jd(e,j=>v.createElement(W1.Provider,{value:L},v.createElement(Y1.Provider,{value:q},j))))}),hz=v.forwardRef((e,t)=>{var r,s;let o=Qt(),l=v.useRef(null),u=v.useContext(X1),d=Bl(),f=Q1(e),m=(s=(r=f.current)==null?void 0:r.forceMount)!=null?s:u==null?void 0:u.forceMount;Ms(()=>{if(!m)return d.item(o,u==null?void 0:u.id)},[m]);let b=Z1(o,l,[e.value,e.children,l],e.keywords),g=ig(),w=Ka($=>$.value&&$.value===b.current),_=Ka($=>m||d.filter()===!1?!0:$.search?$.filtered.items.get(o)>0:!0);v.useEffect(()=>{let $=l.current;if(!(!$||e.disabled))return $.addEventListener(sp,E),()=>$.removeEventListener(sp,E)},[_,e.onSelect,e.disabled]);function E(){var $,L;S(),(L=($=f.current).onSelect)==null||L.call($,b.current)}function S(){g.setState("value",b.current,!0)}if(!_)return null;let{disabled:A,value:C,onSelect:R,forceMount:N,keywords:P,...F}=e;return v.createElement(je.div,{ref:en(l,t),...F,id:o,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!w,"data-disabled":!!A,"data-selected":!!w,onPointerMove:A||d.getDisablePointerSelection()?void 0:S,onClick:A?void 0:E},e.children)}),mz=v.forwardRef((e,t)=>{let{heading:r,children:s,forceMount:o,...l}=e,u=Qt(),d=v.useRef(null),f=v.useRef(null),m=Qt(),b=Bl(),g=Ka(_=>o||b.filter()===!1?!0:_.search?_.filtered.groups.has(u):!0);Ms(()=>b.group(u),[]),Z1(u,d,[e.value,e.heading,f]);let w=v.useMemo(()=>({id:u,forceMount:o}),[o]);return v.createElement(je.div,{ref:en(d,t),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&v.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:m},r),jd(e,_=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},v.createElement(X1.Provider,{value:w},_))))}),pz=v.forwardRef((e,t)=>{let{alwaysRender:r,...s}=e,o=v.useRef(null),l=Ka(u=>!u.search);return!r&&!l?null:v.createElement(je.div,{ref:en(o,t),...s,"cmdk-separator":"",role:"separator"})}),gz=v.forwardRef((e,t)=>{let{onValueChange:r,...s}=e,o=e.value!=null,l=ig(),u=Ka(m=>m.search),d=Ka(m=>m.selectedItemId),f=Bl();return v.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),v.createElement(je.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":d,id:f.inputId,type:"text",value:o?e.value:u,onChange:m=>{o||l.setState("search",m.target.value),r==null||r(m.target.value)}})}),yz=v.forwardRef((e,t)=>{let{children:r,label:s="Suggestions",...o}=e,l=v.useRef(null),u=v.useRef(null),d=Ka(m=>m.selectedItemId),f=Bl();return v.useEffect(()=>{if(u.current&&l.current){let m=u.current,b=l.current,g,w=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let _=m.offsetHeight;b.style.setProperty("--cmdk-list-height",_.toFixed(1)+"px")})});return w.observe(m),()=>{cancelAnimationFrame(g),w.unobserve(m)}}},[]),v.createElement(je.div,{ref:en(l,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":s,id:f.listId},jd(e,m=>v.createElement("div",{ref:en(u,f.listInnerRef),"cmdk-list-sizer":""},m)))}),vz=v.forwardRef((e,t)=>{let{open:r,onOpenChange:s,overlayClassName:o,contentClassName:l,container:u,...d}=e;return v.createElement(zE,{open:r,onOpenChange:s},v.createElement(UE,{container:u},v.createElement(tg,{"cmdk-overlay":"",className:o}),v.createElement(ng,{"aria-label":e.label,"cmdk-dialog":"",className:l},v.createElement(J1,{ref:t,...d}))))}),bz=v.forwardRef((e,t)=>Ka(r=>r.filtered.count===0)?v.createElement(je.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),wz=v.forwardRef((e,t)=>{let{progress:r,children:s,label:o="Loading...",...l}=e;return v.createElement(je.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},jd(e,u=>v.createElement("div",{"aria-hidden":!0},u)))}),bn=Object.assign(J1,{List:yz,Item:hz,Input:gz,Group:mz,Separator:pz,Dialog:vz,Empty:bz,Loading:wz});function xz(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function _z(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Q1(e){let t=v.useRef(e);return Ms(()=>{t.current=e}),t}var Ms=typeof window>"u"?v.useEffect:v.useLayoutEffect;function zi(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Ka(e){let t=ig(),r=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,r,r)}function Z1(e,t,r,s=[]){let o=v.useRef(),l=Bl();return Ms(()=>{var u;let d=(()=>{var m;for(let b of r){if(typeof b=="string")return b.trim();if(typeof b=="object"&&"current"in b)return b.current?(m=b.current.textContent)==null?void 0:m.trim():o.current}})(),f=s.map(m=>m.trim());l.value(e,d,f),(u=t.current)==null||u.setAttribute(Pi,d),o.current=d}),o}var Sz=()=>{let[e,t]=v.useState(),r=zi(()=>new Map);return Ms(()=>{r.current.forEach(s=>s()),r.current=new Map},[e]),(s,o)=>{r.current.set(s,o),t({})}};function Ez(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function jd({asChild:e,children:t},r){return e&&v.isValidElement(t)?v.cloneElement(Ez(t),{ref:t.ref},r(t.props.children)):r(t)}var Cz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const og=v.forwardRef(({className:e,...t},r)=>y.jsx(bn,{ref:r,className:Ae("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));og.displayName=bn.displayName;const lg=v.forwardRef(({className:e,...t},r)=>y.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[y.jsx(Fu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),y.jsx(bn.Input,{ref:r,className:Ae("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));lg.displayName=bn.Input.displayName;const cg=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.List,{ref:r,className:Ae("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));cg.displayName=bn.List.displayName;const ug=v.forwardRef((e,t)=>y.jsx(bn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));ug.displayName=bn.Empty.displayName;const dg=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.Group,{ref:r,className:Ae("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));dg.displayName=bn.Group.displayName;const eC=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.Separator,{ref:r,className:Ae("-mx-1 h-px bg-border",e),...t}));eC.displayName=bn.Separator.displayName;const ad=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.Item,{ref:r,className:Ae("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));ad.displayName=bn.Item.displayName;function Az(e){const t=Tz(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(Nz);if(f){const m=f.props.children,b=d.map(g=>g===f?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return y.jsx(t,{...u,ref:o,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return y.jsx(t,{...u,ref:o,children:l})});return r.displayName=`${e}.Slot`,r}function Tz(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=jz(o),d=kz(l,o.props);return o.type!==v.Fragment&&(d.ref=s?en(s,u):u),v.cloneElement(o,d)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rz=Symbol("radix.slottable");function Nz(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rz}function kz(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const f=l(...d);return o(...d),f}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function jz(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Od="Popover",[tC]=la(Od,[Zi]),Hl=Zi(),[Oz,Ja]=tC(Od),nC=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:o,onOpenChange:l,modal:u=!1}=e,d=Hl(t),f=v.useRef(null),[m,b]=v.useState(!1),[g,w]=Rs({prop:s,defaultProp:o??!1,onChange:l,caller:Od});return y.jsx(Ip,{...d,children:y.jsx(Oz,{scope:t,contentId:Qt(),triggerRef:f,open:g,onOpenChange:w,onOpenToggle:v.useCallback(()=>w(_=>!_),[w]),hasCustomAnchor:m,onCustomAnchorAdd:v.useCallback(()=>b(!0),[]),onCustomAnchorRemove:v.useCallback(()=>b(!1),[]),modal:u,children:r})})};nC.displayName=Od;var rC="PopoverAnchor",Mz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Ja(rC,r),l=Hl(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=o;return v.useEffect(()=>(u(),()=>d()),[u,d]),y.jsx(wd,{...l,...s,ref:t})});Mz.displayName=rC;var aC="PopoverTrigger",sC=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Ja(aC,r),l=Hl(r),u=Xe(t,o.triggerRef),d=y.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":uC(o.open),...s,ref:u,onClick:we(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?d:y.jsx(wd,{asChild:!0,...l,children:d})});sC.displayName=aC;var fg="PopoverPortal",[Dz,Lz]=tC(fg,{forceMount:void 0}),iC=e=>{const{__scopePopover:t,forceMount:r,children:s,container:o}=e,l=Ja(fg,t);return y.jsx(Dz,{scope:t,forceMount:r,children:y.jsx(or,{present:r||l.open,children:y.jsx(Pl,{asChild:!0,container:o,children:s})})})};iC.displayName=fg;var Fi="PopoverContent",oC=v.forwardRef((e,t)=>{const r=Lz(Fi,e.__scopePopover),{forceMount:s=r.forceMount,...o}=e,l=Ja(Fi,e.__scopePopover);return y.jsx(or,{present:s||l.open,children:l.modal?y.jsx(zz,{...o,ref:t}):y.jsx(Uz,{...o,ref:t})})});oC.displayName=Fi;var Pz=Az("PopoverContent.RemoveScroll"),zz=v.forwardRef((e,t)=>{const r=Ja(Fi,e.__scopePopover),s=v.useRef(null),o=Xe(t,s),l=v.useRef(!1);return v.useEffect(()=>{const u=s.current;if(u)return xd(u)},[]),y.jsx(Ul,{as:Pz,allowPinchZoom:!0,children:y.jsx(lC,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,u=>{var d;u.preventDefault(),l.current||(d=r.triggerRef.current)==null||d.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,m=d.button===2||f;l.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:we(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),Uz=v.forwardRef((e,t)=>{const r=Ja(Fi,e.__scopePopover),s=v.useRef(!1),o=v.useRef(!1);return y.jsx(lC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var u,d;(u=e.onCloseAutoFocus)==null||u.call(e,l),l.defaultPrevented||(s.current||(d=r.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:l=>{var f,m;(f=e.onInteractOutside)==null||f.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;((m=r.triggerRef.current)==null?void 0:m.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),lC=v.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:b,...g}=e,w=Ja(Fi,r),_=Hl(r);return pd(),y.jsx(Dl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:y.jsx(Ml,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:b,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onDismiss:()=>w.onOpenChange(!1),children:y.jsx($p,{"data-state":uC(w.open),role:"dialog",id:w.contentId,..._,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),cC="PopoverClose",Iz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Ja(cC,r);return y.jsx(je.button,{type:"button",...s,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});Iz.displayName=cC;var $z="PopoverArrow",Bz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Hl(r);return y.jsx(Bp,{...o,...s,ref:t})});Bz.displayName=$z;function uC(e){return e?"open":"closed"}var Hz=nC,qz=sC,Vz=iC,dC=oC;const fC=Hz,hC=qz,hg=v.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},o)=>y.jsx(Vz,{children:y.jsx(dC,{ref:o,align:t,sideOffset:r,className:Ae("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin)",e),...s})}));hg.displayName=dC.displayName;function Gz(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function ea({value:e,options:t,onValueChange:r,placeholder:s="Seleccionar…",searchPlaceholder:o="Buscar…",emptyText:l="No hay resultados.",disabled:u=!1,clearLabel:d}){const[f,m]=v.useState(!1),b=v.useMemo(()=>t.find(g=>g===e)??e,[t,e]);return y.jsxs(fC,{open:f,onOpenChange:m,children:[y.jsx(hC,{asChild:!0,children:y.jsxs(ut,{type:"button",variant:"outline",role:"combobox","aria-expanded":f,disabled:u,className:Ae("h-10 w-full justify-between rounded-md border-border bg-background px-3 font-normal hover:bg-background",!b&&"text-muted-foreground"),children:[y.jsx("span",{className:"truncate",children:b||s}),y.jsx(c_,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),y.jsx(hg,{align:"start",className:"w-[min(92vw,560px)] min-w-[var(--radix-popover-trigger-width)] p-0",children:y.jsxs(og,{children:[y.jsx(lg,{placeholder:o}),y.jsxs(cg,{className:"overscroll-contain",onWheel:Gz,children:[y.jsx(ug,{children:l}),y.jsxs(dg,{children:[d&&y.jsxs(y.Fragment,{children:[y.jsxs(ad,{value:`__clear_${d}`,onSelect:()=>{r(""),m(!1)},children:[y.jsx(Ts,{className:Ae("mr-2 h-4 w-4",e?"opacity-0":"opacity-100")}),y.jsx("span",{className:"whitespace-normal break-words font-medium",children:d})]},"__clear__"),t.length>0&&y.jsx(eC,{className:"my-1"})]}),t.map(g=>y.jsxs(ad,{value:g,onSelect:()=>{r(g),m(!1)},children:[y.jsx(Ts,{className:Ae("mr-2 h-4 w-4",e===g?"opacity-100":"opacity-0")}),y.jsx("span",{className:"whitespace-normal break-words leading-snug",children:g})]},g))]})]})]})})]})}const Fz=new RegExp("[\\u0000-\\u001F\\u007F-\\u009F\\u200B-\\u200D\\uFEFF]","g");function mC(e){return String(e||"").replace(Fz,"").replace(/\s+/g," ").trim()}function it(e){return mC(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function Ft(e){const t=mC(e);return it(t)==="republica dominicana"?"Republica Dominicana":t}function pt(e){const t=new Map;for(const r of e){const s=Ft(r);if(!s)continue;const o=it(s);o&&(t.has(o)||t.set(o,s))}return Array.from(t.values())}function Xw(e,t){const r=pt(e),s=Ft(t);if(!s)return r;const o=it(s);return r.some(u=>it(u)===o)?r:[s,...r]}function Kz(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function Jw(e){return pt(e.map(t=>Ft(t)).filter(Boolean))}function Qw({values:e,options:t,onValuesChange:r,placeholder:s="Seleccionar…",searchPlaceholder:o="Buscar…",emptyText:l="No hay resultados.",disabled:u=!1,summaryLabel:d="opciones seleccionadas"}){const[f,m]=v.useState(!1),b=v.useMemo(()=>Jw(e),[e]),g=v.useMemo(()=>new Set(b.map(C=>it(C))),[b]),w=v.useMemo(()=>pt([...t,...b].map(C=>Ft(C))),[t,b]),_=v.useMemo(()=>b.length===0?"":b.length<=2?b.join(", "):`${b.length} ${d}`,[b,d]),E=C=>{r(Jw(C))},S=C=>{const R=Ft(C),N=it(R);if(g.has(N)){E(b.filter(P=>it(P)!==N));return}E([...b,R])},A=C=>{const R=it(C);E(b.filter(N=>it(N)!==R))};return y.jsxs("div",{className:"space-y-2",children:[y.jsxs(fC,{open:f,onOpenChange:m,children:[y.jsx(hC,{asChild:!0,children:y.jsxs(ut,{type:"button",variant:"outline",role:"combobox","aria-expanded":f,disabled:u,className:Ae("min-h-10 w-full justify-between rounded-md border-border bg-background px-3 font-normal hover:bg-background",!_&&"text-muted-foreground"),children:[y.jsx("span",{className:"truncate text-left",children:_||s}),y.jsx(c_,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),y.jsx(hg,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:y.jsxs(og,{children:[y.jsx(lg,{placeholder:o}),y.jsxs(cg,{className:"overscroll-contain",onWheel:Kz,children:[y.jsx(ug,{children:l}),y.jsx(dg,{children:w.map(C=>{const R=g.has(it(C));return y.jsxs(ad,{value:C,onSelect:()=>S(C),children:[y.jsx(Ts,{className:Ae("mr-2 h-4 w-4",R?"opacity-100":"opacity-0")}),y.jsx("span",{className:"truncate",children:C})]},C)})})]})]})})]}),b.length>0&&y.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map(C=>y.jsxs(Cs,{variant:"secondary",className:"gap-1 rounded-full px-2 py-0.5",children:[y.jsx("span",{className:"max-w-[190px] truncate",children:C}),y.jsx("button",{type:"button",onClick:()=>A(C),className:"rounded-full text-muted-foreground transition-colors hover:text-foreground","aria-label":`Quitar ${C}`,children:y.jsx(wl,{className:"h-3 w-3"})})]},C))})]})}const Sm=[{id:"grafico",label:"Tarifario Gráfico CDC"},{id:"estrategia",label:"Estrategia y Creatividad"}],Yz="design_final_art",Wz="adaptation_final_art",gn="reference";function me(e,t,r,s,o,l){return{id:e,label:t,reference:r,min:s,max:o,hint:l}}function pn({designHour:e="35 - 50",adaptationHour:t="30",design:r,adaptation:s}){const o=[{id:Yz,label:"Diseño + Entregable Arte Final",shortLabel:"Diseño + AF",hourReference:e,levels:r}];return s!=null&&s.length&&o.push({id:Wz,label:"Adaptación Arte Final",shortLabel:"Adaptación AF",hourReference:t,levels:s}),o}const ll=[{id:"pdv-materiales-basicos",section:"grafico",category:"Materiales de PDV estándar",service:"Cenefas, habladores, danglers, rompetráficos, afiches, backings, rollups, uniformes, piezas WhatsApp/web",notes:"Incluye diseño en alta resolución, troqueles y 3 rondas de cambios. Cambios adicionales pueden agregarse como Otros.",workTypes:pn({design:[me("basic","Básico","50 - 80",50,80),me("intermediate","Intermedio","100 - 150",100,150),me("advanced","Avanzado","150 - 300",150,300)],adaptation:[me("basic","Básico","30 - 50",30,50),me("intermediate","Intermedio","60 - 80",60,80),me("advanced","Avanzado","100 - 150",100,150)]})},{id:"pdv-promocion-pack",section:"grafico",category:"Promoción en PDV",service:"Quick counter + roll up + mecánica de canje + uniforme (pack 3 a 5 piezas o más)",notes:"Montos por paquete de 3 a 5 piezas. Piezas o solicitudes extra deben agregarse como Otros.",workTypes:pn({design:[me("basic","Básico","320 - 500",320,500),me("intermediate","Intermedio","500 - 700",500,700),me("advanced","Avanzado","800 - 1000",800,1e3)],adaptation:[me("basic","Básico","200 - 350",200,350),me("intermediate","Intermedio","350 - 550",350,550),me("advanced","Avanzado","600 - 800+",600,800,"Puede superar el rango si el caso lo requiere.")]})},{id:"ooh-gigantografias",section:"grafico",category:"OOH y gigantografías",service:"Vallas, mupies y gigantografías",notes:"Los niveles están asociados a tamaño aproximado: 6m², más de 10m² y más de 20m².",workTypes:pn({design:[me("basic","6m² aprox","250 - 350",250,350),me("intermediate","Más 10m²","400 - 650",400,650),me("advanced","Más de 20m²","700 - 1100",700,1100)],adaptation:[me("basic","6m² aprox","100 - 150",100,150),me("intermediate","Más 10m²","200 - 300",200,300),me("advanced","Más de 20m²","400 - 600",400,600)]})},{id:"stands-muebles-exhibidores",section:"grafico",category:"Stands, muebles y exhibidores",service:"One Way, cabeceras de góndola, revestimiento de islas y displays básicos",notes:"Incluye diseño en alta resolución, troqueles y 3 rondas de cambios.",workTypes:pn({design:[me("basic","Básico","300 - 400",300,400),me("intermediate","Intermedio","450 - 650",450,650),me("advanced","Avanzado","700 - 1000",700,1e3)],adaptation:[me("basic","Básico","200 - 300",200,300),me("intermediate","Intermedio","300 - 400",300,400),me("advanced","Avanzado","450 - 600",450,600)]})},{id:"proyectos-especiales-muebles",section:"grafico",category:"Proyectos especiales",service:"Diseño de muebles u otros proyectos especiales con planos estructurales y troqueles desde cero",notes:"Precio por proyecto. Incluye diseño gráfico/estructural, planos, troqueles, conceptualización y 4 rondas de cambios.",workTypes:pn({design:[me("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[me("project","Precio único","600 - 850",600,850)]})},{id:"stands-creativos-eventos",section:"grafico",category:"Proyectos especiales",service:"Stands creativos para ferias/eventos, montaje de eventos especiales y diseños de espacios especiales",notes:"Precio por proyecto. Incluye stand creativo, planos estructurales, visualizaciones 3D y 4 rondas de cambios.",workTypes:pn({design:[me("project","Precio único","1500 - 3000",1500,3e3)],adaptation:[me("project","Precio único","800 - 1200",800,1200)]})},{id:"empaque-simple",section:"grafico",category:"Diseño de empaques",service:"Empaque simple",notes:"Diseño gráfico original para empaques simples sin troqueles complejos.",workTypes:pn({design:[me("project","Precio único","700 - 1000",700,1e3)],adaptation:[me("project","Adaptación / SKU","100 - 300",100,300)]})},{id:"empaque-complejo",section:"grafico",category:"Diseño de empaques",service:"Empaque complejo",notes:"Diseño gráfico y estructural para empaques con troqueles personalizados o formas no convencionales.",workTypes:pn({design:[me("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[me("project","Adaptación / SKU","100 - 300",100,300)]})},{id:"brochures",section:"grafico",category:"Catálogos, brochures y folletos",service:"Brochures",notes:"Incluye diseño y 3 rondas de cambios.",workTypes:pn({design:[me("basic","Básico","200 - 400",200,400),me("intermediate","Intermedio","400 - 600",400,600),me("advanced","Avanzado","600 - 800",600,800)],adaptation:[me("basic","Básico","50 - 100",50,100),me("intermediate","Intermedio","100 - 150",100,150),me("advanced","Avanzado","150 - 350",150,350)]})},{id:"catalogos-folletos-pagina",section:"grafico",category:"Catálogos, brochures y folletos",service:"Catálogos y folletos (costo por página)",notes:"Costo por página. Incluye diseño y 3 rondas de cambios.",workTypes:pn({design:[me("basic","Básico","30 - 60",30,60),me("intermediate","Intermedio","60 - 90",60,90),me("advanced","Avanzado","90 - 120",90,120)],adaptation:[me("basic","Básico","15 - 30",15,30),me("intermediate","Intermedio","30 - 60",30,60),me("advanced","Avanzado","60 - 100",60,100)]})},{id:"web-landing",section:"grafico",category:"Páginas web",service:"Landing page o sitio simple hasta 5 páginas",notes:"Sitio web básico con diseño estático, contenido del cliente y hasta 2 rondas de cambios.",workTypes:[{id:gn,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[me("project","Precio único","800 - 1500",800,1500)]}]},{id:"web-intermedio",section:"grafico",category:"Páginas web",service:"Sitio corporativo intermedio de 6 a 15 páginas",notes:"Sitio mediano con páginas adicionales y diseño más personalizado. Hasta 3 rondas de cambios.",workTypes:[{id:gn,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[me("project","Precio único","2000 - 5000",2e3,5e3)]}]},{id:"web-avanzado",section:"grafico",category:"Páginas web",service:"Sitio avanzado: más de 15 páginas, interactividad o integraciones complejas",notes:"Incluye desarrollo a medida y hasta 5 rondas de cambios.",workTypes:[{id:gn,label:"Diseño web",shortLabel:"Web",hourReference:"36 - 50",levels:[me("project","Precio único","4000 - 8000",4e3,8e3)]}]},{id:"retoques-fotograficos",section:"grafico",category:"Otros servicios",service:"Retoques fotográficos",notes:"Incluye 2 rondas de ajustes.",workTypes:pn({design:[me("basic","Básico","20 - 40",20,40),me("intermediate","Intermedio","50 - 100",50,100),me("advanced","Avanzado","150 - 300",150,300)],adaptation:void 0})},{id:"videos",section:"grafico",category:"Otros servicios",service:"Videos",notes:"Referencia por complejidad del video.",workTypes:pn({designHour:"35 - 50",design:[me("basic","Básico","100 - 250",100,250),me("intermediate","Intermedio","250 - 500",250,500),me("advanced","Avanzado","500 - 1200",500,1200)]})},{id:"copy-puntual",section:"grafico",category:"Otros servicios",service:"Copy puntual para ADS, tarjetas o comunicaciones sueltas",notes:"Solo copy puntual. Si requiere concepto, presupuestar según proyecto/hora hombre.",workTypes:pn({designHour:"1 - 25",design:[me("basic","Básico","100",100,100),me("intermediate","Intermedio","100 - 200",100,200),me("advanced","Avanzado","200 - 500",200,500)]})},{id:"render-sencillo",section:"grafico",category:"Otros servicios",service:"Render sencillo de 1 solo plano por unidad",notes:"No aplica para eventos donde hay que conceptualizar el ambiente total.",workTypes:pn({designHour:"1 - 50",design:[me("basic","Básico","100",100,100),me("intermediate","Intermedio","100 - 150",100,150),me("advanced","Avanzado","150 - 300",150,300)]})},{id:"carnets",section:"grafico",category:"Otros servicios",service:"Carnets",notes:"Referencia especial: diseño base + réplicas. El Director Creativo calcula y escribe el monto final manualmente.",workTypes:[{id:gn,label:"Referencia manual",shortLabel:"Manual",levels:[me("base","Diseño base","20 base",20,20),me("replica","Réplicas","5 por réplica",5,5)]}]},{id:"identidad-basica",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo básico para pequeñas marcas o emprendimientos",notes:"Incluye logo, paleta, tipografía, identidad visual básica, hasta 2 conceptos y 3 rondas de cambios.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Básico","2000 - 4000",2e3,4e3)]}]},{id:"identidad-intermedia",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo intermedio para marcas medianas",notes:"Incluye nombre si aplica, logotipo, paleta, tipografía, key visuals y manual de marca detallado.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Intermedio","4000 - 8000",4e3,8e3)]}]},{id:"identidad-avanzada",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo avanzado para grandes marcas o redes",notes:"Identidad visual robusta con aplicaciones de marca, investigación, key visuals y manual exhaustivo.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Avanzado","8000 - 15000 o más",8e3,15e3)]}]},{id:"campana-key-visual-basica",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Concepto y Key Visual básico para campañas pequeñas",notes:"Concepto creativo básico, key visual, línea gráfica y eslogan con aplicaciones limitadas.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Básico","2000 - 3000",2e3,3e3)]}]},{id:"campana-creativa-intermedia",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Campaña creativa intermedia para lanzamientos medianos",notes:"Concepto creativo completo, key visuals, eslogan y piezas para distintos medios.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Intermedio","3000 - 5000",3e3,5e3)]}]},{id:"campana-creativa-avanzada",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Campaña creativa avanzada para lanzamientos grandes",notes:"Desarrollo estratégico y creativo de campaña grande con insights, key visuals y múltiples piezas.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Avanzado","5000 - 8000 o más",5e3,8e3)]}]},{id:"consultoria-estrategica",section:"estrategia",category:"Desarrollo Estratégico y Conceptual",service:"Consultoría estratégica y desarrollo de concepto",notes:"Investigación de mercado, análisis de competencia, concepto estratégico y alineación con objetivos del cliente.",workTypes:[{id:gn,label:"Tarifa fija o por hora",shortLabel:"Referencia",levels:[me("project","Por proyecto","1500 - 3000",1500,3e3),me("hour","Por hora","100 - 200 por hora",100,200)]}]},{id:"rondas-adicionales-estrategia",section:"estrategia",category:"Adicionales estratégicos",service:"Rondas adicionales de cambios",notes:"Referencia para trabajo adicional en estrategia o creatividad.",workTypes:[{id:gn,label:"Por hora",shortLabel:"Hora",levels:[me("hour","Por hora","50 - 150 por hora",50,150)]}]}];function Zw(e){return e?e.reference:""}function bu(e){return e&&typeof e.min=="number"&&typeof e.max=="number"?String((e.min===e.max,e.min)):""}const pC="tablero_cdc_tariff_catalog",ip="Referencia",gC="Precio único";let Ia={rows:op(ll),catalog:ll,source:"fallback",loading:!1,error:null},Mu=!1,Du=[],Em=0;function Cm(){Du.forEach(e=>e())}function ex(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const t=Number(e.trim());if(Number.isFinite(t))return t}return null}function cl(e){return String(e||"").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function yC(e,t,r){return[e,t,r].map(cl).filter(Boolean).join("__")}function Xz(e){const t=String(e.section||"grafico")==="estrategia"?"estrategia":"grafico",r=String(e.category||"").trim(),s=String(e.service||"").trim(),o=String(e.catalog_item_id||cl(`${t}-${r}-${s}`)).trim(),l=String(e.work_type_label||ip).trim(),u=String(e.level_label||gC).trim(),d=String(e.work_type_id||cl(l)||gn).trim(),f=String(e.level_id||cl(u)||"project").trim();return{id:String(e.id||yC(o,d,f)).trim(),catalog_item_id:o,section:t,category:r,service:s,notes:String(e.notes||"").trim(),work_type_id:d,work_type_label:l,work_type_short_label:String(e.work_type_short_label||l).trim(),hour_reference:String(e.hour_reference||"").trim(),level_id:f,level_label:u,reference:String(e.reference||"").trim(),reference_min:ex(e.reference_min),reference_max:ex(e.reference_max),level_hint:String(e.level_hint||"").trim(),sort_order:Number(e.sort_order||0),is_active:e.is_active!==!1,created_at:typeof e.created_at=="string"?e.created_at:null,updated_at:typeof e.updated_at=="string"?e.updated_at:null}}function Jz(e){const t=new Map,r=new Map,s=e.filter(o=>o.is_active).sort((o,l)=>o.sort_order-l.sort_order||o.category.localeCompare(l.category));for(const o of s){const l=o.catalog_item_id||cl(`${o.section}-${o.category}-${o.service}`);let u=t.get(l);u||(u={id:l,section:o.section,category:o.category,service:o.service,notes:o.notes,workTypes:[]},t.set(l,u),r.set(l,new Map));const d=o.work_type_id||gn,f=r.get(l);let m=f.get(d);m||(m={id:d,label:o.work_type_label||ip,shortLabel:o.work_type_short_label||o.work_type_label||ip,hourReference:o.hour_reference||void 0,levels:[]},f.set(d,m),u.workTypes.push(m));const b={id:o.level_id||"project",label:o.level_label||gC,reference:o.reference||"",min:o.reference_min??void 0,max:o.reference_max??void 0,hint:o.level_hint||void 0};m.levels.some(g=>g.id===b.id)||m.levels.push(b)}return Array.from(t.values())}function op(e){const t=[];return e.forEach((r,s)=>{r.workTypes.forEach((o,l)=>{o.levels.forEach((u,d)=>{t.push({id:yC(r.id,o.id,u.id),catalog_item_id:r.id,section:r.section,category:r.category,service:r.service,notes:r.notes||"",work_type_id:o.id,work_type_label:o.label,work_type_short_label:o.shortLabel,hour_reference:o.hourReference||"",level_id:u.id,level_label:u.label,reference:u.reference,reference_min:u.min??null,reference_max:u.max??null,level_hint:u.hint||"",sort_order:s*1e3+l*100+d,is_active:!0})})})}),t}function Qz(e){const t=e instanceof Error?e.message:String(e||"");return t.includes(pC)||t.includes("Could not find the table")||t.includes("relation")||t.includes("does not exist")}async function tx(e=!1){if(Mu&&!e)return Ia;const t=Em+=1;Ia={...Ia,loading:!0,error:null},Cm();try{const{data:r,error:s}=await qe.from(pC).select("id, catalog_item_id, section, category, service, notes, work_type_id, work_type_label, work_type_short_label, hour_reference, level_id, level_label, reference, reference_min, reference_max, level_hint, sort_order, is_active, created_at, updated_at").order("sort_order",{ascending:!0}).order("category",{ascending:!0});if(s)throw s;const o=(r||[]).map(m=>Xz(m)),l=op(ll),u=new Map;l.forEach(m=>u.set(m.id,m)),o.forEach(m=>u.set(m.id,m));const d=Array.from(u.values()).sort((m,b)=>m.sort_order-b.sort_order||m.category.localeCompare(b.category)),f=Jz(d);t===Em&&(Ia={rows:d,catalog:f,source:o.length?"supabase":"fallback",loading:!1,error:o.length?null:"La tabla del tarifario está vacía. Se está usando el tarifario base de la app como respaldo."},Mu=!0,Cm())}catch(r){const s=r instanceof Error?r.message:String(r||""),o=Qz(r)?"Falta crear la tabla tablero_cdc_tariff_catalog en Supabase. Se está usando el tarifario base de la app como respaldo.":s||"No se pudo cargar el tarifario dinámico.";t===Em&&(Ia={rows:op(ll),catalog:ll,source:"fallback",loading:!1,error:o},Mu=!0,Cm())}return Ia}function Zz(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return Du.push(t),!Mu&&!Ia.loading&&tx(),()=>{Du=Du.filter(r=>r!==t)}},[]),{...Ia,refresh:()=>tx(!0)}}function wu(e){const t=Number(e.replace(/,/g,"").trim());return Number.isFinite(t)?t:0}function Am(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function eU(e){return(e==null?void 0:e.workTypes[0])||null}function nx(e){return(e==null?void 0:e.levels[0])||null}function Tm(e){return e.trim()}function tU({items:e,onChange:t,loading:r,error:s}){var Z;const[o,l]=v.useState("grafico"),[u,d]=v.useState(""),[f,m]=v.useState(""),[b,g]=v.useState(""),[w,_]=v.useState(""),[E,S]=v.useState(""),[A,C]=v.useState(""),[R,N]=v.useState(""),[P,F]=v.useState(""),{catalog:$,loading:L,error:q}=Zz(),ie=Sm.map(z=>z.label),he=((Z=Sm.find(z=>z.id===o))==null?void 0:Z.label)||"",pe=v.useMemo(()=>$.filter(z=>z.section===o).map(z=>`${z.category} · ${z.service}`),[o,$]),oe=v.useMemo(()=>{const z=u;return $.find(ee=>ee.section===o&&`${ee.category} · ${ee.service}`===z)||null},[o,u,$]),ue=v.useMemo(()=>oe&&oe.workTypes.find(z=>z.id===f)||null,[oe,f]),ce=v.useMemo(()=>ue&&ue.levels.find(z=>z.id===b)||null,[ue,b]),fe=e.reduce((z,ee)=>z+Number(ee.amount||0),0),M=()=>{d(""),m(""),g(""),_(""),S("")},K=z=>{const ee=Sm.find(ae=>ae.label===z);l((ee==null?void 0:ee.id)||"grafico"),M()},J=z=>{d(z);const ee=$.find(Ee=>Ee.section===o&&`${Ee.category} · ${Ee.service}`===z),ae=eU(ee),xe=nx(ae);m((ae==null?void 0:ae.id)||""),g((xe==null?void 0:xe.id)||""),_(bu(xe)),S("")},ne=z=>{if(!oe)return;const ee=oe.workTypes.find(xe=>xe.label===z),ae=nx(ee);m((ee==null?void 0:ee.id)||""),g((ae==null?void 0:ae.id)||""),_(bu(ae))},X=z=>{if(!ue)return;const ee=ue.levels.find(ae=>ae.label===z);g((ee==null?void 0:ee.id)||""),_(bu(ee))},k=()=>{if(!oe||!ue||!ce)return;const z=wu(w);z<=0||(t([...e,{source:"tariff",category:oe.category,serviceName:oe.service,workType:ue.label,complexityLevel:ce.label,referenceLabel:Zw(ce),referenceMin:ce.min??null,referenceMax:ce.max??null,amount:z,description:Tm(E)}]),S(""),_(bu(ce)))},j=()=>{const z=wu(P),ee=Tm(A)||"Otros / costo manual";z<=0||(t([...e,{source:"manual",category:"Otros",serviceName:ee,workType:"Manual",complexityLevel:"",referenceLabel:"Monto manual",referenceMin:null,referenceMax:null,amount:z,description:Tm(R)}]),C(""),N(""),F(""))},I=z=>{t(e.filter((ee,ae)=>ae!==z))},Y=(ue==null?void 0:ue.label)||"",V=(ce==null?void 0:ce.label)||"";return y.jsxs("div",{className:"md:col-span-2 rounded-2xl border border-border bg-muted/20 p-4",children:[y.jsxs("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[y.jsxs("div",{className:"flex items-start gap-2.5",children:[y.jsx("span",{className:"mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:y.jsx(t2,{className:"h-4 w-4"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"text-sm font-semibold",children:"Tarifario / Estimación interna"}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Agrega costos del tarifario o montos manuales. El total se guarda como Interno Cargado."})]})]}),y.jsxs("div",{className:"rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-sm font-semibold text-primary",children:["Total: ",Am(fe)]})]}),(s||q)&&y.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-xl border border-amber-300/50 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:[y.jsx(j2,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0"}),y.jsx("span",{children:s||q})]}),(r||L)&&y.jsx("div",{className:"mb-3 rounded-xl border border-border bg-card px-3 py-2 text-xs text-muted-foreground",children:r?"Cargando costos guardados…":"Cargando tarifario…"}),y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y.jsxs("div",{children:[y.jsx("p",{className:"text-sm font-medium",children:"Agregar desde tarifario"}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Referencia flexible. El Director Creativo decide el monto final."})]}),y.jsx(Cs,{variant:"secondary",children:"Tarifario"})]}),y.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Sección"}),y.jsx(ea,{value:he,options:ie,onValueChange:K,placeholder:"Seleccionar sección…",searchPlaceholder:"Buscar sección…"})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Ítem a cobrar"}),y.jsx(ea,{value:u,options:pe,onValueChange:J,placeholder:"Seleccionar ítem…",searchPlaceholder:"Buscar ítem…",emptyText:"No se encontró ese ítem."})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Tipo de trabajo"}),y.jsx(ea,{value:Y,options:(oe==null?void 0:oe.workTypes.map(z=>z.label))||[],onValueChange:ne,placeholder:"Seleccionar tipo…",searchPlaceholder:"Buscar tipo…",disabled:!oe})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Nivel / referencia"}),y.jsx(ea,{value:V,options:(ue==null?void 0:ue.levels.map(z=>z.label))||[],onValueChange:X,placeholder:"Seleccionar nivel…",searchPlaceholder:"Buscar nivel…",disabled:!ue})]})]}),oe&&ue&&ce&&y.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground",children:[y.jsxs("p",{children:[y.jsx("span",{className:"font-medium text-foreground",children:"Referencia:"})," ",Zw(ce)," USD",ue.hourReference?` · Hora hombre ref.: ${ue.hourReference}`:""]}),oe.notes&&y.jsx("p",{className:"mt-1",children:oe.notes}),ce.hint&&y.jsx("p",{className:"mt-1",children:ce.hint})]}),y.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[220px_minmax(0,1fr)]",children:[y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Monto final"}),y.jsx(jn,{type:"number",min:"0",step:"0.01",value:w,onChange:z=>_(z.target.value),placeholder:"0.00",disabled:!ce})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Observación"}),y.jsx(nd,{value:E,onChange:z=>S(z.target.value),placeholder:"Ej: más rondas de cambios, piezas adicionales, complejidad especial…",disabled:!ce,rows:5,className:"min-h-[132px] resize-y"})]})]}),y.jsx("div",{className:"flex justify-end",children:y.jsxs(ut,{type:"button",onClick:k,disabled:!oe||!ue||!ce||wu(w)<=0,className:"gap-1.5 rounded-full",children:[y.jsx(bl,{className:"h-4 w-4"}),"Agregar tarifa"]})})]}),y.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[y.jsxs("div",{children:[y.jsx("p",{className:"text-sm font-medium",children:"Agregar costo manual"}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Para otros, adicionales o casos fuera del tarifario."})]}),y.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[minmax(0,1fr)_220px]",children:[y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Nombre"}),y.jsx(jn,{value:A,onChange:z=>C(z.target.value),placeholder:"Ej: Piezas adicionales"})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Monto"}),y.jsx(jn,{type:"number",min:"0",step:"0.01",value:P,onChange:z=>F(z.target.value),placeholder:"0.00"})]})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(xt,{children:"Descripción"}),y.jsx(nd,{value:R,onChange:z=>N(z.target.value),placeholder:"Ej: Cliente pidió 8 piezas adicionales fuera del paquete.",rows:4,className:"min-h-[110px] resize-y"})]}),y.jsx("div",{className:"flex justify-end",children:y.jsxs(ut,{type:"button",variant:"outline",onClick:j,disabled:wu(P)<=0,className:"w-full gap-1.5 rounded-full sm:w-auto sm:min-w-[240px]",children:[y.jsx(bl,{className:"h-4 w-4"}),"Agregar costo manual"]})})]})]}),y.jsx(Ii,{className:"my-4"}),y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y.jsx("p",{className:"text-sm font-medium",children:"Costos agregados"}),y.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.length," línea(s)"]})]}),e.length===0?y.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card/70 px-3 py-3 text-sm text-muted-foreground",children:"Aún no hay costos agregados. Puedes usar el tarifario, agregar otros manuales o ambos."}):y.jsxs("div",{className:"space-y-2",children:[e.map((z,ee)=>y.jsxs("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card px-3 py-3 sm:flex-row sm:items-start sm:justify-between",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y.jsx(Cs,{variant:z.source==="manual"?"outline":"secondary",children:z.source==="manual"?"Manual":"Tarifario"}),y.jsx("p",{className:"text-sm font-medium",children:z.serviceName})]}),y.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[z.category&&y.jsx("span",{children:z.category}),z.workType&&y.jsx("span",{children:z.workType}),z.complexityLevel&&y.jsx("span",{children:z.complexityLevel}),z.referenceLabel&&y.jsxs("span",{children:["Ref.: ",z.referenceLabel]})]}),z.description&&y.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:z.description})]}),y.jsxs("div",{className:"flex items-center justify-between gap-3 sm:flex-col sm:items-end",children:[y.jsx("p",{className:"text-sm font-semibold text-foreground",children:Am(Number(z.amount||0))}),y.jsxs(ut,{type:"button",variant:"ghost",size:"sm",onClick:()=>I(ee),className:Ae("h-8 rounded-full px-2 text-muted-foreground hover:text-destructive"),children:[y.jsx(u_,{className:"mr-1 h-3.5 w-3.5"}),"Quitar"]})]})]},`${z.source}-${z.serviceName}-${ee}`)),y.jsxs("div",{className:"flex items-center justify-end gap-2 rounded-xl bg-primary/10 px-3 py-2 text-primary",children:[y.jsx(Ep,{className:"h-4 w-4"}),y.jsxs("span",{className:"text-sm font-semibold",children:["Total interno estimado: ",Am(fe)]})]})]})]})]})}const $i={clientes:jP,marcas:MP,bus:OP,buCm:Jp,status:[...DP]};let Lu=[],lp=$i,El=!1,vC=!1,mg=null,ul=null,Ss=null,xu=0;function cp(){Lu.forEach(e=>e())}function Pa(e){return pt(e)}function nU(e){return String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function rU(e){const t=nU(e);return["client","clients","cliente","clientes"].includes(t)?"client":["brand","brands","marca","marcas"].includes(t)?"brand":["country","countries","pais","paises","bu","business_unit","business unit"].includes(t)?"country":["status","estatus","estado","estados"].includes(t)?"status":["country_manager","country manager","cm","bu_cm","bu cm","manager","managers"].includes(t)?"country_manager":t}function aU(e){return Ft(String(e.label||e.value||""))}function sU(e){const t=[],r=[],s=[],o=[],l={...Jp};for(const u of e){if(u.is_active===!1)continue;const d=rU(u.category),f=aU(u),m=Ft(String(u.value||""));if(!(!f&&!m)&&(d==="client"&&t.push(f||m),d==="brand"&&r.push(f||m),d==="country"&&s.push(f||m),d==="status"&&o.push(f||m),d==="country_manager"&&m)){const b=f||m;b&&b!==m&&(l[m]=b)}}return{clientes:t.length?Pa(t):Pa($i.clientes),marcas:r.length?Pa(r):Pa($i.marcas),bus:s.length?Pa(s):Pa($i.bus),buCm:l,status:o.length?Pa(o):Pa($i.status)}}function iU(e){mg=e,cp()}async function up(){El=!0,iU(null),cp();try{const{data:e,error:t}=await qe.from("tablero_cdc_app_lists").select("category, value, label, sort_order, is_active").eq("is_active",!0).order("category",{ascending:!0}).order("sort_order",{ascending:!0}).order("label",{ascending:!0});if(t)throw t;lp=sU(e||[]),vC=!0}catch(e){console.error("Error cargando listas desde Supabase:",e),mg=e instanceof Error?e.message:"No se pudieron cargar los desplegables desde Supabase.",lp=$i}finally{El=!1,cp()}}function oU(){Ss&&clearTimeout(Ss),Ss=setTimeout(()=>{Ss=null,El||up()},350)}function lU(){ul||(ul=qe.channel("tablero-cdc-app-lists").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_lists"},()=>oU()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a tablero_cdc_app_lists:",e)}))}function cU(){Ss&&(clearTimeout(Ss),Ss=null),ul&&(qe.removeChannel(ul),ul=null)}function bC(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return Lu.push(t),xu+=1,lU(),!vC&&!El&&up(),()=>{Lu=Lu.filter(r=>r!==t),xu=Math.max(0,xu-1),xu===0&&cU()}},[]),{lists:lp,loading:El,error:mg,refresh:up}}const wC="blue",Md="Activo",pg="gmarrero@gomezleemarketing.com",uU=[pg,"iaracena@gomezleemarketing.com"],dU=[pg,"iaracena@gomezleemarketing.com"],Jr={tab:"todos",search:"",page:1,pageSize:24,country:"",brand:"",client:"",cm:""};let Pu=[],aa=[],sd=0,xC={countries:[],brands:[],clients:[],cms:[]},Cl=!1,_C=!1,gg=null,dl=null,Es=null,_u=0,vn={...Jr},Ar=0,Su=0;function Al(){Pu.forEach(e=>e())}function id(e,t=""){return typeof e=="string"?e:t}function fU(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function hU(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const r=Number(e.trim());if(Number.isFinite(r))return r}return t}function mU(e,t){return id(e.legacy_month,"")||id(e.mes,"")||t.toLocaleString("es-DO",{month:"long"})}function pU(e,t){return hU(e.legacy_year,fU(e.anio,t.getFullYear()))}function gU(e){return!e||e===Md?"":e}function yU(e){return e&&e.trim()?e:Md}function SC(e){return{tab:(e==null?void 0:e.tab)??vn.tab??Jr.tab,search:String((e==null?void 0:e.search)??vn.search??Jr.search).trim(),page:Math.max(1,Math.floor(Number((e==null?void 0:e.page)??vn.page??Jr.page))),pageSize:Math.max(1,Math.min(100,Math.floor(Number((e==null?void 0:e.pageSize)??vn.pageSize??Jr.pageSize)))),country:String((e==null?void 0:e.country)??vn.country??Jr.country).trim(),brand:String((e==null?void 0:e.brand)??vn.brand??Jr.brand).trim(),client:String((e==null?void 0:e.client)??vn.client??Jr.client).trim(),cm:String((e==null?void 0:e.cm)??vn.cm??Jr.cm).trim()}}function EC(e){const t=e.extra_data||{},r=e.project_links||[],s=r.filter(d=>d.link_type==="proposal").map(d=>d.url||"").filter(Boolean),o=r.filter(d=>d.link_type==="final_art").map(d=>d.url||"").filter(Boolean),l=e.created_at?new Date(e.created_at).getTime():Date.now(),u=Number.isFinite(l)?new Date(l):new Date;return{id:e.id,nombre:e.title||"",color:id(t.color,wC),cliente:e.client||"",bu:e.country||"",cm:e.country_manager||"",marca:e.brand||"",solicitante:e.requested_by||"",comentarios:e.description||"",briefLink:e.brief_link||"",propuestaLinks:s,afLinks:o,status:gU(e.status),monto:e.internal_amount==null?null:Number(e.internal_amount),mes:mU(t,u),anio:pU(t,u),createdAt:Number.isFinite(l)?l:Date.now(),extraData:t}}function vU(e){const t=e.created_at?new Date(e.created_at).getTime():Date.now();return{id:e.id,projectId:e.project_id,type:e.activity_type||"note",title:e.title||"Actividad registrada",description:e.description||"",actorName:e.actor_name||e.actor_email||"Usuario CDC",actorEmail:e.actor_email||"",createdAt:Number.isFinite(t)?t:Date.now()}}function bU(e){const t=e.created_at?new Date(e.created_at).getTime():Date.now(),r=Number(e.amount??0),s=e.reference_min==null?null:Number(e.reference_min),o=e.reference_max==null?null:Number(e.reference_max);return{id:e.id,projectId:e.project_id,source:e.source==="manual"?"manual":"tariff",category:e.category||"",serviceName:e.service_name||"",workType:e.work_type||"",complexityLevel:e.complexity_level||"",referenceLabel:e.reference_label||"",referenceMin:Number.isFinite(s)?s:null,referenceMax:Number.isFinite(o)?o:null,amount:Number.isFinite(r)?r:0,description:e.description||"",createdAt:Number.isFinite(t)?t:Date.now()}}function CC(e){var r;const t=e.user_metadata||{};return t.full_name||t.name||t.display_name||((r=e.email)==null?void 0:r.split("@")[0])||"Usuario CDC"}function rx(e){return e&&e.trim()?e:Md}function Eu(e,t,r){return`${e} ${e===1?t:r}`}function ax(e){return Array.isArray(e)?e.map(t=>String(t||"").trim()).filter(Boolean).join(" | "):String(e??"").trim()}function za(e,t,r,s,o){const l=ax(r),u=ax(s);if(l!==u){if(o!=null&&o.privateValue){e.push(`${t} actualizado.`);return}e.push(`${t}: ${l||"—"}${u||"—"}`)}}function wU(e,t,r){const s=[];return za(s,"Nombre",e.nombre,t.nombre),za(s,"Cliente",e.cliente,t.cliente),za(s,"Marca",e.marca,t.marca),za(s,"País/BU",e.bu,t.bu),za(s,"CM",e.cm,t.cm),za(s,"Solicitado por",e.solicitante,t.solicitante),za(s,"Estatus",rx(e.status),rx(t.status)),e.color!==t.color&&s.push("Etiqueta de color actualizada."),(e.comentarios||"").trim()!==(t.comentarios||"").trim()&&s.push("Comentarios actualizados."),(e.briefLink||"").trim()!==(t.briefLink||"").trim()&&s.push("Link del brief actualizado."),e.propuestaLinks.join("|")!==t.propuestaLinks.join("|")&&s.push(`Links de propuestas: ${Eu(e.propuestaLinks.length,"link","links")}${Eu(t.propuestaLinks.length,"link","links")}.`),e.afLinks.join("|")!==t.afLinks.join("|")&&s.push(`Links de artes finales: ${Eu(e.afLinks.length,"link","links")}${Eu(t.afLinks.length,"link","links")}.`),r&&Number(e.monto??0)!==Number(t.monto??0)&&za(s,"Monto interno",e.monto,t.monto,{privateValue:!0}),s}async function to(){const{data:e,error:t}=await qe.auth.getUser();if(t||!e.user)throw new Error("No hay una sesión activa de Supabase.");return e.user}async function AC(){return(await to()).id}async function xU(){var t;return((t=(await to()).email)==null?void 0:t.toLowerCase())===pg}async function TC(){var t;const e=await to();return uU.includes(((t=e.email)==null?void 0:t.toLowerCase())||"")}async function _U(){var t;const e=await to();return dU.includes(((t=e.email)==null?void 0:t.toLowerCase())||"")}function RC(e){const t=e.extraData&&typeof e.extraData=="object"&&!Array.isArray(e.extraData)?e.extraData:{};return{title:e.nombre,client:e.cliente,brand:e.marca,country:e.bu,requested_by:e.solicitante,country_manager:e.cm,description:e.comentarios,status:yU(e.status),internal_amount:e.monto??null,brief_link:e.briefLink,extra_data:{...t,color:e.color??id(t.color,wC),mes:e.mes,anio:e.anio}}}function SU(e,t){const r=t.propuestaLinks.map(o=>o.trim()).filter(Boolean).map((o,l)=>({project_id:e,link_type:"proposal",url:o,label:`Propuesta ${l+1}`})),s=t.afLinks.map(o=>o.trim()).filter(Boolean).map((o,l)=>({project_id:e,link_type:"final_art",url:o,label:`AF ${l+1}`}));return[...r,...s]}function NC(e){aa=e,Al()}function qa(e){return Array.isArray(e)?Array.from(new Set(e.map(t=>String(t??"").trim()).filter(Boolean))).sort((t,r)=>t.localeCompare(r,"es",{sensitivity:"base"})):[]}function EU(e){return{countries:qa(e.map(t=>t.bu)),brands:qa(e.map(t=>t.marca)),clients:qa(e.map(t=>t.cliente)),cms:qa(e.map(t=>t.cm))}}function nr(e){gg=e,Al()}function kC(e){aa.some(r=>r.id===e.id)&&NC(aa.map(r=>r.id===e.id?e:r))}function CU(e){aa.some(t=>t.id===e)&&(NC(aa.filter(t=>t.id!==e)),sd=Math.max(0,sd-1),Al())}function AU(){return"https://agenteit.digitalcompass.agency/webhook/tablero-cdc-sync-proyecto".trim()||""}async function Dd(e,t){const r=AU();if(!r)return console.info("No se configuró VITE_WEBHOOK_URL; se omite sincronización con Google Sheet."),{sheetSyncStatus:"skipped",sheetSyncMessage:t==="delete"?"No hay webhook configurado para eliminar el proyecto del Google Sheet.":"Proyecto guardado. No hay webhook configurado para sincronizar el Sheet."};const s=new AbortController,o=window.setTimeout(()=>s.abort(),15e3);try{const l=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_id:e,action:t,source:"tablero-cdc",sent_at:new Date().toISOString()}),signal:s.signal});if(!l.ok){const u=await l.text().catch(()=>""),d=u||`${l.status} ${l.statusText}`.trim();return console.warn("El proyecto se guardó en Supabase, pero n8n no respondió correctamente.",{status:l.status,statusText:l.statusText,errorText:u}),{sheetSyncStatus:"failed",sheetSyncMessage:t==="delete"?`No se pudo eliminar el proyecto del Google Sheet: ${d}`:`Proyecto guardado, pero el Sheet no se pudo sincronizar: ${d}`}}return{sheetSyncStatus:"synced",sheetSyncMessage:t==="delete"?"Proyecto eliminado del Google Sheet.":"Proyecto guardado y sincronizado con el Google Sheet."}}catch(l){const u=l instanceof DOMException&&l.name==="AbortError";return console.warn("El proyecto se guardó en Supabase, pero no se pudo sincronizar con Google Sheet.",l),{sheetSyncStatus:u?"timeout":"failed",sheetSyncMessage:u?t==="delete"?"n8n tardó demasiado en responder. No se eliminó el proyecto para evitar inconsistencias.":"Proyecto guardado, pero n8n tardó demasiado en responder. Revisa el workflow si el Sheet no se actualizó.":t==="delete"?"No se pudo eliminar el proyecto del Google Sheet. No se eliminó el proyecto para evitar inconsistencias.":"Proyecto guardado, pero no se pudo sincronizar con Google Sheet."}}finally{window.clearTimeout(o)}}function sx(){Es&&clearTimeout(Es),Es=setTimeout(()=>{Es=null,!Cl&&Ar===0&&As(vn)},350)}function TU(){dl||(dl=qe.channel("tablero-cdc-projects").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_projects"},()=>sx()).on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_project_links"},()=>sx()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a proyectos:",e)}))}function RU(){Es&&(clearTimeout(Es),Es=null),dl&&(qe.removeChannel(dl),dl=null)}async function jC(e,t){const r=SU(e,t);try{const{error:l}=await qe.rpc("tablero_cdc_replace_project_links",{p_project_id:e,p_links:r.map(({link_type:u,url:d,label:f})=>({link_type:u,url:d,label:f}))});if(l)throw l;return}catch(l){if(!LU(l))throw l;console.warn("RPC tablero_cdc_replace_project_links no existe todavía. Usando reemplazo de links por delete+insert.",l)}const{error:s}=await qe.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw s;if(r.length===0)return;const{error:o}=await qe.from("tablero_cdc_project_links").insert(r);if(o)throw o}async function OC(e,t){if(!Array.isArray(t))return;const{error:r}=await qe.from("tablero_cdc_project_pricing_items").delete().eq("project_id",e);if(r)throw r;const s=t.map((l,u)=>({item:l,index:u})).filter(({item:l})=>Number.isFinite(Number(l.amount))&&Number(l.amount)>0).map(({item:l,index:u})=>({project_id:e,source:l.source,category:l.category||"",service_name:l.serviceName||"Costo manual",work_type:l.workType||"",complexity_level:l.complexityLevel||"",reference_label:l.referenceLabel||"",reference_min:l.referenceMin??null,reference_max:l.referenceMax??null,amount:Number(l.amount),description:l.description||"",sort_order:u}));if(s.length===0)return;const{error:o}=await qe.from("tablero_cdc_project_pricing_items").insert(s);if(o)throw o}async function NU(e){const{data:t,error:r}=await qe.from("tablero_cdc_project_pricing_items").select("id, project_id, source, category, service_name, work_type, complexity_level, reference_label, reference_min, reference_max, amount, description, created_at").eq("project_id",e).order("sort_order",{ascending:!0}).order("created_at",{ascending:!0});if(r)throw r;return(t||[]).map(bU)}async function ix(e,t=20,r=0){const s=Math.max(1,Math.min(50,Math.floor(t))),o=Math.max(0,Math.floor(r)),{data:l,error:u}=await qe.from("tablero_cdc_project_activity").select("id, project_id, activity_type, title, description, actor_name, actor_email, created_at").eq("project_id",e).order("created_at",{ascending:!1}).range(o,o+s-1);if(u)throw u;return(l||[]).map(vU)}function kU(e,t,r,s){const o=new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(s),l=r?`${t} (${r})`:t;return`[${o}] ${l}:
${e}`}async function jU(e,t,r,s,o,l){const{data:u,error:d}=await qe.from("tablero_cdc_projects").select("description").eq("id",e).single();if(d)throw d;const f=String((u==null?void 0:u.description)||"").trim(),m=kU(t,r,s,l),b=f?`${f}
${m}`:m,{error:g}=await qe.from("tablero_cdc_projects").update({description:b,updated_by:o}).eq("id",e);if(g)throw g;const w=aa.find(_=>_.id===e);return w&&kC({...w,comentarios:b}),b}async function OU(e,t){const r=t.trim();if(!r)throw new Error("Escribe una nota antes de agregarla al historial.");const s=await to(),o=CC(s),l=s.email||"",u=new Date,{error:d}=await qe.from("tablero_cdc_project_activity").insert({project_id:e,activity_type:"note",title:"Comentario agregado",description:r,actor_id:s.id,actor_email:l||null,actor_name:o});if(d)throw d;const f=await jU(e,r,o,l,s.id,u),m=await Dd(e,"update");return{comments:f,...m}}async function MC(e,t,r,s="",o=!1){try{const l=await to(),u=CC(l),{error:d}=await qe.from("tablero_cdc_project_activity").insert({project_id:e,activity_type:t,title:r,description:s,actor_id:l.id,actor_email:l.email||null,actor_name:u});if(d)throw d}catch(l){if(console.warn("No se pudo registrar la actividad del proyecto:",l),o)throw l instanceof Error?l:new Error("No se pudo registrar la actividad del proyecto.")}}function MU(e){return`
id,
title,
client,
brand,
country,
requested_by,
country_manager,
description,
status,
${e?"internal_amount,":""}
brief_link,
created_at,
extra_data,
project_links:tablero_cdc_project_links (
id,
link_type,
url,
label
)
`}function yg(e){return e instanceof Error?e.message:e&&typeof e=="object"&&"message"in e?String(e.message||""):String(e||"")}function DU(e){const t=yg(e);return t.includes("tablero_cdc_get_projects_paginated")||t.includes("Could not find the function")}function LU(e){const t=yg(e);return t.includes("tablero_cdc_replace_project_links")||t.includes("Could not find the function")}function PU(e){const t=yg(e);return t.includes("tablero_cdc_get_pricing_summary")||t.includes("Could not find the function")}function el(e){return e.replace(/[%_]/g,"\\$&").replace(/,/g," ")}function DC(e,t){let r=e;t.tab==="abiertos"&&(r=r.or("status.is.null,status.eq.,status.eq.Activo")),t.tab==="cerrados"&&(r=r.not("status","is",null).neq("status","").neq("status",Md));const s=t.search.trim();if(s){const l=`%${el(s)}%`;r=r.or(`title.ilike.${l},client.ilike.${l},brand.ilike.${l},country.ilike.${l},requested_by.ilike.${l},country_manager.ilike.${l},description.ilike.${l}`)}if(t.country){const o=`%${el(t.country)}%`;r=r.or(`country.ilike.${o}`)}if(t.brand){const o=`%${el(t.brand)}%`;r=r.or(`brand.ilike.${o}`)}if(t.client){const o=`%${el(t.client)}%`;r=r.or(`client.ilike.${o}`)}if(t.cm){const o=`%${el(t.cm)}%`;r=r.or(`country_manager.ilike.${o}`)}return r}async function zU(e,t){const r=(e.page-1)*e.pageSize,s=r+e.pageSize-1;let o=qe.from("tablero_cdc_projects").select(MU(t),{count:"exact"}).order("created_at",{ascending:!1});o=DC(o,e);const{data:l,error:u,count:d}=await o.range(r,s);if(u)throw u;const f=(l||[]).map(m=>EC(m));return{projects:f,totalProjects:d??0,filterOptions:EU(f)}}async function UU(e){var l,u,d,f;const{data:t,error:r}=await qe.rpc("tablero_cdc_get_projects_paginated",{p_tab:e.tab,p_search:e.search,p_page:e.page,p_page_size:e.pageSize,p_country:e.country||"",p_brand:e.brand||"",p_client:e.client||"",p_cm:e.cm||""});if(r)throw r;const s=t||{},o=Array.isArray(s.projects)?s.projects:[];return{totalProjects:Number(s.total_count||0),projects:o.map(m=>EC(m)),filterOptions:{countries:qa((l=s.filter_options)==null?void 0:l.countries),brands:qa((u=s.filter_options)==null?void 0:u.brands),clients:qa((d=s.filter_options)==null?void 0:d.clients),cms:qa((f=s.filter_options)==null?void 0:f.cms)}}}async function As(e){const t=SC(e),r=Su+=1;vn=t,Cl=!0,nr(null),Al();try{const s=await TC();let o;try{o=await UU(t)}catch(l){if(!DU(l))throw l;console.warn("RPC tablero_cdc_get_projects_paginated no existe todavía. Usando consulta directa como respaldo temporal.",l),o=await zU(t,s)}if(r!==Su)return;sd=o.totalProjects,aa=o.projects,xC=o.filterOptions,_C=!0}catch(s){if(r!==Su)return;console.error("Error cargando proyectos desde Supabase:",s),gg=s instanceof Error?s.message:"No se pudieron cargar los proyectos desde Supabase."}finally{r===Su&&(Cl=!1,Al())}}async function IU(e){nr(null),Ar+=1;try{const t=await AC(),r={...RC(e),created_by:t,updated_by:t},{data:s,error:o}=await qe.from("tablero_cdc_projects").insert(r).select("id").single();if(o)throw nr(o.message),o;await jC(s.id,e),await OC(s.id,e.pricingItems),await MC(s.id,"created","Proyecto creado",`${e.nombre||"Proyecto sin título"} quedó registrado en el tablero.`);const l=await Dd(s.id,"create");return await As(vn),{projectId:s.id,...l}}finally{Ar=Math.max(0,Ar-1)}}async function $U(e,t){nr(null),Ar+=1;try{const r=await AC(),s=await xU(),o=await TC(),l=aa.find(w=>w.id===e);if(!l){const w="No se encontró el proyecto en la página actual. Recarga el tablero antes de guardar para evitar sobrescribir datos.";throw nr(w),new Error(w)}const u={...l,...t},d=RC(u),f=s?{...d,updated_by:r}:o?{title:d.title,client:d.client,brand:d.brand,country:d.country,requested_by:d.requested_by,country_manager:d.country_manager,description:d.description,status:l.status,internal_amount:d.internal_amount,brief_link:d.brief_link,extra_data:d.extra_data,updated_by:r}:{title:d.title,client:d.client,brand:d.brand,country:d.country,requested_by:d.requested_by,country_manager:d.country_manager,description:d.description,status:d.status,brief_link:d.brief_link,extra_data:d.extra_data,updated_by:r},{error:m}=await qe.from("tablero_cdc_projects").update(f).eq("id",e);if(m)throw nr(m.message),m;kC(u),await jC(e,u),o&&await OC(e,t.pricingItems);const b=wU(l,u,o);b.length>0&&await MC(e,"updated","Proyecto actualizado",b.slice(0,8).join(`
`));const g=await Dd(e,"update");return await As(vn),{projectId:e,...g}}finally{Ar=Math.max(0,Ar-1)}}async function BU(e){nr(null),Ar+=1;try{if(!await _U()){const l="No tienes permiso para eliminar proyectos.";throw nr(l),new Error(l)}const r=await Dd(e,"delete");if(r.sheetSyncStatus!=="synced"){const l=r.sheetSyncMessage||"No se pudo eliminar el proyecto del Google Sheet.";throw nr(l),new Error(l)}const{error:s}=await qe.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw nr(s.message),s;const{error:o}=await qe.from("tablero_cdc_projects").delete().eq("id",e);if(o)throw nr(o.message),o;CU(e),await As(vn)}finally{Ar=Math.max(0,Ar-1)}}async function HU(e){const{data:t,error:r}=await qe.rpc("tablero_cdc_get_pricing_summary",{p_tab:e.tab,p_search:e.search,p_country:e.country||"",p_brand:e.brand||"",p_client:e.client||"",p_cm:e.cm||""});if(r)throw r;const s=t||{},o=Number(s.total_amount||0),l=Number(s.project_count||0);return{totalAmount:Number.isFinite(o)?o:0,projectCount:Number.isFinite(l)?l:0,loadedAt:Date.now()}}async function qU(e){let r=0,s=null,o=0;for(;s===null||r<s;){let l=qe.from("tablero_cdc_projects").select("id, internal_amount",{count:"exact"}).order("created_at",{ascending:!1});l=DC(l,e);const{data:u,error:d,count:f}=await l.range(r,r+1e3-1);if(d)throw d;s===null&&(s=f??(u||[]).length);const m=u||[];if(m.forEach(b=>{const g=Number(b.internal_amount??0);Number.isFinite(g)&&g>0&&(o+=g)}),m.length<1e3)break;r+=1e3}return{totalAmount:o,projectCount:s??0,loadedAt:Date.now()}}async function ox(e){const t=SC({...e,page:1,pageSize:1e3});try{return await HU(t)}catch(r){if(!PU(r))throw r;return console.warn("RPC tablero_cdc_get_pricing_summary no existe todavía. Usando suma directa como respaldo temporal.",r),qU(t)}}function VU(e,t){const[r,s]=v.useState({totalAmount:0,projectCount:0,loadedAt:null}),[o,l]=v.useState(!1),[u,d]=v.useState(null),f=e.tab,m=e.search,b=e.country,g=e.brand,w=e.client,_=e.cm;return v.useEffect(()=>{if(!t){s({totalAmount:0,projectCount:0,loadedAt:null}),d(null),l(!1);return}let E=!1;return l(!0),d(null),ox({tab:f,search:m,country:b,brand:g,client:w,cm:_,page:1,pageSize:1e3}).then(S=>{E||s(S)}).catch(S=>{E||(console.error("No se pudo calcular el total tarifado filtrado:",S),d(S instanceof Error?S.message:"No se pudo calcular el total tarifado filtrado."))}).finally(()=>{E||l(!1)}),()=>{E=!0}},[t,f,m,b,g,w,_]),{summary:r,loading:o,error:u,refresh:()=>ox(e).then(E=>(s(E),E))}}function LC(e){const[,t]=v.useState(0),r=e==null?void 0:e.tab,s=e==null?void 0:e.search,o=e==null?void 0:e.page,l=e==null?void 0:e.pageSize,u=e==null?void 0:e.country,d=e==null?void 0:e.brand,f=e==null?void 0:e.client,m=e==null?void 0:e.cm;return v.useEffect(()=>{const b=()=>t(g=>g+1);return Pu.push(b),_u+=1,TU(),()=>{Pu=Pu.filter(g=>g!==b),_u=Math.max(0,_u-1),_u===0&&RU()}},[]),v.useEffect(()=>{if(r&&o&&l){As({tab:r,search:s??"",page:o,pageSize:l,country:u??"",brand:d??"",client:f??"",cm:m??""});return}!_C&&!Cl&&As()},[r,s,o,l,u,d,f,m]),{projects:aa,totalProjects:sd,filterOptions:xC,loading:Cl,error:gg,refresh:()=>As(e??vn),add:IU,update:$U,remove:BU}}function GU(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const FU=e=>{switch(e){case"success":return WU;case"info":return JU;case"warning":return XU;case"error":return QU;default:return null}},KU=Array(12).fill(0),YU=({visible:e,className:t})=>le.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},le.createElement("div",{className:"sonner-spinner"},KU.map((r,s)=>le.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),WU=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),XU=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),JU=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),QU=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ZU=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},le.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),le.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),eI=()=>{const[e,t]=le.useState(document.hidden);return le.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let dp=1;class tI{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:s,...o}=t,l=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:dp++,u=this.toasts.find(f=>f.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(f=>f.id===l?(this.publish({...f,...t,id:l,title:s}),{...f,...t,id:l,dismissible:d,title:s}):f):this.addToast({title:s,...o,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let s;r.loading!==void 0&&(s=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let l=s!==void 0,u;const d=o.then(async m=>{if(u=["resolve",m],le.isValidElement(m))l=!1,this.create({id:s,type:"default",message:m});else if(rI(m)&&!m.ok){l=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${m.status}`):r.error,w=typeof r.description=="function"?await r.description(`HTTP error! status: ${m.status}`):r.description,E=typeof g=="object"&&!le.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:w,...E})}else if(m instanceof Error){l=!1;const g=typeof r.error=="function"?await r.error(m):r.error,w=typeof r.description=="function"?await r.description(m):r.description,E=typeof g=="object"&&!le.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:w,...E})}else if(r.success!==void 0){l=!1;const g=typeof r.success=="function"?await r.success(m):r.success,w=typeof r.description=="function"?await r.description(m):r.description,E=typeof g=="object"&&!le.isValidElement(g)?g:{message:g};this.create({id:s,type:"success",description:w,...E})}}).catch(async m=>{if(u=["reject",m],r.error!==void 0){l=!1;const b=typeof r.error=="function"?await r.error(m):r.error,g=typeof r.description=="function"?await r.description(m):r.description,_=typeof b=="object"&&!le.isValidElement(b)?b:{message:b};this.create({id:s,type:"error",description:g,..._})}}).finally(()=>{l&&(this.dismiss(s),s=void 0),r.finally==null||r.finally.call(r)}),f=()=>new Promise((m,b)=>d.then(()=>u[0]==="reject"?b(u[1]):m(u[1])).catch(b));return typeof s!="string"&&typeof s!="number"?{unwrap:f}:Object.assign(s,{unwrap:f})},this.custom=(t,r)=>{const s=(r==null?void 0:r.id)||dp++;return this.create({jsx:t(s),id:s,...r}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const yn=new tI,nI=(e,t)=>{const r=(t==null?void 0:t.id)||dp++;return yn.addToast({title:e,...t,id:r}),r},rI=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",aI=nI,sI=()=>yn.toasts,iI=()=>yn.getActiveToasts(),br=Object.assign(aI,{success:yn.success,info:yn.info,warning:yn.warning,error:yn.error,custom:yn.custom,message:yn.message,promise:yn.promise,dismiss:yn.dismiss,loading:yn.loading},{getHistory:sI,getToasts:iI});GU("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Cu(e){return e.label!==void 0}const oI=3,lI="24px",cI="16px",lx=4e3,uI=356,dI=14,fI=45,hI=200;function wr(...e){return e.filter(Boolean).join(" ")}function mI(e){const[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}const pI=e=>{var t,r,s,o,l,u,d,f,m;const{invert:b,toast:g,unstyled:w,interacting:_,setHeights:E,visibleToasts:S,heights:A,index:C,toasts:R,expanded:N,removeToast:P,defaultRichColors:F,closeButton:$,style:L,cancelButtonStyle:q,actionButtonStyle:ie,className:he="",descriptionClassName:pe="",duration:oe,position:ue,gap:ce,expandByDefault:fe,classNames:M,icons:K,closeButtonAriaLabel:J="Close toast"}=e,[ne,X]=le.useState(null),[k,j]=le.useState(null),[I,Y]=le.useState(!1),[V,Z]=le.useState(!1),[z,ee]=le.useState(!1),[ae,xe]=le.useState(!1),[Ee,Te]=le.useState(!1),[nt,Be]=le.useState(0),[Kt,Yt]=le.useState(0),Ot=le.useRef(g.duration||oe||lx),wn=le.useRef(null),yt=le.useRef(null),cr=C===0,Pe=C+1<=S,ot=g.type,rt=g.dismissible!==!1,ht=g.className||"",no=g.descriptionClassName||"",Nr=le.useMemo(()=>A.findIndex(ke=>ke.toastId===g.id)||0,[A,g.id]),ur=le.useMemo(()=>{var ke;return(ke=g.closeButton)!=null?ke:$},[g.closeButton,$]),dr=le.useMemo(()=>g.duration||oe||lx,[g.duration,oe]),kr=le.useRef(0),Fn=le.useRef(0),Qa=le.useRef(0),Kn=le.useRef(null),[fr,Ut]=ue.split("-"),xn=le.useMemo(()=>A.reduce((ke,dt,Dt)=>Dt>=Nr?ke:ke+dt.height,0),[A,Nr]),Mt=eI(),ro=g.invert||b,se=ot==="loading";Fn.current=le.useMemo(()=>Nr*ce+xn,[Nr,xn]),le.useEffect(()=>{Ot.current=dr},[dr]),le.useEffect(()=>{Y(!0)},[]),le.useEffect(()=>{const ke=yt.current;if(ke){const dt=ke.getBoundingClientRect().height;return Yt(dt),E(Dt=>[{toastId:g.id,height:dt,position:g.position},...Dt]),()=>E(Dt=>Dt.filter(Xt=>Xt.toastId!==g.id))}},[E,g.id]),le.useLayoutEffect(()=>{if(!I)return;const ke=yt.current,dt=ke.style.height;ke.style.height="auto";const Dt=ke.getBoundingClientRect().height;ke.style.height=dt,Yt(Dt),E(Xt=>Xt.find(mt=>mt.toastId===g.id)?Xt.map(mt=>mt.toastId===g.id?{...mt,height:Dt}:mt):[{toastId:g.id,height:Dt,position:g.position},...Xt])},[I,g.title,g.description,E,g.id,g.jsx,g.action,g.cancel]);const Ce=le.useCallback(()=>{Z(!0),Be(Fn.current),E(ke=>ke.filter(dt=>dt.toastId!==g.id)),setTimeout(()=>{P(g)},hI)},[g,P,E,Fn]);le.useEffect(()=>{if(g.promise&&ot==="loading"||g.duration===1/0||g.type==="loading")return;let ke;return N||_||Mt?(()=>{if(Qa.current<kr.current){const Xt=new Date().getTime()-kr.current;Ot.current=Ot.current-Xt}Qa.current=new Date().getTime()})():(()=>{Ot.current!==1/0&&(kr.current=new Date().getTime(),ke=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),Ce()},Ot.current))})(),()=>clearTimeout(ke)},[N,_,g,ot,Mt,Ce]),le.useEffect(()=>{g.delete&&(Ce(),g.onDismiss==null||g.onDismiss.call(g,g))},[Ce,g.delete]);function Ge(){var ke;if(K!=null&&K.loading){var dt;return le.createElement("div",{className:wr(M==null?void 0:M.loader,g==null||(dt=g.classNames)==null?void 0:dt.loader,"sonner-loader"),"data-visible":ot==="loading"},K.loading)}return le.createElement(YU,{className:wr(M==null?void 0:M.loader,g==null||(ke=g.classNames)==null?void 0:ke.loader),visible:ot==="loading"})}const Ye=g.icon||(K==null?void 0:K[ot])||FU(ot);var Wt,nn;return le.createElement("li",{tabIndex:0,ref:yt,className:wr(he,ht,M==null?void 0:M.toast,g==null||(t=g.classNames)==null?void 0:t.toast,M==null?void 0:M.default,M==null?void 0:M[ot],g==null||(r=g.classNames)==null?void 0:r[ot]),"data-sonner-toast":"","data-rich-colors":(Wt=g.richColors)!=null?Wt:F,"data-styled":!(g.jsx||g.unstyled||w),"data-mounted":I,"data-promise":!!g.promise,"data-swiped":Ee,"data-removed":V,"data-visible":Pe,"data-y-position":fr,"data-x-position":Ut,"data-index":C,"data-front":cr,"data-swiping":z,"data-dismissible":rt,"data-type":ot,"data-invert":ro,"data-swipe-out":ae,"data-swipe-direction":k,"data-expanded":!!(N||fe&&I),"data-testid":g.testId,style:{"--index":C,"--toasts-before":C,"--z-index":R.length-C,"--offset":`${V?nt:Fn.current}px`,"--initial-height":fe?"auto":`${Kt}px`,...L,...g.style},onDragEnd:()=>{ee(!1),X(null),Kn.current=null},onPointerDown:ke=>{ke.button!==2&&(se||!rt||(wn.current=new Date,Be(Fn.current),ke.target.setPointerCapture(ke.pointerId),ke.target.tagName!=="BUTTON"&&(ee(!0),Kn.current={x:ke.clientX,y:ke.clientY})))},onPointerUp:()=>{var ke,dt,Dt;if(ae||!rt)return;Kn.current=null;const Xt=Number(((ke=yt.current)==null?void 0:ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ua=Number(((dt=yt.current)==null?void 0:dt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),mt=new Date().getTime()-((Dt=wn.current)==null?void 0:Dt.getTime()),rn=ne==="x"?Xt:ua,Za=Math.abs(rn)/mt;if(Math.abs(rn)>=fI||Za>.11){Be(Fn.current),g.onDismiss==null||g.onDismiss.call(g,g),j(ne==="x"?Xt>0?"right":"left":ua>0?"down":"up"),Ce(),xe(!0);return}else{var an,sn;(an=yt.current)==null||an.style.setProperty("--swipe-amount-x","0px"),(sn=yt.current)==null||sn.style.setProperty("--swipe-amount-y","0px")}Te(!1),ee(!1),X(null)},onPointerMove:ke=>{var dt,Dt,Xt;if(!Kn.current||!rt||((dt=window.getSelection())==null?void 0:dt.toString().length)>0)return;const mt=ke.clientY-Kn.current.y,rn=ke.clientX-Kn.current.x;var Za;const an=(Za=e.swipeDirections)!=null?Za:mI(ue);!ne&&(Math.abs(rn)>1||Math.abs(mt)>1)&&X(Math.abs(rn)>Math.abs(mt)?"x":"y");let sn={x:0,y:0};const zs=Yn=>1/(1.5+Math.abs(Yn)/20);if(ne==="y"){if(an.includes("top")||an.includes("bottom"))if(an.includes("top")&&mt<0||an.includes("bottom")&&mt>0)sn.y=mt;else{const Yn=mt*zs(mt);sn.y=Math.abs(Yn)<Math.abs(mt)?Yn:mt}}else if(ne==="x"&&(an.includes("left")||an.includes("right")))if(an.includes("left")&&rn<0||an.includes("right")&&rn>0)sn.x=rn;else{const Yn=rn*zs(rn);sn.x=Math.abs(Yn)<Math.abs(rn)?Yn:rn}(Math.abs(sn.x)>0||Math.abs(sn.y)>0)&&Te(!0),(Dt=yt.current)==null||Dt.style.setProperty("--swipe-amount-x",`${sn.x}px`),(Xt=yt.current)==null||Xt.style.setProperty("--swipe-amount-y",`${sn.y}px`)}},ur&&!g.jsx&&ot!=="loading"?le.createElement("button",{"aria-label":J,"data-disabled":se,"data-close-button":!0,onClick:se||!rt?()=>{}:()=>{Ce(),g.onDismiss==null||g.onDismiss.call(g,g)},className:wr(M==null?void 0:M.closeButton,g==null||(s=g.classNames)==null?void 0:s.closeButton)},(nn=K==null?void 0:K.close)!=null?nn:ZU):null,(ot||g.icon||g.promise)&&g.icon!==null&&((K==null?void 0:K[ot])!==null||g.icon)?le.createElement("div",{"data-icon":"",className:wr(M==null?void 0:M.icon,g==null||(o=g.classNames)==null?void 0:o.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||Ge():null,g.type!=="loading"?Ye:null):null,le.createElement("div",{"data-content":"",className:wr(M==null?void 0:M.content,g==null||(l=g.classNames)==null?void 0:l.content)},le.createElement("div",{"data-title":"",className:wr(M==null?void 0:M.title,g==null||(u=g.classNames)==null?void 0:u.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?le.createElement("div",{"data-description":"",className:wr(pe,no,M==null?void 0:M.description,g==null||(d=g.classNames)==null?void 0:d.description)},typeof g.description=="function"?g.description():g.description):null),le.isValidElement(g.cancel)?g.cancel:g.cancel&&Cu(g.cancel)?le.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||q,onClick:ke=>{Cu(g.cancel)&&rt&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,ke),Ce())},className:wr(M==null?void 0:M.cancelButton,g==null||(f=g.classNames)==null?void 0:f.cancelButton)},g.cancel.label):null,le.isValidElement(g.action)?g.action:g.action&&Cu(g.action)?le.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||ie,onClick:ke=>{Cu(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,ke),!ke.defaultPrevented&&Ce())},className:wr(M==null?void 0:M.actionButton,g==null||(m=g.classNames)==null?void 0:m.actionButton)},g.action.label):null)};function cx(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function gI(e,t){const r={};return[e,t].forEach((s,o)=>{const l=o===1,u=l?"--mobile-offset":"--offset",d=l?cI:lI;function f(m){["top","right","bottom","left"].forEach(b=>{r[`${u}-${b}`]=typeof m=="number"?`${m}px`:m})}typeof s=="number"||typeof s=="string"?f(s):typeof s=="object"?["top","right","bottom","left"].forEach(m=>{s[m]===void 0?r[`${u}-${m}`]=d:r[`${u}-${m}`]=typeof s[m]=="number"?`${s[m]}px`:s[m]}):f(d)}),r}const yI=le.forwardRef(function(t,r){const{id:s,invert:o,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:f,className:m,offset:b,mobileOffset:g,theme:w="light",richColors:_,duration:E,style:S,visibleToasts:A=oI,toastOptions:C,dir:R=cx(),gap:N=dI,icons:P,containerAriaLabel:F="Notifications"}=t,[$,L]=le.useState([]),q=le.useMemo(()=>s?$.filter(I=>I.toasterId===s):$.filter(I=>!I.toasterId),[$,s]),ie=le.useMemo(()=>Array.from(new Set([l].concat(q.filter(I=>I.position).map(I=>I.position)))),[q,l]),[he,pe]=le.useState([]),[oe,ue]=le.useState(!1),[ce,fe]=le.useState(!1),[M,K]=le.useState(w!=="system"?w:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),J=le.useRef(null),ne=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),X=le.useRef(null),k=le.useRef(!1),j=le.useCallback(I=>{L(Y=>{var V;return(V=Y.find(Z=>Z.id===I.id))!=null&&V.delete||yn.dismiss(I.id),Y.filter(({id:Z})=>Z!==I.id)})},[]);return le.useEffect(()=>yn.subscribe(I=>{if(I.dismiss){requestAnimationFrame(()=>{L(Y=>Y.map(V=>V.id===I.id?{...V,delete:!0}:V))});return}setTimeout(()=>{Lx.flushSync(()=>{L(Y=>{const V=Y.findIndex(Z=>Z.id===I.id);return V!==-1?[...Y.slice(0,V),{...Y[V],...I},...Y.slice(V+1)]:[I,...Y]})})})}),[$]),le.useEffect(()=>{if(w!=="system"){K(w);return}if(w==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const I=window.matchMedia("(prefers-color-scheme: dark)");try{I.addEventListener("change",({matches:Y})=>{K(Y?"dark":"light")})}catch{I.addListener(({matches:V})=>{try{K(V?"dark":"light")}catch(Z){console.error(Z)}})}},[w]),le.useEffect(()=>{$.length<=1&&ue(!1)},[$]),le.useEffect(()=>{const I=Y=>{var V;if(u.every(ee=>Y[ee]||Y.code===ee)){var z;ue(!0),(z=J.current)==null||z.focus()}Y.code==="Escape"&&(document.activeElement===J.current||(V=J.current)!=null&&V.contains(document.activeElement))&&ue(!1)};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[u]),le.useEffect(()=>{if(J.current)return()=>{X.current&&(X.current.focus({preventScroll:!0}),X.current=null,k.current=!1)}},[J.current]),le.createElement("section",{ref:r,"aria-label":`${F} ${ne}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ie.map((I,Y)=>{var V;const[Z,z]=I.split("-");return q.length?le.createElement("ol",{key:I,dir:R==="auto"?cx():R,tabIndex:-1,ref:J,className:m,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":Z,"data-x-position":z,style:{"--front-toast-height":`${((V=he[0])==null?void 0:V.height)||0}px`,"--width":`${uI}px`,"--gap":`${N}px`,...S,...gI(b,g)},onBlur:ee=>{k.current&&!ee.currentTarget.contains(ee.relatedTarget)&&(k.current=!1,X.current&&(X.current.focus({preventScroll:!0}),X.current=null))},onFocus:ee=>{ee.target instanceof HTMLElement&&ee.target.dataset.dismissible==="false"||k.current||(k.current=!0,X.current=ee.relatedTarget)},onMouseEnter:()=>ue(!0),onMouseMove:()=>ue(!0),onMouseLeave:()=>{ce||ue(!1)},onDragEnd:()=>ue(!1),onPointerDown:ee=>{ee.target instanceof HTMLElement&&ee.target.dataset.dismissible==="false"||fe(!0)},onPointerUp:()=>fe(!1)},q.filter(ee=>!ee.position&&Y===0||ee.position===I).map((ee,ae)=>{var xe,Ee;return le.createElement(pI,{key:ee.id,icons:P,index:ae,toast:ee,defaultRichColors:_,duration:(xe=C==null?void 0:C.duration)!=null?xe:E,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:o,visibleToasts:A,closeButton:(Ee=C==null?void 0:C.closeButton)!=null?Ee:f,interacting:ce,position:I,style:C==null?void 0:C.style,unstyled:C==null?void 0:C.unstyled,classNames:C==null?void 0:C.classNames,cancelButtonStyle:C==null?void 0:C.cancelButtonStyle,actionButtonStyle:C==null?void 0:C.actionButtonStyle,closeButtonAriaLabel:C==null?void 0:C.closeButtonAriaLabel,removeToast:j,toasts:q.filter(Te=>Te.position==ee.position),heights:he.filter(Te=>Te.position==ee.position),setHeights:pe,expandByDefault:d,gap:N,expanded:oe,swipeDirections:t.swipeDirections})})):null}))}),vI="Walmart Connect WMC",ki=15;function bI(e){return new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function wI(e){return e.split(`
`).map(t=>t.trim()).filter(Boolean)}function PC(e){return e.reduce((t,r)=>t+Number(r.amount||0),0)}function xI(e){return e.map(t=>({id:t.id,source:t.source,category:t.category,serviceName:t.serviceName,workType:t.workType,complexityLevel:t.complexityLevel,referenceLabel:t.referenceLabel,referenceMin:t.referenceMin,referenceMax:t.referenceMax,amount:t.amount,description:t.description}))}function _I(e,t){if(!t.length||e==null)return!1;const r=Number(e);if(!Number.isFinite(r)||r<=0)return!1;const s=PC(t);return Math.abs(r-s)>.01}function SI(e,t=[]){const r=Ft(e);if(!r)return[];const s=new Map(pt(t).map(f=>[it(f),f])),o=s.get(it(r));if(o)return[o];const l=r.split(/[,;]/).map(f=>Ft(f)).filter(Boolean);if(l.length<=1)return pt([o||r]);const u=[];let d=0;for(;d<l.length;){let f="",m=d+1;for(let b=l.length;b>d;b-=1){const g=l.slice(d,b).join(", "),w=s.get(it(g));if(w){f=w,m=b;break}}u.push(f||l[d]),d=m}return pt(u)}function EI(e){return pt(e.map(t=>Ft(t)).filter(Boolean)).join(", ")}function CI(e,t=[]){const r=Ft(e);if(!r)return[];const s=new Map(pt(t).map(u=>[it(u),u])),o=s.get(it(r));if(o)return[o];const l=r.split(/[,;]/).map(u=>Ft(u)).filter(Boolean);return l.length<=1?pt([o||r]):pt(l.map(u=>s.get(it(u))||u))}function AI(e){return pt(e.map(t=>Ft(t)).filter(Boolean)).join(", ")}function Au(e){return it(e)===it(vI)}const ux=()=>{const e=new Date;return{nombre:"",color:"blue",cliente:"",bu:"",cm:"",marca:"",solicitante:"",comentarios:"",briefLink:"",propuestaLinks:[],afLinks:[],status:"",monto:null,mes:LP[e.getMonth()],anio:e.getFullYear()}};function TI({open:e,onOpenChange:t,project:r,onDelete:s,deleting:o=!1}){const{add:l,update:u}=LC(),{lists:d,loading:f,error:m,refresh:b}=bC(),{isGerardo:g,canDeleteProjects:w,canManageInternalPricing:_}=Ol(),E=!!r,[S,A]=v.useState(ux()),[C,R]=v.useState([]),[N,P]=v.useState(!1),[F,$]=v.useState(""),[L,q]=v.useState(null),[ie,he]=v.useState(null),[pe,oe]=v.useState([]),[ue,ce]=v.useState(!1),[fe,M]=v.useState(null),[K,J]=v.useState(""),[ne,X]=v.useState(!1),[k,j]=v.useState(!1),[I,Y]=v.useState(!1),[V,Z]=v.useState([]),[z,ee]=v.useState(!1),[ae,xe]=v.useState(null),[Ee,Te]=v.useState(!1),nt=SI(S.marca,d.marcas),Be=CI(S.bu,d.bus),Kt=pt(Xw(d.clientes,S.cliente)),Yt=pt([...d.marcas,...nt]),Ot=pt([...d.bus,...Be]),wn=pt(Xw(d.status,S.status)),yt=Ot.filter(se=>it(se).includes(it(F))),cr=PC(V);v.useEffect(()=>{if(he(null),q(null),r){const{id:se,createdAt:Ce,...Ge}=r,Ye=Ft(Ge.bu);A({...Ge,bu:Ye}),R(Ye?[Ye]:[]),$(""),oe([]),X(!1),M(null),J(""),Z([]),xe(null),Te(!1)}else e&&(A(ux()),R([]),$(""),oe([]),X(!1),M(null),J(""),Z([]),xe(null),Te(!1))},[r,e]);const Pe=v.useCallback(async()=>{if(r!=null&&r.id)try{ce(!0),M(null);const se=await ix(r.id,ki+1);oe(se.slice(0,ki)),X(se.length>ki)}catch(se){console.warn("No se pudo cargar el historial del proyecto:",se),M("No se pudo cargar el historial. Revisa que el SQL de actividad esté ejecutado en Supabase."),oe([]),X(!1)}finally{ce(!1)}},[r==null?void 0:r.id]),ot=v.useCallback(async()=>{if(!(!(r!=null&&r.id)||k||!ne))try{j(!0),M(null);const se=await ix(r.id,ki+1,pe.length);oe(Ce=>[...Ce,...se.slice(0,ki)]),X(se.length>ki)}catch(se){console.warn("No se pudo cargar más historial del proyecto:",se),M("No se pudo cargar más actividad. Inténtalo nuevamente.")}finally{j(!1)}},[ne,pe.length,k,r==null?void 0:r.id]);v.useEffect(()=>{!e||!(r!=null&&r.id)||Pe()},[e,r==null?void 0:r.id,Pe]),v.useEffect(()=>{if(!e||!(r!=null&&r.id)||!_)return;let se=!1;return(async()=>{try{ee(!0),xe(null);const Ge=await NU(r.id),Ye=xI(Ge);se||(Te(_I(r.monto,Ye)),Z(Ye))}catch(Ge){console.warn("No se pudo cargar el tarifario del proyecto:",Ge),se||(Z([]),xe("No se pudieron cargar los costos guardados. Revisa que el SQL del tarifario esté ejecutado en Supabase."))}finally{se||ee(!1)}})(),()=>{se=!0}},[_,e,r==null?void 0:r.id,r==null?void 0:r.monto]);const rt=(se,Ce)=>A(Ge=>({...Ge,[se]:Ce}));v.useEffect(()=>{if(!_||!V.length||Ee)return;const se=Number(cr.toFixed(2));A(Ce=>Ce.monto===se?Ce:{...Ce,monto:se})},[_,Ee,V.length,cr]);const ht=se=>{const Ce=d.buCm[se];if(Ce)return Ce;const Ge=it(se),Ye=Object.entries(d.buCm).find(([Wt])=>it(Wt)===Ge);return(Ye==null?void 0:Ye[1])??""},no=se=>{const Ce=pt(se.map(Ye=>Ft(Ye)).filter(Boolean)),Ge=pt(Ce.map(ht).filter(Boolean));A(Ye=>({...Ye,bu:AI(Ce),cm:Ge.join(", ")}))},Nr=se=>{const Ce=Ft(se);A(Ge=>({...Ge,cliente:Ce,...Au(Ce)&&!E?{bu:"",cm:""}:Ge.cliente&&Au(Ge.cliente)?{bu:"",cm:""}:{}})),Au(Ce)||(R([]),$(""))},ur=!E&&Au(S.cliente),dr=ur?C:Be,kr=!E&&dr.length>1,Fn=(se,Ce)=>{const Ge=Ft(se);R(Ye=>Ce?pt([...Ye,Ge]):Ye.filter(Wt=>it(Wt)!==it(Ge)))},Qa=C.map(se=>({country:se,manager:ht(se)})),Kn=Be.map(se=>({country:se,manager:ht(se)})),fr=S.nombre.trim()&&S.cliente&&S.marca&&S.solicitante.trim()&&(ur?C.length>0:Be.length>0),Ut=se=>{if(se.sheetSyncStatus==="synced"){br.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó y se sincronizó con el Google Sheet."});return}if(se.sheetSyncStatus==="skipped"){br.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó. La sincronización con Google Sheet no está configurada."});return}br.warning("Proyecto guardado con aviso",{description:se.sheetSyncMessage})},xn=async()=>{if(!(!(r!=null&&r.id)||!K.trim()||I))try{Y(!0);const se=await OU(r.id,K);rt("comentarios",se.comments),J(""),await Pe(),se.sheetSyncStatus==="synced"?br.success("Comentario agregado al historial",{description:"También se actualizó la columna Comentarios del Google Sheet."}):se.sheetSyncStatus==="skipped"?br.success("Comentario agregado al historial",{description:"Se guardó como comentario interno. La sincronización con Sheet no está configurada."}):br.warning("Comentario agregado con aviso",{description:se.sheetSyncMessage})}catch(se){console.error("Error agregando comentario al historial:",se);const Ce=se instanceof Error?se.message:"No se pudo agregar el comentario al historial.";br.error("No se pudo agregar el comentario",{description:Ce})}finally{Y(!1)}},Mt=async()=>{if(!fr||N)return;const se=g?S:_?{...S,status:(r==null?void 0:r.status)??""}:{...S,status:(r==null?void 0:r.status)??"",monto:(r==null?void 0:r.monto)??null};try{if(P(!0),he(null),q("Guardando y sincronizando con Google Sheet…"),kr){const Ce=dr,Ge=[];for(const[Wt,nn]of Ce.entries()){q(`Guardando país ${Wt+1} de ${Ce.length}: ${nn}`);const ke={...se,bu:nn,cm:ht(nn),id:crypto.randomUUID(),createdAt:Date.now()+Wt};Ge.push(await l({...ke,pricingItems:_?V:void 0}))}const Ye=Ge.filter(Wt=>Wt.sheetSyncStatus!=="synced");Ye.length===0?br.success("Proyectos multipaís creados",{description:`Se crearon ${Ce.length} proyectos y ${Ce.length} filas en Google Sheet. El Interno Cargado se aplicó por país.`}):br.warning("Proyectos multipaís creados con aviso",{description:`${Ye.length} de ${Ce.length} sincronizaciones con Google Sheet requieren revisión.`})}else{const Ce=E&&r?await u(r.id,{...se,pricingItems:_?V:void 0}):await l({...se,id:crypto.randomUUID(),createdAt:Date.now(),pricingItems:_?V:void 0});Ut(Ce)}t(!1)}catch(Ce){console.error("Error guardando proyecto:",Ce);const Ge=Ce instanceof Error?Ce.message:"No se pudo guardar el proyecto. Revisa los permisos o intenta de nuevo.";he(Ge),br.error("No se pudo guardar el proyecto",{description:Ge})}finally{P(!1),q(null)}},ro=!!S.status;return y.jsx(e4,{open:e,onOpenChange:t,children:y.jsxs(HE,{className:"max-w-3xl max-h-[92vh] overflow-y-auto p-0 gap-0",children:[y.jsx("div",{className:"h-2.5 w-full rounded-t-lg",style:{backgroundColor:xE(S.color)}}),y.jsxs("div",{className:"px-7 pt-6 pb-7",children:[y.jsx(qE,{className:"space-y-3",children:y.jsx("div",{className:"flex items-start justify-between gap-4",children:y.jsxs("div",{className:"flex-1",children:[y.jsx(GE,{className:"text-2xl tracking-tight",children:E?S.nombre||"Sin título":"Nuevo proyecto"}),y.jsxs(FE,{className:"mt-1 flex items-center gap-2 text-xs",children:[y.jsx(r2,{className:"w-3.5 h-3.5"}),S.mes," · ",S.anio,ro&&y.jsx(Cs,{variant:"secondary",className:"ml-2",children:"Cerrado"})]})]})})}),y.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mt-6",children:[y.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[y.jsxs(xt,{children:["Nombre del proyecto ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(jn,{value:S.nombre,onChange:se=>rt("nombre",se.target.value),placeholder:"Ej: Promoción Día de las Madres",className:"h-10"})]}),y.jsxs("div",{className:"md:col-span-2 space-y-2",children:[y.jsx(xt,{children:"Etiqueta de color"}),y.jsx(tz,{value:S.color,onChange:se=>rt("color",se)})]}),y.jsx(Ii,{className:"md:col-span-2 my-1"}),(f||m)&&y.jsxs("div",{className:Ae("md:col-span-2 flex items-center justify-between gap-3 rounded-xl border px-3 py-2 text-xs",m?"border-amber-300/50 bg-amber-50 text-amber-900":"border-border bg-muted/30 text-muted-foreground"),children:[y.jsx("span",{className:"flex items-center gap-2",children:f?y.jsxs(y.Fragment,{children:[y.jsx(Ha,{className:"h-3.5 w-3.5 animate-spin"}),"Cargando listas…"]}):y.jsxs(y.Fragment,{children:[y.jsx(Gu,{className:"h-3.5 w-3.5"}),"No se pudieron cargar las listas. Se usaron opciones locales."]})}),m&&y.jsx("button",{type:"button",onClick:()=>void b(),className:"font-medium text-amber-950 underline-offset-4 hover:underline",children:"Reintentar"})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsxs(xt,{children:["Cliente ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(ea,{value:S.cliente,options:Kt,onValueChange:Nr,placeholder:"Seleccionar…",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente."})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsxs(xt,{children:["Marca ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(Qw,{values:nt,options:Yt,onValuesChange:se=>rt("marca",EI(se)),placeholder:"Seleccionar una o varias marcas…",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",summaryLabel:"marcas seleccionadas"})]}),ur?y.jsxs("div",{className:"md:col-span-2 space-y-2 rounded-xl border border-primary/20 bg-primary/5 p-3",children:[y.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[y.jsxs(xt,{children:["BU Solicita (Países) ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsxs("span",{className:"text-xs font-medium text-primary",children:[C.length," seleccionado(s)"]})]}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Para Walmart Connect WMC puedes seleccionar varios países. La app creará un proyecto y una fila del Sheet por cada país, como hasta ahora."}),y.jsxs("div",{className:"relative",children:[y.jsx(Fu,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),y.jsx(jn,{value:F,onChange:se=>$(se.target.value),placeholder:"Buscar país…",className:"h-9 pl-9 bg-card"})]}),y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:yt.map(se=>{const Ce=C.some(Ye=>it(Ye)===it(se)),Ge=ht(se);return y.jsxs("label",{className:Ae("flex cursor-pointer items-start gap-2 rounded-lg border bg-card px-3 py-2 text-sm transition-colors",Ce?"border-primary/50 bg-primary/10":"border-border hover:bg-muted/40"),children:[y.jsx(r1,{checked:Ce,onCheckedChange:Ye=>Fn(se,Ye===!0),className:"mt-0.5"}),y.jsxs("span",{className:"leading-tight",children:[y.jsx("span",{className:"block font-medium",children:se}),y.jsxs("span",{className:"text-xs text-muted-foreground",children:["CM: ",Ge||"—"]})]})]},se)})})]}):y.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[y.jsxs(xt,{children:["BU Solicita (Países) ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(Qw,{values:Be,options:Ot,onValuesChange:no,placeholder:"Seleccionar uno o varios países…",searchPlaceholder:"Buscar país…",emptyText:"No se encontró ese país.",summaryLabel:"países seleccionados"}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Si seleccionas varios países al crear, la app creará un proyecto y una fila del Sheet por cada país."})]}),y.jsxs("div",{className:Ae("space-y-1.5",ur&&"md:col-span-2"),children:[y.jsxs(xt,{className:"flex items-center gap-1.5",children:["Country Manager ",y.jsx("span",{className:"text-xs text-muted-foreground",children:"(automático)"})]}),ur?y.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:Qa.length===0?y.jsx("span",{className:"text-muted-foreground",children:"Selecciona uno o más países."}):y.jsx("div",{className:"flex flex-wrap gap-1.5",children:Qa.map(({country:se,manager:Ce})=>y.jsxs(Cs,{variant:"secondary",className:"font-normal",children:[se,": ",Ce||"—"]},se))})}):y.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:Kn.length===0?y.jsx("span",{className:"text-muted-foreground",children:"Selecciona uno o más países."}):y.jsx("div",{className:"flex flex-wrap gap-1.5",children:Kn.map(({country:se,manager:Ce})=>y.jsxs(Cs,{variant:"secondary",className:"font-normal",children:[se,": ",Ce||"—"]},se))})})]}),kr&&_&&y.jsx("div",{className:"md:col-span-2 rounded-xl border border-amber-300/50 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:"Si seleccionas varios países, el Interno Cargado se aplicará por cada país. La app no divide el monto automáticamente."}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsxs(xt,{children:["Solicitado por ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(jn,{value:S.solicitante,onChange:se=>rt("solicitante",se.target.value),placeholder:"Nombre de quien solicita",className:"h-10"})]}),y.jsx(RI,{isEdit:E,items:pe,loading:ue,error:fe,note:K,hasMore:ne,loadingMore:k,addingNote:I,onNoteChange:J,onAddNote:xn,onRefresh:Pe,onLoadMore:ot}),y.jsx(Ii,{className:"md:col-span-2 my-1"}),y.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[y.jsxs(xt,{children:["Link del Brief"," ",y.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(carpeta de Fulgencio)"})]}),y.jsx(jn,{value:S.briefLink,onChange:se=>rt("briefLink",se.target.value),placeholder:"https://drive.google.com/…",className:"h-10"})]}),y.jsx("div",{className:"md:col-span-2",children:y.jsx(Fw,{label:"Links de Propuestas",links:S.propuestaLinks,onChange:se=>rt("propuestaLinks",se),emptyText:"Aún no hay propuestas. Pega tantos links como necesites."})}),y.jsx("div",{className:"md:col-span-2",children:y.jsx(Fw,{label:"Links de Artes Finales",prefix:"AF",links:S.afLinks,onChange:se=>rt("afLinks",se),emptyText:"Aún no hay artes finales."})}),y.jsx(Ii,{className:"md:col-span-2 my-1"}),_&&y.jsx(tU,{items:V,onChange:Z,loading:z,error:ae}),y.jsx(Ii,{className:"md:col-span-2 my-1"}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsxs(xt,{className:"flex items-center gap-1.5 pl-1",children:["Estatus",!g&&y.jsx(I2,{className:"w-3 h-3 text-muted-foreground"})]}),g?y.jsxs(F4,{value:S.status||"_none",onValueChange:se=>rt("status",se==="_none"?"":se),children:[y.jsx($1,{className:"h-10",children:y.jsx(K4,{placeholder:"Sin estatus"})}),y.jsxs(q1,{children:[y.jsx(rp,{value:"_none",children:"Sin estatus"}),wn.map(se=>y.jsx(rp,{value:se,children:se},se))]})]}):y.jsx("div",{className:"h-10 px-3 flex items-center rounded-md border border-border bg-muted/30 text-sm text-foreground",children:S.status||"Sin estatus"}),!g&&y.jsx("p",{className:"pl-1 text-[11px] text-muted-foreground",children:"Solo el Director Creativo puede cambiar el estatus."})]}),_&&y.jsxs("div",{className:"space-y-1.5",children:[y.jsxs(xt,{className:"flex items-center gap-1.5 pl-1",children:["Interno Cargado ",y.jsx(Ep,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),y.jsx(jn,{type:"number",value:S.monto??"",onChange:se=>{Te(!0),rt("monto",se.target.value===""?null:Number(se.target.value))},placeholder:"0.00",className:"h-10"}),y.jsxs("p",{className:"pl-1 text-[11px] text-muted-foreground",children:["Privado · solo usuarios internos autorizados.",Ee&&V.length>0?" Monto ajustado manualmente; se respetará al guardar.":V.length>0?" El total del tarifario se refleja aquí y puedes ajustarlo.":""]})]})]}),(ie||L)&&y.jsxs("div",{className:Ae("mt-5 flex items-start gap-2 rounded-xl border px-3 py-2 text-sm",ie?"border-destructive/30 bg-destructive/5 text-destructive":"border-primary/20 bg-primary/5 text-primary"),children:[ie?y.jsx(Gu,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}):y.jsx(Ha,{className:"mt-0.5 h-4 w-4 flex-shrink-0 animate-spin"}),y.jsx("span",{children:ie||L})]})]}),y.jsx(VE,{className:"px-7 py-4 border-t bg-muted/30 rounded-b-lg sm:justify-between",children:y.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[y.jsx("div",{children:E&&r&&w&&s&&y.jsxs(ut,{type:"button",variant:"destructive",onClick:()=>s(r),disabled:N||o,className:"gap-1.5 rounded-full",children:[o?y.jsx(Ha,{className:"h-4 w-4 animate-spin"}):y.jsx(u_,{className:"h-4 w-4"}),o?"Eliminando…":"Eliminar proyecto"]})}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx(ut,{variant:"ghost",onClick:()=>t(!1),disabled:N||o,children:"Cancelar"}),y.jsxs(ut,{onClick:Mt,disabled:!fr||N||o,children:[N&&y.jsx(Ha,{className:"mr-1.5 h-4 w-4 animate-spin"}),N?"Guardando…":E?"Guardar cambios":kr?"Crear proyectos":"Crear proyecto"]})]})]})})]})})}function RI({isEdit:e,items:t,loading:r,error:s,note:o,hasMore:l,loadingMore:u,addingNote:d,onNoteChange:f,onAddNote:m,onRefresh:b,onLoadMore:g}){return y.jsxs("div",{className:"md:col-span-2 rounded-2xl border border-border bg-muted/20 p-4",children:[y.jsxs("div",{className:"mb-3 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[y.jsxs("div",{className:"flex items-start gap-2.5",children:[y.jsx("span",{className:"mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:y.jsx(N2,{className:"h-4 w-4"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"text-sm font-semibold",children:"Actividad del proyecto"}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Comentarios y movimientos recientes con fecha."})]})]}),e&&y.jsxs(ut,{type:"button",variant:"ghost",size:"sm",onClick:()=>void b(),disabled:r,className:"h-8 rounded-full px-2.5 text-xs text-muted-foreground hover:text-foreground",children:[r?y.jsx(Ha,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):null,"Actualizar"]})]}),e?y.jsxs("div",{className:"space-y-3",children:[y.jsxs("div",{className:"rounded-xl border border-border bg-card p-3",children:[y.jsx(xt,{className:"text-xs font-medium",children:"Agregar comentario o solicitud adicional"}),y.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[y.jsx(nd,{value:o,onChange:w=>f(w.target.value),placeholder:"Ej: CM pidió ajustar artes, agregar una marca o cambiar una fecha…",rows:2,className:"min-h-[64px] flex-1 resize-none"}),y.jsxs(ut,{type:"button",onClick:()=>void m(),disabled:!o.trim()||d,className:"gap-1.5 rounded-full sm:self-end",children:[d?y.jsx(Ha,{className:"h-4 w-4 animate-spin"}):y.jsx(G2,{className:"h-4 w-4"}),"Agregar"]})]})]}),s&&y.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-amber-300/50 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:[y.jsx(Gu,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0"}),y.jsx("span",{children:s})]}),r&&t.length===0?y.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground",children:[y.jsx(Ha,{className:"h-4 w-4 animate-spin"}),"Cargando actividad…"]}):t.length===0?y.jsx("div",{className:"rounded-xl border border-border bg-card px-3 py-3 text-sm text-muted-foreground",children:"Aún no hay actividad registrada. Los próximos comentarios o cambios quedarán aquí."}):y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 px-0.5 text-[11px] text-muted-foreground",children:[y.jsx("span",{children:"Mostrando los movimientos más recientes."}),y.jsxs("span",{children:[t.length," visibles"]})]}),y.jsx("div",{className:"max-h-[440px] space-y-2 overflow-y-auto pr-1",children:t.map(w=>{const _=wI(w.description);return y.jsxs("div",{className:"rounded-xl border border-border bg-card px-3 py-3 shadow-sm",children:[y.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",children:[y.jsxs("div",{children:[y.jsx("p",{className:"text-sm font-medium",children:w.title}),y.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.actorName,w.actorEmail?` · ${w.actorEmail}`:""]})]}),y.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[y.jsx(v2,{className:"h-3.5 w-3.5"}),bI(w.createdAt)]})]}),_.length>0&&y.jsx("div",{className:"mt-2 space-y-1 text-sm text-muted-foreground",children:_.map(E=>y.jsx("p",{children:E},E))})]},w.id)})}),l&&y.jsx("div",{className:"flex justify-center pt-1",children:y.jsxs(ut,{type:"button",variant:"outline",size:"sm",onClick:()=>void g(),disabled:u,className:"rounded-full",children:[u?y.jsx(Ha,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,u?"Cargando…":"Cargar más"]})})]})]}):y.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card/70 px-3 py-3 text-sm text-muted-foreground",children:"El historial se activará cuando el proyecto sea creado."})]})}const zC="pricing_summary_public";function UC(e){var t;return!!((t=e==null?void 0:e.value)!=null&&t.enabled)}async function NI(){const{data:e,error:t}=await qe.from("tablero_cdc_app_settings").select("key, value").eq("key",zC).maybeSingle();if(t)throw t;return UC(e)}async function kI(e){const{error:t}=await qe.rpc("tablero_cdc_set_pricing_summary_public",{p_enabled:e});if(t)throw t}function jI(e=!0){const[t,r]=v.useState(!1),[s,o]=v.useState(e),[l,u]=v.useState(!1),[d,f]=v.useState(null),m=v.useCallback(async()=>{if(!e)return!1;o(!0),f(null);try{const g=await NI();return r(g),g}catch(g){return console.error("No se pudo leer la visibilidad del total tarifado:",g),f(g instanceof Error?g.message:"No se pudo leer la visibilidad del total tarifado."),!1}finally{o(!1)}},[e]),b=v.useCallback(async g=>{u(!0),f(null);try{return await kI(g),r(g),g}catch(w){throw console.error("No se pudo actualizar la visibilidad del total tarifado:",w),f(w instanceof Error?w.message:"No se pudo actualizar la visibilidad del total tarifado."),w}finally{u(!1)}},[]);return v.useEffect(()=>{m()},[m]),v.useEffect(()=>{if(!e)return;const g=qe.channel("tablero-cdc-pricing-summary-visibility").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_settings",filter:`key=eq.${zC}`},w=>{const _=w.new||w.old;r(UC(_))}).subscribe();return()=>{qe.removeChannel(g)}},[e]),{isPublic:t,loading:s,saving:l,error:d,refresh:m,setPublicVisibility:b}}const ji=24,dx={country:"",brand:"",client:"",cm:""};function OI(e,t){if(e){const r=e.trim().split(/\s+/);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():e.slice(0,2).toUpperCase()}return t?t.slice(0,2).toUpperCase():"?"}function MI(){const[e,t]=v.useState(!1),[r,s]=v.useState(null),[o,l]=v.useState(""),[u,d]=v.useState("todos"),[f,m]=v.useState(dx),[b,g]=v.useState({todos:1,abiertos:1,cerrados:1}),[w,_]=v.useState(null),E=b[u],{lists:S}=bC(),{projects:A,totalProjects:C,filterOptions:R,loading:N,error:P,refresh:F,remove:$}=LC({tab:u,search:o,page:E,pageSize:ji,country:f.country,brand:f.brand,client:f.client,cm:f.cm}),{user:L,isGerardo:q,canControlPricingSummary:ie,logout:he}=Ol(),pe={tab:u,search:o,page:1,pageSize:ji,country:f.country,brand:f.brand,client:f.client,cm:f.cm},{isPublic:oe,loading:ue,saving:ce,error:fe,setPublicVisibility:M}=jI(!!L),K=ie||oe,{summary:J,loading:ne,error:X}=VU(pe,K),k=Object.values(S.buCm),j=pt([...S.bus,...R.countries,f.country]),I=pt([...S.marcas,...R.brands,f.brand]),Y=pt([...S.clientes,...R.clients,f.client]),V=pt([...k,...R.cms,f.cm]),Z=Object.values(f).filter(Boolean).length,z=Math.max(1,Math.ceil(C/ji)),ee=Math.min(E,z),ae=(ee-1)*ji,xe=C===0?0:ae+1,Ee=Math.min(ae+ji,C);v.useEffect(()=>{g(Pe=>({...Pe,[u]:1}))},[o,u,f.country,f.brand,f.client,f.cm]),v.useEffect(()=>{E>z&&g(Pe=>({...Pe,[u]:z}))},[E,u,z]);const Te=Pe=>{const ot=Math.min(Math.max(Pe,1),z);ot!==E&&(g(rt=>({...rt,[u]:ot})),window.scrollTo({top:0,behavior:"smooth"}))},nt=(Pe,ot)=>{m(rt=>({...rt,[Pe]:ot}))},Be=()=>{m(dx)},Kt=()=>{s(null),t(!0)},Yt=Pe=>{s(Pe),t(!0)},Ot=async Pe=>{if(window.confirm(`¿Seguro que deseas eliminar el proyecto "${Pe.nombre||"Sin título"}"?
Esta acción eliminará el proyecto del tablero y del Google Sheet.`)){_(Pe.id);try{await $(Pe.id),(r==null?void 0:r.id)===Pe.id&&(t(!1),s(null))}catch(rt){console.error("Error eliminando proyecto:",rt);const ht=rt instanceof Error?rt.message:"No se pudo eliminar el proyecto. Revisa n8n, Supabase o permisos.";window.alert(ht)}finally{_(null)}}},wn=(L==null?void 0:L.displayName)??(L==null?void 0:L.email)??"Usuario",yt=q?"Jefe CDC":"Usuario CDC",cr=OI(L==null?void 0:L.displayName,L==null?void 0:L.email);return y.jsxs("div",{className:"min-h-screen bg-background",children:[y.jsx("header",{className:"sticky top-0 z-30 bg-background/85 backdrop-blur-md border-b border-border",children:y.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-3.5 flex items-center gap-4",children:[y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx("div",{className:"w-9 h-9 rounded-xl bg-primary flex items-center justify-center",children:y.jsx(Cp,{className:"w-4 h-4 text-primary-foreground"})}),y.jsxs("div",{className:"leading-tight",children:[y.jsx("h1",{className:"text-[15px] font-semibold tracking-tight",children:"Tablero CDC"}),y.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Flujo de Proyectos"})]})]}),y.jsxs("div",{className:"flex-1 max-w-md ml-4 relative hidden md:block",children:[y.jsx(Fu,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),y.jsx(jn,{value:o,onChange:Pe=>l(Pe.target.value),placeholder:"Buscar proyecto, cliente, marca…",className:"pl-9 h-9 bg-muted/40 border-transparent focus-visible:bg-card focus-visible:border-border"})]}),y.jsx("div",{className:"flex-1 md:flex-none"}),y.jsxs(fP,{children:[y.jsx(hP,{asChild:!0,children:y.jsxs(ut,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2.5",children:[y.jsxs(vE,{className:"w-7 h-7",children:[(L==null?void 0:L.photoURL)&&y.jsx(bE,{src:L.photoURL,alt:wn,referrerPolicy:"no-referrer"}),y.jsx(wE,{className:q?"bg-primary text-primary-foreground text-xs":"bg-accent text-accent-foreground text-xs",children:cr})]}),y.jsxs("div",{className:"text-left leading-tight hidden sm:block",children:[y.jsx("div",{className:"text-xs font-medium",children:wn}),y.jsx("div",{className:"text-[10px] text-muted-foreground",children:yt})]}),y.jsx(Sp,{className:"w-3.5 h-3.5 text-muted-foreground"})]})}),y.jsxs(iE,{align:"end",className:"w-52",children:[y.jsxs("div",{className:"px-3 py-2",children:[y.jsx("p",{className:"text-xs font-medium truncate",children:wn}),y.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:L==null?void 0:L.email})]}),y.jsx(lE,{}),y.jsxs(oE,{onClick:he,className:"gap-2 text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer",children:[y.jsx(B2,{className:"w-3.5 h-3.5"}),"Cerrar sesión"]})]})]}),y.jsxs(ut,{onClick:Kt,className:"gap-1.5 h-9 rounded-full px-4 shadow-sm",children:[y.jsx(bl,{className:"w-4 h-4"})," Nuevo"]})]})}),y.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 pt-6 pb-3 space-y-3",children:[y.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[y.jsx("div",{children:y.jsx("h2",{className:"pl-3 text-2xl font-semibold tracking-tight",children:"Proyectos"})}),y.jsx("div",{className:"flex items-center gap-2",children:y.jsx("div",{className:"inline-flex bg-muted/60 rounded-full p-1 text-xs",children:[["todos","Todos"],["abiertos","Activos"],["cerrados","Cerrados"]].map(([Pe,ot])=>y.jsx("button",{onClick:()=>d(Pe),className:`px-3.5 py-1.5 rounded-full transition-colors font-medium ${u===Pe?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:ot},Pe))})})]}),y.jsxs("div",{className:"relative md:hidden",children:[y.jsx(Fu,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),y.jsx(jn,{value:o,onChange:Pe=>l(Pe.target.value),placeholder:"Buscar proyecto, cliente, marca…",className:"pl-9 h-9 bg-muted/40 border-transparent focus-visible:bg-card focus-visible:border-border"})]}),y.jsx(PI,{filters:f,activeCount:Z,countryOptions:j,brandOptions:I,clientOptions:Y,cmOptions:V,onFilterChange:nt,onClear:Be}),K&&y.jsx(LI,{totalAmount:J.totalAmount,projectCount:J.projectCount,loading:ne||ue,error:X||fe,hasFilters:u!=="todos"||o.trim().length>0||Z>0,canControlVisibility:ie,isPublic:oe,visibilitySaving:ce,onToggleVisibility:()=>M(!oe).catch(()=>{})})]}),y.jsxs("main",{className:"max-w-[1400px] mx-auto px-6 pb-16",children:[P&&y.jsxs("div",{className:"mb-4 flex flex-col gap-3 rounded-2xl border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm text-destructive sm:flex-row sm:items-center sm:justify-between",children:[y.jsxs("span",{className:"flex items-start gap-2",children:[y.jsx(Gu,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),y.jsxs("span",{children:[y.jsx("span",{className:"font-medium",children:"No se pudieron cargar los proyectos."})," ",P]})]}),y.jsxs(ut,{variant:"outline",size:"sm",onClick:()=>void F(),className:"gap-1.5",children:[y.jsx(Y2,{className:"h-3.5 w-3.5"})," Reintentar"]})]}),N&&A.length===0?y.jsx(II,{}):A.length===0?y.jsx($I,{onNew:Kt,hasProjects:C>0||u!=="todos"||o.trim().length>0||Z>0,filter:u,query:o,activeAdvancedFilterCount:Z}):y.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:A.map(Pe=>y.jsx(PP,{project:Pe,onClick:()=>Yt(Pe)},Pe.id))}),C>ji&&y.jsx(zI,{currentPage:ee,totalPages:z,visibleStart:xe,visibleEnd:Ee,totalItems:C,onPageChange:Te})]}),y.jsx(TI,{open:e,onOpenChange:t,project:r,onDelete:Ot,deleting:!!r&&w===r.id})]})}function DI(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function LI({totalAmount:e,projectCount:t,loading:r,error:s,hasFilters:o,canControlVisibility:l,isPublic:u,visibilitySaving:d,onToggleVisibility:f}){return y.jsx("div",{className:"rounded-2xl border border-primary/15 bg-primary/5 px-4 py-3 shadow-sm",children:y.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[y.jsxs("div",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"mt-0.5 flex h-9 w-9 items-center justify-center rounded-xl bg-primary/10 text-primary",children:y.jsx(Ep,{className:"h-4 w-4"})}),y.jsxs("div",{children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:o?"Total tarifado filtrado":"Total tarifado global"}),y.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${u?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-primary/20 bg-card text-primary"}`,children:u?"Visible para todos":"Privado"})]}),y.jsx("p",{className:"mt-0.5 text-2xl font-semibold tracking-tight text-foreground",children:r?"Calculando…":DI(e)}),y.jsx("p",{className:"text-xs text-muted-foreground",children:s?`No se pudo calcular el total: ${s}`:`${t} proyecto(s) incluidos según los filtros actuales.`})]})]}),y.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center lg:justify-end",children:[y.jsx("div",{className:"rounded-full border border-primary/20 bg-card px-3 py-1 text-xs font-medium text-primary",children:o?"Según filtros activos":"Sin filtros aplicados"}),l&&y.jsxs(ut,{type:"button",variant:u?"secondary":"outline",size:"sm",className:"gap-1.5 rounded-full",disabled:d,onClick:f,title:u?"Ocultar este total para los demás usuarios":"Mostrar este total temporalmente a todos los usuarios",children:[u?y.jsx(S2,{className:"h-3.5 w-3.5"}):y.jsx(C2,{className:"h-3.5 w-3.5"}),d?"Actualizando…":u?"Ocultar a todos":"Mostrar a todos"]})]})]})})}function PI({filters:e,activeCount:t,countryOptions:r,brandOptions:s,clientOptions:o,cmOptions:l,onFilterChange:u,onClear:d}){return y.jsx("div",{className:"rounded-2xl border border-border bg-card/70 px-3.5 py-3 shadow-sm",children:y.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 lg:w-auto lg:min-w-[120px] lg:justify-start",children:[y.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[y.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:y.jsx(J2,{className:"h-4 w-4"})}),y.jsx("span",{children:"Filtros"}),t>0&&y.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary",children:t})]}),t>0&&y.jsxs(ut,{type:"button",variant:"ghost",size:"sm",onClick:d,className:"h-8 rounded-full px-2.5 text-xs text-muted-foreground hover:text-foreground lg:hidden",children:[y.jsx(wl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]}),y.jsxs("div",{className:"grid flex-1 grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[y.jsx(ea,{value:e.country,options:r,onValueChange:f=>u("country",f),placeholder:"País: Todos",searchPlaceholder:"Buscar país…",emptyText:"No se encontró ese país.",clearLabel:"Todos"}),y.jsx(ea,{value:e.brand,options:s,onValueChange:f=>u("brand",f),placeholder:"Marca: Todas",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",clearLabel:"Todas"}),y.jsx(ea,{value:e.client,options:o,onValueChange:f=>u("client",f),placeholder:"Cliente: Todos",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente.",clearLabel:"Todos"}),y.jsx(ea,{value:e.cm,options:l,onValueChange:f=>u("cm",f),placeholder:"CM: Todos",searchPlaceholder:"Buscar CM…",emptyText:"No se encontró ese CM.",clearLabel:"Todos"})]}),y.jsxs(ut,{type:"button",variant:"ghost",size:"sm",onClick:d,disabled:t===0,className:"hidden h-9 rounded-full px-3 text-xs text-muted-foreground hover:text-foreground lg:inline-flex",children:[y.jsx(wl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]})})}function zI({currentPage:e,totalPages:t,visibleStart:r,visibleEnd:s,totalItems:o,onPageChange:l}){const u=UI(e,t);return y.jsxs("div",{className:"mt-6 flex flex-col sm:flex-row items-center justify-between gap-3 rounded-2xl border border-border bg-card/70 px-4 py-3",children:[y.jsxs("p",{className:"text-xs text-muted-foreground",children:[y.jsxs("span",{className:"font-medium text-foreground",children:[r,"-",s]})," ","de ",y.jsx("span",{className:"font-medium text-foreground",children:o})," proyectos"]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsxs(ut,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-full px-2.5",onClick:()=>l(e-1),disabled:e===1,children:[y.jsx(o2,{className:"h-4 w-4"}),y.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),y.jsx("div",{className:"flex items-center gap-1",children:u.map((d,f)=>d==="ellipsis"?y.jsx("span",{className:"flex h-8 w-8 items-center justify-center text-xs text-muted-foreground",children:"…"},`ellipsis-${f}`):y.jsx(ut,{type:"button",variant:d===e?"default":"ghost",size:"sm",className:"h-8 w-8 rounded-full p-0 text-xs",onClick:()=>l(d),"aria-current":d===e?"page":void 0,children:d},d))}),y.jsxs(ut,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-full px-2.5",onClick:()=>l(e+1),disabled:e===t,children:[y.jsx("span",{className:"hidden sm:inline",children:"Siguiente"}),y.jsx(l_,{className:"h-4 w-4"})]})]})]})}function UI(e,t){if(t<=7)return Array.from({length:t},(o,l)=>l+1);const r=new Set([1,t,e]);return e>1&&r.add(e-1),e<t&&r.add(e+1),e<=3&&(r.add(2),r.add(3),r.add(4)),e>=t-2&&(r.add(t-3),r.add(t-2),r.add(t-1)),Array.from(r).filter(o=>o>=1&&o<=t).sort((o,l)=>o-l).reduce((o,l)=>{const u=o[o.length-1];return typeof u=="number"&&l-u>1&&o.push("ellipsis"),o.push(l),o},[])}function II(){return y.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Array.from({length:8}).map((e,t)=>y.jsxs("div",{className:"min-h-[230px] overflow-hidden rounded-2xl border border-border bg-card",children:[y.jsx("div",{className:"h-14 bg-muted animate-pulse"}),y.jsxs("div",{className:"space-y-3 p-4",children:[y.jsx("div",{className:"h-3 w-3/4 rounded-full bg-muted animate-pulse"}),y.jsx("div",{className:"h-3 w-2/3 rounded-full bg-muted animate-pulse"}),y.jsx("div",{className:"h-3 w-1/2 rounded-full bg-muted animate-pulse"}),y.jsx("div",{className:"mt-6 h-8 rounded-full bg-muted animate-pulse"})]})]},t))})}function $I({onNew:e,hasProjects:t,filter:r,query:s,activeAdvancedFilterCount:o}){const l=s.trim().length>0,u=o>0;let d="Tu tablero está vacío",f="Crea tu primer proyecto para que el equipo pueda darle seguimiento.";return t&&l&&u?(d="Nada coincide con la búsqueda y filtros",f="Intenta cambiar la búsqueda, limpiar filtros o seleccionar otras opciones."):t&&l?(d="Nada coincide con la búsqueda",f="Intenta cambiar la búsqueda o borrar el texto escrito."):t&&u?(d="Nada coincide con los filtros",f="Intenta limpiar filtros o seleccionar otras opciones."):t&&r==="abiertos"?(d="No hay proyectos activos",f="Cuando se cree un proyecto nuevo, aparecerá en esta pestaña."):t&&r==="cerrados"?(d="No hay proyectos cerrados",f="Cuando el Director Creativo asigne un estatus a un proyecto, aparecerá aquí."):t&&(d="Nada coincide con el filtro",f="Intenta quitar el filtro o cambiar la búsqueda."),y.jsxs("div",{className:"text-center py-24 rounded-2xl border border-dashed border-border bg-card/40",children:[y.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 mx-auto flex items-center justify-center mb-4",children:y.jsx(Cp,{className:"w-6 h-6 text-primary"})}),y.jsx("h3",{className:"text-lg font-semibold",children:d}),y.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm mx-auto",children:f}),!t&&y.jsxs(ut,{onClick:e,className:"mt-5 gap-1.5 rounded-full",children:[y.jsx(bl,{className:"w-4 h-4"})," Crear proyecto"]})]})}const BI=({...e})=>y.jsx(yI,{className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e});class HI extends v.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){console.error("Uncaught error:",t,r)}render(){return this.state.hasError?y.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:y.jsxs("div",{className:"max-w-md text-center",children:[y.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Ocurrió un error al cargar el tablero."}),y.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Intenta recargar la página."}),y.jsx("div",{className:"mt-6",children:y.jsx("button",{onClick:()=>window.location.reload(),className:"inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:"Recargar"})})]})}):this.props.children}}function qI(){const{user:e,loading:t}=Ol();return t?y.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("div",{className:"w-9 h-9 rounded-xl bg-primary flex items-center justify-center animate-pulse",children:y.jsxs("svg",{className:"w-4 h-4 text-primary-foreground",fill:"none",viewBox:"0 0 24 24",children:[y.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1",fill:"currentColor"}),y.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1",fill:"currentColor",opacity:"0.5"}),y.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",fill:"currentColor",opacity:"0.5"}),y.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1",fill:"currentColor"})]})}),y.jsx("p",{className:"text-sm text-muted-foreground",children:"Cargando tablero…"})]})}):e?y.jsx(aN,{children:y.jsx(kx,{path:"/*",element:y.jsx(MI,{})})}):y.jsx(rD,{})}function VI(){return y.jsx(HI,{children:y.jsx(YO,{children:y.jsxs(RN,{basename:"/tablero-cdc/",children:[y.jsx(qI,{}),y.jsx(BI,{richColors:!0,position:"top-right"})]})})})}sR.createRoot(document.getElementById("root")).render(y.jsx(v.StrictMode,{children:y.jsx(VI,{})}));