399 lines
761 KiB
JavaScript
399 lines
761 KiB
JavaScript
function WR(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 dx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vh={exports:{}},Ko={};/**
|
||
* @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 l0;function XR(){if(l0)return Ko;l0=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 Ko.Fragment=t,Ko.jsx=r,Ko.jsxs=r,Ko}var c0;function JR(){return c0||(c0=1,Vh.exports=XR()),Vh.exports}var y=JR(),Gh={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 u0;function QR(){if(u0)return Oe;u0=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,T={};function C(k,j,I){this.props=k,this.context=j,this.refs=T,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 A(){}A.prototype=C.prototype;function N(k,j,I){this.props=k,this.context=j,this.refs=T,this.updater=I||E}var P=N.prototype=new A;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 d0;function id(){return d0||(d0=1,Gh.exports=QR()),Gh.exports}var v=id();const le=dx(v),up=WR({__proto__:null,default:le},[v]);var Fh={exports:{}},Yo={},Kh={exports:{}},Yh={};/**
|
||
* @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 f0;function ZR(){return f0||(f0=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,T=!1,C=typeof setTimeout=="function"?setTimeout:null,A=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 T?!0:!(e.unstable_now()-ie<q)}function pe(){if(T=!1,$){var M=e.unstable_now();ie=M;var K=!0;try{e:{E=!1,S&&(S=!1,A(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(){T=!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?(A(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}}}})(Yh)),Yh}var h0;function eA(){return h0||(h0=1,Kh.exports=ZR()),Kh.exports}var Wh={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 m0;function tA(){if(m0)return Jt;m0=1;var e=id();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 p0;function fx(){if(p0)return Wh.exports;p0=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(),Wh.exports=tA(),Wh.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 g0;function nA(){if(g0)return Yo;g0=1;var e=eA(),t=id(),r=fx();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,R=h.child;R;){if(R===i){x=!0,i=h,c=p;break}if(R===c){x=!0,c=h,i=p;break}R=R.sibling}if(!x){for(R=p.child;R;){if(R===i){x=!0,i=p,c=h;break}if(R===c){x=!0,c=p,i=h;break}R=R.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"),T=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=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 T: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 A: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)?jb(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=jb(a),n=Ob(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=Ob(a,n.type);a!==i&&(I(V,n),I(Y,i))}function Ce(n){V.current===n&&(j(Y),j(V)),z.current===n&&(j(z),qo._currentValue=J)}var Re,nt;function He(n){if(Re===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",nt=-1<i.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Re+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],R=p[1];if(x&&R){var O=x.split(`
|
||
`),H=R.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:"")?He(i):""}function Ot(n,a){switch(n.tag){case 26:case 27:case 5:return He(n.type);case 16:return He("Lazy");case 13:return n.child!==a&&a!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("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 He("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,ze=e.unstable_cancelCallback,ot=e.unstable_shouldYield,rt=e.unstable_requestPaint,ht=e.unstable_now,to=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:Te,no=Math.log,se=Math.LN2;function Te(n){return n>>>=0,n===0?32:31-(no(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 R=c&134217727;return R!==0?(c=R&~p,c!==0?h=nn(c):(x&=R,x!==0?h=nn(x):i||(i=R&~n,i!==0&&(h=nn(i))))):(R=c&~p,R!==0?h=nn(R):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 R=n.entanglements,O=n.expirationTimes,H=n.hiddenUpdates;for(i=x&~i;0<i;){var Q=31-Mt(i),re=1<<Q;R[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 Md(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:t0(n.type))}function yg(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,Dd="__reactEvents$"+da,UC="__reactListeners$"+da,IC="__reactHandles$"+da,vg="__reactResources$"+da,ro="__reactMarker$"+da;function Ld(n){delete n[It],delete n[on],delete n[Dd],delete n[UC],delete n[IC]}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=Ib(n);n!==null;){if(i=n[It])return i;n=Ib(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 ao(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[vg];return a||(a=n[vg]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Lt(n){n[ro]=!0}var bg=new Set,wg={};function es(n,a){Hs(n,a),Hs(n+"Capture",a)}function Hs(n,a){for(wg[n]=a,n=0;n<a.length;n++)bg.add(a[n])}var $C=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]*$"),xg={},_g={};function BC(n){return yt.call(_g,n)?!0:yt.call(xg,n)?!1:$C.test(n)?_g[n]=!0:(xg[n]=!0,!1)}function Hl(n,a,i){if(BC(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 ql(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 Sg(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function HC(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 Pd(n){if(!n._valueTracker){var a=Sg(n)?"checked":"value";n._valueTracker=HC(n,a,""+n[a])}}function Eg(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var i=a.getValue(),c="";return n&&(c=Sg(n)?n.checked?"true":"false":n.value),n=c,n!==i?(a.setValue(n),!0):!1}function Vl(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 qC=/[\n"\\]/g;function Dn(n){return n.replace(qC,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function zd(n,a,i,c,h,p,x,R){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?Ud(n,x,Mn(a)):i!=null?Ud(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"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?n.name=""+Mn(R):n.removeAttribute("name")}function Cg(n,a,i,c,h,p,x,R){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)){Pd(n);return}i=i!=null?""+Mn(i):"",a=a!=null?""+Mn(a):i,R||a===n.value||(n.value=a),n.defaultValue=a}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=R?n.checked:!!c,n.defaultChecked=!!c,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),Pd(n)}function Ud(n,a,i){a==="number"&&Vl(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),Pd(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 VC=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 Ag(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||VC.has(a)?a==="float"?n.cssFloat=i:n[a]=(""+i).trim():n[a]=i+"px"}function Ng(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&&Ag(n,h,c)}else for(var p in a)a.hasOwnProperty(p)&&Ag(n,p,a[p])}function Id(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 GC=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"]]),FC=/^[\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 Gl(n){return FC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Or(){}var $d=null;function Bd(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 kg(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(zd(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));zd(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&&Eg(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 Hd=!1;function jg(n,a,i){if(Hd)return n(a,i);Hd=!0;try{var c=n(a);return c}finally{if(Hd=!1,(Gs!==null||Fs!==null)&&(Oc(),Gs&&(a=Gs,n=Fs,Fs=Gs=null,kg(a),n)))for(a=0;a<n.length;a++)kg(n[a])}}function so(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"),qd=!1;if(Mr)try{var io={};Object.defineProperty(io,"passive",{get:function(){qd=!0}}),window.addEventListener("test",io,io),window.removeEventListener("test",io,io)}catch{qd=!1}var fa=null,Vd=null,Fl=null;function Og(){if(Fl)return Fl;var n,a=Vd,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 Fl=h.slice(n,1<c?1-c:void 0)}function Kl(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 Yl(){return!0}function Mg(){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 R in n)n.hasOwnProperty(R)&&(i=n[R],this[R]=i?i(p):p[R]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Yl:Mg,this.isPropagationStopped=Mg,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=Yl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Yl)},persist:function(){},isPersistent:Yl}),a}var ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wl=ln(ts),oo=g({},ts,{view:0,detail:0}),KC=ln(oo),Gd,Fd,lo,Xl=g({},oo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yd,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!==lo&&(lo&&n.type==="mousemove"?(Gd=n.screenX-lo.screenX,Fd=n.screenY-lo.screenY):Fd=Gd=0,lo=n),Gd)},movementY:function(n){return"movementY"in n?n.movementY:Fd}}),Dg=ln(Xl),YC=g({},Xl,{dataTransfer:0}),WC=ln(YC),XC=g({},oo,{relatedTarget:0}),Kd=ln(XC),JC=g({},ts,{animationName:0,elapsedTime:0,pseudoElement:0}),QC=ln(JC),ZC=g({},ts,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),eT=ln(ZC),tT=g({},ts,{data:0}),Lg=ln(tT),nT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rT={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"},aT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sT(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=aT[n])?!!a[n]:!1}function Yd(){return sT}var iT=g({},oo,{key:function(n){if(n.key){var a=nT[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=Kl(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?rT[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yd,charCode:function(n){return n.type==="keypress"?Kl(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Kl(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),oT=ln(iT),lT=g({},Xl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pg=ln(lT),cT=g({},oo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yd}),uT=ln(cT),dT=g({},ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),fT=ln(dT),hT=g({},Xl,{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}),mT=ln(hT),pT=g({},ts,{newState:0,oldState:0}),gT=ln(pT),yT=[9,13,27,32],Wd=Mr&&"CompositionEvent"in window,co=null;Mr&&"documentMode"in document&&(co=document.documentMode);var vT=Mr&&"TextEvent"in window&&!co,zg=Mr&&(!Wd||co&&8<co&&11>=co),Ug=" ",Ig=!1;function $g(n,a){switch(n){case"keyup":return yT.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ks=!1;function bT(n,a){switch(n){case"compositionend":return Bg(a);case"keypress":return a.which!==32?null:(Ig=!0,Ug);case"textInput":return n=a.data,n===Ug&&Ig?null:n;default:return null}}function wT(n,a){if(Ks)return n==="compositionend"||!Wd&&$g(n,a)?(n=Og(),Fl=Vd=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 zg&&a.locale!=="ko"?null:a.data;default:return null}}var xT={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 Hg(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!xT[n.type]:a==="textarea"}function qg(n,a,i,c){Gs?Fs?Fs.push(c):Fs=[c]:Gs=c,a=Ic(a,"onChange"),0<a.length&&(i=new Wl("onChange","change",null,i,c),n.push({event:i,listeners:a}))}var uo=null,fo=null;function _T(n){Cb(n,0)}function Jl(n){var a=ao(n);if(Eg(a))return n}function Vg(n,a){if(n==="change")return a}var Gg=!1;if(Mr){var Xd;if(Mr){var Jd="oninput"in document;if(!Jd){var Fg=document.createElement("div");Fg.setAttribute("oninput","return;"),Jd=typeof Fg.oninput=="function"}Xd=Jd}else Xd=!1;Gg=Xd&&(!document.documentMode||9<document.documentMode)}function Kg(){uo&&(uo.detachEvent("onpropertychange",Yg),fo=uo=null)}function Yg(n){if(n.propertyName==="value"&&Jl(fo)){var a=[];qg(a,fo,n,Bd(n)),jg(_T,a)}}function ST(n,a,i){n==="focusin"?(Kg(),uo=a,fo=i,uo.attachEvent("onpropertychange",Yg)):n==="focusout"&&Kg()}function ET(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Jl(fo)}function CT(n,a){if(n==="click")return Jl(a)}function TT(n,a){if(n==="input"||n==="change")return Jl(a)}function RT(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var _n=typeof Object.is=="function"?Object.is:RT;function ho(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 Wg(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Xg(n,a){var i=Wg(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=Wg(i)}}function Jg(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Jg(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Qg(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=Vl(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=Vl(n.document)}return a}function Qd(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 AT=Mr&&"documentMode"in document&&11>=document.documentMode,Ys=null,Zd=null,mo=null,ef=!1;function Zg(n,a,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ef||Ys==null||Ys!==Vl(c)||(c=Ys,"selectionStart"in c&&Qd(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}),mo&&ho(mo,c)||(mo=c,c=Ic(Zd,"onSelect"),0<c.length&&(a=new Wl("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")},tf={},ey={};Mr&&(ey=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(tf[n])return tf[n];if(!Ws[n])return n;var a=Ws[n],i;for(i in a)if(a.hasOwnProperty(i)&&i in ey)return tf[n]=a[i];return n}var ty=rs("animationend"),ny=rs("animationiteration"),ry=rs("animationstart"),NT=rs("transitionrun"),kT=rs("transitionstart"),jT=rs("transitioncancel"),ay=rs("transitionend"),sy=new Map,nf="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(" ");nf.push("scrollEnd");function Wn(n,a){sy.set(n,a),es(a,[n])}var Ql=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,rf=0;function Zl(){for(var n=Xs,a=rf=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&&iy(i,h,p)}}function ec(n,a,i,c){Ln[Xs++]=n,Ln[Xs++]=a,Ln[Xs++]=i,Ln[Xs++]=c,rf|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function af(n,a,i,c){return ec(n,a,i,c),tc(n)}function as(n,a){return ec(n,null,null,a),tc(n)}function iy(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 tc(n){if(50<Po)throw Po=0,mh=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 OT(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 OT(n,a,i,c)}function sf(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 oy(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 nc(n,a,i,c,h,p){var x=0;if(c=n,typeof n=="function")sf(n)&&(x=1);else if(typeof n=="string")x=zR(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 T: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 A: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 of(n,a,i){return n=Sn(6,n,null,a),n.lanes=i,n}function ly(n){var a=Sn(18,null,null,0);return a.stateNode=n,a}function lf(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 cy=new WeakMap;function Pn(n,a){if(typeof n=="object"&&n!==null){var i=cy.get(n);return i!==void 0?i:(a={value:n,source:a,stack:wn(a)},cy.set(n,a),a)}return{value:n,source:a,stack:wn(a)}}var Qs=[],Zs=0,rc=null,po=0,zn=[],Un=0,ha=null,hr=1,mr="";function Lr(n,a){Qs[Zs++]=po,Qs[Zs++]=rc,rc=n,po=a}function uy(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 cf(n){n.return!==null&&(Lr(n,1),uy(n,1,0))}function uf(n){for(;n===rc;)rc=Qs[--Zs],Qs[Zs]=null,po=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 dy(n,a){zn[Un++]=hr,zn[Un++]=mr,zn[Un++]=ha,hr=a.id,mr=a.overflow,ha=n}var $t=null,lt=null,qe=!1,ma=null,In=!1,df=Error(s(519));function pa(n){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw go(Pn(a,n)),df}function fy(n){var a=n.stateNode,i=n.type,c=n.memoizedProps;switch(a[It]=n,a[on]=c,i){case"dialog":Ie("cancel",a),Ie("close",a);break;case"iframe":case"object":case"embed":Ie("load",a);break;case"video":case"audio":for(i=0;i<Uo.length;i++)Ie(Uo[i],a);break;case"source":Ie("error",a);break;case"img":case"image":case"link":Ie("error",a),Ie("load",a);break;case"details":Ie("toggle",a);break;case"input":Ie("invalid",a),Cg(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Ie("invalid",a);break;case"textarea":Ie("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||Nb(a.textContent,i)?(c.popover!=null&&(Ie("beforetoggle",a),Ie("toggle",a)),c.onScroll!=null&&Ie("scroll",a),c.onScrollEnd!=null&&Ie("scrollend",a),c.onClick!=null&&(a.onclick=Or),a=!0):a=!1,a||pa(n,!0)}function hy(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(!qe)return hy(n),qe=!0,!1;var a=n.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||Nh(n.type,n.memoizedProps)),i=!i),i&<&&pa(n),hy(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));lt=Ub(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));lt=Ub(n)}else a===27?(a=lt,Na(n.type)?(n=Dh,Dh=null,lt=n):lt=a):lt=$t?Bn(n.stateNode.nextSibling):null;return!0}function is(){lt=$t=null,qe=!1}function ff(){var n=ma;return n!==null&&(fn===null?fn=n:fn.push.apply(fn,n),ma=null),n}function go(n){ma===null?ma=[n]:ma.push(n)}var hf=k(null),os=null,Pr=null;function ga(n,a,i){I(hf,a._currentValue),a._currentValue=i}function zr(n){n._currentValue=hf.current,j(hf)}function mf(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 pf(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 R=p;p=h;for(var O=0;O<a.length;O++)if(R.context===a[O]){p.lanes|=i,R=p.alternate,R!==null&&(R.lanes|=i),mf(p.return,i,n),c||(x=null);break e}p=R.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),mf(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 R=h.type;_n(h.pendingProps.value,x.value)||(n!==null?n.push(R):n=[R])}}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(qo):n=[qo])}h=h.return}n!==null&&pf(a,n,i,c),a.flags|=262144}function ac(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 my(os,n)}function sc(n,a){return os===null&&ls(n),my(n,a)}function my(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 MT=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()})}},DT=e.unstable_scheduleCallback,LT=e.unstable_NormalPriority,Et={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gf(){return{controller:new MT,data:new Map,refCount:0}}function yo(n){n.refCount--,n.refCount===0&&DT(LT,function(){n.controller.abort()})}var vo=null,yf=0,ni=0,ri=null;function PT(n,a){if(vo===null){var i=vo=[];yf=0,ni=wh(),ri={status:"pending",value:void 0,then:function(c){i.push(c)}}}return yf++,a.then(py,py),a}function py(){if(--yf===0&&vo!==null){ri!==null&&(ri.status="fulfilled");var n=vo;vo=null,ni=0,ri=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function zT(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 gy=M.S;M.S=function(n,a){Zv=ht(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&PT(n,a),gy!==null&&gy(n,a)};var cs=k(null);function vf(){var n=cs.current;return n!==null?n:at.pooledCache}function ic(n,a){a===null?I(cs,cs.current):I(cs,a.pool)}function yy(){var n=vf();return n===null?null:{parent:Et._currentValue,pool:n}}var ai=Error(s(460)),bf=Error(s(474)),oc=Error(s(542)),lc={then:function(){}};function vy(n){return n=n.status,n==="fulfilled"||n==="rejected"}function by(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,xy(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,xy(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 wy(){if(ds===null)throw Error(s(459));var n=ds;return ds=null,n}function xy(n){if(n===ai||n===oc)throw Error(s(483))}var si=null,bo=0;function cc(n){var a=bo;return bo+=1,si===null&&(si=[]),by(si,n,a)}function wo(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function uc(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 _y(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 R(U,D,B,te){return D===null||D.tag!==6?(D=of(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),wo(D,B),D.return=U,D):(D=nc(B.type,B.key,B.props,null,U.mode,te),wo(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=lf(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=of(""+D,U.mode,B),D.return=U,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case _:return B=nc(D.type,D.key,D.props,null,U.mode,B),wo(B,D),B.return=U,B;case E:return D=lf(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,cc(D),B);if(D.$$typeof===N)return re(U,sc(U,D),B);uc(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:R(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,cc(B),te);if(B.$$typeof===N)return G(U,D,sc(U,B),te);uc(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,R(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,cc(te),Se);if(te.$$typeof===N)return W(U,D,B,sc(D,te),Se);uc(D,te)}return null}function ve(U,D,B,te){for(var Se=null,Fe=null,_e=D,De=D=0,Be=null;_e!==null&&De<B.length;De++){_e.index>De?(Be=_e,_e=null):Be=_e.sibling;var Ke=G(U,_e,B[De],te);if(Ke===null){_e===null&&(_e=Be);break}n&&_e&&Ke.alternate===null&&a(U,_e),D=p(Ke,D,De),Fe===null?Se=Ke:Fe.sibling=Ke,Fe=Ke,_e=Be}if(De===B.length)return i(U,_e),qe&&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 qe&&Lr(U,De),Se}for(_e=c(_e);De<B.length;De++)Be=W(_e,U,De,B[De],te),Be!==null&&(n&&Be.alternate!==null&&_e.delete(Be.key===null?De:Be.key),D=p(Be,D,De),Fe===null?Se=Be:Fe.sibling=Be,Fe=Be);return n&&_e.forEach(function(Da){return a(U,Da)}),qe&&Lr(U,De),Se}function Ae(U,D,B,te){if(B==null)throw Error(s(151));for(var Se=null,Fe=null,_e=D,De=D=0,Be=null,Ke=B.next();_e!==null&&!Ke.done;De++,Ke=B.next()){_e.index>De?(Be=_e,_e=null):Be=_e.sibling;var Da=G(U,_e,Ke.value,te);if(Da===null){_e===null&&(_e=Be);break}n&&_e&&Da.alternate===null&&a(U,_e),D=p(Da,D,De),Fe===null?Se=Da:Fe.sibling=Da,Fe=Da,_e=Be}if(Ke.done)return i(U,_e),qe&&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 qe&&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(YR){return a(U,YR)}),qe&&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),wo(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=nc(B.type,B.key,B.props,null,U.mode,te),wo(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=lf(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),Ae(U,D,B,te)}if(typeof B.then=="function")return tt(U,D,cc(B),te);if(B.$$typeof===N)return tt(U,D,sc(U,B),te);uc(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=of(B,U.mode,te),te.return=U,U=te),x(U)):i(U,D)}return function(U,D,B,te){try{bo=0;var Se=tt(U,D,B,te);return si=null,Se}catch(_e){if(_e===ai||_e===oc)throw _e;var Fe=Sn(29,_e,null,U.mode);return Fe.lanes=te,Fe.return=U,Fe}finally{}}}var fs=_y(!0),Sy=_y(!1),ya=!1;function wf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xf(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=tc(n),iy(n,null,i),a}return ec(n,c,a,i),tc(n)}function xo(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 _f(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 Sf=!1;function _o(){if(Sf){var n=ri;if(n!==null)throw n}}function So(n,a,i,c){Sf=!1;var h=n.updateQueue;ya=!1;var p=h.firstBaseUpdate,x=h.lastBaseUpdate,R=h.shared.pending;if(R!==null){h.shared.pending=null;var O=R,H=O.next;O.next=null,x===null?p=H:x.next=H,x=O;var Q=n.alternate;Q!==null&&(Q=Q.updateQueue,R=Q.lastBaseUpdate,R!==x&&(R===null?Q.firstBaseUpdate=H:R.next=H,Q.lastBaseUpdate=O))}if(p!==null){var re=h.baseState;x=0,Q=H=O=null,R=p;do{var G=R.lane&-536870913,W=G!==R.lane;if(W?($e&G)===G:(c&G)===G){G!==0&&G===ni&&(Sf=!0),Q!==null&&(Q=Q.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var ve=n,Ae=R;G=a;var tt=i;switch(Ae.tag){case 1:if(ve=Ae.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=Ae.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=R.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:R.tag,payload:R.payload,callback:R.callback,next:null},Q===null?(H=Q=W,O=re):Q=Q.next=W,x|=G;if(R=R.next,R===null){if(R=h.shared.pending,R===null)break;W=R,R=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 Ey(n,a){if(typeof n!="function")throw Error(s(191,n));n.call(a)}function Cy(n,a){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)Ey(i[n],a)}var ii=k(null),dc=k(0);function Ty(n,a){n=Fr,I(dc,n),I(ii,a),Fr=n|a.baseLanes}function Ef(){I(dc,Fr),I(ii,ii.current)}function Cf(){Fr=dc.current,j(ii),j(dc)}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 Tf(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 fc(n){for(var a=n;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Oh(i)||Mh(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,hc=!1,oi=!1,hs=!1,mc=0,Eo=0,li=null,UT=0;function vt(){throw Error(s(321))}function Rf(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 Af(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?uv:qf,hs=!1,p=i(c,h),hs=!1,oi&&(p=Ny(a,i,c,h)),Ay(n),p}function Ay(n){M.H=Ro;var a=Ze!==null&&Ze.next!==null;if(Ur=0,Ct=Ze=Me=null,hc=!1,Eo=0,li=null,a)throw Error(s(300));n===null||Tt||(n=n.dependencies,n!==null&&ac(n)&&(Tt=!0))}function Ny(n,a,i,c){Me=n;var h=0;do{if(oi&&(li=null),Eo=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=dv,p=a(i,c)}while(oi);return p}function IT(){var n=M.H,a=n.useState()[0];return a=typeof a.then=="function"?Co(a):a,n=n.useState()[0],(Ze!==null?Ze.memoizedState:null)!==n&&(Me.flags|=1024),a}function Nf(){var n=mc!==0;return mc=0,n}function kf(n,a,i){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~i}function jf(n){if(hc){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}hc=!1}Ur=0,Ct=Ze=Me=null,oi=!1,Eo=mc=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 pc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Co(n){var a=Eo;return Eo+=1,li===null&&(li=[]),n=by(li,n,a),a=Me,(Ct===null?a.memoizedState:Ct.next)===null&&(a=a.alternate,M.H=a===null||a.memoizedState===null?uv:qf),n}function gc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Co(n);if(n.$$typeof===N)return Bt(n)}throw Error(s(438,String(n)))}function Of(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=pc(),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 yc(n){var a=St();return Mf(a,Ze,n)}function Mf(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 R=x=null,O=null,H=a,Q=!1;do{var re=H.lane&-536870913;if(re!==H.lane?($e&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?(R=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?(R=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=R,!_n(p,n.memoizedState)&&(Tt=!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 Df(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)||(Tt=!0),a.memoizedState=p,a.baseQueue===null&&(a.baseState=p),i.lastRenderedState=p}return[p,c]}function ky(n,a,i){var c=Me,h=St(),p=qe;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,Tt=!0),h=h.queue,zf(My.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},Oy.bind(null,c,h,i,a),null),at===null)throw Error(s(349));p||(Ur&127)!==0||jy(c,a,i)}return i}function jy(n,a,i){n.flags|=16384,n={getSnapshot:a,value:i},a=Me.updateQueue,a===null?(a=pc(),Me.updateQueue=a,a.stores=[n]):(i=a.stores,i===null?a.stores=[n]:i.push(n))}function Oy(n,a,i,c){a.value=i,a.getSnapshot=c,Dy(a)&&Ly(n)}function My(n,a,i){return i(function(){Dy(a)&&Ly(n)})}function Dy(n){var a=n.getSnapshot;n=n.value;try{var i=a();return!_n(n,i)}catch{return!0}}function Ly(n){var a=as(n,2);a!==null&&hn(a,n,2)}function Lf(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 Py(n,a,i,c){return n.baseState=i,Mf(n,Ze,typeof c=="function"?c:Ir)}function $T(n,a,i,c,h){if(wc(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,zy(a,p)):(p.next=i.next,a.pending=i.next=p)}}function zy(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 R=i(h,c),O=M.S;O!==null&&O(x,R),Uy(n,a,R)}catch(H){Pf(n,a,H)}finally{p!==null&&x.types!==null&&(p.types=x.types),M.T=p}}else try{p=i(h,c),Uy(n,a,p)}catch(H){Pf(n,a,H)}}function Uy(n,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(c){Iy(n,a,c)},function(c){return Pf(n,a,c)}):Iy(n,a,i)}function Iy(n,a,i){a.status="fulfilled",a.value=i,$y(a),n.state=i,a=n.pending,a!==null&&(i=a.next,i===a?n.pending=null:(i=i.next,a.next=i,zy(n,i)))}function Pf(n,a,i){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=i,$y(a),a=a.next;while(a!==c)}n.action=null}function $y(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function By(n,a){return a}function Hy(n,a){if(qe){var i=at.formState;if(i!==null){e:{var c=Me;if(qe){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:By,lastRenderedState:a},i.queue=c,i=ov.bind(null,Me,c),c.dispatch=i,c=Lf(!1),p=Hf.bind(null,Me,!1,c.queue),c=Zt(),h={state:a,dispatch:null,action:n,pending:null},c.queue=h,i=$T.bind(null,Me,h,p,i),h.dispatch=i,c.memoizedState=n,[a,i,!1]}function qy(n){var a=St();return Vy(a,Ze,n)}function Vy(n,a,i){if(a=Mf(n,a,By)[0],n=yc(Ir)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=Co(a)}catch(x){throw x===ai?oc: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},BT.bind(null,h,i),null)),[c,p,n]}function BT(n,a){n.action=a}function Gy(n){var a=St(),i=Ze;if(i!==null)return Vy(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=pc(),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 Fy(){return St().memoizedState}function vc(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 bc(n,a,i,c){var h=St();c=c===void 0?null:c;var p=h.memoizedState.inst;Ze!==null&&c!==null&&Rf(c,Ze.memoizedState.deps)?h.memoizedState=ci(a,p,i,c):(Me.flags|=n,h.memoizedState=ci(1|a,p,i,c))}function Ky(n,a){vc(8390656,8,n,a)}function zf(n,a){bc(2048,8,n,a)}function HT(n){Me.flags|=4;var a=Me.updateQueue;if(a===null)a=pc(),Me.updateQueue=a,a.events=[n];else{var i=a.events;i===null?a.events=[n]:i.push(n)}}function Yy(n){var a=St().memoizedState;return HT({ref:a,nextImpl:n}),function(){if((We&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function Wy(n,a){return bc(4,2,n,a)}function Xy(n,a){return bc(4,4,n,a)}function Jy(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 Qy(n,a,i){i=i!=null?i.concat([n]):null,bc(4,4,Jy.bind(null,a,n),i)}function Uf(){}function Zy(n,a){var i=St();a=a===void 0?null:a;var c=i.memoizedState;return a!==null&&Rf(a,c[1])?c[0]:(i.memoizedState=[n,a],n)}function ev(n,a){var i=St();a=a===void 0?null:a;var c=i.memoizedState;if(a!==null&&Rf(a,c[1]))return c[0];if(c=n(),hs){xn(!0);try{n()}finally{xn(!1)}}return i.memoizedState=[c,a],c}function If(n,a,i){return i===void 0||(Ur&1073741824)!==0&&($e&261930)===0?n.memoizedState=a:(n.memoizedState=i,n=tb(),Me.lanes|=n,Ea|=n,i)}function tv(n,a,i,c){return _n(i,a)?i:ii.current!==null?(n=If(n,i,c),_n(n,a)||(Tt=!0),n):(Ur&42)===0||(Ur&1073741824)!==0&&($e&261930)===0?(Tt=!0,n.memoizedState=i):(n=tb(),Me.lanes|=n,Ea|=n,a)}function nv(n,a,i,c,h){var p=K.p;K.p=p!==0&&8>p?p:8;var x=M.T,R={};M.T=R,Hf(n,!1,a,i);try{var O=h(),H=M.S;if(H!==null&&H(R,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Q=zT(O,c);To(n,a,Q,An(n))}else To(n,a,c,An(n))}catch(re){To(n,a,{then:function(){},status:"rejected",reason:re},An())}finally{K.p=p,x!==null&&R.types!==null&&(x.types=R.types),M.T=x}}function qT(){}function $f(n,a,i,c){if(n.tag!==5)throw Error(s(476));var h=rv(n).queue;nv(n,h,a,J,i===null?qT:function(){return av(n),i(c)})}function rv(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 av(n){var a=rv(n);a.next===null&&(a=n.alternate.memoizedState),To(n,a.next.queue,{},An())}function Bf(){return Bt(qo)}function sv(){return St().memoizedState}function iv(){return St().memoizedState}function VT(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var i=An();n=va(i);var c=ba(a,n,i);c!==null&&(hn(c,a,i),xo(c,a,i)),a={cache:gf()},n.payload=a;return}a=a.return}}function GT(n,a,i){var c=An();i={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},wc(n)?lv(a,i):(i=af(n,a,i,c),i!==null&&(hn(i,n,c),cv(i,a,c)))}function ov(n,a,i){var c=An();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(wc(n))lv(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,R=p(x,i);if(h.hasEagerState=!0,h.eagerState=R,_n(R,x))return ec(n,a,h,0),at===null&&Zl(),!1}catch{}finally{}if(i=af(n,a,h,c),i!==null)return hn(i,n,c),cv(i,a,c),!0}return!1}function Hf(n,a,i,c){if(c={lane:2,revertLane:wh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},wc(n)){if(a)throw Error(s(479))}else a=af(n,i,c,2),a!==null&&hn(a,n,2)}function wc(n){var a=n.alternate;return n===Me||a!==null&&a===Me}function lv(n,a){oi=hc=!0;var i=n.pending;i===null?a.next=a:(a.next=i.next,i.next=a),n.pending=a}function cv(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:gc,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 uv={readContext:Bt,use:gc,useCallback:function(n,a){return Zt().memoizedState=[n,a===void 0?null:a],n},useContext:Bt,useEffect:Ky,useImperativeHandle:function(n,a,i){i=i!=null?i.concat([n]):null,vc(4194308,4,Jy.bind(null,a,n),i)},useLayoutEffect:function(n,a){return vc(4194308,4,n,a)},useInsertionEffect:function(n,a){vc(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=GT.bind(null,Me,n),[c.memoizedState,n]},useRef:function(n){var a=Zt();return n={current:n},a.memoizedState=n},useState:function(n){n=Lf(n);var a=n.queue,i=ov.bind(null,Me,a);return a.dispatch=i,[n.memoizedState,i]},useDebugValue:Uf,useDeferredValue:function(n,a){var i=Zt();return If(i,n,a)},useTransition:function(){var n=Lf(!1);return n=nv.bind(null,Me,n.queue,!0,!1),Zt().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,i){var c=Me,h=Zt();if(qe){if(i===void 0)throw Error(s(407));i=i()}else{if(i=a(),at===null)throw Error(s(349));($e&127)!==0||jy(c,a,i)}h.memoizedState=i;var p={value:i,getSnapshot:a};return h.queue=p,Ky(My.bind(null,c,p,n),[n]),c.flags|=2048,ci(9,{destroy:void 0},Oy.bind(null,c,p,i,a),null),i},useId:function(){var n=Zt(),a=at.identifierPrefix;if(qe){var i=mr,c=hr;i=(c&~(1<<32-Mt(c)-1)).toString(32)+i,a="_"+a+"R_"+i,i=mc++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=UT++,a="_"+a+"r_"+i.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:Bf,useFormState:Hy,useActionState:Hy,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=Hf.bind(null,Me,!0,i),i.dispatch=a,[n,a]},useMemoCache:Of,useCacheRefresh:function(){return Zt().memoizedState=VT.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)}}},qf={readContext:Bt,use:gc,useCallback:Zy,useContext:Bt,useEffect:zf,useImperativeHandle:Qy,useInsertionEffect:Wy,useLayoutEffect:Xy,useMemo:ev,useReducer:yc,useRef:Fy,useState:function(){return yc(Ir)},useDebugValue:Uf,useDeferredValue:function(n,a){var i=St();return tv(i,Ze.memoizedState,n,a)},useTransition:function(){var n=yc(Ir)[0],a=St().memoizedState;return[typeof n=="boolean"?n:Co(n),a]},useSyncExternalStore:ky,useId:sv,useHostTransitionStatus:Bf,useFormState:qy,useActionState:qy,useOptimistic:function(n,a){var i=St();return Py(i,Ze,n,a)},useMemoCache:Of,useCacheRefresh:iv};qf.useEffectEvent=Yy;var dv={readContext:Bt,use:gc,useCallback:Zy,useContext:Bt,useEffect:zf,useImperativeHandle:Qy,useInsertionEffect:Wy,useLayoutEffect:Xy,useMemo:ev,useReducer:Df,useRef:Fy,useState:function(){return Df(Ir)},useDebugValue:Uf,useDeferredValue:function(n,a){var i=St();return Ze===null?If(i,n,a):tv(i,Ze.memoizedState,n,a)},useTransition:function(){var n=Df(Ir)[0],a=St().memoizedState;return[typeof n=="boolean"?n:Co(n),a]},useSyncExternalStore:ky,useId:sv,useHostTransitionStatus:Bf,useFormState:Gy,useActionState:Gy,useOptimistic:function(n,a){var i=St();return Ze!==null?Py(i,Ze,n,a):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:Of,useCacheRefresh:iv};dv.useEffectEvent=Yy;function Vf(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 Gf={enqueueSetState:function(n,a,i){n=n._reactInternals;var c=An(),h=va(c);h.payload=a,i!=null&&(h.callback=i),a=ba(n,h,c),a!==null&&(hn(a,n,c),xo(a,n,c))},enqueueReplaceState:function(n,a,i){n=n._reactInternals;var c=An(),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),xo(a,n,c))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var i=An(),c=va(i);c.tag=2,a!=null&&(c.callback=a),a=ba(n,c,i),a!==null&&(hn(a,n,i),xo(a,n,i))}};function fv(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?!ho(i,c)||!ho(h,p):!0}function hv(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&&Gf.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 mv(n){Ql(n)}function pv(n){console.error(n)}function gv(n){Ql(n)}function xc(n,a){try{var i=n.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function yv(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 Ff(n,a,i){return i=va(i),i.tag=3,i.payload={element:null},i.callback=function(){xc(n,a)},i}function vv(n){return n=va(n),n.tag=3,n}function bv(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(){yv(a,i,c)}}var x=i.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){yv(a,i,c),typeof h!="function"&&(Ca===null?Ca=new Set([this]):Ca.add(this));var R=c.stack;this.componentDidCatch(c.value,{componentStack:R!==null?R:""})})}function FT(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?Mc():i.alternate===null&&bt===0&&(bt=3),i.flags&=-257,i.flags|=65536,i.lanes=h,c===lc?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([c]):a.add(c),yh(n,c,h)),!1;case 22:return i.flags|=65536,c===lc?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)),yh(n,c,h)),!1}throw Error(s(435,i.tag))}return yh(n,c,h),Mc(),!1}if(qe)return a=En.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=h,c!==df&&(n=Error(s(422),{cause:c}),go(Pn(n,i)))):(c!==df&&(a=Error(s(423),{cause:c}),go(Pn(a,i))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,c=Pn(c,i),h=Ff(n.stateNode,c,h),_f(n,h),bt!==4&&(bt=2)),!1;var p=Error(s(520),{cause:c});if(p=Pn(p,i),Lo===null?Lo=[p]:Lo.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=Ff(i.stateNode,c,n),_f(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=vv(h),bv(h,n,i,c),_f(i,h),!1}i=i.return}while(i!==null);return!1}var Kf=Error(s(461)),Tt=!1;function Ht(n,a,i,c){a.child=n===null?Sy(a,null,i,c):fs(a,n.child,i,c)}function wv(n,a,i,c,h){i=i.render;var p=a.ref;if("ref"in c){var x={};for(var R in c)R!=="ref"&&(x[R]=c[R])}else x=c;return ls(a),c=Af(n,a,i,x,p,h),R=Nf(),n!==null&&!Tt?(kf(n,a,h),$r(n,a,h)):(qe&&R&&cf(a),a.flags|=1,Ht(n,a,c,h),a.child)}function xv(n,a,i,c,h){if(n===null){var p=i.type;return typeof p=="function"&&!sf(p)&&p.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=p,_v(n,a,p,c,h)):(n=nc(i.type,null,c,a,a.mode,h),n.ref=a.ref,n.return=a,a.child=n)}if(p=n.child,!th(n,h)){var x=p.memoizedProps;if(i=i.compare,i=i!==null?i:ho,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 _v(n,a,i,c,h){if(n!==null){var p=n.memoizedProps;if(ho(p,c)&&n.ref===a.ref)if(Tt=!1,a.pendingProps=c=p,th(n,h))(n.flags&131072)!==0&&(Tt=!0);else return a.lanes=n.lanes,$r(n,a,h)}return Yf(n,a,i,c,h)}function Sv(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 Ev(n,a,p,i,c)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&ic(a,p!==null?p.cachePool:null),p!==null?Ty(a,p):Ef(),Ry(a);else return c=a.lanes=536870912,Ev(n,a,p!==null?p.baseLanes|i:i,i,c)}else p!==null?(ic(a,p.cachePool),Ty(a,p),xa(),a.memoizedState=null):(n!==null&&ic(a,null),Ef(),xa());return Ht(n,a,h,i),a.child}function Ao(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Ev(n,a,i,c,h){var p=vf();return p=p===null?null:{parent:Et._currentValue,pool:p},a.memoizedState={baseLanes:i,cachePool:p},n!==null&&ic(a,null),Ef(),Ry(a),n!==null&&ti(n,a,c,!0),a.childLanes=h,null}function _c(n,a){return a=Ec({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function Cv(n,a,i){return fs(a,n.child,null,i),n=_c(a,a.pendingProps),n.flags|=2,Cn(a),a.memoizedState=null,n}function KT(n,a,i){var c=a.pendingProps,h=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(qe){if(c.mode==="hidden")return n=_c(a,c),a.lanes=536870912,Ao(null,n);if(Tf(a),(n=lt)?(n=zb(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=ly(n),i.return=a,a.child=i,$t=a,lt=null)):n=null,n===null)throw pa(a);return a.lanes=536870912,null}return _c(a,c)}var p=n.memoizedState;if(p!==null){var x=p.dehydrated;if(Tf(a),h)if(a.flags&256)a.flags&=-257,a=Cv(n,a,i);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(s(558));else if(Tt||ti(n,a,i,!1),h=(i&n.childLanes)!==0,Tt||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),Kf;Mc(),a=Cv(n,a,i)}else n=p.treeContext,lt=Bn(x.nextSibling),$t=a,qe=!0,ma=null,In=!1,n!==null&&dy(a,n),a=_c(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 Sc(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 Yf(n,a,i,c,h){return ls(a),i=Af(n,a,i,c,void 0,h),c=Nf(),n!==null&&!Tt?(kf(n,a,h),$r(n,a,h)):(qe&&c&&cf(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=Ny(a,c,i,h),Ay(n),c=Nf(),n!==null&&!Tt?(kf(n,a,p),$r(n,a,p)):(qe&&c&&cf(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=Gf,a.stateNode=p,p._reactInternals=a,p=a.stateNode,p.props=c,p.state=a.memoizedState,p.refs={},wf(a),x=i.contextType,p.context=typeof x=="object"&&x!==null?Bt(x):Js,p.state=a.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&(Vf(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&&Gf.enqueueReplaceState(p,p.state,null),So(a,c,p,h),_o(),p.state=a.memoizedState),typeof p.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(n===null){p=a.stateNode;var R=a.memoizedProps,O=ms(i,R);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",R=a.pendingProps!==R,Q||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(R||H!==x)&&hv(a,p,c,x),ya=!1;var G=a.memoizedState;p.state=G,So(a,c,p,h),_o(),H=a.memoizedState,R||G!==H||ya?(typeof re=="function"&&(Vf(a,i,re,c),H=a.memoizedState),(O=ya||fv(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,xf(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)),R=i.getDerivedStateFromProps,(H=typeof R=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==re||G!==O)&&hv(a,p,c,O),ya=!1,G=a.memoizedState,p.state=G,So(a,c,p,h),_o();var W=a.memoizedState;x!==re||G!==W||ya||n!==null&&n.dependencies!==null&&ac(n.dependencies)?(typeof R=="function"&&(Vf(a,i,R,c),W=a.memoizedState),(Q=ya||fv(a,i,Q,c,G,W,O)||n!==null&&n.dependencies!==null&&ac(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,Sc(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 Av(n,a,i,c){return is(),a.flags|=256,Ht(n,a,i,c),a.child}var Wf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xf(n){return{baseLanes:n,cachePool:yy()}}function Jf(n,a,i){return n=n!==null?n.childLanes&~i:0,a&&(n|=Rn),n}function Nv(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(qe){if(h?wa(a):xa(),(n=lt)?(n=zb(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=ly(n),i.return=a,a.child=i,$t=a,lt=null)):n=null,n===null)throw pa(a);return Mh(n)?a.lanes=32:a.lanes=536870912,null}var R=c.children;return c=c.fallback,h?(xa(),h=a.mode,R=Ec({mode:"hidden",children:R},h),c=ss(c,h,i,null),R.return=a,c.return=a,R.sibling=c,a.child=R,c=a.child,c.memoizedState=Xf(i),c.childLanes=Jf(n,x,i),a.memoizedState=Wf,Ao(null,c)):(wa(a),Qf(a,R))}var O=n.memoizedState;if(O!==null&&(R=O.dehydrated,R!==null)){if(p)a.flags&256?(wa(a),a.flags&=-257,a=Zf(n,a,i)):a.memoizedState!==null?(xa(),a.child=n.child,a.flags|=128,a=null):(xa(),R=c.fallback,h=a.mode,c=Ec({mode:"visible",children:c.children},h),R=ss(R,h,i,null),R.flags|=2,c.return=a,R.return=a,c.sibling=R,a.child=c,fs(a,n.child,null,i),c=a.child,c.memoizedState=Xf(i),c.childLanes=Jf(n,x,i),a.memoizedState=Wf,a=Ao(null,c));else if(wa(a),Mh(R)){if(x=R.nextSibling&&R.nextSibling.dataset,x)var H=x.dgst;x=H,c=Error(s(419)),c.stack="",c.digest=x,go({value:c,source:null,stack:null}),a=Zf(n,a,i)}else if(Tt||ti(n,a,i,!1),x=(i&n.childLanes)!==0,Tt||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),Kf;Oh(R)||Mc(),a=Zf(n,a,i)}else Oh(R)?(a.flags|=192,a.child=n.child,a=null):(n=O.treeContext,lt=Bn(R.nextSibling),$t=a,qe=!0,ma=null,In=!1,n!==null&&dy(a,n),a=Qf(a,c.children),a.flags|=4096);return a}return h?(xa(),R=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?R=Dr(H,R):(R=ss(R,h,i,null),R.flags|=2),R.return=a,c.return=a,c.sibling=R,a.child=c,Ao(null,c),c=a.child,R=n.child.memoizedState,R===null?R=Xf(i):(h=R.cachePool,h!==null?(O=Et._currentValue,h=h.parent!==O?{parent:O,pool:O}:h):h=yy(),R={baseLanes:R.baseLanes|i,cachePool:h}),c.memoizedState=R,c.childLanes=Jf(n,x,i),a.memoizedState=Wf,Ao(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 Qf(n,a){return a=Ec({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Ec(n,a){return n=Sn(22,n,null,a),n.lanes=0,n}function Zf(n,a,i){return fs(a,n.child,null,i),n=Qf(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function kv(n,a,i){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a),mf(n.return,a,i)}function eh(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 jv(n,a,i){var c=a.pendingProps,h=c.revealOrder,p=c.tail;c=c.children;var x=_t.current,R=(x&2)!==0;if(R?(x=x&1|2,a.flags|=128):x&=1,I(_t,x),Ht(n,a,c,i),c=qe?po:0,!R&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&kv(n,i,a);else if(n.tag===19)kv(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&&fc(n)===null&&(h=i),i=i.sibling;i=h,i===null?(h=a.child,a.child=null):(h=i.sibling,i.sibling=null),eh(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&&fc(n)===null){a.child=h;break}n=h.sibling,h.sibling=i,i=h,h=n}eh(a,!0,i,null,p,c);break;case"together":eh(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 th(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&ac(n)))}function YT(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,Tf(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?Nv(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 jv(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,Sv(n,a,i,a.pendingProps);case 24:ga(a,Et,n.memoizedState.cache)}return $r(n,a,i)}function Ov(n,a,i){if(n!==null)if(n.memoizedProps!==a.pendingProps)Tt=!0;else{if(!th(n,i)&&(a.flags&128)===0)return Tt=!1,YT(n,a,i);Tt=(n.flags&131072)!==0}else Tt=!1,qe&&(a.flags&1048576)!==0&&uy(a,po,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")sf(n)?(c=ms(n,c),a.tag=1,a=Rv(null,a,n,c,i)):(a.tag=0,a=Yf(null,a,n,c,i));else{if(n!=null){var h=n.$$typeof;if(h===P){a.tag=11,a=wv(null,a,n,c,i);break e}else if(h===L){a.tag=14,a=xv(null,a,n,c,i);break e}}throw a=ce(n)||n,Error(s(306,a,""))}}return a;case 0:return Yf(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,xf(n,a),So(a,c,null,i);var x=a.memoizedState;if(c=x.cache,ga(a,Et,c),c!==p.cache&&pf(a,[Et],i,!0),_o(),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=Av(n,a,c,i);break e}else if(c!==h){h=Pn(Error(s(424)),a),go(h),a=Av(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,qe=!0,ma=null,In=!0,i=Sy(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 Sc(n,a),n===null?(i=qb(a.type,null,a.pendingProps,null))?a.memoizedState=i:qe||(i=a.type,n=a.pendingProps,c=$c(Z.current).createElement(i),c[It]=a,c[on]=n,qt(c,i,n),Lt(c),a.stateNode=c):a.memoizedState=qb(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return xe(a),n===null&&qe&&(c=a.stateNode=$b(a.type,a.pendingProps,Z.current),$t=a,In=!0,h=lt,Na(a.type)?(Dh=h,lt=Bn(c.firstChild)):lt=h),Ht(n,a,a.pendingProps.children,i),Sc(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&qe&&((h=c=lt)&&(c=ER(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,Nh(h,p)?c=null:x!==null&&Nh(h,x)&&(a.flags|=32),a.memoizedState!==null&&(h=Af(n,a,IT,null,null,i),qo._currentValue=h),Sc(n,a),Ht(n,a,c,i),a.child;case 6:return n===null&&qe&&((n=i=lt)&&(i=CR(i,a.pendingProps,In),i!==null?(a.stateNode=i,$t=a,lt=null,n=!0):n=!1),n||pa(a)),null;case 13:return Nv(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 wv(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 xv(n,a,a.type,a.pendingProps,i);case 15:return _v(n,a,a.type,a.pendingProps,i);case 19:return jv(n,a,i);case 31:return KT(n,a,i);case 22:return Sv(n,a,i,a.pendingProps);case 24:return ls(a),c=Bt(Et),n===null?(h=vf(),h===null&&(h=at,p=gf(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=i),h=p),a.memoizedState={parent:c,cache:h},wf(a),ga(a,Et,h)):((n.lanes&i)!==0&&(xf(n,a),So(a,null,null,i),_o()),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&&pf(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 nh(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(sb())n.flags|=8192;else throw ds=lc,bf}else n.flags&=-16777217}function Mv(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Yb(a))if(sb())n.flags|=8192;else throw ds=lc,bf}function Cc(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Xt():536870912,n.lanes|=a,hi|=a)}function No(n,a){if(!qe)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 WT(n,a,i){var c=a.pendingProps;switch(uf(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,ff())),ct(a),null;case 26:var h=a.type,p=a.memoizedState;return n===null?(Br(a),p!==null?(ct(a),Mv(a,p)):(ct(a),nh(a,h,null,c,i))):p?p!==n.memoizedState?(Br(a),ct(a),Mv(a,p)):(ct(a),a.flags&=-16777217):(n=n.memoizedProps,n!==c&&Br(a),ct(a),nh(a,h,n,c,i)),null;case 27:if(Ce(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)?fy(a):(n=$b(h,c,i),a.stateNode=n,Br(a))}return ct(a),null;case 5:if(Ce(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))fy(a);else{var x=$c(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),nh(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||Nb(n.nodeValue,i)),n||pa(a,!0)}else n=$c(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=ff(),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=ff(),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),Cc(a,a.updateQueue),ct(a),null);case 4:return ae(),n===null&&Eh(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)No(c,!1);else{if(bt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(p=fc(n),p!==null){for(a.flags|=128,No(c,!1),n=p.updateQueue,a.updateQueue=n,Cc(a,n),a.subtreeFlags=0,n=i,i=a.child;i!==null;)oy(i,n),i=i.sibling;return I(_t,_t.current&1|2),qe&&Lr(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&ht()>kc&&(a.flags|=128,h=!0,No(c,!1),a.lanes=4194304)}else{if(!h)if(n=fc(p),n!==null){if(a.flags|=128,h=!0,n=n.updateQueue,a.updateQueue=n,Cc(a,n),No(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!qe)return ct(a),null}else 2*ht()-c.renderingStartTime>kc&&i!==536870912&&(a.flags|=128,h=!0,No(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),qe&&Lr(a,c.treeForkCount),n):(ct(a),null);case 22:case 23:return Cn(a),Cf(),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&&Cc(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 XT(n,a){switch(uf(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 Ce(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),Cf(),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 Dv(n,a){switch(uf(a),a.tag){case 3:zr(Et),ae();break;case 26:case 27:case 5:Ce(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),Cf(),n!==null&&j(cs);break;case 24:zr(Et)}}function ko(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(R){Qe(a,a.return,R)}}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,R=x.destroy;if(R!==void 0){x.destroy=void 0,h=a;var O=i,H=R;try{H()}catch(Q){Qe(h,O,Q)}}}c=c.next}while(c!==p)}}catch(Q){Qe(a,a.return,Q)}}function Lv(n){var a=n.updateQueue;if(a!==null){var i=n.stateNode;try{Cy(a,i)}catch(c){Qe(n,n.return,c)}}}function Pv(n,a,i){i.props=ms(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(c){Qe(n,a,c)}}function jo(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 zv(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 rh(n,a,i){try{var c=n.stateNode;vR(c,n.type,i,a),c[on]=a}catch(h){Qe(n,n.return,h)}}function Uv(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Na(n.type)||n.tag===4}function ah(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Uv(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 sh(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(sh(n,a,i),n=n.sibling;n!==null;)sh(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 Iv(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,Rt=!1,ih=!1,$v=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function JT(n,a){if(n=n.containerInfo,Rh=Kc,n=Qg(n),Qd(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,R=-1,O=-1,H=0,Q=0,re=n,G=null;t:for(;;){for(var W;re!==i||h!==0&&re.nodeType!==3||(R=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&&(R=x),G===p&&++Q===c&&(O=x),(W=re.nextSibling)!==null)break;re=G,G=re.parentNode}re=W}i=R===-1||O===-1?null:{start:R,end:O}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ah={focusedElem:n,selectionRange:i},Kc=!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(Ae){Qe(i,i.return,Ae)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,i=n.nodeType,i===9)jh(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":jh(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 Bv(n,a,i){var c=i.flags;switch(i.tag){case 0:case 11:case 15:Vr(n,i),c&4&&ko(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&&Lv(i),c&512&&jo(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{Cy(n,a)}catch(x){Qe(i,i.return,x)}}break;case 27:a===null&&c&4&&Iv(i);case 26:case 5:Vr(n,i),a===null&&c&4&&zv(i),c&512&&jo(i,i.return);break;case 12:Vr(n,i);break;case 31:Vr(n,i),c&4&&Vv(n,i);break;case 13:Vr(n,i),c&4&&Gv(n,i),c&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=iR.bind(null,i),TR(n,i))));break;case 22:if(c=i.memoizedState!==null||Hr,!c){a=a!==null&&a.memoizedState!==null||Rt,h=Hr;var p=Rt;Hr=c,(Rt=a)&&!p?Gr(n,i,(i.subtreeFlags&8772)!==0):Vr(n,i),Hr=h,Rt=p}break;case 30:break;default:Vr(n,i)}}function Hv(n){var a=n.alternate;a!==null&&(n.alternate=null,Hv(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&Ld(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;)qv(n,a,i),i=i.sibling}function qv(n,a,i){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(fr,i)}catch{}switch(i.tag){case 26:Rt||pr(i,a),qr(n,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Rt||pr(i,a);var c=ft,h=cn;Na(i.type)&&(ft=i.stateNode,cn=!1),qr(n,a,i),$o(i.stateNode),ft=c,cn=h;break;case 5:Rt||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,Lb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),xi(n)):Lb(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),Rt||_a(4,i,a),qr(n,a,i);break;case 1:Rt||(pr(i,a),c=i.stateNode,typeof c.componentWillUnmount=="function"&&Pv(i,a,c)),qr(n,a,i);break;case 21:qr(n,a,i);break;case 22:Rt=(c=Rt)||i.memoizedState!==null,qr(n,a,i),Rt=c;break;default:qr(n,a,i)}}function Vv(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 Gv(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 QT(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new $v),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new $v),a;default:throw Error(s(435,n.tag))}}function Rc(n,a){var i=QT(n);a.forEach(function(c){if(!i.has(c)){i.add(c);var h=oR.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,R=x;e:for(;R!==null;){switch(R.tag){case 27:if(Na(R.type)){ft=R.stateNode,cn=!1;break e}break;case 5:ft=R.stateNode,cn=!1;break e;case 3:case 4:ft=R.stateNode.containerInfo,cn=!0;break e}R=R.return}if(ft===null)throw Error(s(160));qv(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;)Fv(a,n),a=a.sibling}var Xn=null;function Fv(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),ko(3,n),_a(5,n,n.return));break;case 1:un(a,n),dn(n),c&512&&(Rt||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&&(Rt||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[ro]||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=Fb("link","href",h).get(c+(i.href||""));if(x){for(var R=0;R<x.length;R++)if(p=x[R],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(R,1);break t}}p=h.createElement(c),qt(p,c,i),h.head.appendChild(p);break;case"meta":if(x=Fb("meta","content",h).get(c+(i.content||""))){for(R=0;R<x.length;R++)if(p=x[R],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(R,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 Kb(h,n.type,n.stateNode);else n.stateNode=Gb(h,c,n.memoizedProps);else p!==c?(p===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):p.count--,c===null?Kb(h,n.type,n.stateNode):Gb(h,c,n.memoizedProps)):c===null&&n.stateNode!==null&&rh(n,n.memoizedProps,i.memoizedProps)}break;case 27:un(a,n),dn(n),c&512&&(Rt||i===null||pr(i,i.return)),i!==null&&c&4&&rh(n,n.memoizedProps,i.memoizedProps);break;case 5:if(un(a,n),dn(n),c&512&&(Rt||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,rh(n,h,i!==null?i.memoizedProps:h)),c&1024&&(ih=!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(qc=null,h=Xn,Xn=Bc(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)}ih&&(ih=!1,Kv(n));break;case 4:c=Xn,Xn=Bc(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)&&(Nc=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=Rt;if(Hr=H||h,Rt=Q||O,un(a,n),Rt=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||Rt||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{R=O.stateNode;var re=O.memoizedProps.style,G=re!=null&&re.hasOwnProperty("display")?re.display:null;R.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?Pb(W,!0):Pb(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(Uv(c)){i=c;break}c=c.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var h=i.stateNode,p=ah(n);Tc(n,p,h);break;case 5:var x=i.stateNode;i.flags&32&&(Vs(x,""),i.flags&=-33);var R=ah(n);Tc(n,R,x);break;case 3:case 4:var O=i.stateNode.containerInfo,H=ah(n);sh(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 Kv(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Kv(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;)Bv(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"&&Pv(a,a.return,i),ps(a);break;case 27:$o(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),ko(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 R=c.stateNode;try{var O=h.shared.hiddenCallbacks;if(O!==null)for(h.shared.hiddenCallbacks=null,h=0;h<O.length;h++)Ey(O[h],R)}catch(H){Qe(c,c.return,H)}}i&&x&64&&Lv(p),jo(p,p.return);break;case 27:Iv(p);case 26:case 5:Gr(h,p,i),i&&c===null&&x&4&&zv(p),jo(p,p.return);break;case 12:Gr(h,p,i);break;case 31:Gr(h,p,i),i&&x&4&&Vv(h,p);break;case 13:Gr(h,p,i),i&&x&4&&Gv(h,p);break;case 22:p.memoizedState===null&&Gr(h,p,i),jo(p,p.return);break;case 30:break;default:Gr(h,p,i)}a=a.sibling}}function oh(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&&yo(i))}function lh(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&yo(n))}function Jn(n,a,i,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Yv(n,a,i,c),a=a.sibling}function Yv(n,a,i,c){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Jn(n,a,i,c),h&2048&&ko(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&&yo(n)));break;case 12:if(h&2048){Jn(n,a,i,c),n=a.stateNode;try{var p=a.memoizedProps,x=p.id,R=p.onPostCommit;typeof R=="function"&&R(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):Oo(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&&oh(x,a);break;case 24:Jn(n,a,i,c),h&2048&&lh(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,R=i,O=c,H=x.flags;switch(x.tag){case 0:case 11:case 15:ui(p,x,R,O,h),ko(8,x);break;case 23:break;case 22:var Q=x.stateNode;x.memoizedState!==null?Q._visibility&2?ui(p,x,R,O,h):Oo(p,x):(Q._visibility|=2,ui(p,x,R,O,h)),h&&H&2048&&oh(x.alternate,x);break;case 24:ui(p,x,R,O,h),h&&H&2048&&lh(x.alternate,x);break;default:ui(p,x,R,O,h)}a=a.sibling}}function Oo(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:Oo(i,c),h&2048&&oh(c.alternate,c);break;case 24:Oo(i,c),h&2048&&lh(c.alternate,c);break;default:Oo(i,c)}a=a.sibling}}var Mo=8192;function di(n,a,i){if(n.subtreeFlags&Mo)for(n=n.child;n!==null;)Wv(n,a,i),n=n.sibling}function Wv(n,a,i){switch(n.tag){case 26:di(n,a,i),n.flags&Mo&&n.memoizedState!==null&&UR(i,Xn,n.memoizedState,n.memoizedProps);break;case 5:di(n,a,i);break;case 3:case 4:var c=Xn;Xn=Bc(n.stateNode.containerInfo),di(n,a,i),Xn=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Mo,Mo=16777216,di(n,a,i),Mo=c):di(n,a,i));break;default:di(n,a,i)}}function Xv(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 Do(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,Qv(c,n)}Xv(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Jv(n),n=n.sibling}function Jv(n){switch(n.tag){case 0:case 11:case 15:Do(n),n.flags&2048&&_a(9,n,n.return);break;case 3:Do(n);break;case 12:Do(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Ac(n)):Do(n);break;default:Do(n)}}function Ac(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,Qv(c,n)}Xv(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:_a(8,a,a.return),Ac(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,Ac(a));break;default:Ac(a)}n=n.sibling}}function Qv(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:yo(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(Hv(c),c===i){Pt=null;break e}if(h!==null){h.return=p,Pt=h;break e}Pt=p}}}var ZT={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}},eR=typeof WeakMap=="function"?WeakMap:Map,We=0,at=null,Ue=null,$e=0,Je=0,Tn=null,Sa=!1,fi=!1,ch=!1,Fr=0,bt=0,Ea=0,gs=0,uh=0,Rn=0,hi=0,Lo=null,fn=null,dh=!1,Nc=0,Zv=0,kc=1/0,jc=null,Ca=null,Nt=0,Ta=null,mi=null,Kr=0,fh=0,hh=null,eb=null,Po=0,mh=null;function An(){return(We&2)!==0&&$e!==0?$e&-$e:M.T!==null?wh():Md()}function tb(){if(Rn===0)if(($e&536870912)===0||qe){var n=Ye;Ye<<=1,(Ye&3932160)===0&&(Ye=262144),Rn=n}else Rn=536870912;return n=En.current,n!==null&&(n.flags|=32),Rn}function hn(n,a,i){(n===at&&(Je===2||Je===9)||n.cancelPendingCommit!==null)&&(pi(n,0),Ra(n,$e,Rn,!1)),mt(n,i),((We&2)===0||n!==at)&&(n===at&&((We&2)===0&&(gs|=i),bt===4&&Ra(n,$e,Rn,!1)),gr(n))}function nb(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?rR(n,a):gh(n,a,!0),p=c;do{if(h===0){fi&&!c&&Ra(n,a,0,!1);break}else{if(i=n.current.alternate,p&&!tR(i)){h=gh(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 R=n;h=Lo;var O=R.current.memoizedState.isDehydrated;if(O&&(pi(R,x).flags|=256),x=gh(R,x,!1),x!==2){if(ch&&!O){R.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),Ra(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:Ra(c,a,Rn,!Sa);break e;case 2:fn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(h=Nc+300-ht(),10<h)){if(Ra(c,a,Rn,!Sa),ke(c,0,!0)!==0)break e;Kr=a,c.timeoutHandle=Mb(rb.bind(null,c,i,fn,jc,dh,a,Rn,gs,hi,Sa,p,"Throttled",-0,0),h);break e}rb(c,i,fn,jc,dh,a,Rn,gs,hi,Sa,p,null,-0,0)}}break}while(!0);gr(n)}function rb(n,a,i,c,h,p,x,R,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},Wv(a,p,re);var ve=(p&62914560)===p?Nc-ht():(p&4194048)===p?Zv-ht():0;if(ve=IR(re,ve),ve!==null){Kr=p,n.cancelPendingCommit=ve(db.bind(null,n,a,p,i,c,h,x,R,O,Q,re,null,G,W)),Ra(n,p,x,!H);return}}db(n,a,p,i,c,h,x,R,O)}function tR(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 Ra(n,a,i,c){a&=~uh,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 Oc(){return(We&6)===0?(zo(0),!1):!0}function ph(){if(Ue!==null){if(Je===0)var n=Ue.return;else n=Ue,Pr=os=null,jf(n),si=null,bo=0,n=Ue;for(;n!==null;)Dv(n.alternate,n),n=n.return;Ue=null}}function pi(n,a){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,xR(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Kr=0,ph(),at=n,Ue=i=Dr(n.current,null),$e=a,Je=0,Tn=null,Sa=!1,fi=dt(n,a),ch=!1,hi=Rn=uh=gs=Ea=bt=0,fn=Lo=null,dh=!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,Zl(),i}function ab(n,a){Me=null,M.H=Ro,a===ai||a===oc?(a=wy(),Je=3):a===bf?(a=wy(),Je=4):Je=a===Kf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Tn=a,Ue===null&&(bt=1,xc(n,Pn(a,n.current)))}function sb(){var n=En.current;return n===null?!0:($e&4194048)===$e?$n===null:($e&62914560)===$e||($e&536870912)!==0?n===$n:!1}function ib(){var n=M.H;return M.H=Ro,n===null?Ro:n}function ob(){var n=M.A;return M.A=ZT,n}function Mc(){bt=4,Sa||($e&4194048)!==$e&&En.current!==null||(fi=!0),(Ea&134217727)===0&&(gs&134217727)===0||at===null||Ra(at,$e,Rn,!1)}function gh(n,a,i){var c=We;We|=2;var h=ib(),p=ob();(at!==n||$e!==a)&&(jc=null,pi(n,a)),a=!1;var x=bt;e:do try{if(Je!==0&&Ue!==null){var R=Ue,O=Tn;switch(Je){case 8:ph(),x=6;break e;case 3:case 2:case 9:case 6:En.current===null&&(a=!0);var H=Je;if(Je=0,Tn=null,gi(n,R,O,H),i&&fi){x=0;break e}break;default:H=Je,Je=0,Tn=null,gi(n,R,O,H)}}nR(),x=bt;break}catch(Q){ab(n,Q)}while(!0);return a&&n.shellSuspendCounter++,Pr=os=null,We=c,M.H=h,M.A=p,Ue===null&&(at=null,$e=0,Zl()),x}function nR(){for(;Ue!==null;)lb(Ue)}function rR(n,a){var i=We;We|=2;var c=ib(),h=ob();at!==n||$e!==a?(jc=null,kc=ht()+500,pi(n,a)):fi=dt(n,a);e:do try{if(Je!==0&&Ue!==null){a=Ue;var p=Tn;t:switch(Je){case 1:Je=0,Tn=null,gi(n,a,p,1);break;case 2:case 9:if(vy(p)){Je=0,Tn=null,cb(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:vy(p)?(Je=0,Tn=null,cb(a)):(Je=0,Tn=null,gi(n,a,p,7));break;case 5:var x=null;switch(Ue.tag){case 26:x=Ue.memoizedState;case 5:case 27:var R=Ue;if(x?Yb(x):R.stateNode.complete){Je=0,Tn=null;var O=R.sibling;if(O!==null)Ue=O;else{var H=R.return;H!==null?(Ue=H,Dc(H)):Ue=null}break t}}Je=0,Tn=null,gi(n,a,p,5);break;case 6:Je=0,Tn=null,gi(n,a,p,6);break;case 8:ph(),bt=6;break e;default:throw Error(s(462))}}aR();break}catch(Q){ab(n,Q)}while(!0);return Pr=os=null,M.H=c,M.A=h,We=i,Ue!==null?0:(at=null,$e=0,Zl(),bt)}function aR(){for(;Ue!==null&&!ot();)lb(Ue)}function lb(n){var a=Ov(n.alternate,n,Fr);n.memoizedProps=n.pendingProps,a===null?Dc(n):Ue=a}function cb(n){var a=n,i=a.alternate;switch(a.tag){case 15:case 0:a=Tv(i,a,a.pendingProps,a.type,void 0,$e);break;case 11:a=Tv(i,a,a.pendingProps,a.type.render,a.ref,$e);break;case 5:jf(a);default:Dv(i,a),a=Ue=oy(a,Fr),a=Ov(i,a,Fr)}n.memoizedProps=n.pendingProps,a===null?Dc(n):Ue=a}function gi(n,a,i,c){Pr=os=null,jf(a),si=null,bo=0;var h=a.return;try{if(FT(n,h,a,i,$e)){bt=1,xc(n,Pn(i,n.current)),Ue=null;return}}catch(p){if(h!==null)throw Ue=h,p;bt=1,xc(n,Pn(i,n.current)),Ue=null;return}a.flags&32768?(qe||c===1?n=!0:fi||($e&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))),ub(a,n)):Dc(a)}function Dc(n){var a=n;do{if((a.flags&32768)!==0){ub(a,Sa);return}n=a.return;var i=WT(a.alternate,a,Fr);if(i!==null){Ue=i;return}if(a=a.sibling,a!==null){Ue=a;return}Ue=a=n}while(a!==null);bt===0&&(bt=5)}function ub(n,a){do{var i=XT(n.alternate,n);if(i!==null){i.flags&=32767,Ue=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(n=n.sibling,n!==null)){Ue=n;return}Ue=n=i}while(n!==null);bt=6,Ue=null}function db(n,a,i,c,h,p,x,R,O){n.cancelPendingCommit=null;do Lc();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|=rf,rn(n,i,p,x,R,O),n===at&&(Ue=at=null,$e=0),mi=a,Ta=n,Kr=i,fh=p,hh=h,eb=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,lR(dr,function(){return gb(),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{JT(n,a,i)}finally{We=x,K.p=h,M.T=c}}Nt=1,fb(),hb(),mb()}}function fb(){if(Nt===1){Nt=0;var n=Ta,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{Fv(a,n);var p=Ah,x=Qg(n.containerInfo),R=p.focusedElem,O=p.selectionRange;if(x!==R&&R&&R.ownerDocument&&Jg(R.ownerDocument.documentElement,R)){if(O!==null&&Qd(R)){var H=O.start,Q=O.end;if(Q===void 0&&(Q=H),"selectionStart"in R)R.selectionStart=H,R.selectionEnd=Math.min(Q,R.value.length);else{var re=R.ownerDocument||document,G=re&&re.defaultView||window;if(G.getSelection){var W=G.getSelection(),ve=R.textContent.length,Ae=Math.min(O.start,ve),tt=O.end===void 0?Ae:Math.min(O.end,ve);!W.extend&&Ae>tt&&(x=tt,tt=Ae,Ae=x);var U=Xg(R,Ae),D=Xg(R,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(),Ae>tt?(W.addRange(B),W.extend(D.node,D.offset)):(B.setEnd(D.node,D.offset),W.addRange(B))}}}}for(re=[],W=R;W=W.parentNode;)W.nodeType===1&&re.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<re.length;R++){var te=re[R];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Kc=!!Rh,Ah=Rh=null}finally{We=h,K.p=c,M.T=i}}n.current=a,Nt=2}}function hb(){if(Nt===2){Nt=0;var n=Ta,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{Bv(n,a.alternate,a)}finally{We=h,K.p=c,M.T=i}}Nt=3}}function mb(){if(Nt===4||Nt===3){Nt=0,rt();var n=Ta,a=mi,i=Kr,c=eb;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Nt=5:(Nt=0,mi=Ta=null,pb(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 R=c[x];p(R.value,{componentStack:R.stack})}}finally{M.T=a,K.p=h}}(Kr&3)!==0&&Lc(),gr(n),h=n.pendingLanes,(i&261930)!==0&&(h&42)!==0?n===mh?Po++:(Po=0,mh=n):Po=0,zo(0)}}function pb(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,yo(a)))}function Lc(){return fb(),hb(),mb(),gb()}function gb(){if(Nt!==5)return!1;var n=Ta,a=fh;fh=0;var i=Yn(Kr),c=M.T,h=K.p;try{K.p=32>i?32:i,M.T=null,i=hh,hh=null;var p=Ta,x=Kr;if(Nt=0,mi=Ta=null,Kr=0,(We&6)!==0)throw Error(s(331));var R=We;if(We|=4,Jv(p.current),Yv(p,p.current,x,i),We=R,zo(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(fr,p)}catch{}return!0}finally{K.p=h,M.T=c,pb(n,a)}}function yb(n,a,i){a=Pn(i,a),a=Ff(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)yb(n,n,i);else for(;a!==null;){if(a.tag===3){yb(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=vv(2),c=ba(a,i,2),c!==null&&(bv(i,c,a,n),mt(c,2),gr(c));break}}a=a.return}}function yh(n,a,i){var c=n.pingCache;if(c===null){c=n.pingCache=new eR;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)||(ch=!0,h.add(i),n=sR.bind(null,n,a,i),a.then(n,n))}function sR(n,a,i){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,at===n&&($e&i)===i&&(bt===4||bt===3&&($e&62914560)===$e&&300>ht()-Nc?(We&2)===0&&pi(n,0):uh|=i,hi===$e&&(hi=0)),gr(n)}function vb(n,a){a===0&&(a=Xt()),n=as(n,a),n!==null&&(mt(n,a),gr(n))}function iR(n){var a=n.memoizedState,i=0;a!==null&&(i=a.retryLane),vb(n,i)}function oR(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),vb(n,i)}function lR(n,a){return cr(n,a)}var Pc=null,yi=null,vh=!1,zc=!1,bh=!1,Aa=0;function gr(n){n!==yi&&n.next===null&&(yi===null?Pc=yi=n:yi=yi.next=n),zc=!0,vh||(vh=!0,uR())}function zo(n,a){if(!bh&&zc){bh=!0;do for(var i=!1,c=Pc;c!==null;){if(n!==0){var h=c.pendingLanes;if(h===0)var p=0;else{var x=c.suspendedLanes,R=c.pingedLanes;p=(1<<31-Mt(42|n)+1)-1,p&=h&~(x&~R),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(i=!0,_b(c,p))}else p=$e,p=ke(c,c===at?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||dt(c,p)||(i=!0,_b(c,p));c=c.next}while(i);bh=!1}}function cR(){bb()}function bb(){zc=vh=!1;var n=0;Aa!==0&&wR()&&(n=Aa);for(var a=ht(),i=null,c=Pc;c!==null;){var h=c.next,p=wb(c,a);p===0?(c.next=null,i===null?Pc=h:i.next=h,h===null&&(yi=i)):(i=c,(n!==0||(p&3)!==0)&&(zc=!0)),c=h}Nt!==0&&Nt!==5||zo(n),Aa!==0&&(Aa=0)}function wb(n,a){for(var i=n.suspendedLanes,c=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var x=31-Mt(p),R=1<<x,O=h[x];O===-1?((R&i)===0||(R&c)!==0)&&(h[x]=Dt(R,a)):O<=a&&(n.expiredLanes|=R),p&=~R}if(a=at,i=$e,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&&ze(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&&ze(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=xb.bind(null,n),i=cr(i,c),n.callbackPriority=a,n.callbackNode=i,a}return c!==null&&c!==null&&ze(c),n.callbackPriority=2,n.callbackNode=null,2}function xb(n,a){if(Nt!==0&&Nt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Lc()&&n.callbackNode!==i)return null;var c=$e;return c=ke(n,n===at?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(nb(n,c,a),wb(n,ht()),n.callbackNode!=null&&n.callbackNode===i?xb.bind(null,n):null)}function _b(n,a){if(Lc())return null;nb(n,a,!0)}function uR(){_R(function(){(We&6)!==0?cr(Nr,cR):bb()})}function wh(){if(Aa===0){var n=ni;n===0&&(n=Ge,Ge<<=1,(Ge&261888)===0&&(Ge=256)),Aa=n}return Aa}function Sb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Gl(""+n)}function Eb(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 dR(n,a,i,c,h){if(a==="submit"&&i&&i.stateNode===h){var p=Sb((h[on]||null).action),x=c.submitter;x&&(a=(a=x[on]||null)?Sb(a.formAction):x.getAttribute("formAction"),a!==null&&(p=a,x=null));var R=new Wl("action","action",null,c,h);n.push({event:R,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Aa!==0){var O=x?Eb(h,x):new FormData(h);$f(i,{pending:!0,data:O,method:h.method,action:p},null,O)}}else typeof p=="function"&&(R.preventDefault(),O=x?Eb(h,x):new FormData(h),$f(i,{pending:!0,data:O,method:h.method,action:p},p,O))},currentTarget:h}]})}}for(var xh=0;xh<nf.length;xh++){var _h=nf[xh],fR=_h.toLowerCase(),hR=_h[0].toUpperCase()+_h.slice(1);Wn(fR,"on"+hR)}Wn(ty,"onAnimationEnd"),Wn(ny,"onAnimationIteration"),Wn(ry,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(NT,"onTransitionRun"),Wn(kT,"onTransitionStart"),Wn(jT,"onTransitionCancel"),Wn(ay,"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 Uo="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(" "),mR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Uo));function Cb(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 R=c[x],O=R.instance,H=R.currentTarget;if(R=R.listener,O!==p&&h.isPropagationStopped())break e;p=R,h.currentTarget=H;try{p(h)}catch(Q){Ql(Q)}h.currentTarget=null,p=O}else for(x=0;x<c.length;x++){if(R=c[x],O=R.instance,H=R.currentTarget,R=R.listener,O!==p&&h.isPropagationStopped())break e;p=R,h.currentTarget=H;try{p(h)}catch(Q){Ql(Q)}h.currentTarget=null,p=O}}}}function Ie(n,a){var i=a[Dd];i===void 0&&(i=a[Dd]=new Set);var c=n+"__bubble";i.has(c)||(Tb(a,n,2,!1),i.add(c))}function Sh(n,a,i){var c=0;a&&(c|=4),Tb(i,n,c,a)}var Uc="_reactListening"+Math.random().toString(36).slice(2);function Eh(n){if(!n[Uc]){n[Uc]=!0,bg.forEach(function(i){i!=="selectionchange"&&(mR.has(i)||Sh(i,!1,n),Sh(i,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Uc]||(a[Uc]=!0,Sh("selectionchange",!1,a))}}function Tb(n,a,i,c){switch(t0(a)){case 2:var h=HR;break;case 8:h=qR;break;default:h=Ih}i=h.bind(null,a,i,n),h=void 0,!qd||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 Ch(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 R=c.stateNode.containerInfo;if(R===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(;R!==null;){if(x=Is(R),x===null)return;if(O=x.tag,O===5||O===6||O===26||O===27){c=p=x;continue e}R=R.parentNode}}c=c.return}jg(function(){var H=p,Q=Bd(i),re=[];e:{var G=sy.get(n);if(G!==void 0){var W=Wl,ve=n;switch(n){case"keypress":if(Kl(i)===0)break e;case"keydown":case"keyup":W=oT;break;case"focusin":ve="focus",W=Kd;break;case"focusout":ve="blur",W=Kd;break;case"beforeblur":case"afterblur":W=Kd;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=Dg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=WC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=uT;break;case ty:case ny:case ry:W=QC;break;case ay:W=fT;break;case"scroll":case"scrollend":W=KC;break;case"wheel":W=mT;break;case"copy":case"cut":case"paste":W=eT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=Pg;break;case"toggle":case"beforetoggle":W=gT}var Ae=(a&4)!==0,tt=!Ae&&(n==="scroll"||n==="scrollend"),U=Ae?G!==null?G+"Capture":null:G;Ae=[];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=so(D,U),te!=null&&Ae.push(Io(D,te,B))),tt)break;D=D.return}0<Ae.length&&(G=new W(G,ve,null,i,Q),re.push({event:G,listeners:Ae}))}}if((a&7)===0){e:{if(G=n==="mouseover"||n==="pointerover",W=n==="mouseout"||n==="pointerout",G&&i!==$d&&(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),Ae=ve.tag,ve!==tt||Ae!==5&&Ae!==27&&Ae!==6)&&(ve=null)):(W=null,ve=H),W!==ve)){if(Ae=Dg,te="onMouseLeave",U="onMouseEnter",D="mouse",(n==="pointerout"||n==="pointerover")&&(Ae=Pg,te="onPointerLeave",U="onPointerEnter",D="pointer"),tt=W==null?G:ao(W),B=ve==null?G:ao(ve),G=new Ae(te,D+"leave",W,i,Q),G.target=tt,G.relatedTarget=B,te=null,Is(Q)===H&&(Ae=new Ae(U,D+"enter",ve,i,Q),Ae.target=B,Ae.relatedTarget=tt,te=Ae),tt=te,W&&ve)t:{for(Ae=pR,U=W,D=ve,B=0,te=U;te;te=Ae(te))B++;te=0;for(var Se=D;Se;Se=Ae(Se))te++;for(;0<B-te;)U=Ae(U),B--;for(;0<te-B;)D=Ae(D),te--;for(;B--;){if(U===D||D!==null&&U===D.alternate){Ae=U;break t}U=Ae(U),D=Ae(D)}Ae=null}else Ae=null;W!==null&&Rb(re,G,W,Ae,!1),ve!==null&&tt!==null&&Rb(re,tt,ve,Ae,!0)}}e:{if(G=H?ao(H):window,W=G.nodeName&&G.nodeName.toLowerCase(),W==="select"||W==="input"&&G.type==="file")var Fe=Vg;else if(Hg(G))if(Gg)Fe=TT;else{Fe=ET;var _e=ST}else W=G.nodeName,!W||W.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?H&&Id(H.elementType)&&(Fe=Vg):Fe=CT;if(Fe&&(Fe=Fe(n,H))){qg(re,Fe,i,Q);break e}_e&&_e(n,G,H),n==="focusout"&&H&&G.type==="number"&&H.memoizedProps.value!=null&&Ud(G,"number",G.value)}switch(_e=H?ao(H):window,n){case"focusin":(Hg(_e)||_e.contentEditable==="true")&&(Ys=_e,Zd=H,mo=null);break;case"focusout":mo=Zd=Ys=null;break;case"mousedown":ef=!0;break;case"contextmenu":case"mouseup":case"dragend":ef=!1,Zg(re,i,Q);break;case"selectionchange":if(AT)break;case"keydown":case"keyup":Zg(re,i,Q)}var De;if(Wd)e:{switch(n){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else Ks?$g(n,i)&&(Be="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(Be="onCompositionStart");Be&&(zg&&i.locale!=="ko"&&(Ks||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&Ks&&(De=Og()):(fa=Q,Vd="value"in fa?fa.value:fa.textContent,Ks=!0)),_e=Ic(H,Be),0<_e.length&&(Be=new Lg(Be,n,null,i,Q),re.push({event:Be,listeners:_e}),De?Be.data=De:(De=Bg(i),De!==null&&(Be.data=De)))),(De=vT?bT(n,i):wT(n,i))&&(Be=Ic(H,"onBeforeInput"),0<Be.length&&(_e=new Lg("onBeforeInput","beforeinput",null,i,Q),re.push({event:_e,listeners:Be}),_e.data=De)),dR(re,n,H,i,Q)}Cb(re,a)})}function Io(n,a,i){return{instance:n,listener:a,currentTarget:i}}function Ic(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=so(n,i),h!=null&&c.unshift(Io(n,h,p)),h=so(n,a),h!=null&&c.push(Io(n,h,p))),n.tag===3)return c;n=n.return}return[]}function pR(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 R=i,O=R.alternate,H=R.stateNode;if(R=R.tag,O!==null&&O===c)break;R!==5&&R!==26&&R!==27||H===null||(O=H,h?(H=so(i,p),H!=null&&x.unshift(Io(i,H,O))):h||(H=so(i,p),H!=null&&x.push(Io(i,H,O)))),i=i.return}x.length!==0&&n.push({event:a,listeners:x})}var gR=/\r\n?/g,yR=/\u0000|\uFFFD/g;function Ab(n){return(typeof n=="string"?n:""+n).replace(gR,`
|
||
`).replace(yR,"")}function Nb(n,a){return a=Ab(a),Ab(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":ql(n,"class",c);break;case"tabIndex":ql(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":ql(n,i,c);break;case"style":Ng(n,c,p);break;case"data":if(a!=="object"){ql(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=Gl(""+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=Gl(""+c),n.setAttribute(i,c);break;case"onClick":c!=null&&(n.onclick=Or);break;case"onScroll":c!=null&&Ie("scroll",n);break;case"onScrollEnd":c!=null&&Ie("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=Gl(""+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":Ie("beforetoggle",n),Ie("toggle",n),Hl(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":Hl(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=GC.get(i)||i,Hl(n,i,c))}}function Th(n,a,i,c,h,p){switch(i){case"style":Ng(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&&Ie("scroll",n);break;case"onScrollEnd":c!=null&&Ie("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(!wg.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,""):Hl(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":Ie("error",n),Ie("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":Ie("invalid",n);var R=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":R=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(s(137,a));break;default:et(n,a,c,Q,i,null)}}Cg(n,p,R,O,H,x,h,!1);return;case"select":Ie("invalid",n),c=x=p=null;for(h in i)if(i.hasOwnProperty(h)&&(R=i[h],R!=null))switch(h){case"value":p=R;break;case"defaultValue":x=R;break;case"multiple":c=R;default:et(n,a,h,R,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":Ie("invalid",n),p=h=c=null;for(x in i)if(i.hasOwnProperty(x)&&(R=i[x],R!=null))switch(x){case"value":c=R;break;case"defaultValue":h=R;break;case"children":p=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(s(91));break;default:et(n,a,x,R,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":Ie("beforetoggle",n),Ie("toggle",n),Ie("cancel",n),Ie("close",n);break;case"iframe":case"object":Ie("load",n);break;case"video":case"audio":for(c=0;c<Uo.length;c++)Ie(Uo[c],n);break;case"image":Ie("error",n),Ie("load",n);break;case"details":Ie("toggle",n);break;case"embed":case"source":case"link":Ie("error",n),Ie("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(Id(a)){for(Q in i)i.hasOwnProperty(Q)&&(c=i[Q],c!==void 0&&Th(n,a,Q,c,i,void 0));return}}for(R in i)i.hasOwnProperty(R)&&(c=i[R],c!=null&&et(n,a,R,c,i,null))}function vR(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,R=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":R=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)}}zd(n,x,R,O,H,Q,p,h);return;case"select":W=x=R=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":R=p;break;case"multiple":x=p;default:p!==O&&et(n,a,h,p,c,O)}a=R,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(R in i)if(h=i[R],i.hasOwnProperty(R)&&h!=null&&!c.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:et(n,a,R,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 Ae in i)G=i[Ae],i.hasOwnProperty(Ae)&&G!=null&&!c.hasOwnProperty(Ae)&&et(n,a,Ae,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(Id(a)){for(var tt in i)G=i[tt],i.hasOwnProperty(tt)&&G!==void 0&&!c.hasOwnProperty(tt)&&Th(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||Th(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 kb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bR(){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,R=h.duration;if(p&&R&&kb(x)){for(x=0,R=h.responseEnd,c+=1;c<i.length;c++){var O=i[c],H=O.startTime;if(H>R)break;var Q=O.transferSize,re=O.initiatorType;Q&&kb(re)&&(O=O.responseEnd,x+=Q*(O<R?1:(R-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 Rh=null,Ah=null;function $c(n){return n.nodeType===9?n:n.ownerDocument}function jb(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 Ob(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 Nh(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 kh=null;function wR(){var n=window.event;return n&&n.type==="popstate"?n===kh?!1:(kh=n,!0):(kh=null,!1)}var Mb=typeof setTimeout=="function"?setTimeout:void 0,xR=typeof clearTimeout=="function"?clearTimeout:void 0,Db=typeof Promise=="function"?Promise:void 0,_R=typeof queueMicrotask=="function"?queueMicrotask:typeof Db<"u"?function(n){return Db.resolve(null).then(n).catch(SR)}:Mb;function SR(n){setTimeout(function(){throw n})}function Na(n){return n==="head"}function Lb(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")$o(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,$o(i);for(var p=i.firstChild;p;){var x=p.nextSibling,R=p.nodeName;p[ro]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&p.rel.toLowerCase()==="stylesheet"||i.removeChild(p),p=x}}else i==="body"&&$o(n.ownerDocument.body);i=h}while(i);xi(a)}function Pb(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 jh(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":jh(i),Ld(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function ER(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[ro])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 CR(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 zb(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 Oh(n){return n.data==="$?"||n.data==="$~"}function Mh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function TR(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 Dh=null;function Ub(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 Ib(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 $b(n,a,i){switch(a=$c(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 $o(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Ld(n)}var Hn=new Map,Bb=new Set;function Bc(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Yr=K.d;K.d={f:RR,r:AR,D:NR,C:kR,L:jR,m:OR,X:DR,S:MR,M:LR};function RR(){var n=Yr.f(),a=Oc();return n||a}function AR(n){var a=$s(n);a!==null&&a.tag===5&&a.type==="form"?av(a):Yr.r(n)}var vi=typeof document>"u"?null:document;function Hb(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+'"]'),Bb.has(h)||(Bb.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 NR(n){Yr.D(n),Hb("dns-prefetch",n,null)}function kR(n,a){Yr.C(n,a),Hb("preconnect",n,a)}function jR(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(Bo(p))||a==="script"&&c.querySelector(Ho(p))||(a=c.createElement("link"),qt(a,"link",n),Lt(a),c.head.appendChild(a)))}}function OR(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(Ho(p)))return}c=i.createElement("link"),qt(c,"link",n),Lt(c),i.head.appendChild(c)}}}function MR(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 R={loading:0,preload:null};if(x=c.querySelector(Bo(p)))R.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":a},i),(i=Hn.get(p))&&Lh(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(){R.loading|=1}),O.addEventListener("error",function(){R.loading|=2}),R.loading|=4,Hc(x,a,c)}x={type:"stylesheet",instance:x,count:1,state:R},h.set(p,x)}}}function DR(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(Ho(h)),p||(n=g({src:n,async:!0},a),(a=Hn.get(h))&&Ph(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 LR(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(Ho(h)),p||(n=g({src:n,async:!0,type:"module"},a),(a=Hn.get(h))&&Ph(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 qb(n,a,i,c){var h=(h=Z.current)?Bc(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(Bo(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||PR(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 Bo(n){return'link[rel="stylesheet"]['+n+"]"}function Vb(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function PR(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 Ho(n){return"script[async]"+n}function Gb(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),Hc(c,i.precedence,n),a.instance=c;case"stylesheet":h=bi(i.href);var p=n.querySelector(Bo(h));if(p)return a.state.loading|=4,a.instance=p,Lt(p),p;c=Vb(i),(h=Hn.get(h))&&Lh(c,h),p=(n.ownerDocument||n).createElement("link"),Lt(p);var x=p;return x._p=new Promise(function(R,O){x.onload=R,x.onerror=O}),qt(p,"link",c),a.state.loading|=4,Hc(p,i.precedence,n),a.instance=p;case"script":return p=wi(i.src),(h=n.querySelector(Ho(p)))?(a.instance=h,Lt(h),h):(c=i,(h=Hn.get(p))&&(c=g({},i),Ph(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,Hc(c,i.precedence,n));return a.instance}function Hc(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 R=c[x];if(R.dataset.precedence===a)p=R;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 Lh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function Ph(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var qc=null;function Fb(n,a,i){if(qc===null){var c=new Map,h=qc=new Map;h.set(i,c)}else h=qc,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[ro]||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 R=c.get(x);R?R.push(p):c.set(x,[p])}}return c}function Kb(n,a,i){n=n.ownerDocument||n,n.head.insertBefore(i,a==="title"?n.querySelector("head > title"):null)}function zR(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 Yb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function UR(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(Bo(h));if(p){a=p._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=Vc.bind(n),a.then(n,n)),i.state.loading|=4,i.instance=p,Lt(p);return}p=a.ownerDocument||a,c=Vb(c),(h=Hn.get(h))&&Lh(c,h),p=p.createElement("link"),Lt(p);var x=p;x._p=new Promise(function(R,O){x.onload=R,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=Vc.bind(n),a.addEventListener("load",i),a.addEventListener("error",i))}}var zh=0;function IR(n,a){return n.stylesheets&&n.count===0&&Fc(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var c=setTimeout(function(){if(n.stylesheets&&Fc(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+a);0<n.imgBytes&&zh===0&&(zh=62500*bR());var h=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Fc(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>zh?50:800)+a);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function Vc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fc(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Gc=null;function Fc(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Gc=new Map,a.forEach($R,n),Gc=null,Vc.call(n))}function $R(n,a){if(!(a.state.loading&4)){var i=Gc.get(n);if(i)var c=i.get(null);else{i=new Map,Gc.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=Vc.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 qo={$$typeof:N,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function BR(n,a,i,c,h,p,x,R,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 Wb(n,a,i,c,h,p,x,R,O,H,Q,re){return n=new BR(n,a,i,x,O,H,Q,re,R),a=1,p===!0&&(a|=24),p=Sn(3,null,null,a),n.current=p,p.stateNode=n,a=gf(),a.refCount++,n.pooledCache=a,a.refCount++,p.memoizedState={element:c,isDehydrated:i,cache:a},wf(p),n}function Xb(n){return n?(n=Js,n):Js}function Jb(n,a,i,c,h,p){h=Xb(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),xo(i,n,a))}function Qb(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<a?i:a}}function Uh(n,a){Qb(n,a),(n=n.alternate)&&Qb(n,a)}function Zb(n){if(n.tag===13||n.tag===31){var a=as(n,67108864);a!==null&&hn(a,n,67108864),Uh(n,67108864)}}function e0(n){if(n.tag===13||n.tag===31){var a=An();a=zs(a);var i=as(n,a);i!==null&&hn(i,n,a),Uh(n,a)}}var Kc=!0;function HR(n,a,i,c){var h=M.T;M.T=null;var p=K.p;try{K.p=2,Ih(n,a,i,c)}finally{K.p=p,M.T=h}}function qR(n,a,i,c){var h=M.T;M.T=null;var p=K.p;try{K.p=8,Ih(n,a,i,c)}finally{K.p=p,M.T=h}}function Ih(n,a,i,c){if(Kc){var h=$h(c);if(h===null)Ch(n,a,c,Yc,i),n0(n,c);else if(GR(h,n,a,i,c))c.stopPropagation();else if(n0(n,c),a&4&&-1<VR.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 R=p;for(R.pendingLanes|=2,R.entangledLanes|=2;x;){var O=1<<31-Mt(x);R.entanglements[1]|=O,x&=~O}gr(p),(We&6)===0&&(kc=ht()+500,zo(0))}}break;case 31:case 13:R=as(p,2),R!==null&&hn(R,p,2),Oc(),Uh(p,2)}if(p=$h(c),p===null&&Ch(n,a,c,Yc,i),p===h)break;h=p}h!==null&&c.stopPropagation()}else Ch(n,a,c,null,i)}}function $h(n){return n=Bd(n),Bh(n)}var Yc=null;function Bh(n){if(Yc=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 Yc=n,null}function t0(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(to()){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 Hh=!1,ka=null,ja=null,Oa=null,Vo=new Map,Go=new Map,Ma=[],VR="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 n0(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":Vo.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Go.delete(a.pointerId)}}function Fo(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&&Zb(a)),n):(n.eventSystemFlags|=c,a=n.targetContainers,h!==null&&a.indexOf(h)===-1&&a.push(h),n)}function GR(n,a,i,c,h){switch(a){case"focusin":return ka=Fo(ka,n,a,i,c,h),!0;case"dragenter":return ja=Fo(ja,n,a,i,c,h),!0;case"mouseover":return Oa=Fo(Oa,n,a,i,c,h),!0;case"pointerover":var p=h.pointerId;return Vo.set(p,Fo(Vo.get(p)||null,n,a,i,c,h)),!0;case"gotpointercapture":return p=h.pointerId,Go.set(p,Fo(Go.get(p)||null,n,a,i,c,h)),!0}return!1}function r0(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,yg(n.priority,function(){e0(i)});return}}else if(a===31){if(a=d(i),a!==null){n.blockedOn=a,yg(n.priority,function(){e0(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 Wc(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var i=$h(n.nativeEvent);if(i===null){i=n.nativeEvent;var c=new i.constructor(i.type,i);$d=c,i.target.dispatchEvent(c),$d=null}else return a=$s(i),a!==null&&Zb(a),n.blockedOn=i,!1;a.shift()}return!0}function a0(n,a,i){Wc(n)&&i.delete(a)}function FR(){Hh=!1,ka!==null&&Wc(ka)&&(ka=null),ja!==null&&Wc(ja)&&(ja=null),Oa!==null&&Wc(Oa)&&(Oa=null),Vo.forEach(a0),Go.forEach(a0)}function Xc(n,a){n.blockedOn===a&&(n.blockedOn=null,Hh||(Hh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,FR)))}var Jc=null;function s0(n){Jc!==n&&(Jc=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Jc===n&&(Jc=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(Bh(c||i)===null)continue;break}var p=$s(i);p!==null&&(n.splice(a,3),a-=3,$f(p,{pending:!0,data:h,method:i.method,action:c},c,h))}}))}function xi(n){function a(O){return Xc(O,n)}ka!==null&&Xc(ka,n),ja!==null&&Xc(ja,n),Oa!==null&&Xc(Oa,n),Vo.forEach(a),Go.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);)r0(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||s0(i);else if(x){var R=null;if(p&&p.hasAttribute("formAction")){if(h=p,x=p[on]||null)R=x.formAction;else if(Bh(h)!==null)continue}else R=x.action;typeof R=="function"?i[c+1]=R:(i.splice(c,3),c-=3),s0(i)}}}function i0(){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 qh(n){this._internalRoot=n}Qc.prototype.render=qh.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(s(409));var i=a.current,c=An();Jb(i,c,n,a,null,null)},Qc.prototype.unmount=qh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;Jb(n.current,2,null,n,null,null),Oc(),a[Us]=null}};function Qc(n){this._internalRoot=n}Qc.prototype.unstable_scheduleHydration=function(n){if(n){var a=Md();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&&r0(n)}};var o0=t.version;if(o0!=="19.2.6")throw Error(s(527,o0,"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 KR={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zc.isDisabled&&Zc.supportsFiber)try{fr=Zc.inject(KR),Ut=Zc}catch{}}return Yo.createRoot=function(n,a){if(!o(n))throw Error(s(299));var i=!1,c="",h=mv,p=pv,x=gv;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=Wb(n,1,!1,null,null,i,c,null,h,p,x,i0),n[Us]=a.current,Eh(n),new qh(a)},Yo.hydrateRoot=function(n,a,i){if(!o(n))throw Error(s(299));var c=!1,h="",p=mv,x=pv,R=gv,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&&(R=i.onRecoverableError),i.formState!==void 0&&(O=i.formState)),a=Wb(n,1,!0,a,i??null,c,h,O,p,x,R,i0),a.context=Xb(null),i=a.current,c=An(),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,Eh(n),new Qc(a)},Yo.version="19.2.6",Yo}var y0;function rA(){if(y0)return Fh.exports;y0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Fh.exports=nA(),Fh.exports}var aA=rA();/**
|
||
* 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 v0="popstate";function b0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function sA(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 Tm("",{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:dl(o)}return oA(t,r,null,e)}function gt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Rr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function iA(){return Math.random().toString(36).substring(2,10)}function w0(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 Tm(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||iA(),mask:o}}function dl({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 oA(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 T=b(),C=T==null?null:T-m;m=T,f&&f({action:d,location:S.location,delta:C})}function w(T,C){d="PUSH";let A=b0(T)?T:Tm(S.location,T,C);m=b()+1;let N=w0(A,m),P=S.createHref(A.mask||A);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 _(T,C){d="REPLACE";let A=b0(T)?T:Tm(S.location,T,C);m=b();let N=w0(A,m),P=S.createHref(A.mask||A);u.replaceState(N,"",P),l&&f&&f({action:d,location:S.location,delta:0})}function E(T){return lA(T)}let S={get action(){return d},get location(){return e(o,u)},listen(T){if(f)throw new Error("A history only accepts one active listener");return o.addEventListener(v0,g),f=T,()=>{o.removeEventListener(v0,g),f=null}},createHref(T){return t(o,T)},createURL:E,encodeLocation(T){let C=E(T);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:w,replace:_,go(T){return u.go(T)}};return S}function lA(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:dl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function hx(e,t,r="/"){return cA(e,t,r,!1)}function cA(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=uA(e),f=null,m=_A(u);for(let b=0;f==null&&b<d.length;++b)f=wA(d[b],m,s);return f}function uA(e){let t=mx(e);return dA(t),t}function mx(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}".`),mx(u.children,t,w,g,f)),!(u.path==null&&!u.index)&&t.push({path:g,score:vA(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 px(u.path))l(u,d,!0,m)}),t}function px(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=px(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 dA(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:bA(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var fA=/^:[\w-]+$/,hA=3,mA=2,pA=1,gA=10,yA=-2,x0=e=>e==="*";function vA(e,t){let r=e.split("/"),s=r.length;return r.some(x0)&&(s+=yA),t&&(s+=mA),r.filter(o=>!x0(o)).reduce((o,l)=>o+(fA.test(l)?hA:l===""?pA:gA),s)}function bA(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 wA(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=Pu({path:f.relativePath,caseSensitive:f.caseSensitive,end:m},b),w=f.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=Pu({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:TA(rr([l,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(l=rr([l,g.pathnameBase]))}return u}function Pu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=xA(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 xA(e,t=!1,r=!0){Rr(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 _A(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Rr(!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 SA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function EA(e,t="/"){let{pathname:r,search:s="",hash:o=""}=typeof e=="string"?Ki(e):e,l;return r?(r=yx(r),r.startsWith("/")?l=_0(r.substring(1),"/"):l=_0(r,t)):l=t,{pathname:l,search:RA(s),hash:AA(o)}}function _0(e,t){let r=zu(t).split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function Xh(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 CA(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function gx(e){let t=CA(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function dp(e,t,r,s=!1){let o;typeof e=="string"?o=Ki(e):(o={...e},gt(!o.pathname||!o.pathname.includes("?"),Xh("?","pathname","search",o)),gt(!o.pathname||!o.pathname.includes("#"),Xh("#","pathname","hash",o)),gt(!o.search||!o.search.includes("#"),Xh("#","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=EA(o,d),m=u&&u!=="/"&&u.endsWith("/"),b=(l||u===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(m||b)&&(f.pathname+="/"),f}var yx=e=>e.replace(/\/\/+/g,"/"),rr=e=>yx(e.join("/")),zu=e=>e.replace(/\/+$/,""),TA=e=>zu(e).replace(/^\/*/,"/"),RA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,AA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,NA=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 kA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function jA(e){let t=e.map(r=>r.route.path).filter(Boolean);return rr(t)||"/"}var vx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function bx(e,t){let r=e;if(typeof r!="string"||!SA.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,o=!1;if(vx)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{Rr(!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 wx=["POST","PUT","PATCH","DELETE"];new Set(wx);var OA=["GET",...wx];new Set(OA);var Yi=v.createContext(null);Yi.displayName="DataRouter";var od=v.createContext(null);od.displayName="DataRouterState";var xx=v.createContext(!1);function MA(){return v.useContext(xx)}var _x=v.createContext({isTransitioning:!1});_x.displayName="ViewTransition";var DA=v.createContext(new Map);DA.displayName="Fetchers";var LA=v.createContext(null);LA.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 fp=v.createContext(null);fp.displayName="RouteError";var Sx="REACT_ROUTER_ERROR",PA="REDIRECT",zA="ROUTE_ERROR_RESPONSE";function UA(e){if(e.startsWith(`${Sx}:${PA}:{`))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 IA(e){if(e.startsWith(`${Sx}:${zA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new NA(t.status,t.statusText,t.data)}catch{}}function $A(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}=Al(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 Ex="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Cx(e){v.useContext(Gn).static||v.useLayoutEffect(e)}function BA(){let{isDataRoute:e}=v.useContext(sa);return e?eN():HA()}function HA(){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(gx(s)),u=v.useRef(!1);return Cx(()=>{u.current=!0}),v.useCallback((f,m={})=>{if(Rr(u.current,Ex),!u.current)return;if(typeof f=="number"){r.go(f);return}let b=dp(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 Al(e,{relative:t}={}){let{matches:r}=v.useContext(sa),{pathname:s}=ia(),o=JSON.stringify(gx(r));return v.useMemo(()=>dp(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function qA(e,t){return Tx(e,t)}function Tx(e,t,r){var T;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||"";Ax(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==="/"||((T=C.pathname)==null?void 0:T.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})):hx(e,{pathname:_});Rr(m||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Rr(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=YA(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 VA(){let e=ZA(),t=kA(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 GA=v.createElement(VA,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=IA(e.digest);r&&(e=r)}let t=e!==void 0?v.createElement(sa.Provider,{value:this.props.routeContext},v.createElement(fp.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(FA,{error:e},t):t}};Rx.contextType=xx;var Jh=new WeakMap;function FA({children:e,error:t}){let{basename:r}=v.useContext(Gn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=UA(t.digest);if(s){let o=Jh.get(t);if(o)throw o;let l=bx(s.location,r);if(vx&&!Jh.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 Jh.set(t,u),u}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function KA({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 YA(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:jA(s.matches),errorInfo:g})}:void 0;return o.reduceRight((b,g,w)=>{let _,E=!1,S=null,T=null;s&&(_=l&&g.route.id?l[g.route.id]:void 0,S=g.route.errorElement||GA,u&&(d<0&&w===0?(Ax("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,T=null):d===w&&(E=!0,T=g.route.hydrateFallbackElement||null)));let C=t.concat(o.slice(0,w+1)),A=()=>{let N;return _?N=S:E?N=T:g.route.Component?N=v.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=b,v.createElement(KA,{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:A(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:m}):A()},null)}function hp(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function WA(e){let t=v.useContext(Yi);return gt(t,hp(e)),t}function XA(e){let t=v.useContext(od);return gt(t,hp(e)),t}function JA(e){let t=v.useContext(sa);return gt(t,hp(e)),t}function mp(e){let t=JA(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 QA(){return mp("useRouteId")}function ZA(){var s;let e=v.useContext(fp),t=XA("useRouteError"),r=mp("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function eN(){let{router:e}=WA("useNavigate"),t=mp("useNavigate"),r=v.useRef(!1);return Cx(()=>{r.current=!0}),v.useCallback(async(o,l={})=>{Rr(r.current,Ex),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...l}))},[e,t])}var S0={};function Ax(e,t,r){!t&&!S0[e]&&(S0[e]=!0,Rr(!1,r))}v.memo(tN);function tN({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 Nx(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 nN({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 T=ta(m,d);return T==null?null:{location:{pathname:T,search:b,hash:g,state:w,key:_,mask:E},navigationType:s}},[d,m,b,g,w,_,s,E]);return Rr(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 rN({children:e,location:t}){return qA(Rm(e),t)}function Rm(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,Rm(s.props.children,l));return}gt(s.type===Nx,`[${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=Rm(s.props.children,l)),r.push(u)}),r}var Tu="get",Ru="application/x-www-form-urlencoded";function ld(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function aN(e){return ld(e)&&e.tagName.toLowerCase()==="button"}function sN(e){return ld(e)&&e.tagName.toLowerCase()==="form"}function iN(e){return ld(e)&&e.tagName.toLowerCase()==="input"}function oN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function lN(e,t){return e.button===0&&(!t||t==="_self")&&!oN(e)}var eu=null;function cN(){if(eu===null)try{new FormData(document.createElement("form"),0),eu=!1}catch{eu=!0}return eu}var uN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Qh(e){return e!=null&&!uN.has(e)?(Rr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ru}"`),null):e}function dN(e,t){let r,s,o,l,u;if(sN(e)){let d=e.getAttribute("action");s=d?ta(d,t):null,r=e.getAttribute("method")||Tu,o=Qh(e.getAttribute("enctype"))||Ru,l=new FormData(e)}else if(aN(e)||iN(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=Qh(e.getAttribute("formenctype"))||Qh(d.getAttribute("enctype"))||Ru,l=new FormData(d,e),!cN()){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(ld(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 pp(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function kx(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=`${zu(t)}/_root.${s}`:o.pathname=`${zu(o.pathname)}.${s}`,o}async function fN(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 hN(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 mN(e,t,r){let s=await Promise.all(e.map(async o=>{let l=t.routes[o.route.id];if(l){let u=await fN(l,r);return u.links?u.links():[]}return[]}));return vN(s.flat(1).filter(hN).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function E0(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 pN(e,t,{includeHydrateFallback:r}={}){return gN(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 gN(e){return[...new Set(e)]}function yN(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function vN(e,t){let r=new Set;return new Set(t),e.reduce((s,o)=>{let l=JSON.stringify(yN(o));return r.has(l)||(r.add(l),s.push({key:l,link:o})),s},[])}function gp(){let e=v.useContext(Yi);return pp(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function bN(){let e=v.useContext(od);return pp(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var yp=v.createContext(void 0);yp.displayName="FrameworkContext";function vp(){let e=v.useContext(yp);return pp(e,"You must render this element inside a <HydratedRouter> element"),e}function wN(e,t){let r=v.useContext(yp),[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(A=>{u(A.isIntersecting)})},T=new IntersectionObserver(S,{threshold:.5});return w.current&&T.observe(w.current),()=>{T.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:Wo(d,_),onBlur:Wo(f,E),onMouseEnter:Wo(m,_),onMouseLeave:Wo(b,E),onTouchStart:Wo(g,_)}]:[!1,w,{}]}function Wo(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function xN({page:e,...t}){let r=MA(),{router:s}=gp(),o=v.useMemo(()=>hx(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?r?v.createElement(SN,{page:e,matches:o,...t}):v.createElement(EN,{page:e,matches:o,...t}):null}function _N(e){let{manifest:t,routeModules:r}=vp(),[s,o]=v.useState([]);return v.useEffect(()=>{let l=!1;return mN(e,t,r).then(u=>{l||o(u)}),()=>{l=!0}},[e,t,r]),s}function SN({page:e,matches:t,...r}){let s=ia(),{future:o}=vp(),{basename:l}=gp(),u=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let d=kx(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 EN({page:e,matches:t,...r}){let s=ia(),{future:o,manifest:l,routeModules:u}=vp(),{basename:d}=gp(),{loaderData:f,matches:m}=bN(),b=v.useMemo(()=>E0(e,t,m,l,s,"data"),[e,t,m,l,s]),g=v.useMemo(()=>E0(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,T=!1;if(t.forEach(A=>{var P;let N=l.routes[A.route.id];!N||!N.hasLoader||(!b.some(F=>F.route.id===A.route.id)&&A.route.id in f&&((P=u[A.route.id])!=null&&P.shouldRevalidate)||N.hasClientLoader?T=!0:S.add(A.route.id))}),S.size===0)return[];let C=kx(e,d,o.unstable_trailingSlashAwareDataRequests,"data");return T&&S.size>0&&C.searchParams.set("_routes",t.filter(A=>S.has(A.route.id)).map(A=>A.route.id).join(",")),[C.pathname+C.search]},[d,o.unstable_trailingSlashAwareDataRequests,f,s,l,b,t,e,u]),_=v.useMemo(()=>pN(g,l),[g,l]),E=_N(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:T})=>v.createElement("link",{key:S,nonce:r.nonce,...T,crossOrigin:T.crossOrigin??r.crossOrigin})))}function CN(...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=sA({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(nN,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,useTransitions:r})}var jx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ox=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:T,navigator:C,useTransitions:A}=v.useContext(Gn),N=typeof b=="string"&&jx.test(b),P=bx(b,T);b=P.to;let F=$A(b,{relative:o}),$=ia(),L=null;if(d){let fe=dp(d,[],$.mask?$.mask.pathname:"/",!0);T!=="/"&&(fe.pathname=fe.pathname==="/"?T:rr([T,fe.pathname])),L=C.createHref(fe)}let[q,ie,he]=wN(s,E),pe=jN(b,{replace:u,mask:d,state:f,target:m,preventScrollReset:g,relative:o,viewTransition:w,defaultShouldRevalidate:_,useTransitions:A});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:CN(S,ie),target:m,"data-discover":!N&&r==="render"?"true":void 0});return q&&!N?v.createElement(v.Fragment,null,ce,v.createElement(xN,{page:F})):ce});Ox.displayName="Link";var AN=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=Al(u,{relative:m.relative}),w=ia(),_=v.useContext(od),{navigator:E,basename:S}=v.useContext(Gn),T=_!=null&&PN(g)&&d===!0,C=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,A=w.pathname,N=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(A=A.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=A===C||!o&&A.startsWith(C)&&A.charAt(P)==="/",$=N!=null&&(N===C||!o&&N.startsWith(C)&&N.charAt(C.length)==="/"),L={isActive:F,isPending:$,isTransitioning:T},q=F?t:void 0,ie;typeof s=="function"?ie=s(L):ie=[s,F?"active":null,$?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let he=typeof l=="function"?l(L):l;return v.createElement(Ox,{...m,"aria-current":q,className:ie,ref:b,style:he,to:u,viewTransition:d},typeof f=="function"?f(L):f)});AN.displayName="NavLink";var NN=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),T=DN(),C=LN(d,{relative:m}),A=u.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&jx.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=()=>T($||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:A,action:C,onSubmit:s?f:P,..._,"data-discover":!N&&e==="render"?"true":void 0})});NN.displayName="Form";function kN(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mx(e){let t=v.useContext(Yi);return gt(t,kN(e)),t}function jN(e,{target:t,replace:r,mask:s,state:o,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:m}={}){let b=BA(),g=ia(),w=Al(e,{relative:u});return v.useCallback(_=>{if(lN(_,t)){_.preventDefault();let E=r!==void 0?r:dl(g)===dl(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 ON=0,MN=()=>`__${String(++ON)}__`;function DN(){let{router:e}=Mx("useSubmit"),{basename:t}=v.useContext(Gn),r=QA(),s=e.fetch,o=e.navigate;return v.useCallback(async(l,u={})=>{let{action:d,method:f,encType:m,formData:b,body:g}=dN(l,t);if(u.navigate===!1){let w=u.fetcherKey||MN();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 LN(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={...Al(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])),dl(l)}function PN(e,{relative:t}={}){let r=v.useContext(_x);gt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Mx("useViewTransitionState"),o=Al(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 Pu(o.pathname,u)!=null||Pu(o.pathname,l)!=null}var Nl=fx();const Dx=dx(Nl);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 zN(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 UN(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 IN=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class bp 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 $N extends bp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class C0 extends bp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class T0 extends bp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Am;(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"})(Am||(Am={}));class BN{constructor(t,{headers:r={},customFetch:s,region:o=Am.Any}={}){this.url=t,this.headers=r,this.region=o,this.fetch=IN(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return zN(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 T=b;g&&(u=new AbortController,l=setTimeout(()=>u.abort(),g),b?(T=u.signal,b.addEventListener("abort",()=>u.abort())):T=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:T}).catch(F=>{throw new $N(F)}),A=C.headers.get("x-relay-error");if(A&&A==="true")throw new C0(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 C0?d.context:void 0}}finally{l&&clearTimeout(l)}})}}const Lx=3,R0=e=>Math.min(1e3*2**e,3e4),HN=[520,503],Px=["GET","HEAD","OPTIONS"];var qN=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 A0(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 VN(e,t,r,s){return!(!s||r>=Lx||!Px.includes(e)||!HN.includes(t))}var GN=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"||!Px.includes(r.method))throw g;if(r.retryEnabled&&u<Lx){const w=R0(u);u++,await A0(w,r.signal);continue}throw g}if(VN(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 A0(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 A=(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"}: ${A}`,N&&(f+=` (${N})`),g!=null&&g.stack&&(f+=`
|
||
${g.stack}`)}else{var T;f=(T=u==null?void 0:u.stack)!==null&&T!==void 0?T:""}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 qN(r)}return{success:r===null,error:r,data:s,count:o,status:l,statusText:u}}returns(){return this}overrideTypes(){return this}},FN=class extends GN{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 N0=new RegExp("[,()]");var Oi=class extends FN{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"&&N0.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"&&N0.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}},KN=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 fl(e){"@babel/helpers - typeof";return fl=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},fl(e)}function YN(e,t){if(fl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(fl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function WN(e){var t=YN(e,"string");return fl(t)=="symbol"?t:t+""}function XN(e,t,r){return(t=WN(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k0(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 tu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?k0(Object(r),!0).forEach(function(s){XN(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var JN=class zx{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,tu(tu({},b),{},{signal:g.signal})).finally(()=>{clearTimeout(w),_.removeEventListener("abort",E)})}return f(m,tu(tu({},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 KN(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 zx(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 QN{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 ZN="2.106.2",ek=`realtime-js/${ZN}`,tk="1.0.0",Ux="2.0.0",nk=Ux,rk=1e4,ak=100,$a={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ix={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Nm={connecting:"connecting",closing:"closing",closed:"closed"};class sk{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 T=new Uint8Array(_.byteLength+s.byteLength);return T.set(new Uint8Array(_),0),T.set(new Uint8Array(s),_.byteLength),T.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 j0=(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]=ik(u,e,t,o),l),{}):{}},ik=(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)?$x(l,u):km(u)},$x=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return uk(t,r)}switch(e){case st.bool:return ok(t);case st.float4:case st.float8:case st.int2:case st.int4:case st.int8:case st.numeric:case st.oid:return lk(t);case st.json:case st.jsonb:return ck(t);case st.timestamp:return dk(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 km(t);default:return km(t)}},km=e=>e,ok=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},lk=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},ck=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},uk=(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=>$x(t,d))}return e},dk=e=>typeof e=="string"?e.replace(" ","T"):e,Bx=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 al=e=>typeof e=="function"?e:function(){return e},fk=typeof self<"u"?self:null,Mi=typeof window<"u"?window:null,xr=fk||Mi||globalThis,hk="2.0.0",mk=1e4,pk=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"},jm={longpoll:"longpoll",websocket:"websocket"},gk={complete:4},Om="base64url.bearer.phx.",nu=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})}},Hx=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))}},yk=class{constructor(e,t,r){this.state=mn.closed,this.topic=e,this.params=al(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new nu(this,Qr.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Hx(()=>{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 nu(this,Qr.leave,al({}),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 nu(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 nu(this,Qr.leave,al({}),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}},Uu=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===gk.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)}`}},vk=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(Om)&&(this.authToken=atob(t[1].slice(Om.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("(.*)/"+jm.websocket),"$1/"+jm.longpoll)}endpointURL(){return Uu.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=vk(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=Uu.request(e,this.endpointURL(),t,r,this.timeout,u,d=>{this.reqs.delete(l),this.isActive()&&o(d)}),this.reqs.add(l)}},bk=class el{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=el.syncState(this.state,o,l,u),this.pendingDiffs.forEach(f=>{this.state=el.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=el.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 el.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))}},ru={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}}},wk=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||mk,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=ru.encode.bind(ru),this.defaultDecoder=ru.decode.bind(ru),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=al(t.params||{}),this.endPoint=`${e}/${jm.websocket}`,this.vsn=t.vsn||hk,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Hx(()=>{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=Uu.appendParams(Uu.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=al(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",`${Om}${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(),pk,"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 yk(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 sl{constructor(t,r){const s=_k(r);this.presence=new bk(t.getChannel(),s),this.presence.onJoin((o,l,u)=>{const d=sl.onJoinPayload(o,l,u);t.getChannel().trigger("presence",d)}),this.presence.onLeave((o,l,u)=>{const d=sl.onLeavePayload(o,l,u);t.getChannel().trigger("presence",d)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return sl.transformState(this.presence.state)}static transformState(t){return t=xk(t),Object.getOwnPropertyNames(t).reduce((r,s)=>{const o=t[s];return r[s]=Au(o),r},{})}static onJoinPayload(t,r,s){const o=O0(r),l=Au(s);return{event:"join",key:t,currentPresences:o,newPresences:l}}static onLeavePayload(t,r,s){const o=O0(r),l=Au(s);return{event:"leave",key:t,currentPresences:o,leftPresences:l}}}function Au(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function xk(e){return JSON.parse(JSON.stringify(e))}function _k(e){return(e==null?void 0:e.events)&&{events:e.events}}function O0(e){return e!=null&&e.metas?Au(e):[]}var M0;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(M0||(M0={}));class Sk{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new sl(this.channel.channelAdapter,r)}}function Ek(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 Ck{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>ak){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 D0;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(D0||(D0={}));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 il{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 Ck(this.socket.socketAdapter,t,this.params),this.presence=new Sk(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Bx(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,Ek(_))}),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&&il.isFilterValueEqual(_.schema,b)&&il.isFilterValueEqual(_.table,g)&&il.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}=Ix;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=j0(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=j0(t.columns,t.old_record)),r}}class Rk{constructor(t,r){this.socket=new wk(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()==Nm.connecting}isDisconnecting(){return this.socket.connectionState()==Nm.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const L0={HEARTBEAT_INTERVAL:25e3},Ak=[1e3,2e3,5e3,1e4],Nk=1e4;function kk(){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 jk(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return kk()}const Ok=`
|
||
addEventListener("message", (e) => {
|
||
if (e.data.event === "start") {
|
||
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
||
}
|
||
});`;class Mk{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 sk,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=Bx(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()||Nm.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 il(`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:ek};r&&o.updateJoinPayload(l),o.joinedOnce&&o.channelAdapter.isJoined()&&o.channelAdapter.push(Ix.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([Ok],{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:rk,E.heartbeatIntervalMs=(l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:L0.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:L0.HEARTBEAT_INTERVAL),E.transport=(f=t==null?void 0:t.transport)!==null&&f!==void 0?f:QN.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:jk(),E.reconnectAfterMs=(b=t==null?void 0:t.reconnectAfterMs)!==null&&b!==void 0?b:(A=>Ak[A-1]||Nk);let S,T;const C=(g=t==null?void 0:t.vsn)!==null&&g!==void 0?g:nk;switch(C){case tk:S=(A,N)=>N(JSON.stringify(A)),T=(A,N)=>N(JSON.parse(A));break;case Ux:S=this.serializer.encode.bind(this.serializer),T=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?_:T,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 hl=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 Dk(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 Lk(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 Pk(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:o,body:l,headers:u}){const d=Dk(e.baseUrl,s,o),f=await Lk(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 hl((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 au(e){return e.join("")}var zk=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:au(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/${au(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${au(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${au(e.namespace)}`}),!0}catch(t){if(t instanceof hl&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof hl&&r.status===409)return;throw r}}};function Si(e){return e.join("")}var Uk=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 hl&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof hl&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},Ik=class{constructor(e){var s;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Pk({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(s=e.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new zk(this.client,t),this.tableOps=new Uk(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 ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}function $k(e,t){if(ml(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(ml(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bk(e){var t=$k(e,"string");return ml(t)=="symbol"?t:t+""}function Hk(e,t,r){return(t=Bk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P0(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?P0(Object(r),!0).forEach(function(s){Hk(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var cd=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 ud(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Mm=class extends cd{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())}},qx=class extends cd{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Iu(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 qk(e){const t={};for(const[r,s]of Object.entries(e))t[r.toLowerCase()]=s;return t}const Vk=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Gk=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)},Dm=e=>{if(Array.isArray(e))return e.map(r=>Dm(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]=Dm(s)}),t},Fk=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),z0=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)},Kk=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 Mm(z0(u),l,d,s))}).catch(()=>{const u=l+"";t(new Mm(o.statusText||`HTTP ${l} error`,l,u,s))})}else t(new qx(z0(e),e,s))},Yk=(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(Gk(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=Iu(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 Xo(e,t,r,s,o,l,u){return new Promise((d,f)=>{e(r,Yk(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=>Kk(m,f,s,u))})}function Vx(e="storage"){return{get:async(t,r,s,o)=>Xo(t,"GET",r,s,o,void 0,e),post:async(t,r,s,o,l)=>Xo(t,"POST",r,o,l,s,e),put:async(t,r,s,o,l)=>Xo(t,"PUT",r,o,l,s,e),head:async(t,r,s,o)=>Xo(t,"HEAD",r,Ne(Ne({},s),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,s,o,l)=>Xo(t,"DELETE",r,o,l,s,e)}}const Wk=Vx("storage"),{get:pl,post:er,put:Lm,head:Xk,remove:wp}=Wk,kn=Vx("vectors");var Xi=class{constructor(e,t={},r,s="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=qk(t),this.fetch=Vk(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Iu(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(ud(r))return{data:null,error:r};throw r}}};let Gx;Gx=Symbol.toStringTag;var Jk=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Gx]="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(ud(t))return{data:null,error:t};throw t}}};let Fx;Fx=Symbol.toStringTag;var Qk=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Fx]="BlobDownloadBuilder",this.promise=null}asStream(){return new Jk(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(ud(t))return{data:null,error:t};throw t}}};const Zk={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},U0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var ej=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({},U0),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=Iu(d,w,_);const m=o._removeEmptyFolders(t),b=o._getFinalPath(m),g=await(e=="PUT"?Lm: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({},U0),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=Iu(b,w,_);return{path:l,fullPath:(await Lm(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 cd("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=()=>pl(this.fetch,`${this.url}/${s}/${u}${l?`?${l}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Qk(d,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>Dm(await pl(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await Xk(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(o){if(t.shouldThrowOnError)throw o;if(ud(o)){var s;const l=o instanceof Mm?o.status:o instanceof qx?(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 wp(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({},Zk),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 tj="2.106.2",kl={"X-Client-Info":`storage-js/${tj}`};var nj=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({},kl),t);super(l,u,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await pl(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await pl(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 Lm(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 wp(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():""}},rj=class extends Xi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},kl),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 pl(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await wp(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Fk(e))throw new cd("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 Ik({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}}}}})}},aj=class extends Xi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},kl),{},{"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})||{})}},sj=class extends Xi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},kl),{},{"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})||{})}},ij=class extends Xi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=Ne(Ne({},kl),{},{"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})||{})}},oj=class extends ij{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new lj(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)}},lj=class extends aj{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 cj(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},cj=class extends sj{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}))}},uj=class extends nj{constructor(e,t={},r,s){super(e,t,r,s)}from(e){return new ej(this.url,this.headers,e,this.fetch)}get vectors(){return new oj(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new rj(this.url+"/iceberg",this.headers,this.fetch)}};const Kx="2.106.2",Di=30*1e3,Pm=3,Zh=Pm*Di,dj="http://localhost:9999",fj="supabase.auth.token",hj={"X-Client-Info":`gotrue-js/${Kx}`},zm="X-Supabase-Api-Version",Yx={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},mj=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,pj=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 gj extends Vi{constructor(t,r,s){super(t,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function yj(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 su(e){return de(e)&&e.name==="AuthSessionMissingError"}class Ei extends oa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class iu extends oa{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ou 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 vj(e){return de(e)&&e.name==="AuthImplicitGrantRedirectError"}class I0 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 bj 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 Um extends oa{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function em(e){return de(e)&&e.name==="AuthRetryableFetchError"}class $0 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 Im extends oa{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const $u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),B0=`
|
||
\r=`.split(""),wj=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<B0.length;t+=1)e[B0[t].charCodeAt(0)]=-2;for(let t=0;t<$u.length;t+=1)e[$u[t].charCodeAt(0)]=t;return e})();function H0(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($u[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($u[s]),t.queuedBits-=6}}function Wx(e,t,r){const s=wj[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 q0(e){const t=[],r=u=>{t.push(String.fromCodePoint(u))},s={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{Sj(u,s,r)};for(let u=0;u<e.length;u+=1)Wx(e.charCodeAt(u),o,l);return t.join("")}function xj(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 _j(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}xj(s,t)}}function Sj(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)Wx(e.charCodeAt(o),r,s);return new Uint8Array(t)}function Ej(e){const t=[];return _j(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=>H0(o,r,s)),H0(null,r,s),t.join("")}function Cj(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},Xx=()=>{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 Jx=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Aj=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 dd{constructor(){this.promise=new dd.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}dd.promiseConstructor=Promise;function lu(e){const t=e.split(".");if(t.length!==3)throw new Im("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!mj.test(t[s]))throw new Im("JWT not in base64url format");return{header:JSON.parse(q0(t[0])),payload:JSON.parse(q0(t[1])),signature:Bi(t[2]),raw:{header:t[0],payload:t[1]}}}async function Nj(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function kj(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 jj(e){return("0"+e.toString(16)).substr(-2)}function Oj(){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,jj).join("")}async function Mj(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 Dj(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 Mj(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ci(e,t,r=!1){const s=Oj();let o=s;r&&(o+="/recovery"),await Li(e,`${t}-code-verifier`,o);const l=await Dj(s);return[l,s===l?"plain":"s256"]}const Lj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Pj(e){const t=e.headers.get(zm);if(!t||!t.match(Lj))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function zj(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 Uj(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 Ij=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Wr(e){if(!Ij.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 tm(){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 $j(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 V0(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)},Bj=[502,503,504,520,521,522,523,524,530];async function G0(e){var t;if(!Aj(e))throw new Um(xs(e),0);if(Bj.includes(e.status))throw new Um(xs(e),e.status);let r;try{r=await e.json()}catch(l){throw new tr(xs(l),l)}let s;const o=Pj(e);if(o&&o.getTime()>=Yx["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 $0(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 $0(xs(r),e.status,r.weak_password.reasons);throw new gj(xs(r),e.status||500,s)}const Hj=(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[zm]||(l[zm]=Yx["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 qj(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 qj(e,t,r,s,o,l){const u=Hj(t,s,o,l);let d;try{d=await e(r,Object.assign({},u))}catch(f){throw console.error(f),new Um(xs(f),0)}if(d.ok||await G0(d),s!=null&&s.noResolveJson)return d;try{return await d.json()}catch(f){await G0(f)}}function qn(e){var t;let r=null;Fj(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=Cj(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 F0(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 Vj(e){return{data:e,error:null}}function Gj(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 K0(e){return e}function Fj(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const nm=["global","local","others"];class Kj{_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=Jx(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=nm[0]){if(nm.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${nm.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:Gj,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:K0});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)),T=JSON.parse(E.split(";")[1].split("=")[1]);m[`${T}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:K0});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)),T=JSON.parse(E.split(";")[1].split("=")[1]);m[`${T}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 Y0(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const yr={debug:!!(globalThis&&Xx()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Qx extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class W0 extends Qx{}async function Yj(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 W0(`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 W0(`Lock "${e}" was released because another request stole it`)}throw l}}function Wj(){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 Zx(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Xj(e){return parseInt(e,16)}function Jj(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function Qj(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 _=Zx(e.address),E=b?`${b}://${s}`:s,S=e.statement?`${e.statement}
|
||
`:"",T=`${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 A=`
|
||
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}`);A+=`
|
||
- ${N}`}C+=A}return`${T}
|
||
${C}`}class At 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 Bu extends At{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function Zj({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 At({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 At({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 At({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 At({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 At({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new At({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 At({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new At({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(e_(u)){if(l.rp.id!==u)return new At({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new At({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 At({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 At({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 At({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function eO({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 At({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new At({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(e_(s)){if(r.rpId!==s)return new At({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new At({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new At({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 At({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class tO{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 $m=new tO;function X0(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 J0(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 Q0(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 Z0(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 e_(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Hu(){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 t_(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Bu("Browser returned unexpected credential type",t)}:{data:null,error:new Bu("Empty credential response",t)}}catch(t){return{data:null,error:Zj({error:t,options:e})}}}async function n_(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Bu("Browser returned unexpected credential type",t)}:{data:null,error:new Bu("Empty credential response",t)}}catch(t){return{data:null,error:eO({error:t,options:e})}}}const nO={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},rO={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function qu(...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]=qu(d,u):s[l]=qu(u)}else s[l]=u}return s}function aO(e,t){return qu(nO,e,t||{})}function sO(e,t){return qu(rO,e,t||{})}class iO{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??$m.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=aO(d.webauthn.credential_options.publicKey,l==null?void 0:l.create),{data:g,error:w}=await t_({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=sO(d.webauthn.credential_options.publicKey,l==null?void 0:l.request),{data:g,error:w}=await n_(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(!Hu())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(!Hu())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)}}}}Wj();const oO={url:dj,storageKey:fj,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:hj,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function ew(e,t,r){return await r()}const Ti={};class gl{get jwks(){var t,r;return(r=(t=Ti[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Ti[this.storageKey]=Object.assign(Object.assign({},Ti[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Ti[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ti[this.storageKey]=Object.assign(Object.assign({},Ti[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({},oO),t);if(this.storageKey=u.storageKey,this.instanceID=(r=gl.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,gl.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 Kj({url:u.url,headers:u.headers,fetch:u.fetch,experimental:this.experimental}),this.url=u.url,this.headers=u.headers,this.fetch=Jx(u.fetch),this.lock=u.lock||ew,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=Yj:this.lock=ew,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 iO(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:Xx()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Y0(this.memoryStorage)),u.userStorage&&(this.userStorage=u.userStorage)):(this.memoryStorage={},this.storage=Y0(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} (${Kx}) ${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),vj(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 iu("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:F0})}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:F0})}else throw new iu("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:T,statement:C,options:A}=t;let N;if(Gt())if(typeof T=="object")N=T;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 T!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=T}const P=new URL((r=A==null?void 0:A.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 $=Zx(F[0]);let L=(s=A==null?void 0:A.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!L){const ie=await N.request({method:"eth_chainId"});L=Xj(ie)}const q={domain:P.host,address:$,statement:C,uri:P.href,version:"1",chainId:L,nonce:(o=A==null?void 0:A.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(u=(l=A==null?void 0:A.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=A==null?void 0:A.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(f=A==null?void 0:A.signInWithEthereum)===null||f===void 0?void 0:f.notBefore,requestId:(m=A==null?void 0:A.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(b=A==null?void 0:A.signInWithEthereum)===null||b===void 0?void 0:b.resources};_=Qj(q),E=await N.request({method:"personal_sign",params:[Jj(_),$]})}try{const{data:S,error:T}=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(T)throw T;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:T})}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:T,wallet:C,statement:A,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}),A?{statement:A}: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(),...A?["",A,""]:[""],"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:T,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(!T||!T.session||!T.user){const A=new Ei;return this._returnResult({data:{user:null,session:null},error:A})}return T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),this._returnResult({data:Object.assign({},T),error:C})}catch(T){if(de(T))return this._returnResult({data:{user:null,session:null},error:T});throw T}}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 bj;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 iu("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:Vj});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 iu("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()<Zh:!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=tm()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};t.user=$j(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 su(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}=lu(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 ou("No browser detected.");if(t.error||t.error_description||t.error_code)throw new ou(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 I0("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ou("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 I0("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 ou("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:T,error:C}=await this._getUser(u);if(C)throw C;const A={provider_token:o,provider_refresh_token:l,access_token:u,expires_in:w,expires_at:_,refresh_token:d,token_type:b,user:T.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:A,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&&!su(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&&!(yj(d)&&(d.status===404||d.status===401||d.status===403)||su(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),su(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 kj(async o=>(o>0&&await Nj(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&&em(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:tm()}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=tm()}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()<Zh;if(this._debug(s,`session has${l?"":" not"} expired with margin of ${Zh}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),em(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 dd;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 em(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=V0(o);await Li(this.storage,this.storageKey,l)}else{const o=V0(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 ${Pm} ticks`),o<=Pm&&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 Qx)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"?Q0(t.webauthn.credential_response):Z0(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:X0(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:J0(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:_}=lu(t);let E=null;_.aal&&(E=_.aal);let S=E;const{data:{user:T},error:C}=await this.getUser(t);if(C)return this._returnResult({data:null,error:C});((s=(r=T==null?void 0:T.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}=lu(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+pj>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}}=lu(s);r!=null&&r.allowExpired||zj(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=Uj(o.alg),g=await crypto.subtle.importKey("jwk",m,b,!0,["verify"]);if(!await crypto.subtle.verify(b,g,u,Ej(`${d}.${f}`)))throw new Im("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(!Hu())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=J0(l.options),f=(o=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&o!==void 0?o:$m.createNewAbortSignal(),{data:m,error:b}=await n_({publicKey:d,signal:f});if(b||!m)return this._returnResult({data:null,error:b??new tr("WebAuthn ceremony failed",null)});const g=Z0(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(!Hu())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=X0(o.options),d=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:$m.createNewAbortSignal(),{data:f,error:m}=await t_({publicKey:u,signal:d});if(m||!f)return this._returnResult({data:null,error:m??new tr("WebAuthn ceremony failed",null)});const b=Q0(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}}}gl.nextInstanceID={};const lO=gl,cO="2.106.2";let tl="";typeof Deno<"u"?tl="deno":typeof document<"u"?tl="web":typeof navigator<"u"&&navigator.product==="ReactNative"?tl="react-native":tl="node";const uO={"X-Client-Info":`supabase-js-${tl}/${cO}`},dO={headers:uO},fO={schema:"public"},hO={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},mO={},pO={enabled:!1,respectSamplingDecision:!0};function gO(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 rm=null;const yO="@opentelemetry/api";function vO(){return rm===null&&(rm=import(yO).catch(()=>null)),rm}function bO(){return gO(this,void 0,void 0,function*(){try{const e=yield vO();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 wO(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 xO(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(_O(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 _O(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 SO(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 yl(e){"@babel/helpers - typeof";return yl=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},yl(e)}function EO(e,t){if(yl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(yl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function CO(e){var t=EO(e,"string");return yl(t)=="symbol"?t:t+""}function TO(e,t,r){return(t=CO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tw(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?tw(Object(r),!0).forEach(function(s){TO(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tw(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),AO=()=>Headers,NO=(e,t,r,s,o)=>{const l=RO(s),u=AO(),d=(o==null?void 0:o.enabled)===!0,f=(o==null?void 0:o.respectSamplingDecision)!==!1,m=d?SO(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 kO(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 kO(e,t,r){if(!xO(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const s=await bO();if(!s||!s.traceparent)return null;if(r){const o=wO(s.traceparent);if(o&&!o.isSampled)return null}return s}function nw(e){return typeof e=="boolean"?{enabled:e}:e}function jO(e){return e.endsWith("/")?e:e+"/"}function OO(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,T=nw(e.tracePropagation),C=nw(t.tracePropagation),A={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=T==null?void 0:T.enabled)!==null&&l!==void 0?l:C==null?void 0:C.enabled)!==null&&o!==void 0?o:!1,respectSamplingDecision:(u=(d=T==null?void 0:T.respectSamplingDecision)!==null&&d!==void 0?d:C==null?void 0:C.respectSamplingDecision)!==null&&u!==void 0?u:!0},accessToken:async()=>""};return e.accessToken?A.accessToken=e.accessToken:delete A.accessToken,A}function MO(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(jO(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var DO=class extends lO{constructor(e){super(e)}},LO=class{constructor(e,t,r){var s,o;this.supabaseUrl=e,this.supabaseKey=t;const l=MO(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:fO,realtime:mO,auth:wt(wt({},hO),{},{storageKey:u}),global:dO,tracePropagation:pO},f=OO(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=NO(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 JN(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 uj(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new BN(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 DO({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(T=>T.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Mk(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 PO=(e,t,r)=>new LO(e,t,r);function zO(){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}zO()&&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 UO={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"},IO=["VITE_SUPABASE_URL","VITE_SUPABASE_ANON_KEY"],rw=IO.filter(e=>!UO[e]);if(rw.length>0)throw new Error(`Faltan variables de entorno de Supabase. Revisa tu archivo .env.
|
||
Variables faltantes: ${rw.join(", ")}`);const Pe=PO("https://dbit.digitalcompass.agency","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE",{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}});function r_(e){return String(e??"").trim().toLowerCase()}function $O(e){return!(e!=null&&e.email)||e.is_active!==!0?null:{email:r_(e.email),fullName:e.full_name??null,role:String(e.role||"user").trim()||"user",isActive:!0,canDeleteProjects:e.can_delete_projects===!0,canManageInternalPricing:e.can_manage_internal_pricing===!0,canControlPricingSummary:e.can_control_pricing_summary===!0}}async function a_(e){const t=r_(e);if(!t)return null;const{data:r,error:s}=await Pe.from("tablero_cdc_allowed_users").select("email, full_name, role, is_active, can_delete_projects, can_manage_internal_pricing, can_control_pricing_summary").eq("email",t).eq("is_active",!0).maybeSingle();if(s)throw s;return $O(r)}async function xp(){const{data:e,error:t}=await Pe.auth.getUser();if(t||!e.user)throw new Error("No hay una sesión activa de Supabase.");const r=await a_(e.user.email);if(!r)throw new Error("Tu correo no está autorizado para acceder al Tablero CDC.");return r}function BO(){return typeof window>"u"?"/tablero-cdc/":new URL("/tablero-cdc/",window.location.origin).toString()}function HO(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 s_=v.createContext(null);function qO({children:e}){const[t,r]=v.useState(null),[s,o]=v.useState(null),[l,u]=v.useState(!0),[d,f]=v.useState(null),m=v.useCallback(async T=>{if(!T){r(null),o(null);return}let C=null;try{C=await a_(T.email)}catch(A){console.error("Error al validar acceso al Tablero CDC:",A),await Pe.auth.signOut(),r(null),o(null),f("No se pudo validar tu acceso al Tablero CDC. Verifica que el SQL de accesos esté ejecutado o contacta a IT.");return}if(!C){await Pe.auth.signOut(),r(null),o(null),f("Tu correo no está autorizado para acceder al Tablero CDC. Solicita acceso a IT o al equipo CDC.");return}r(HO(T)),o(C),f(null)},[]);v.useEffect(()=>{let T=!0;Pe.auth.getSession().then(async({data:A,error:N})=>{var P;if(T){if(N){console.error("Error al recuperar sesión de Supabase:",N),r(null),f("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo.");return}await m(((P=A.session)==null?void 0:P.user)??null)}}).catch(A=>{T&&(console.error("Error inesperado al recuperar sesión:",A),r(null),f("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo."))}).finally(()=>{T&&u(!1)});const{data:C}=Pe.auth.onAuthStateChange((A,N)=>{u(!0),m((N==null?void 0:N.user)??null).finally(()=>{T&&u(!1)})});return()=>{T=!1,C.subscription.unsubscribe()}},[m]);const b=v.useCallback(async()=>{f(null);const{error:T}=await Pe.auth.signInWithOAuth({provider:"google",options:{redirectTo:BO(),queryParams:{prompt:"select_account"}}});T&&(console.error("Error al iniciar sesión con Google:",T),f("No se pudo iniciar sesión. Intenta de nuevo."))},[]),g=v.useCallback(async()=>{const{error:T}=await Pe.auth.signOut();if(T){console.error("Error al cerrar sesión:",T),f("No se pudo cerrar sesión. Intenta de nuevo.");return}r(null),o(null),f(null)},[]),w=v.useMemo(()=>(s==null?void 0:s.role)==="director_creativo",[s==null?void 0:s.role]),_=v.useMemo(()=>(s==null?void 0:s.canManageInternalPricing)===!0,[s==null?void 0:s.canManageInternalPricing]),E=v.useMemo(()=>(s==null?void 0:s.canDeleteProjects)===!0,[s==null?void 0:s.canDeleteProjects]),S=v.useMemo(()=>(s==null?void 0:s.canControlPricingSummary)===!0,[s==null?void 0:s.canControlPricingSummary]);return y.jsx(s_.Provider,{value:{user:t,loading:l,error:d,isGerardo:w,canDeleteProjects:E,canManageInternalPricing:_,canControlPricingSummary:S,loginWithGoogle:b,logout:g},children:e})}function jl(){const e=v.useContext(s_);if(!e)throw new Error("useAuth debe usarse dentro de <AuthProvider>");return e}function aw(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=aw(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():aw(e[o],null)}}}}function Xe(...e){return v.useCallback(en(...e),e)}var VO=Symbol.for("react.lazy"),Vu=up[" use ".trim().toString()];function GO(e){return typeof e=="object"&&e!==null&&"then"in e}function i_(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===VO&&"_payload"in e&&GO(e._payload)}function fd(e){const t=KO(e),r=v.forwardRef((s,o)=>{let{children:l,...u}=s;i_(l)&&typeof Vu=="function"&&(l=Vu(l._payload));const d=v.Children.toArray(l),f=d.find(WO);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 FO=fd("Slot");function KO(e){const t=v.forwardRef((r,s)=>{let{children:o,...l}=r;if(i_(o)&&typeof Vu=="function"&&(o=Vu(o._payload)),v.isValidElement(o)){const u=JO(o),d=XO(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 YO=Symbol("radix.slottable");function WO(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===YO}function XO(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 JO(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 o_(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=o_(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function l_(){for(var e,t,r=0,s="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=o_(e))&&(s&&(s+=" "),s+=t);return s}const sw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,iw=l_,_p=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return iw(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=sw(b)||sw(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,T]=E;return Array.isArray(T)?T.includes({...l,...d}[S]):{...l,...d}[S]===T})?[...m,g,w]:m},[]);return iw(e,u,f,r==null?void 0:r.class,r==null?void 0:r.className)},QO=(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},ZO=(e,t)=>({classGroupId:e,validator:t}),c_=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Gu="-",ow=[],e2="arbitrary..",t2=e=>{const t=r2(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return n2(u);const d=u.split(Gu),f=d[0]===""&&d.length>1?1:0;return u_(d,f,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const f=s[u],m=r[u];return f?m?QO(m,f):f:m||ow}return r[u]||ow}}},u_=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],l=r.nextPart.get(o);if(l){const m=u_(e,t+1,l);if(m)return m}const u=r.validators;if(u===null)return;const d=t===0?e.join(Gu):e.slice(t).join(Gu),f=u.length;for(let m=0;m<f;m++){const b=u[m];if(b.validator(d))return b.classGroupId}},n2=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?e2+s:void 0})(),r2=e=>{const{theme:t,classGroups:r}=e;return a2(r,t)},a2=(e,t)=>{const r=c_();for(const s in e){const o=e[s];Sp(o,r,s,t)}return r},Sp=(e,t,r,s)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];s2(u,t,r,s)}},s2=(e,t,r,s)=>{if(typeof e=="string"){i2(e,t,r);return}if(typeof e=="function"){o2(e,t,r,s);return}l2(e,t,r,s)},i2=(e,t,r)=>{const s=e===""?t:d_(t,e);s.classGroupId=r},o2=(e,t,r,s)=>{if(c2(e)){Sp(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(ZO(r,e))},l2=(e,t,r,s)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[d,f]=o[u];Sp(f,d_(t,d),r,s)}},d_=(e,t)=>{let r=e;const s=t.split(Gu),o=s.length;for(let l=0;l<o;l++){const u=s[l];let d=r.nextPart.get(u);d||(d=c_(),r.nextPart.set(u,d)),r=d}return r},c2=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,u2=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)}}},Bm="!",lw=":",d2=[],cw=(e,t,r,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:o}),f2=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 T=o[S];if(u===0&&d===0){if(T===lw){l.push(o.slice(f,S)),f=S+1;continue}if(T==="/"){m=S;continue}}T==="["?u++:T==="]"?u--:T==="("?d++:T===")"&&d--}const g=l.length===0?o:o.slice(f);let w=g,_=!1;g.endsWith(Bm)?(w=g.slice(0,-1),_=!0):g.startsWith(Bm)&&(w=g.slice(1),_=!0);const E=m&&m>f?m-f:void 0;return cw(l,_,w,E)};if(t){const o=t+lw,l=s;s=u=>u.startsWith(o)?l(u.slice(o.length)):cw(d2,!1,u,void 0,!0)}if(r){const o=s;s=l=>r({className:l,parseClassName:o})}return s},h2=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}},m2=e=>({cache:u2(e.cacheSize),parseClassName:f2(e),sortModifiers:h2(e),postfixLookupClassGroupIds:p2(e),...t2(e)}),p2=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},g2=/\s+/,y2=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,d=[],f=e.trim().split(g2);let m="";for(let b=f.length-1;b>=0;b-=1){const g=f[b],{isExternal:w,modifiers:_,hasImportantModifier:E,baseClassName:S,maybePostfixModifierPosition:T}=r(g);if(w){m=g+(m.length>0?" "+m:m);continue}let C=!!T,A;if(C){const L=S.substring(0,T);A=s(L);const q=A&&u[A]?s(S):void 0;q&&q!==A&&(A=q,C=!1)}else A=s(S);if(!A){if(!C){m=g+(m.length>0?" "+m:m);continue}if(A=s(S),!A){m=g+(m.length>0?" "+m:m);continue}C=!1}const N=_.length===0?"":_.length===1?_[0]:l(_).join(":"),P=E?N+Bm:N,F=P+A;if(d.indexOf(F)>-1)continue;d.push(F);const $=o(A,C);for(let L=0;L<$.length;++L){const q=$[L];d.push(P+q)}m=g+(m.length>0?" "+m:m)}return m},v2=(...e)=>{let t=0,r,s,o="";for(;t<e.length;)(r=e[t++])&&(s=f_(r))&&(o&&(o+=" "),o+=s);return o},f_=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=f_(e[s]))&&(r&&(r+=" "),r+=t);return r},b2=(e,...t)=>{let r,s,o,l;const u=f=>{const m=t.reduce((b,g)=>g(b),e());return r=m2(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=y2(f,r);return o(f,b),b};return l=u,(...f)=>l(v2(...f))},w2=[],kt=e=>{const t=r=>r[e]||w2;return t.isThemeGetter=!0,t},h_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,m_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,x2=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,_2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,S2=/\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$/,E2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,C2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,La=e=>x2.test(e),Le=e=>!!e&&!Number.isNaN(Number(e)),vr=e=>!!e&&Number.isInteger(Number(e)),am=e=>e.endsWith("%")&&Le(e.slice(0,-1)),Xr=e=>_2.test(e),p_=()=>!0,R2=e=>S2.test(e)&&!E2.test(e),Ep=()=>!1,A2=e=>C2.test(e),N2=e=>T2.test(e),k2=e=>!ge(e)&&!ye(e),j2=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)),O2=e=>Ya(e,v_,Ep),ge=e=>h_.test(e),bs=e=>Ya(e,b_,R2),uw=e=>Ya(e,$2,Le),M2=e=>Ya(e,x_,p_),D2=e=>Ya(e,w_,Ep),dw=e=>Ya(e,g_,Ep),L2=e=>Ya(e,y_,N2),cu=e=>Ya(e,__,A2),ye=e=>m_.test(e),Jo=e=>Ds(e,b_),P2=e=>Ds(e,w_),fw=e=>Ds(e,g_),z2=e=>Ds(e,v_),U2=e=>Ds(e,y_),uu=e=>Ds(e,__,!0),I2=e=>Ds(e,x_,!0),Ya=(e,t,r)=>{const s=h_.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Ds=(e,t,r=!1)=>{const s=m_.exec(e);return s?s[1]?t(s[1]):r:!1},g_=e=>e==="position"||e==="percentage",y_=e=>e==="image"||e==="url",v_=e=>e==="length"||e==="size"||e==="bg-size",b_=e=>e==="length",$2=e=>e==="number",w_=e=>e==="family-name",x_=e=>e==="number"||e==="weight",__=e=>e==="shadow",B2=()=>{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"),T=kt("aspect"),C=kt("ease"),A=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(),fw,dw,{position:[ye,ge]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",z2,O2,{size:[ye,ge]}],Y=()=>[am,Jo,bs],V=()=>["","none","full",m,ye,ge],Z=()=>["",Le,Jo,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,am,fw,dw],xe=()=>["","none",E,ye,ge],Ce=()=>["none",Le,ye,ge],Re=()=>["none",Le,ye,ge],nt=()=>[Le,ye,ge],He=()=>[La,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xr],breakpoint:[Xr],color:[p_],container:[Xr],"drop-shadow":[Xr],ease:["in","out","in-out"],font:[k2],"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,T]}],container:["container"],"container-type":[{"@container":["","normal","size",ye,ge]}],"container-named":[j2],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,Jo,bs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,I2,M2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",am,ge]}],"font-family":[{font:[P2,D2,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,uw]}],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]},U2,L2]}],"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,Jo,bs]}],"outline-color":[{outline:X()}],shadow:[{shadow:["","none",b,uu,cu]}],"shadow-color":[{shadow:X()}],"inset-shadow":[{"inset-shadow":["none",g,uu,cu]}],"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,uu,cu]}],"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",_,uu,cu]}],"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",A,ye,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ye,ge]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"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:He()}],"translate-x":[{"translate-x":He()}],"translate-y":[{"translate-y":He()}],"translate-z":[{"translate-z":He()}],"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,Jo,bs,uw]}],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"]}},H2=b2(B2);function Ee(...e){return H2(l_(e))}const q2=_p("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?FO:"button";return y.jsx(u,{className:Ee(q2({variant:t,size:r,className:e})),ref:l,...o})});ut.displayName="Button";function Cp({size:e="sm",className:t}){const r=e==="lg"?"h-auto w-[168px]":"h-auto w-[104px]",s=e==="lg"?"-translate-x-1":"";return y.jsx("div",{className:Ee("inline-flex items-center",t),"aria-label":"GLM",children:y.jsx("img",{src:"/tablero-cdc/glm-logo.png",alt:"GLM",className:Ee(r,s),loading:"eager",decoding:"async"})})}function V2(){const{loginWithGoogle:e,error:t,loading:r}=jl();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-5",children:[y.jsx(Cp,{size:"lg"}),y.jsx("h1",{className:"text-2xl font-bold tracking-tight text-[#4F758B]",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.jsx("p",{className:"text-center text-xs text-muted-foreground mt-6",children:"Acceso restringido a usuarios autorizados"})]})})}/**
|
||
* @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 S_=(...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 G2=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 F2=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 hw=e=>{const t=F2(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 K2={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 Y2=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 W2=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,...K2,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:S_("lucide",o),...!l&&!Y2(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(W2,{ref:l,iconNode:t,className:S_(`lucide-${G2(hw(e))}`,`lucide-${e}`,s),...o}));return r.displayName=hw(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 X2=[["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"}]],J2=Ve("calculator",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:"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"}]],Z2=Ve("calendar",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 eM=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Rs=Ve("check",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 tM=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tp=Ve("chevron-down",tM);/**
|
||
* @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:"m15 18-6-6 6-6",key:"1wnfg3"}]],rM=Ve("chevron-left",nM);/**
|
||
* @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 aM=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],E_=Ve("chevron-right",aM);/**
|
||
* @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 sM=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],iM=Ve("chevron-up",sM);/**
|
||
* @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 oM=[["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",oM);/**
|
||
* @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 lM=[["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"}]],Fu=Ve("circle-alert",lM);/**
|
||
* @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 cM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],uM=Ve("circle-check",cM);/**
|
||
* @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 dM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fM=Ve("circle",dM);/**
|
||
* @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 hM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],mM=Ve("clock-3",hM);/**
|
||
* @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 pM=[["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"}]],Rp=Ve("dollar-sign",pM);/**
|
||
* @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 gM=[["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"}]],yM=Ve("external-link",gM);/**
|
||
* @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 vM=[["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"}]],bM=Ve("eye-off",vM);/**
|
||
* @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 wM=[["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"}]],xM=Ve("eye",wM);/**
|
||
* @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 _M=[["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"}]],SM=Ve("file-check-corner",_M);/**
|
||
* @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:"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"}]],CM=Ve("history",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 TM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],RM=Ve("info",TM);/**
|
||
* @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 AM=[["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"}]],NM=Ve("layout-grid",AM);/**
|
||
* @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 kM=[["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"}]],jM=Ve("link-2",kM);/**
|
||
* @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 OM=[["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"}]],MM=Ve("link",OM);/**
|
||
* @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 DM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ha=Ve("loader-circle",DM);/**
|
||
* @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 LM=[["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"}]],PM=Ve("lock",LM);/**
|
||
* @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 zM=[["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"}]],UM=Ve("log-out",zM);/**
|
||
* @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 IM=[["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"}]],$M=Ve("map-pin",IM);/**
|
||
* @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 BM=[["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"}]],HM=Ve("message-square-plus",BM);/**
|
||
* @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 qM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],vl=Ve("plus",qM);/**
|
||
* @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 VM=[["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"}]],GM=Ve("refresh-cw",VM);/**
|
||
* @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 FM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ku=Ve("search",FM);/**
|
||
* @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 KM=[["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"}]],YM=Ve("sliders-horizontal",KM);/**
|
||
* @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 WM=[["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"}]],mw=Ve("tag",WM);/**
|
||
* @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 XM=[["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"}]],T_=Ve("trash-2",XM);/**
|
||
* @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 JM=[["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"}]],QM=Ve("user",JM);/**
|
||
* @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 ZM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],bl=Ve("x",ZM),jn=v.forwardRef(({className:e,type:t,...r},s)=>y.jsx("input",{type:t,className:Ee("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 eD(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,T=v.useMemo(()=>E,Object.values(E));return y.jsx(S.Provider,{value:T,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,tD(o,...t)]}function tD(...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:()=>{},nD=up[" useInsertionEffect ".trim().toString()]||jt;function As({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[o,l,u]=rD({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=aD(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 rD({defaultProp:e,onChange:t}){const[r,s]=v.useState(e),o=v.useRef(r),l=v.useRef(t);return nD(()=>{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 aD(e){return typeof e=="function"}function sD(e){const t=iD(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(lD);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 iD(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=uD(o),d=cD(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 oD=Symbol("radix.slottable");function lD(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===oD}function cD(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 uD(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 dD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],je=dD.reduce((e,t)=>{const r=sD(`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&&Nl.flushSync(()=>e.dispatchEvent(t))}function pw(e){const t=fD(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(mD);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 fD(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=gD(o),d=pD(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 hD=Symbol("radix.slottable");function mD(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hD}function pD(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 gD(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 Ap(e){const t=e+"CollectionProvider",[r,s]=la(t),[o,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:T,children:C}=S,A=le.useRef(null),N=le.useRef(new Map).current;return y.jsx(o,{scope:T,itemMap:N,collectionRef:A,children:C})};u.displayName=t;const d=e+"CollectionSlot",f=pw(d),m=le.forwardRef((S,T)=>{const{scope:C,children:A}=S,N=l(d,C),P=Xe(T,N.collectionRef);return y.jsx(f,{ref:P,children:A})});m.displayName=d;const b=e+"CollectionItemSlot",g="data-radix-collection-item",w=pw(b),_=le.forwardRef((S,T)=>{const{scope:C,children:A,...N}=S,P=le.useRef(null),F=Xe(T,P),$=l(b,C);return le.useEffect(()=>($.itemMap.set(P,{ref:P,...N}),()=>void $.itemMap.delete(P))),y.jsx(w,{[g]:"",ref:F,children:A})});_.displayName=b;function E(S){const T=l(e+"CollectionConsumer",S);return le.useCallback(()=>{const A=T.collectionRef.current;if(!A)return[];const N=Array.from(A.querySelectorAll(`[${g}]`));return Array.from(T.itemMap.values()).sort(($,L)=>N.indexOf($.ref.current)-N.indexOf(L.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:u,Slot:m,ItemSlot:_},E,s]}var yD=v.createContext(void 0);function Np(e){const t=v.useContext(yD);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 vD(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 bD="DismissableLayer",Hm="dismissableLayer.update",wD="dismissableLayer.pointerDownOutside",xD="dismissableLayer.focusOutside",gw,A_=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ol=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...f}=e,m=v.useContext(A_),[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),[T]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),C=S.indexOf(T),A=b?S.indexOf(b):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,P=A>=C,F=ED(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),$=CD(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 vD(L=>{A===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&&(gw=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(b)),m.layers.add(b),yw(),()=>{r&&m.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=gw)}},[b,w,r,m]),v.useEffect(()=>()=>{b&&(m.layers.delete(b),m.layersWithOutsidePointerEventsDisabled.delete(b),yw())},[b,m]),v.useEffect(()=>{const L=()=>_({});return document.addEventListener(Hm,L),()=>document.removeEventListener(Hm,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)})});Ol.displayName=bD;var _D="DismissableLayerBranch",SD=v.forwardRef((e,t)=>{const r=v.useContext(A_),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})});SD.displayName=_D;function ED(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(){N_(wD,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 CD(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&&N_(xD,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 yw(){const e=new CustomEvent(Hm);document.dispatchEvent(e)}function N_(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 sm=0;function hd(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??vw()),document.body.insertAdjacentElement("beforeend",e[1]??vw()),sm++,()=>{sm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),sm--}},[])}function vw(){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 im="focusScope.autoFocusOnMount",om="focusScope.autoFocusOnUnmount",bw={bubbles:!1,cancelable:!0},TD="FocusScope",Ml=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})},T=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",T);const A=new MutationObserver(C);return d&&A.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",T),A.disconnect()}}},[s,d,_.paused]),v.useEffect(()=>{if(d){xw.add(_);const S=document.activeElement;if(!d.contains(S)){const C=new CustomEvent(im,bw);d.addEventListener(im,m),d.dispatchEvent(C),C.defaultPrevented||(RD(OD(k_(d)),{select:!0}),document.activeElement===S&&Ua(d))}return()=>{d.removeEventListener(im,m),setTimeout(()=>{const C=new CustomEvent(om,bw);d.addEventListener(om,b),d.dispatchEvent(C),C.defaultPrevented||Ua(S??document.body,{select:!0}),d.removeEventListener(om,b),xw.remove(_)},0)}}},[d,m,b,_]);const E=v.useCallback(S=>{if(!r&&!s||_.paused)return;const T=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,C=document.activeElement;if(T&&C){const A=S.currentTarget,[N,P]=AD(A);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===A&&S.preventDefault()}},[r,s,_.paused]);return y.jsx(je.div,{tabIndex:-1,...u,ref:w,onKeyDown:E})});Ml.displayName=TD;function RD(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(Ua(s,{select:t}),document.activeElement!==r)return}function AD(e){const t=k_(e),r=ww(t,e),s=ww(t.reverse(),e);return[r,s]}function k_(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 ww(e,t){for(const r of e)if(!ND(r,{upTo:t}))return r}function ND(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 kD(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&&kD(e)&&t&&e.select()}}var xw=jD();function jD(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=_w(e,t),e.unshift(t)},remove(t){var r;e=_w(e,t),(r=e[0])==null||r.resume()}}}function _w(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function OD(e){return e.filter(t=>t.tagName!=="A")}var MD=up[" useId ".trim().toString()]||(()=>{}),DD=0;function Qt(e){const[t,r]=v.useState(MD());return jt(()=>{r(s=>s??String(DD++))},[e]),t?`radix-${t}`:""}const LD=["top","right","bottom","left"],Ga=Math.min,Nn=Math.max,Yu=Math.round,du=Math.floor,Cr=e=>({x:e,y:e}),PD={left:"right",right:"left",bottom:"top",top:"bottom"};function qm(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 kp(e){return e==="x"?"y":"x"}function jp(e){return e==="y"?"height":"width"}function Er(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Op(e){return kp(Er(e))}function zD(e,t,r){r===void 0&&(r=!1);const s=Ji(e),o=Op(e),l=jp(o);let u=o==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=Wu(u)),[u,Wu(u)]}function UD(e){const t=Wu(e);return[Vm(e),t,Vm(t)]}function Vm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Sw=["left","right"],Ew=["right","left"],ID=["top","bottom"],$D=["bottom","top"];function BD(e,t,r){switch(e){case"top":case"bottom":return r?t?Ew:Sw:t?Sw:Ew;case"left":case"right":return t?ID:$D;default:return[]}}function HD(e,t,r,s){const o=Ji(e);let l=BD(ra(e),r==="start",s);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(Vm)))),l}function Wu(e){const t=ra(e);return PD[t]+e.slice(t.length)}function qD(e){return{top:0,right:0,bottom:0,left:0,...e}}function j_(e){return typeof e!="number"?qD(e):{top:e,right:e,bottom:e,left:e}}function Xu(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 Cw(e,t,r){let{reference:s,floating:o}=e;const l=Er(t),u=Op(t),d=jp(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 VD(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=j_(_),T=d[w?g==="floating"?"reference":"floating":g],C=Xu(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(T)))==null||r?T:T.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:m,rootBoundary:b,strategy:f})),A=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=Xu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:A,offsetParent:N,strategy:f}):A);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 GD=50,FD=async(e,t,r)=>{const{placement:s="bottom",strategy:o="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:VD},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}=Cw(m,s,f),w=s,_=0;const E={};for(let S=0;S<l.length;S++){const T=l[S];if(!T)continue;const{name:C,fn:A}=T,{x:N,y:P,data:F,reset:$}=await A({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},$&&_<GD&&(_++,typeof $=="object"&&($.placement&&(w=$.placement),$.rects&&(m=$.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):$.rects),{x:b,y:g}=Cw(m,w,f)),S=-1)}return{x:b,y:g,placement:w,strategy:o,middlewareData:E}},KD=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=j_(b),w={x:r,y:s},_=Op(o),E=jp(_),S=await u.getDimensions(m),T=_==="y",C=T?"top":"left",A=T?"bottom":"right",N=T?"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[A],ie),oe=he,ue=L-S[E]-pe,ce=L/2-S[E]/2+q,fe=qm(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}}}),YD=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,...T}=na(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const C=ra(o),A=Er(d),N=ra(d)===d,P=await(f.isRTL==null?void 0:f.isRTL(m.floating)),F=w||(N||!S?[Wu(d)]:UD(d)),$=E!=="none";!w&&$&&F.push(...HD(d,S,E,P));const L=[d,...F],q=await f.detectOverflow(t,T),ie=[];let he=((s=l.flip)==null?void 0:s.overflows)||[];if(b&&ie.push(q[C]),g){const ce=zD(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"?A!==Er(fe):!1)||he.every(J=>Er(J.placement)===A?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===A||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 LD.some(t=>e[t]>=0)}const WD=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{}}}}},O_=new Set(["left","top"]);async function XD(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=O_.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 JD=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 XD(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}}}}},QD=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:A,y:N}=C;return{x:A,y:N}}},...m}=na(e,t),b={x:r,y:s},g=await l.detectOverflow(t,m),w=Er(ra(o)),_=kp(w);let E=b[_],S=b[w];if(u){const C=_==="y"?"top":"left",A=_==="y"?"bottom":"right",N=E+g[C],P=E-g[A];E=qm(N,E,P)}if(d){const C=w==="y"?"top":"left",A=w==="y"?"bottom":"right",N=S+g[C],P=S-g[A];S=qm(N,S,P)}const T=f.fn({...t,[_]:E,[w]:S});return{...T,data:{x:T.x-r,y:T.y-s,enabled:{[_]:u,[w]:d}}}}}},ZD=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=kp(g);let _=b[w],E=b[g];const S=na(d,t),T=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]+T.mainAxis,F=l.reference[w]+l.reference[N]-T.mainAxis;_<P?_=P:_>F&&(_=F)}if(m){var C,A;const N=w==="y"?"width":"height",P=O_.has(ra(o)),F=l.reference[g]-l.floating[N]+(P&&((C=u.offset)==null?void 0:C[g])||0)+(P?0:T.crossAxis),$=l.reference[g]+l.reference[N]+(P?0:((A=u.offset)==null?void 0:A[g])||0)-(P?T.crossAxis:0);E<F?E=F:E>$&&(E=$)}return{[w]:_,[g]:E}}}},eL=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 T,C;g==="top"||g==="bottom"?(T=g,C=w===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,T=w==="end"?"top":"bottom");const A=S-b.top-b.bottom,N=E-b.left-b.right,P=Ga(S-b[T],A),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=A),$&&!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 md(){return typeof window<"u"}function Qi(e){return M_(e)?(e.nodeName||"").toLowerCase():"#document"}function On(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ar(e){var t;return(t=(M_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function M_(e){return md()?e instanceof Node||e instanceof On(e).Node:!1}function sr(e){return md()?e instanceof Element||e instanceof On(e).Element:!1}function ca(e){return md()?e instanceof HTMLElement||e instanceof On(e).HTMLElement:!1}function Aw(e){return!md()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof On(e).ShadowRoot}function Dl(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 tL(e){return/^(table|td|th)$/.test(Qi(e))}function pd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const nL=/transform|translate|scale|rotate|perspective|filter/,rL=/paint|layout|strict|content/,ws=e=>!!e&&e!=="none";let lm;function Mp(e){const t=sr(e)?ir(e):e;return ws(t.transform)||ws(t.translate)||ws(t.scale)||ws(t.rotate)||ws(t.perspective)||!Dp()&&(ws(t.backdropFilter)||ws(t.filter))||nL.test(t.willChange||"")||rL.test(t.contain||"")}function aL(e){let t=Fa(e);for(;ca(t)&&!Gi(t);){if(Mp(t))return t;if(pd(t))return null;t=Fa(t)}return null}function Dp(){return lm==null&&(lm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),lm}function Gi(e){return/^(html|body|#document)$/.test(Qi(e))}function ir(e){return On(e).getComputedStyle(e)}function gd(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||Aw(e)&&e.host||Ar(e);return Aw(t)?t.host:t}function D_(e){const t=Fa(e);return Gi(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&Dl(t)?t:D_(t)}function wl(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=D_(e),l=o===((s=e.ownerDocument)==null?void 0:s.body),u=On(o);if(l){const d=Gm(u);return t.concat(u,u.visualViewport||[],Dl(o)?o:[],d&&r?wl(d):[])}else return t.concat(o,wl(o,[],r))}function Gm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L_(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=Yu(r)!==l||Yu(s)!==u;return d&&(r=l,s=u),{width:r,height:s,$:d}}function Lp(e){return sr(e)?e:e.contextElement}function Hi(e){const t=Lp(e);if(!ca(t))return Cr(1);const r=t.getBoundingClientRect(),{width:s,height:o,$:l}=L_(t);let u=(l?Yu(r.width):r.width)/s,d=(l?Yu(r.height):r.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const sL=Cr(0);function P_(e){const t=On(e);return!Dp()||!t.visualViewport?sL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iL(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=Lp(e);let u=Cr(1);t&&(s?sr(s)&&(u=Hi(s)):u=Hi(e));const d=iL(l,r,s)?P_(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=Gm(E);for(;S&&s&&_!==E;){const T=Hi(S),C=S.getBoundingClientRect(),A=ir(S),N=C.left+(S.clientLeft+parseFloat(A.paddingLeft))*T.x,P=C.top+(S.clientTop+parseFloat(A.paddingTop))*T.y;f*=T.x,m*=T.y,b*=T.x,g*=T.y,f+=N,m+=P,E=On(S),S=Gm(E)}}return Xu({width:b,height:g,x:f,y:m})}function yd(e,t){const r=gd(e).scrollLeft;return t?t.left+r:Ns(Ar(e)).left+r}function z_(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-yd(e,r),o=r.top+t.scrollTop;return{x:s,y:o}}function oL(e){let{elements:t,rect:r,offsetParent:s,strategy:o}=e;const l=o==="fixed",u=Ar(s),d=t?pd(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"||Dl(u))&&(f=gd(s)),g)){const _=Ns(s);m=Hi(s),b.x=_.x+s.clientLeft,b.y=_.y+s.clientTop}const w=u&&!g&&!l?z_(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 lL(e){return Array.from(e.getClientRects())}function cL(e){const t=Ar(e),r=gd(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+yd(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 Nw=25;function uL(e,t){const r=On(e),s=Ar(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=Dp();(!b||b&&t==="fixed")&&(d=o.offsetLeft,f=o.offsetTop)}const m=yd(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<=Nw&&(l-=E)}else m<=Nw&&(l+=m);return{width:l,height:u,x:d,y:f}}function dL(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 kw(e,t,r){let s;if(t==="viewport")s=uL(e,r);else if(t==="document")s=cL(Ar(e));else if(sr(t))s=dL(t,r);else{const o=P_(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Xu(s)}function U_(e,t){const r=Fa(e);return r===t||!sr(r)||Gi(r)?!1:ir(r).position==="fixed"||U_(r,t)}function fL(e,t){const r=t.get(e);if(r)return r;let s=wl(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=Mp(u);!f&&d.position==="fixed"&&(o=null),(l?!f&&!o:!f&&d.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Dl(u)&&!f&&U_(e,u))?s=s.filter(b=>b!==u):o=d,u=Fa(u)}return t.set(e,s),s}function hL(e){let{element:t,boundary:r,rootBoundary:s,strategy:o}=e;const u=[...r==="clippingAncestors"?pd(t)?[]:fL(t,this._c):[].concat(r),s],d=kw(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 _=kw(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 mL(e){const{width:t,height:r}=L_(e);return{width:t,height:r}}function pL(e,t,r){const s=ca(t),o=Ar(t),l=r==="fixed",u=Ns(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const f=Cr(0);function m(){f.x=yd(o)}if(s||!s&&!l)if((Qi(t)!=="body"||Dl(o))&&(d=gd(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?z_(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 cm(e){return ir(e).position==="static"}function jw(e,t){if(!ca(e)||ir(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ar(e)===r&&(r=r.ownerDocument.body),r}function I_(e,t){const r=On(e);if(pd(e))return r;if(!ca(e)){let o=Fa(e);for(;o&&!Gi(o);){if(sr(o)&&!cm(o))return o;o=Fa(o)}return r}let s=jw(e,t);for(;s&&tL(s)&&cm(s);)s=jw(s,t);return s&&Gi(s)&&cm(s)&&!Mp(s)?r:s||aL(e)||r}const gL=async function(e){const t=this.getOffsetParent||I_,r=this.getDimensions,s=await r(e.floating);return{reference:pL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function yL(e){return ir(e).direction==="rtl"}const vL={convertOffsetParentRelativeRectToViewportRelativeRect:oL,getDocumentElement:Ar,getClippingRect:hL,getOffsetParent:I_,getElementRects:gL,getClientRects:lL,getDimensions:mL,getScale:Hi,isElement:sr,isRTL:yL};function $_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bL(e,t){let r=null,s;const o=Ar(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=du(g),S=du(o.clientWidth-(b+w)),T=du(o.clientHeight-(g+_)),C=du(b),N={rootMargin:-E+"px "+-S+"px "+-T+"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&&!$_(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 wL(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=Lp(e),b=o||l?[...m?wl(m):[],...t?wl(t):[]]:[];b.forEach(C=>{o&&C.addEventListener("scroll",r,{passive:!0}),l&&C.addEventListener("resize",r)});const g=m&&d?bL(m,r):null;let w=-1,_=null;u&&(_=new ResizeObserver(C=>{let[A]=C;A&&A.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&&T();function T(){const C=Ns(e);S&&!$_(S,C)&&r(),S=C,E=requestAnimationFrame(T)}return r(),()=>{var C;b.forEach(A=>{o&&A.removeEventListener("scroll",r),l&&A.removeEventListener("resize",r)}),g==null||g(),(C=_)==null||C.disconnect(),_=null,f&&cancelAnimationFrame(E)}}const xL=JD,_L=QD,SL=YD,EL=eL,CL=WD,Ow=KD,TL=ZD,RL=(e,t,r)=>{const s=new Map,o={platform:vL,...r},l={...o.platform,_c:s};return FD(e,t,{...o,platform:l})};var AL=typeof document<"u",NL=function(){},Nu=AL?v.useLayoutEffect:NL;function Ju(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(!Ju(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)&&!Ju(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function B_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mw(e,t){const r=B_(e);return Math.round(t*r)/r}function um(e){const t=v.useRef(e);return Nu(()=>{t.current=e}),t}function kL(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);Ju(w,s)||_(s);const[E,S]=v.useState(null),[T,C]=v.useState(null),A=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||T,$=v.useRef(null),L=v.useRef(null),q=v.useRef(b),ie=f!=null,he=um(f),pe=um(o),oe=um(m),ue=v.useCallback(()=>{if(!$.current||!L.current)return;const J={placement:t,strategy:r,middleware:w};pe.current&&(J.platform=pe.current),RL($.current,L.current,J).then(ne=>{const X={...ne,isPositioned:oe.current!==!1};ce.current&&!Ju(q.current,X)&&(q.current=X,Nl.flushSync(()=>{g(X)}))})},[w,t,r,pe,oe]);Nu(()=>{m===!1&&q.current.isPositioned&&(q.current.isPositioned=!1,g(J=>({...J,isPositioned:!1})))},[m]);const ce=v.useRef(!1);Nu(()=>(ce.current=!0,()=>{ce.current=!1}),[]),Nu(()=>{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:A,setFloating:N}),[A,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=Mw(M.floating,b.x),X=Mw(M.floating,b.y);return d?{...J,transform:"translate("+ne+"px, "+X+"px)",...B_(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 jL=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?Ow({element:s.current,padding:o}).fn(r):{}:s?Ow({element:s,padding:o}).fn(r):{}}}},OL=(e,t)=>{const r=xL(e);return{name:r.name,fn:r.fn,options:[e,t]}},ML=(e,t)=>{const r=_L(e);return{name:r.name,fn:r.fn,options:[e,t]}},DL=(e,t)=>({fn:TL(e).fn,options:[e,t]}),LL=(e,t)=>{const r=SL(e);return{name:r.name,fn:r.fn,options:[e,t]}},PL=(e,t)=>{const r=EL(e);return{name:r.name,fn:r.fn,options:[e,t]}},zL=(e,t)=>{const r=CL(e);return{name:r.name,fn:r.fn,options:[e,t]}},UL=(e,t)=>{const r=jL(e);return{name:r.name,fn:r.fn,options:[e,t]}};var IL="Arrow",H_=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"})})});H_.displayName=IL;var $L=H_;function q_(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 Pp="Popper",[V_,Zi]=la(Pp),[BL,G_]=V_(Pp),F_=e=>{const{__scopePopper:t,children:r}=e,[s,o]=v.useState(null);return y.jsx(BL,{scope:t,anchor:s,onAnchorChange:o,children:r})};F_.displayName=Pp;var K_="PopperAnchor",Y_=v.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...o}=e,l=G_(K_,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})});Y_.displayName=K_;var zp="PopperContent",[HL,qL]=V_(zp),W_=v.forwardRef((e,t)=>{var z,ee,ae,xe,Ce,Re;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,T=G_(zp,r),[C,A]=v.useState(null),N=Xe(t,nt=>A(nt)),[P,F]=v.useState(null),$=q_(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(GL),altBoundary:oe},{refs:ce,floatingStyles:fe,placement:M,isPositioned:K,middlewareData:J}=kL({strategy:"fixed",placement:ie,whileElementsMounted:(...nt)=>wL(...nt,{animationFrame:_==="always"}),elements:{reference:T.anchor},middleware:[OL({mainAxis:o+q,alignmentAxis:u}),f&&ML({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?DL():void 0,...ue}),f&&LL({...ue}),PL({...ue,apply:({elements:nt,rects:He,availableWidth:Kt,availableHeight:Yt})=>{const{width:Ot,height:wn}=He.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&&UL({element:P,padding:d}),FL({arrowWidth:L,arrowHeight:q}),w&&zL({strategy:"referenceHidden",...ue})]}),[ne,X]=Q_(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,(Ce=J.transformOrigin)==null?void 0:Ce.y].join(" "),...((Re=J.hide)==null?void 0:Re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:y.jsx(HL,{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"}})})})});W_.displayName=zp;var X_="PopperArrow",VL={top:"bottom",right:"left",bottom:"top",left:"right"},J_=v.forwardRef(function(t,r){const{__scopePopper:s,...o}=t,l=qL(X_,s),u=VL[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($L,{...o,ref:r,style:{...o.style,display:"block"}})})});J_.displayName=X_;function GL(e){return e!==null}var FL=e=>({name:"transformOrigin",options:e,fn(t){var T,C,A;const{placement:r,rects:s,middlewareData:o}=t,u=((T=o.arrow)==null?void 0:T.centerOffset)!==0,d=u?0:e.arrowWidth,f=u?0:e.arrowHeight,[m,b]=Q_(r),g={start:"0%",center:"50%",end:"100%"}[b],w=(((C=o.arrow)==null?void 0:C.x)??0)+d/2,_=(((A=o.arrow)==null?void 0:A.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 Q_(e){const[t,r="center"]=e.split("-");return[t,r]}var Up=F_,vd=Y_,Ip=W_,$p=J_,KL="Portal",Ll=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?Dx.createPortal(y.jsx(je.div,{...s,ref:t}),u):null});Ll.displayName=KL;function YL(e,t){return v.useReducer((r,s)=>t[r][s]??r,e)}var or=e=>{const{present:t,children:r}=e,s=WL(t),o=typeof r=="function"?r({present:s.isPresent}):v.Children.only(r),l=Xe(s.ref,XL(o));return typeof r=="function"||s.isPresent?v.cloneElement(o,{ref:l}):null};or.displayName="Presence";function WL(e){const[t,r]=v.useState(),s=v.useRef(null),o=v.useRef(e),l=v.useRef("none"),u=e?"mounted":"unmounted",[d,f]=YL(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const m=fu(s.current);l.current=d==="mounted"?m:"none"},[d]),jt(()=>{const m=s.current,b=o.current;if(b!==e){const w=l.current,_=fu(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=fu(s.current).includes(CSS.escape(_.animationName));if(_.target===t&&S&&(f("ANIMATION_END"),!o.current)){const T=t.style.animationFillMode;t.style.animationFillMode="forwards",m=b.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=T)})}},w=_=>{_.target===t&&(l.current=fu(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 fu(e){return(e==null?void 0:e.animationName)||"none"}function XL(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 dm="rovingFocusGroup.onEntryFocus",JL={bubbles:!1,cancelable:!0},Pl="RovingFocusGroup",[Fm,Z_,QL]=Ap(Pl),[ZL,eS]=la(Pl,[QL]),[e5,t5]=ZL(Pl),tS=v.forwardRef((e,t)=>y.jsx(Fm.Provider,{scope:e.__scopeRovingFocusGroup,children:y.jsx(Fm.Slot,{scope:e.__scopeRovingFocusGroup,children:y.jsx(n5,{...e,ref:t})})}));tS.displayName=Pl;var n5=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=Np(l),[S,T]=As({prop:u,defaultProp:d??null,onChange:f,caller:Pl}),[C,A]=v.useState(!1),N=ar(m),P=Z_(r),F=v.useRef(!1),[$,L]=v.useState(0);return v.useEffect(()=>{const q=w.current;if(q)return q.addEventListener(dm,N),()=>q.removeEventListener(dm,N)},[N]),y.jsx(e5,{scope:r,orientation:s,dir:E,loop:o,currentTabStopId:S,onItemFocus:v.useCallback(q=>T(q),[T]),onItemShiftTab:v.useCallback(()=>A(!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(dm,JL);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);aS(fe,b)}}F.current=!1}),onBlur:we(e.onBlur,()=>A(!1))})})}),nS="RovingFocusGroupItem",rS=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=t5(nS,r),g=b.currentTabStopId===m,w=Z_(r),{onFocusableItemAdd:_,onFocusableItemRemove:E,currentTabStopId:S}=b;return v.useEffect(()=>{if(s)return _(),()=>E()},[s,_,E]),y.jsx(Fm.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,T=>{s?b.onItemFocus(m):T.preventDefault()}),onFocus:we(e.onFocus,()=>b.onItemFocus(m)),onKeyDown:we(e.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){b.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const C=s5(T,b.orientation,b.dir);if(C!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.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(T.currentTarget);N=b.loop?i5(N,P+1):N.slice(P+1)}setTimeout(()=>aS(N))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:S!=null}):u})})});rS.displayName=nS;var r5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function a5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function s5(e,t,r){const s=a5(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return r5[s]}function aS(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function i5(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var o5=tS,l5=rS;function c5(e){const t=u5(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(f5);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 u5(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=m5(o),d=h5(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 d5=Symbol("radix.slottable");function f5(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===d5}function h5(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 m5(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 p5=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ri=new WeakMap,hu=new WeakMap,mu={},fm=0,sS=function(e){return e&&(e.host||sS(e.parentNode))},g5=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=sS(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})},y5=function(e,t,r,s){var o=g5(t,Array.isArray(e)?e:[e]);mu[r]||(mu[r]=new WeakMap);var l=mu[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=(Ri.get(w)||0)+1,T=(l.get(w)||0)+1;Ri.set(w,S),l.set(w,T),u.push(w),S===1&&E&&hu.set(w,!0),T===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(),fm++,function(){u.forEach(function(g){var w=Ri.get(g)-1,_=l.get(g)-1;Ri.set(g,w),l.set(g,_),w||(hu.has(g)||g.removeAttribute(s),hu.delete(g)),_||g.removeAttribute(r)}),fm--,fm||(Ri=new WeakMap,Ri=new WeakMap,hu=new WeakMap,mu={})}},bd=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=p5(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),y5(s,o,r,"aria-hidden")):function(){return null}},ku="right-scroll-bar-position",ju="width-before-scroll-bar",v5="with-scroll-bars-hidden",b5="--removed-body-scroll-bar-size";function hm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function w5(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 x5=typeof window<"u"?v.useLayoutEffect:v.useEffect,Dw=new WeakMap;function _5(e,t){var r=w5(null,function(s){return e.forEach(function(o){return hm(o,s)})});return x5(function(){var s=Dw.get(r);if(s){var o=new Set(s),l=new Set(e),u=r.current;o.forEach(function(d){l.has(d)||hm(d,null)}),l.forEach(function(d){o.has(d)||hm(d,u)})}Dw.set(r,e)},[e]),r}function S5(e){return e}function E5(e,t){t===void 0&&(t=S5);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 C5(e){e===void 0&&(e={});var t=E5(null);return t.options=Sr({async:!0,ssr:!1},e),t}var iS=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))};iS.isSideCarExport=!0;function T5(e,t){return e.useMedium(t),iS}var oS=C5(),mm=function(){},wd=v.forwardRef(function(e,t){var r=v.useRef(null),s=v.useState({onScrollCapture:mm,onWheelCapture:mm,onTouchMoveCapture:mm}),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,T=e.allowPinchZoom,C=e.as,A=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,$=_5([r,t]),L=Sr(Sr({},P),o);return v.createElement(v.Fragment,null,b&&v.createElement(F,{sideCar:oS,removeScrollBar:m,shards:g,noRelative:_,noIsolation:E,inert:S,setCallbacks:l,allowPinchZoom:!!T,lockRef:r,gapMode:N}),u?v.cloneElement(v.Children.only(d),Sr(Sr({},L),{ref:$})):v.createElement(A,Sr({},L,{className:f,ref:$}),d))});wd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wd.classNames={fullWidth:ju,zeroRight:ku};var R5=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function A5(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=R5();return t&&e.setAttribute("nonce",t),e}function N5(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function k5(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var j5=function(){var e=0,t=null;return{add:function(r){e==0&&(t=A5())&&(N5(t,r),k5(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},O5=function(){var e=j5();return function(t,r){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},lS=function(){var e=O5(),t=function(r){var s=r.styles,o=r.dynamic;return e(s,o),null};return t},M5={left:0,top:0,right:0,gap:0},pm=function(e){return parseInt(e||"",10)||0},D5=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[pm(r),pm(s),pm(o)]},L5=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return M5;var t=D5(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])}},P5=lS(),qi="data-scroll-locked",z5=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(v5,` {
|
||
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(ku,` {
|
||
right: `).concat(d,"px ").concat(s,`;
|
||
}
|
||
|
||
.`).concat(ju,` {
|
||
margin-right: `).concat(d,"px ").concat(s,`;
|
||
}
|
||
|
||
.`).concat(ku," .").concat(ku,` {
|
||
right: 0 `).concat(s,`;
|
||
}
|
||
|
||
.`).concat(ju," .").concat(ju,` {
|
||
margin-right: 0 `).concat(s,`;
|
||
}
|
||
|
||
body[`).concat(qi,`] {
|
||
`).concat(b5,": ").concat(d,`px;
|
||
}
|
||
`)},Lw=function(){var e=parseInt(document.body.getAttribute(qi)||"0",10);return isFinite(e)?e:0},U5=function(){v.useEffect(function(){return document.body.setAttribute(qi,(Lw()+1).toString()),function(){var e=Lw()-1;e<=0?document.body.removeAttribute(qi):document.body.setAttribute(qi,e.toString())}},[])},I5=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;U5();var l=v.useMemo(function(){return L5(o)},[o]);return v.createElement(P5,{styles:z5(l,!t,o,r?"":"!important")})},Km=!1;if(typeof window<"u")try{var pu=Object.defineProperty({},"passive",{get:function(){return Km=!0,!0}});window.addEventListener("test",pu,pu),window.removeEventListener("test",pu,pu)}catch{Km=!1}var Ai=Km?{passive:!1}:!1,$5=function(e){return e.tagName==="TEXTAREA"},cS=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!$5(e)&&r[t]==="visible")},B5=function(e){return cS(e,"overflowY")},H5=function(e){return cS(e,"overflowX")},Pw=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=uS(e,s);if(o){var l=dS(e,s),u=l[1],d=l[2];if(u>d)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},q5=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},V5=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},uS=function(e,t){return e==="v"?B5(t):H5(t)},dS=function(e,t){return e==="v"?q5(t):V5(t)},G5=function(e,t){return e==="h"&&t==="rtl"?-1:1},F5=function(e,t,r,s,o){var l=G5(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 _=dS(e,d),E=_[0],S=_[1],T=_[2],C=S-T-l*E;(E||C)&&uS(e,d)&&(g+=C,w+=E);var A=d.parentNode;d=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}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},gu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},zw=function(e){return[e.deltaX,e.deltaY]},Uw=function(e){return e&&"current"in e?e.current:e},K5=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Y5=function(e){return`
|
||
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
||
`)},W5=0,Ni=[];function X5(e){var t=v.useRef([]),r=v.useRef([0,0]),s=v.useRef(),o=v.useState(W5++)[0],l=v.useState(lS)[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=UN([e.lockRef.current],(e.shards||[]).map(Uw),!0).filter(Boolean);return S.forEach(function(T){return T.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),S.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var d=v.useCallback(function(S,T){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var C=gu(S),A=r.current,N="deltaX"in S?S.deltaX:A[0]-C[0],P="deltaY"in S?S.deltaY:A[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=Pw(L,$);if(!pe)return!0;if(pe?F=L:(F=L==="v"?"h":"v",pe=Pw(L,$)),!pe)return!1;if(!s.current&&"changedTouches"in S&&(N||P)&&(s.current=F),!F)return!0;var oe=s.current||F;return F5(oe,T,S,oe==="h"?N:P)},[]),f=v.useCallback(function(S){var T=S;if(!(!Ni.length||Ni[Ni.length-1]!==l)){var C="deltaY"in T?zw(T):gu(T),A=t.current.filter(function(F){return F.name===T.type&&(F.target===T.target||T.target===F.shadowParent)&&K5(F.delta,C)})[0];if(A&&A.should){T.cancelable&&T.preventDefault();return}if(!A){var N=(u.current.shards||[]).map(Uw).filter(Boolean).filter(function(F){return F.contains(T.target)}),P=N.length>0?d(T,N[0]):!u.current.noIsolation;P&&T.cancelable&&T.preventDefault()}}},[]),m=v.useCallback(function(S,T,C,A){var N={name:S,delta:T,target:C,should:A,shadowParent:J5(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=gu(S),s.current=void 0},[]),g=v.useCallback(function(S){m(S.type,zw(S),S.target,d(S,e.lockRef.current))},[]),w=v.useCallback(function(S){m(S.type,gu(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,Ai),document.addEventListener("touchmove",f,Ai),document.addEventListener("touchstart",b,Ai),function(){Ni=Ni.filter(function(S){return S!==l}),document.removeEventListener("wheel",f,Ai),document.removeEventListener("touchmove",f,Ai),document.removeEventListener("touchstart",b,Ai)}},[]);var _=e.removeScrollBar,E=e.inert;return v.createElement(v.Fragment,null,E?v.createElement(l,{styles:Y5(o)}):null,_?v.createElement(I5,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function J5(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Q5=T5(oS,X5);var zl=v.forwardRef(function(e,t){return v.createElement(wd,Sr({},e,{ref:t,sideCar:Q5}))});zl.classNames=wd.classNames;var Ym=["Enter"," "],Z5=["ArrowDown","PageUp","Home"],fS=["ArrowUp","PageDown","End"],e3=[...Z5,...fS],t3={ltr:[...Ym,"ArrowRight"],rtl:[...Ym,"ArrowLeft"]},n3={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ul="Menu",[xl,r3,a3]=Ap(Ul),[Ls,hS]=la(Ul,[a3,Zi,eS]),xd=Zi(),mS=eS(),[s3,Ps]=Ls(Ul),[i3,Il]=Ls(Ul),pS=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:o,onOpenChange:l,modal:u=!0}=e,d=xd(t),[f,m]=v.useState(null),b=v.useRef(!1),g=ar(l),w=Np(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(Up,{...d,children:y.jsx(s3,{scope:t,open:r,onOpenChange:g,content:f,onContentChange:m,children:y.jsx(i3,{scope:t,onClose:v.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:b,dir:w,modal:u,children:s})})})};pS.displayName=Ul;var o3="MenuAnchor",Bp=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,o=xd(r);return y.jsx(vd,{...o,...s,ref:t})});Bp.displayName=o3;var Hp="MenuPortal",[l3,gS]=Ls(Hp,{forceMount:void 0}),yS=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:o}=e,l=Ps(Hp,t);return y.jsx(l3,{scope:t,forceMount:r,children:y.jsx(or,{present:r||l.open,children:y.jsx(Ll,{asChild:!0,container:o,children:s})})})};yS.displayName=Hp;var Vn="MenuContent",[c3,qp]=Ls(Vn),vS=v.forwardRef((e,t)=>{const r=gS(Vn,e.__scopeMenu),{forceMount:s=r.forceMount,...o}=e,l=Ps(Vn,e.__scopeMenu),u=Il(Vn,e.__scopeMenu);return y.jsx(xl.Provider,{scope:e.__scopeMenu,children:y.jsx(or,{present:s||l.open,children:y.jsx(xl.Slot,{scope:e.__scopeMenu,children:u.modal?y.jsx(u3,{...o,ref:t}):y.jsx(d3,{...o,ref:t})})})})}),u3=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 bd(l)},[]),y.jsx(Vp,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:we(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),d3=v.forwardRef((e,t)=>{const r=Ps(Vn,e.__scopeMenu);return y.jsx(Vp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),f3=c5("MenuContent.ScrollLock"),Vp=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,T=Ps(Vn,r),C=Il(Vn,r),A=xd(r),N=mS(r),P=r3(r),[F,$]=v.useState(null),L=v.useRef(null),q=Xe(t,L,T.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?zl:v.Fragment,M=E?{as:f3,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=E3(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),[]),hd();const J=v.useCallback(ne=>{var k,j;return ue.current===((k=oe.current)==null?void 0:k.side)&&T3(ne,(j=oe.current)==null?void 0:j.area)},[]);return y.jsx(c3,{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(Ml,{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(Ol,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:w,onDismiss:_,children:y.jsx(o5,{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(Ip,{role:"menu","aria-orientation":"vertical","data-state":DS(T.open),"data-radix-menu-content":"",dir:C.dir,...A,...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||!e3.includes(ne.key))return;ne.preventDefault();const Z=P().filter(z=>!z.disabled).map(z=>z.ref.current);fS.includes(ne.key)&&Z.reverse(),_3(Z)}),onBlur:we(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(ie.current),he.current="")}),onPointerMove:we(e.onPointerMove,_l(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}}))})})})})})})});vS.displayName=Vn;var h3="MenuGroup",Gp=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{role:"group",...s,ref:t})});Gp.displayName=h3;var m3="MenuLabel",bS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{...s,ref:t})});bS.displayName=m3;var Qu="MenuItem",Iw="menu.itemSelect",_d=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...o}=e,l=v.useRef(null),u=Il(Qu,e.__scopeMenu),d=qp(Qu,e.__scopeMenu),f=Xe(t,l),m=v.useRef(!1),b=()=>{const g=l.current;if(!r&&g){const w=new CustomEvent(Iw,{bubbles:!0,cancelable:!0});g.addEventListener(Iw,_=>s==null?void 0:s(_),{once:!0}),R_(g,w),w.defaultPrevented?m.current=!1:u.onClose()}};return y.jsx(wS,{...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===" "||Ym.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});_d.displayName=Qu;var wS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:o,...l}=e,u=qp(Qu,r),d=mS(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(xl.ItemSlot,{scope:r,disabled:s,textValue:o??w,children:y.jsx(l5,{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,_l(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:we(e.onPointerLeave,_l(E=>u.onItemLeave(E))),onFocus:we(e.onFocus,()=>g(!0)),onBlur:we(e.onBlur,()=>g(!1))})})})}),p3="MenuCheckboxItem",xS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...o}=e;return y.jsx(TS,{scope:e.__scopeMenu,checked:r,children:y.jsx(_d,{role:"menuitemcheckbox","aria-checked":Zu(r)?"mixed":r,...o,ref:t,"data-state":Kp(r),onSelect:we(o.onSelect,()=>s==null?void 0:s(Zu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});xS.displayName=p3;var _S="MenuRadioGroup",[g3,y3]=Ls(_S,{value:void 0,onValueChange:()=>{}}),SS=v.forwardRef((e,t)=>{const{value:r,onValueChange:s,...o}=e,l=ar(s);return y.jsx(g3,{scope:e.__scopeMenu,value:r,onValueChange:l,children:y.jsx(Gp,{...o,ref:t})})});SS.displayName=_S;var ES="MenuRadioItem",CS=v.forwardRef((e,t)=>{const{value:r,...s}=e,o=y3(ES,e.__scopeMenu),l=r===o.value;return y.jsx(TS,{scope:e.__scopeMenu,checked:l,children:y.jsx(_d,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":Kp(l),onSelect:we(s.onSelect,()=>{var u;return(u=o.onValueChange)==null?void 0:u.call(o,r)},{checkForDefaultPrevented:!1})})})});CS.displayName=ES;var Fp="MenuItemIndicator",[TS,v3]=Ls(Fp,{checked:!1}),RS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...o}=e,l=v3(Fp,r);return y.jsx(or,{present:s||Zu(l.checked)||l.checked===!0,children:y.jsx(je.span,{...o,ref:t,"data-state":Kp(l.checked)})})});RS.displayName=Fp;var b3="MenuSeparator",AS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});AS.displayName=b3;var w3="MenuArrow",NS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,o=xd(r);return y.jsx($p,{...o,...s,ref:t})});NS.displayName=w3;var x3="MenuSub",[II,kS]=Ls(x3),nl="MenuSubTrigger",jS=v.forwardRef((e,t)=>{const r=Ps(nl,e.__scopeMenu),s=Il(nl,e.__scopeMenu),o=kS(nl,e.__scopeMenu),l=qp(nl,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(Bp,{asChild:!0,...m,children:y.jsx(wS,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":DS(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,_l(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,_l(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,T=S==="right",C=T?-5:5,A=w[T?"left":"right"],N=w[T?"right":"left"];l.onPointerGraceIntentChange({area:[{x:g.clientX+C,y:g.clientY},{x:A,y:w.top},{x:N,y:w.top},{x:N,y:w.bottom},{x:A,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===" "||t3[s.dir].includes(g.key)&&(r.onOpenChange(!0),(_=r.content)==null||_.focus(),g.preventDefault())})})})});jS.displayName=nl;var OS="MenuSubContent",MS=v.forwardRef((e,t)=>{const r=gS(Vn,e.__scopeMenu),{forceMount:s=r.forceMount,...o}=e,l=Ps(Vn,e.__scopeMenu),u=Il(Vn,e.__scopeMenu),d=kS(OS,e.__scopeMenu),f=v.useRef(null),m=Xe(t,f);return y.jsx(xl.Provider,{scope:e.__scopeMenu,children:y.jsx(or,{present:s||l.open,children:y.jsx(xl.Slot,{scope:e.__scopeMenu,children:y.jsx(Vp,{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=n3[u.dir].includes(b.key);g&&w&&(l.onOpenChange(!1),(_=d.trigger)==null||_.focus(),b.preventDefault())})})})})})});MS.displayName=OS;function DS(e){return e?"open":"closed"}function Zu(e){return e==="indeterminate"}function Kp(e){return Zu(e)?"indeterminate":e?"checked":"unchecked"}function _3(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function S3(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function E3(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=S3(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 C3(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 T3(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return C3(r,t)}function _l(e){return t=>t.pointerType==="mouse"?e(t):void 0}var R3=pS,A3=Bp,N3=yS,k3=vS,j3=Gp,O3=bS,M3=_d,D3=xS,L3=SS,P3=CS,z3=RS,U3=AS,I3=NS,$3=jS,B3=MS,Sd="DropdownMenu",[H3]=la(Sd,[hS]),tn=hS(),[q3,LS]=H3(Sd),PS=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]=As({prop:o,defaultProp:l??!1,onChange:u,caller:Sd});return y.jsx(q3,{scope:t,triggerId:Qt(),triggerRef:m,contentId:Qt(),open:b,onOpenChange:g,onOpenToggle:v.useCallback(()=>g(w=>!w),[g]),modal:d,children:y.jsx(R3,{...f,open:b,onOpenChange:g,dir:s,modal:d,children:r})})};PS.displayName=Sd;var zS="DropdownMenuTrigger",US=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...o}=e,l=LS(zS,r),u=tn(r);return y.jsx(A3,{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())})})})});US.displayName=zS;var V3="DropdownMenuPortal",IS=e=>{const{__scopeDropdownMenu:t,...r}=e,s=tn(t);return y.jsx(N3,{...s,...r})};IS.displayName=V3;var $S="DropdownMenuContent",BS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=LS($S,r),l=tn(r),u=v.useRef(!1);return y.jsx(k3,{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)"}})});BS.displayName=$S;var G3="DropdownMenuGroup",F3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(j3,{...o,...s,ref:t})});F3.displayName=G3;var K3="DropdownMenuLabel",HS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(O3,{...o,...s,ref:t})});HS.displayName=K3;var Y3="DropdownMenuItem",qS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(M3,{...o,...s,ref:t})});qS.displayName=Y3;var W3="DropdownMenuCheckboxItem",VS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(D3,{...o,...s,ref:t})});VS.displayName=W3;var X3="DropdownMenuRadioGroup",J3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(L3,{...o,...s,ref:t})});J3.displayName=X3;var Q3="DropdownMenuRadioItem",GS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(P3,{...o,...s,ref:t})});GS.displayName=Q3;var Z3="DropdownMenuItemIndicator",FS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(z3,{...o,...s,ref:t})});FS.displayName=Z3;var eP="DropdownMenuSeparator",KS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(U3,{...o,...s,ref:t})});KS.displayName=eP;var tP="DropdownMenuArrow",nP=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(I3,{...o,...s,ref:t})});nP.displayName=tP;var rP="DropdownMenuSubTrigger",YS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx($3,{...o,...s,ref:t})});YS.displayName=rP;var aP="DropdownMenuSubContent",WS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(B3,{...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)"}})});WS.displayName=aP;var sP=PS,iP=US,oP=IS,XS=BS,JS=HS,QS=qS,ZS=VS,eE=GS,tE=FS,nE=KS,rE=YS,aE=WS;const lP=sP,cP=iP,uP=v.forwardRef(({className:e,inset:t,children:r,...s},o)=>y.jsxs(rE,{ref:o,className:Ee("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(E_,{className:"ml-auto"})]}));uP.displayName=rE.displayName;const dP=v.forwardRef(({className:e,...t},r)=>y.jsx(aE,{ref:r,className:Ee("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}));dP.displayName=aE.displayName;const sE=v.forwardRef(({className:e,sideOffset:t=4,...r},s)=>y.jsx(oP,{children:y.jsx(XS,{ref:s,sideOffset:t,className:Ee("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})}));sE.displayName=XS.displayName;const iE=v.forwardRef(({className:e,inset:t,...r},s)=>y.jsx(QS,{ref:s,className:Ee("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}));iE.displayName=QS.displayName;const fP=v.forwardRef(({className:e,children:t,checked:r,...s},o)=>y.jsxs(ZS,{ref:o,className:Ee("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(tE,{children:y.jsx(Rs,{className:"h-4 w-4"})})}),t]}));fP.displayName=ZS.displayName;const hP=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(eE,{ref:s,className:Ee("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(tE,{children:y.jsx(fM,{className:"h-2 w-2 fill-current"})})}),t]}));hP.displayName=eE.displayName;const mP=v.forwardRef(({className:e,inset:t,...r},s)=>y.jsx(JS,{ref:s,className:Ee("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));mP.displayName=JS.displayName;const oE=v.forwardRef(({className:e,...t},r)=>y.jsx(nE,{ref:r,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));oE.displayName=nE.displayName;function pP(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,T=v.useMemo(()=>E,Object.values(E));return y.jsx(S.Provider,{value:T,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,gP(o,...t)]}function gP(...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 yP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Yp=yP.reduce((e,t)=>{const r=fd(`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}},{}),gm={exports:{}},ym={};/**
|
||
* @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 $w;function vP(){if($w)return ym;$w=1;var e=id();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,T=E[1];return l(function(){S.value=_,S.getSnapshot=w,f(S)&&T({inst:S})},[g,_,w]),o(function(){return f(S)&&T({inst:S}),g(function(){f(S)&&T({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 ym.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,ym}var Bw;function bP(){return Bw||(Bw=1,gm.exports=vP()),gm.exports}var wP=bP();function xP(){return wP.useSyncExternalStore(_P,()=>!0,()=>!1)}function _P(){return()=>{}}var Wp="Avatar",[SP]=pP(Wp),[EP,lE]=SP(Wp),cE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[o,l]=v.useState("idle");return y.jsx(EP,{scope:r,imageLoadingStatus:o,onImageLoadingStatusChange:l,children:y.jsx(Yp.span,{...s,ref:t})})});cE.displayName=Wp;var uE="AvatarImage",dE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:o=()=>{},...l}=e,u=lE(uE,r),d=CP(s,l),f=ar(m=>{o(m),u.onImageLoadingStatusChange(m)});return jt(()=>{d!=="idle"&&f(d)},[d,f]),d==="loaded"?y.jsx(Yp.img,{...l,ref:t,src:s}):null});dE.displayName=uE;var fE="AvatarFallback",hE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...o}=e,l=lE(fE,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(Yp.span,{...o,ref:t}):null});hE.displayName=fE;function Hw(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function CP(e,{referrerPolicy:t,crossOrigin:r}){const s=xP(),o=v.useRef(null),l=s?(o.current||(o.current=new window.Image),o.current):null,[u,d]=v.useState(()=>Hw(l,e));return jt(()=>{d(Hw(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 mE=cE,pE=dE,gE=hE;const yE=v.forwardRef(({className:e,...t},r)=>y.jsx(mE,{ref:r,className:Ee("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));yE.displayName=mE.displayName;const vE=v.forwardRef(({className:e,...t},r)=>y.jsx(pE,{ref:r,className:Ee("aspect-square h-full w-full",e),...t}));vE.displayName=pE.displayName;const bE=v.forwardRef(({className:e,...t},r)=>y.jsx(gE,{ref:r,className:Ee("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));bE.displayName=gE.displayName;const TP=_p("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:Ee(TP({variant:t}),e),...r})}const RP=["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(),Xp={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"},AP=Object.keys(Xp).sort(),NP=["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"],kP=["Aprobado","No aprobado","Stand by","Aprobado /no ejecutado","Pre aprobado","On going","Sin respuesta"],Wm=[{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"}],jP=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];function wE(e){var t;return((t=Wm.find(r=>r.id===e))==null?void 0:t.hex)??Wm[0].hex}function OP({project:e,onClick:t}){const r=!!e.status,{isGerardo:s}=jl(),o=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t())};return y.jsxs("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:o,className:Ee("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":wE(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(yu,{icon:y.jsx(mw,{className:"w-3.5 h-3.5"}),label:"Cliente",value:e.cliente}),y.jsx(yu,{icon:y.jsx(mw,{className:"w-3.5 h-3.5"}),label:"Marca",value:e.marca}),y.jsx(yu,{icon:y.jsx($M,{className:"w-3.5 h-3.5"}),label:"País",value:e.bu}),y.jsx(yu,{icon:y.jsx(QM,{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(jM,{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(SM,{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:Ee("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(uM,{className:"w-2.5 h-2.5 mr-0.5"}),e.status]})]})]})]})]})}function yu({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 MP(e){const t=DP(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(PP);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 DP(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=UP(o),d=zP(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 LP=Symbol("radix.slottable");function PP(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===LP}function zP(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 UP(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 Ed="Dialog",[xE]=la(Ed),[IP,lr]=xE(Ed),_E=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]=As({prop:s,defaultProp:o??!1,onChange:l,caller:Ed});return y.jsx(IP,{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})};_E.displayName=Ed;var SE="DialogTrigger",$P=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(SE,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":Zp(o.open),...s,ref:l,onClick:we(e.onClick,o.onOpenToggle)})});$P.displayName=SE;var Jp="DialogPortal",[BP,EE]=xE(Jp,{forceMount:void 0}),CE=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:o}=e,l=lr(Jp,t);return y.jsx(BP,{scope:t,forceMount:r,children:v.Children.map(s,u=>y.jsx(or,{present:r||l.open,children:y.jsx(Ll,{asChild:!0,container:o,children:u})}))})};CE.displayName=Jp;var ed="DialogOverlay",TE=v.forwardRef((e,t)=>{const r=EE(ed,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,l=lr(ed,e.__scopeDialog);return l.modal?y.jsx(or,{present:s||l.open,children:y.jsx(qP,{...o,ref:t})}):null});TE.displayName=ed;var HP=MP("DialogOverlay.RemoveScroll"),qP=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(ed,r);return y.jsx(zl,{as:HP,allowPinchZoom:!0,shards:[o.contentRef],children:y.jsx(je.div,{"data-state":Zp(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ks="DialogContent",RE=v.forwardRef((e,t)=>{const r=EE(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(VP,{...o,ref:t}):y.jsx(GP,{...o,ref:t})})});RE.displayName=ks;var VP=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 bd(l)},[]),y.jsx(AE,{...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())})}),GP=v.forwardRef((e,t)=>{const r=lr(ks,e.__scopeDialog),s=v.useRef(!1),o=v.useRef(!1);return y.jsx(AE,{...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()}})}),AE=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 hd(),y.jsxs(y.Fragment,{children:[y.jsx(Ml,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:y.jsx(Ol,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Zp(d.open),...u,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),y.jsxs(y.Fragment,{children:[y.jsx(FP,{titleId:d.titleId}),y.jsx(YP,{contentRef:f,descriptionId:d.descriptionId})]})]})}),Qp="DialogTitle",NE=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(Qp,r);return y.jsx(je.h2,{id:o.titleId,...s,ref:t})});NE.displayName=Qp;var kE="DialogDescription",jE=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(kE,r);return y.jsx(je.p,{id:o.descriptionId,...s,ref:t})});jE.displayName=kE;var OE="DialogClose",ME=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(OE,r);return y.jsx(je.button,{type:"button",...s,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});ME.displayName=OE;function Zp(e){return e?"open":"closed"}var DE="DialogTitleWarning",[$I,LE]=eD(DE,{contentName:ks,titleName:Qp,docsSlug:"dialog"}),FP=({titleId:e})=>{const t=LE(DE),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},KP="DialogDescriptionWarning",YP=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${LE(KP).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},PE=_E,zE=CE,eg=TE,tg=RE,UE=NE,IE=jE,WP=ME;const XP=PE,JP=zE,$E=v.forwardRef(({className:e,...t},r)=>y.jsx(eg,{ref:r,className:Ee("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}));$E.displayName=eg.displayName;const BE=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(JP,{children:[y.jsx($E,{}),y.jsxs(tg,{ref:s,className:Ee("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(WP,{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(bl,{className:"h-4 w-4"}),y.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));BE.displayName=tg.displayName;const HE=({className:e,...t})=>y.jsx("div",{className:Ee("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});HE.displayName="DialogHeader";const qE=({className:e,...t})=>y.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});qE.displayName="DialogFooter";const VE=v.forwardRef(({className:e,...t},r)=>y.jsx(UE,{ref:r,className:Ee("text-lg font-semibold leading-none tracking-tight",e),...t}));VE.displayName=UE.displayName;const GE=v.forwardRef(({className:e,...t},r)=>y.jsx(IE,{ref:r,className:Ee("text-sm text-muted-foreground",e),...t}));GE.displayName=IE.displayName;var QP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ZP=QP.reduce((e,t)=>{const r=fd(`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}},{}),e4="Label",FE=v.forwardRef((e,t)=>y.jsx(ZP.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())}}));FE.displayName=e4;var KE=FE;const t4=_p("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=v.forwardRef(({className:e,...t},r)=>y.jsx(KE,{ref:r,className:Ee(t4(),e),...t}));xt.displayName=KE.displayName;const td=v.forwardRef(({className:e,...t},r)=>y.jsx("textarea",{className:Ee("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}));td.displayName="Textarea";function YE(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 Cd="Checkbox",[n4]=la(Cd),[r4,ng]=n4(Cd);function a4(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,_]=As({prop:r,defaultProp:o??!1,onChange:f,caller:Cd}),[E,S]=v.useState(null),[T,C]=v.useState(null),A=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:A,required:m,defaultChecked:Va(o)?!1:o,isFormControl:N,bubbleInput:T,setBubbleInput:C};return y.jsx(r4,{scope:t,...P,children:s4(g)?g(P):s})}var WE="CheckboxTrigger",XE=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}=ng(WE,e),S=Xe(o,b),T=v.useRef(f);return v.useEffect(()=>{const C=l==null?void 0:l.form;if(C){const A=()=>g(T.current);return C.addEventListener("reset",A),()=>C.removeEventListener("reset",A)}},[l,g]),y.jsx(je.button,{type:"button",role:"checkbox","aria-checked":Va(f)?"mixed":f,"aria-required":m,"data-state":t1(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(A=>Va(A)?!0:!A),E&&_&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})})});XE.displayName=WE;var rg=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(a4,{__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(XE,{...g,ref:t,__scopeCheckbox:r}),w&&y.jsx(e1,{__scopeCheckbox:r})]})})});rg.displayName=Cd;var JE="CheckboxIndicator",QE=v.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...o}=e,l=ng(JE,r);return y.jsx(or,{present:s||Va(l.checked)||l.checked===!0,children:y.jsx(je.span,{"data-state":t1(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});QE.displayName=JE;var ZE="CheckboxBubbleInput",e1=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:_}=ng(ZE,e),E=Xe(r,_),S=YE(l),T=q_(s);v.useEffect(()=>{const A=w;if(!A)return;const N=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(N,"checked").set,$=!o.current;if(S!==l&&F){const L=new Event("click",{bubbles:$});A.indeterminate=Va(l),F.call(A,Va(l)?!1:l),A.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,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});e1.displayName=ZE;function s4(e){return typeof e=="function"}function Va(e){return e==="indeterminate"}function t1(e){return Va(e)?"indeterminate":e?"checked":"unchecked"}const n1=v.forwardRef(({className:e,...t},r)=>y.jsx(rg,{ref:r,className:Ee("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(QE,{className:Ee("grid place-content-center text-current"),children:y.jsx(Rs,{className:"h-4 w-4"})})}));n1.displayName=rg.displayName;function qw(e,[t,r]){return Math.min(r,Math.max(t,e))}function i4(e){const t=o4(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(c4);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 o4(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=d4(o),d=u4(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 l4=Symbol("radix.slottable");function c4(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===l4}function u4(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 d4(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 r1=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"}),f4="VisuallyHidden",h4=v.forwardRef((e,t)=>y.jsx(je.span,{...e,ref:t,style:{...r1,...e.style}}));h4.displayName=f4;var m4=[" ","Enter","ArrowUp","ArrowDown"],p4=[" ","Enter"],js="Select",[Td,Rd,g4]=Ap(js),[eo]=la(js,[g4,Zi]),Ad=Zi(),[y4,Wa]=eo(js),[v4,b4]=eo(js),a1=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=Ad(t),[T,C]=v.useState(null),[A,N]=v.useState(null),[P,F]=v.useState(!1),$=Np(m),[L,q]=As({prop:s,defaultProp:o??!1,onChange:l,caller:js}),[ie,he]=As({prop:u,defaultProp:d,onChange:f,caller:js}),pe=v.useRef(null),oe=T?E||!!T.closest("form"):!0,[ue,ce]=v.useState(new Set),fe=Array.from(ue).map(M=>M.props.value).join(";");return y.jsx(Up,{...S,children:y.jsxs(y4,{required:_,scope:t,trigger:T,onTriggerChange:C,valueNode:A,onValueNodeChange:N,valueNodeHasChildren:P,onValueNodeHasChildrenChange:F,contentId:Qt(),value:ie,onValueChange:he,open:L,onOpenChange:q,dir:$,triggerPointerDownPosRef:pe,disabled:w,children:[y.jsx(Td.Provider,{scope:t,children:y.jsx(v4,{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(A1,{"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]})})};a1.displayName=js;var s1="SelectTrigger",i1=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...o}=e,l=Ad(r),u=Wa(s1,r),d=u.disabled||s,f=Xe(t,u.onTriggerChange),m=Rd(r),b=v.useRef("touch"),[g,w,_]=k1(S=>{const T=m().filter(N=>!N.disabled),C=T.find(N=>N.value===u.value),A=j1(T,S,C);A!==void 0&&u.onValueChange(A.value)}),E=S=>{d||(u.onOpenChange(!0),_()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return y.jsx(vd,{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":N1(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 T=S.target;T.hasPointerCapture(S.pointerId)&&T.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(E(S),S.preventDefault())}),onKeyDown:we(o.onKeyDown,S=>{const T=g.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&w(S.key),!(T&&S.key===" ")&&m4.includes(S.key)&&(E(),S.preventDefault())})})})});i1.displayName=s1;var o1="SelectValue",l1=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,children:l,placeholder:u="",...d}=e,f=Wa(o1,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:N1(f.value)?y.jsx(y.Fragment,{children:u}):l})});l1.displayName=o1;var w4="SelectIcon",c1=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...o}=e;return y.jsx(je.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});c1.displayName=w4;var x4="SelectPortal",u1=e=>y.jsx(Ll,{asChild:!0,...e});u1.displayName=x4;var Os="SelectContent",d1=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?Nl.createPortal(y.jsx(f1,{scope:e.__scopeSelect,children:y.jsx(Td.Slot,{scope:e.__scopeSelect,children:y.jsx("div",{children:e.children})})}),l):null}return y.jsx(h1,{...e,ref:t})});d1.displayName=Os;var Zn=10,[f1,Xa]=eo(Os),_4="SelectContentImpl",S4=i4("SelectContent.RemoveScroll"),h1=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:T,...C}=e,A=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=Rd(r),[ue,ce]=v.useState(!1),fe=v.useRef(!1);v.useEffect(()=>{if(N)return bd(N)},[N]),hd();const M=v.useCallback(z=>{const[ee,...ae]=oe().map(Re=>Re.ref.current),[xe]=ae.slice(-1),Ce=document.activeElement;for(const Re of z)if(Re===Ce||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===ee&&F&&(F.scrollTop=0),Re===xe&&F&&(F.scrollTop=F.scrollHeight),Re==null||Re.focus(),document.activeElement!==Ce))return},[oe,F]),K=v.useCallback(()=>M([q,N]),[M,q,N]);v.useEffect(()=>{ue&&K()},[ue,K]);const{onOpenChange:J,triggerPointerDownPosRef:ne}=A;v.useEffect(()=>{if(N){let z={x:0,y:0};const ee=xe=>{var Ce,Re;z={x:Math.abs(Math.round(xe.pageX)-(((Ce=ne.current)==null?void 0:Ce.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Re=ne.current)==null?void 0:Re.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]=k1(z=>{const ee=oe().filter(Ce=>!Ce.disabled),ae=ee.find(Ce=>Ce.ref.current===document.activeElement),xe=j1(ee,z,ae);xe&&setTimeout(()=>xe.ref.current.focus())}),j=v.useCallback((z,ee,ae)=>{const xe=!fe.current&&!ae;(A.value!==void 0&&A.value===ee||xe)&&(ie(z),xe&&(fe.current=!0))},[A.value]),I=v.useCallback(()=>N==null?void 0:N.focus(),[N]),Y=v.useCallback((z,ee,ae)=>{const xe=!fe.current&&!ae;(A.value!==void 0&&A.value===ee||xe)&&pe(z)},[A.value]),V=s==="popper"?Xm:m1,Z=V===Xm?{side:d,sideOffset:f,align:m,alignOffset:b,arrowPadding:g,collisionBoundary:w,collisionPadding:_,sticky:E,hideWhenDetached:S,avoidCollisions:T}:{};return y.jsx(f1,{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(zl,{as:S4,allowPinchZoom:!0,children:y.jsx(Ml,{asChild:!0,trapped:A.open,onMountAutoFocus:z=>{z.preventDefault()},onUnmountAutoFocus:we(o,z=>{var ee;(ee=A.trigger)==null||ee.focus({preventScroll:!0}),z.preventDefault()}),children:y.jsx(Ol,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:z=>z.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:y.jsx(V,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.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(Ce=>!Ce.disabled).map(Ce=>Ce.ref.current);if(["ArrowUp","End"].includes(z.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(z.key)){const Ce=z.target,Re=xe.indexOf(Ce);xe=xe.slice(Re+1)}setTimeout(()=>M(xe)),z.preventDefault()}})})})})})})});h1.displayName=_4;var E4="SelectItemAlignedPosition",m1=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=Rd(r),_=v.useRef(!1),E=v.useRef(!0),{viewport:S,selectedItem:T,selectedItemText:C,focusSelectedItem:A}=u,N=v.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&m&&S&&T&&C){const L=l.trigger.getBoundingClientRect(),q=m.getBoundingClientRect(),ie=l.valueNode.getBoundingClientRect(),he=C.getBoundingClientRect();if(l.dir!=="rtl"){const Ce=he.left-q.left,Re=ie.left-Ce,nt=L.left-Re,He=L.width+nt,Kt=Math.max(He,q.width),Yt=window.innerWidth-Zn,Ot=qw(Re,[Zn,Math.max(Zn,Yt-Kt)]);d.style.minWidth=He+"px",d.style.left=Ot+"px"}else{const Ce=q.right-he.right,Re=window.innerWidth-ie.right-Ce,nt=window.innerWidth-L.right-Re,He=L.width+nt,Kt=Math.max(He,q.width),Yt=window.innerWidth-Zn,Ot=qw(Re,[Zn,Math.max(Zn,Yt-Kt)]);d.style.minWidth=He+"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(T.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=T.offsetHeight/2,z=T.offsetTop+Z,ee=fe+M+z,ae=ne-ee;if(ee<=Y){const Ce=pe.length>0&&T===pe[pe.length-1].ref.current;d.style.bottom="0px";const Re=m.clientHeight-S.offsetTop-S.offsetHeight,nt=Math.max(V,Z+(Ce?I:0)+Re+K),He=ee+nt;d.style.height=He+"px"}else{const Ce=pe.length>0&&T===pe[0].ref.current;d.style.top="0px";const nt=Math.max(Y,fe+S.offsetTop+(Ce?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,T,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(),A==null||A(),E.current=!1)},[N,A]);return y.jsx(T4,{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}})})})});m1.displayName=E4;var C4="SelectPopperPosition",Xm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:o=Zn,...l}=e,u=Ad(r);return y.jsx(Ip,{...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)"}})});Xm.displayName=C4;var[T4,ag]=eo(Os,{}),Jm="SelectViewport",p1=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...o}=e,l=Xa(Jm,r),u=ag(Jm,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(Td.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),T=parseFloat(g.style.height),C=Math.max(S,T);if(C<E){const A=C+_,N=Math.min(E,A),P=A-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})})})]})});p1.displayName=Jm;var g1="SelectGroup",[R4,A4]=eo(g1),N4=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=Qt();return y.jsx(R4,{scope:r,id:o,children:y.jsx(je.div,{role:"group","aria-labelledby":o,...s,ref:t})})});N4.displayName=g1;var y1="SelectLabel",v1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=A4(y1,r);return y.jsx(je.div,{id:o.id,...s,ref:t})});v1.displayName=y1;var nd="SelectItem",[k4,b1]=eo(nd),w1=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:o=!1,textValue:l,...u}=e,d=Wa(nd,r),f=Xa(nd,r),m=d.value===s,[b,g]=v.useState(l??""),[w,_]=v.useState(!1),E=Xe(t,A=>{var N;return(N=f.itemRefCallback)==null?void 0:N.call(f,A,s,o)}),S=Qt(),T=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(k4,{scope:r,value:s,disabled:o,textId:S,isSelected:m,onItemTextChange:v.useCallback(A=>{g(N=>N||((A==null?void 0:A.textContent)??"").trim())},[]),children:y.jsx(Td.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,()=>{T.current!=="mouse"&&C()}),onPointerUp:we(u.onPointerUp,()=>{T.current==="mouse"&&C()}),onPointerDown:we(u.onPointerDown,A=>{T.current=A.pointerType}),onPointerMove:we(u.onPointerMove,A=>{var N;T.current=A.pointerType,o?(N=f.onItemLeave)==null||N.call(f):T.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(u.onPointerLeave,A=>{var N;A.currentTarget===document.activeElement&&((N=f.onItemLeave)==null||N.call(f))}),onKeyDown:we(u.onKeyDown,A=>{var P;((P=f.searchRef)==null?void 0:P.current)!==""&&A.key===" "||(p4.includes(A.key)&&C(),A.key===" "&&A.preventDefault())})})})})});w1.displayName=nd;var rl="SelectItemText",x1=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,...l}=e,u=Wa(rl,r),d=Xa(rl,r),f=b1(rl,r),m=b4(rl,r),[b,g]=v.useState(null),w=Xe(t,C=>g(C),f.onItemTextChange,C=>{var A;return(A=d.itemTextRefCallback)==null?void 0:A.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:T}=m;return jt(()=>(S(E),()=>T(E)),[S,T,E]),y.jsxs(y.Fragment,{children:[y.jsx(je.span,{id:f.textId,...l,ref:w}),f.isSelected&&u.valueNode&&!u.valueNodeHasChildren?Nl.createPortal(l.children,u.valueNode):null]})});x1.displayName=rl;var _1="SelectItemIndicator",S1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return b1(_1,r).isSelected?y.jsx(je.span,{"aria-hidden":!0,...s,ref:t}):null});S1.displayName=_1;var Qm="SelectScrollUpButton",E1=v.forwardRef((e,t)=>{const r=Xa(Qm,e.__scopeSelect),s=ag(Qm,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});E1.displayName=Qm;var Zm="SelectScrollDownButton",C1=v.forwardRef((e,t)=>{const r=Xa(Zm,e.__scopeSelect),s=ag(Zm,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});C1.displayName=Zm;var T1=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...o}=e,l=Xa("SelectScrollButton",r),u=v.useRef(null),d=Rd(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()})})}),j4="SelectSeparator",R1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return y.jsx(je.div,{"aria-hidden":!0,...s,ref:t})});R1.displayName=j4;var ep="SelectArrow",O4=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=Ad(r),l=Wa(ep,r),u=Xa(ep,r);return l.open&&u.position==="popper"?y.jsx($p,{...o,...s,ref:t}):null});O4.displayName=ep;var M4="SelectBubbleInput",A1=v.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const o=v.useRef(null),l=Xe(s,o),u=YE(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:{...r1,...r.style},ref:l,defaultValue:t})});A1.displayName=M4;function N1(e){return e===""||e===void 0}function k1(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 j1(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=D4(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 D4(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var L4=a1,O1=i1,P4=l1,z4=c1,U4=u1,M1=d1,I4=p1,D1=v1,L1=w1,$4=x1,B4=S1,P1=E1,z1=C1,U1=R1;const H4=L4,q4=P4,I1=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(O1,{ref:s,className:Ee("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(z4,{asChild:!0,children:y.jsx(Tp,{className:"h-4 w-4 opacity-50"})})]}));I1.displayName=O1.displayName;const $1=v.forwardRef(({className:e,...t},r)=>y.jsx(P1,{ref:r,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:y.jsx(iM,{className:"h-4 w-4"})}));$1.displayName=P1.displayName;const B1=v.forwardRef(({className:e,...t},r)=>y.jsx(z1,{ref:r,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:y.jsx(Tp,{className:"h-4 w-4"})}));B1.displayName=z1.displayName;const H1=v.forwardRef(({className:e,children:t,position:r="popper",...s},o)=>y.jsx(U4,{children:y.jsxs(M1,{ref:o,className:Ee("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($1,{}),y.jsx(I4,{className:Ee("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),y.jsx(B1,{})]})}));H1.displayName=M1.displayName;const V4=v.forwardRef(({className:e,...t},r)=>y.jsx(D1,{ref:r,className:Ee("px-2 py-1.5 text-sm font-semibold",e),...t}));V4.displayName=D1.displayName;const tp=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(L1,{ref:s,className:Ee("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(B4,{children:y.jsx(Rs,{className:"h-4 w-4"})})}),y.jsx($4,{children:t})]}));tp.displayName=L1.displayName;const G4=v.forwardRef(({className:e,...t},r)=>y.jsx(U1,{ref:r,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));G4.displayName=U1.displayName;var F4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],K4=F4.reduce((e,t)=>{const r=fd(`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}},{}),Y4="Separator",Vw="horizontal",W4=["horizontal","vertical"],q1=v.forwardRef((e,t)=>{const{decorative:r,orientation:s=Vw,...o}=e,l=X4(s)?s:Vw,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return y.jsx(K4.div,{"data-orientation":l,...d,...o,ref:t})});q1.displayName=Y4;function X4(e){return W4.includes(e)}var V1=q1;const Ii=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},o)=>y.jsx(V1,{ref:o,decorative:r,orientation:t,className:Ee("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Ii.displayName=V1.displayName;function J4({value:e,onChange:t}){return y.jsx("div",{className:"flex flex-wrap gap-2",children:Wm.map(r=>y.jsx("button",{type:"button",onClick:()=>t(r.id),title:r.name,className:Ee("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(Rs,{className:"w-4 h-4 text-white drop-shadow"})},r.id))})}function Gw({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(MM,{className:"w-3.5 h-3.5 flex-shrink-0"}),y.jsx("span",{className:"truncate",children:g}),y.jsx(yM,{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(bl,{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(vl,{className:"w-4 h-4 mr-1"})," Añadir"]})]})]})}var Fw=1,Q4=.9,Z4=.8,ez=.17,vm=.1,bm=.999,tz=.9999,nz=.99,rz=/[\\\/_+.#"@\[\(\{&]/,az=/[\\\/_+.#"@\[\(\{&]/g,sz=/[\s-]/,G1=/[\s-]/g;function np(e,t,r,s,o,l,u){if(l===t.length)return o===e.length?Fw:nz;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=np(e,t,r,s,m+1,l+1,u),g>b&&(m===o?g*=Fw:rz.test(e.charAt(m-1))?(g*=Z4,_=e.slice(o,m-1).match(az),_&&o>0&&(g*=Math.pow(bm,_.length))):sz.test(e.charAt(m-1))?(g*=Q4,E=e.slice(o,m-1).match(G1),E&&o>0&&(g*=Math.pow(bm,E.length))):(g*=ez,o>0&&(g*=Math.pow(bm,m-o))),e.charAt(m)!==t.charAt(l)&&(g*=tz)),(g<vm&&r.charAt(m-1)===s.charAt(l+1)||s.charAt(l+1)===s.charAt(l)&&r.charAt(m-1)!==s.charAt(l))&&(w=np(e,t,r,s,m+1,l+2,u),w*vm>g&&(g=w*vm)),g>b&&(b=g),m=r.indexOf(f,m+1);return u[d]=b,b}function Kw(e){return e.toLowerCase().replace(G1," ")}function iz(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,np(e,t,Kw(e),Kw(t),0,0,{})}var Qo='[cmdk-group=""]',wm='[cmdk-group-items=""]',oz='[cmdk-group-heading=""]',F1='[cmdk-item=""]',Yw=`${F1}:not([aria-disabled="true"])`,rp="cmdk-item-select",Pi="data-value",lz=(e,t,r)=>iz(e,t,r),K1=v.createContext(void 0),$l=()=>v.useContext(K1),Y1=v.createContext(void 0),sg=()=>v.useContext(Y1),W1=v.createContext(void 0),X1=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=J1(e),{label:f,children:m,value:b,onValueChange:g,filter:w,shouldFilter:_,loop:E,disablePointerSelection:S=!1,vimBindings:T=!0,...C}=e,A=Qt(),N=Qt(),P=Qt(),F=v.useRef(null),$=bz();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(A))==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:A,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:lz;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(wm);Z?Z.appendChild(V.parentElement===Z?V:V.closest(`${wm} > *`)):Y.appendChild(V.parentElement===Y?V:V.closest(`${wm} > *`))}),I.sort((V,Z)=>Z[1]-V[1]).forEach(V=>{var Z;let z=(Z=F.current)==null?void 0:Z.querySelector(`${Qo}[${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(Qo))==null?void 0:I.querySelector(oz))==null||Y.scrollIntoView({block:"nearest"})),V.scrollIntoView({block:"nearest"}))}function ce(){var j;return(j=F.current)==null?void 0:j.querySelector(`${F1}[aria-selected="true"]`)}function fe(){var j;return Array.from(((j=F.current)==null?void 0:j.querySelectorAll(Yw))||[])}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(Qo),V;for(;Y&&!V;)Y=j>0?yz(Y,Qo):vz(Y,Qo),V=Y==null?void 0:Y.querySelector(Yw);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":{T&&j.ctrlKey&&X(j);break}case"ArrowDown":{X(j);break}case"p":case"k":{T&&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(rp);V.dispatchEvent(Z)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:q.inputId,id:q.labelId,style:xz},f),Nd(e,j=>v.createElement(Y1.Provider,{value:L},v.createElement(K1.Provider,{value:q},j))))}),cz=v.forwardRef((e,t)=>{var r,s;let o=Qt(),l=v.useRef(null),u=v.useContext(W1),d=$l(),f=J1(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=Q1(o,l,[e.value,e.children,l],e.keywords),g=sg(),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(rp,E),()=>$.removeEventListener(rp,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:T,value:C,onSelect:A,forceMount:N,keywords:P,...F}=e;return v.createElement(je.div,{ref:en(l,t),...F,id:o,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!w,"data-disabled":!!T,"data-selected":!!w,onPointerMove:T||d.getDisablePointerSelection()?void 0:S,onClick:T?void 0:E},e.children)}),uz=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=$l(),g=Ka(_=>o||b.filter()===!1?!0:_.search?_.filtered.groups.has(u):!0);Ms(()=>b.group(u),[]),Q1(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),Nd(e,_=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},v.createElement(W1.Provider,{value:w},_))))}),dz=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"})}),fz=v.forwardRef((e,t)=>{let{onValueChange:r,...s}=e,o=e.value!=null,l=sg(),u=Ka(m=>m.search),d=Ka(m=>m.selectedItemId),f=$l();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)}})}),hz=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=$l();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},Nd(e,m=>v.createElement("div",{ref:en(u,f.listInnerRef),"cmdk-list-sizer":""},m)))}),mz=v.forwardRef((e,t)=>{let{open:r,onOpenChange:s,overlayClassName:o,contentClassName:l,container:u,...d}=e;return v.createElement(PE,{open:r,onOpenChange:s},v.createElement(zE,{container:u},v.createElement(eg,{"cmdk-overlay":"",className:o}),v.createElement(tg,{"aria-label":e.label,"cmdk-dialog":"",className:l},v.createElement(X1,{ref:t,...d}))))}),pz=v.forwardRef((e,t)=>Ka(r=>r.filtered.count===0)?v.createElement(je.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),gz=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},Nd(e,u=>v.createElement("div",{"aria-hidden":!0},u)))}),bn=Object.assign(X1,{List:hz,Item:cz,Input:fz,Group:uz,Separator:dz,Dialog:mz,Empty:pz,Loading:gz});function yz(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function vz(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function J1(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=sg(),r=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,r,r)}function Q1(e,t,r,s=[]){let o=v.useRef(),l=$l();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 bz=()=>{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 wz(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Nd({asChild:e,children:t},r){return e&&v.isValidElement(t)?v.cloneElement(wz(t),{ref:t.ref},r(t.props.children)):r(t)}var xz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const ig=v.forwardRef(({className:e,...t},r)=>y.jsx(bn,{ref:r,className:Ee("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));ig.displayName=bn.displayName;const og=v.forwardRef(({className:e,...t},r)=>y.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[y.jsx(Ku,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),y.jsx(bn.Input,{ref:r,className:Ee("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})]}));og.displayName=bn.Input.displayName;const lg=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.List,{ref:r,className:Ee("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));lg.displayName=bn.List.displayName;const cg=v.forwardRef((e,t)=>y.jsx(bn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));cg.displayName=bn.Empty.displayName;const ug=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.Group,{ref:r,className:Ee("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}));ug.displayName=bn.Group.displayName;const Z1=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.Separator,{ref:r,className:Ee("-mx-1 h-px bg-border",e),...t}));Z1.displayName=bn.Separator.displayName;const rd=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.Item,{ref:r,className:Ee("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}));rd.displayName=bn.Item.displayName;function _z(e){const t=Sz(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(Cz);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 Sz(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=Rz(o),d=Tz(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 Ez=Symbol("radix.slottable");function Cz(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ez}function Tz(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 Rz(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 kd="Popover",[eC]=la(kd,[Zi]),Bl=Zi(),[Az,Ja]=eC(kd),tC=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:o,onOpenChange:l,modal:u=!1}=e,d=Bl(t),f=v.useRef(null),[m,b]=v.useState(!1),[g,w]=As({prop:s,defaultProp:o??!1,onChange:l,caller:kd});return y.jsx(Up,{...d,children:y.jsx(Az,{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})})};tC.displayName=kd;var nC="PopoverAnchor",Nz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Ja(nC,r),l=Bl(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=o;return v.useEffect(()=>(u(),()=>d()),[u,d]),y.jsx(vd,{...l,...s,ref:t})});Nz.displayName=nC;var rC="PopoverTrigger",aC=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Ja(rC,r),l=Bl(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":cC(o.open),...s,ref:u,onClick:we(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?d:y.jsx(vd,{asChild:!0,...l,children:d})});aC.displayName=rC;var dg="PopoverPortal",[kz,jz]=eC(dg,{forceMount:void 0}),sC=e=>{const{__scopePopover:t,forceMount:r,children:s,container:o}=e,l=Ja(dg,t);return y.jsx(kz,{scope:t,forceMount:r,children:y.jsx(or,{present:r||l.open,children:y.jsx(Ll,{asChild:!0,container:o,children:s})})})};sC.displayName=dg;var Fi="PopoverContent",iC=v.forwardRef((e,t)=>{const r=jz(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(Mz,{...o,ref:t}):y.jsx(Dz,{...o,ref:t})})});iC.displayName=Fi;var Oz=_z("PopoverContent.RemoveScroll"),Mz=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 bd(u)},[]),y.jsx(zl,{as:Oz,allowPinchZoom:!0,children:y.jsx(oC,{...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})})})}),Dz=v.forwardRef((e,t)=>{const r=Ja(Fi,e.__scopePopover),s=v.useRef(!1),o=v.useRef(!1);return y.jsx(oC,{...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()}})}),oC=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),_=Bl(r);return hd(),y.jsx(Ml,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:y.jsx(Ol,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:b,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onDismiss:()=>w.onOpenChange(!1),children:y.jsx(Ip,{"data-state":cC(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)"}})})})}),lC="PopoverClose",Lz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Ja(lC,r);return y.jsx(je.button,{type:"button",...s,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});Lz.displayName=lC;var Pz="PopoverArrow",zz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Bl(r);return y.jsx($p,{...o,...s,ref:t})});zz.displayName=Pz;function cC(e){return e?"open":"closed"}var Uz=tC,Iz=aC,$z=sC,uC=iC;const dC=Uz,fC=Iz,fg=v.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},o)=>y.jsx($z,{children:y.jsx(uC,{ref:o,align:t,sideOffset:r,className:Ee("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})}));fg.displayName=uC.displayName;function Bz(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(dC,{open:f,onOpenChange:m,children:[y.jsx(fC,{asChild:!0,children:y.jsxs(ut,{type:"button",variant:"outline",role:"combobox","aria-expanded":f,disabled:u,className:Ee("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(fg,{align:"start",className:"w-[min(92vw,560px)] min-w-[var(--radix-popover-trigger-width)] p-0",children:y.jsxs(ig,{children:[y.jsx(og,{placeholder:o}),y.jsxs(lg,{className:"overscroll-contain",onWheel:Bz,children:[y.jsx(cg,{children:l}),y.jsxs(ug,{children:[d&&y.jsxs(y.Fragment,{children:[y.jsxs(rd,{value:`__clear_${d}`,onSelect:()=>{r(""),m(!1)},children:[y.jsx(Rs,{className:Ee("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(Z1,{className:"my-1"})]}),t.map(g=>y.jsxs(rd,{value:g,onSelect:()=>{r(g),m(!1)},children:[y.jsx(Rs,{className:Ee("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 Hz=new RegExp("[\\u0000-\\u001F\\u007F-\\u009F\\u200B-\\u200D\\uFEFF]","g");function hC(e){return String(e||"").replace(Hz,"").replace(/\s+/g," ").trim()}function it(e){return hC(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function Ft(e){const t=hC(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 Ww(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 qz(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function Xw(e){return pt(e.map(t=>Ft(t)).filter(Boolean))}function Jw({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(()=>Xw(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(Xw(C))},S=C=>{const A=Ft(C),N=it(A);if(g.has(N)){E(b.filter(P=>it(P)!==N));return}E([...b,A])},T=C=>{const A=it(C);E(b.filter(N=>it(N)!==A))};return y.jsxs("div",{className:"space-y-2",children:[y.jsxs(dC,{open:f,onOpenChange:m,children:[y.jsx(fC,{asChild:!0,children:y.jsxs(ut,{type:"button",variant:"outline",role:"combobox","aria-expanded":f,disabled:u,className:Ee("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(fg,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:y.jsxs(ig,{children:[y.jsx(og,{placeholder:o}),y.jsxs(lg,{className:"overscroll-contain",onWheel:qz,children:[y.jsx(cg,{children:l}),y.jsx(ug,{children:w.map(C=>{const A=g.has(it(C));return y.jsxs(rd,{value:C,onSelect:()=>S(C),children:[y.jsx(Rs,{className:Ee("mr-2 h-4 w-4",A?"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:()=>T(C),className:"rounded-full text-muted-foreground transition-colors hover:text-foreground","aria-label":`Quitar ${C}`,children:y.jsx(bl,{className:"h-3 w-3"})})]},C))})]})}const xm=[{id:"grafico",label:"Tarifario Gráfico CDC"},{id:"estrategia",label:"Estrategia y Creatividad"}],Vz="design_final_art",Gz="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:Vz,label:"Diseño + Entregable Arte Final",shortLabel:"Diseño + AF",hourReference:e,levels:r}];return s!=null&&s.length&&o.push({id:Gz,label:"Adaptación Arte Final",shortLabel:"Adaptación AF",hourReference:t,levels:s}),o}const ol=[{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 Qw(e){return e?e.reference:""}function vu(e){return e&&typeof e.min=="number"&&typeof e.max=="number"?String((e.min===e.max,e.min)):""}const mC="tablero_cdc_tariff_catalog",ap="Referencia",pC="Precio único";let Ia={rows:sp(ol),catalog:ol,source:"fallback",loading:!1,error:null},Ou=!1,Mu=[],_m=0;function Sm(){Mu.forEach(e=>e())}function Zw(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 ll(e){return String(e||"").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function gC(e,t,r){return[e,t,r].map(ll).filter(Boolean).join("__")}function Fz(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||ll(`${t}-${r}-${s}`)).trim(),l=String(e.work_type_label||ap).trim(),u=String(e.level_label||pC).trim(),d=String(e.work_type_id||ll(l)||gn).trim(),f=String(e.level_id||ll(u)||"project").trim();return{id:String(e.id||gC(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:Zw(e.reference_min),reference_max:Zw(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 Kz(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||ll(`${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||ap,shortLabel:o.work_type_short_label||o.work_type_label||ap,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||pC,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 sp(e){const t=[];return e.forEach((r,s)=>{r.workTypes.forEach((o,l)=>{o.levels.forEach((u,d)=>{t.push({id:gC(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 Yz(e){const t=e instanceof Error?e.message:String(e||"");return t.includes(mC)||t.includes("Could not find the table")||t.includes("relation")||t.includes("does not exist")}async function ex(e=!1){if(Ou&&!e)return Ia;const t=_m+=1;Ia={...Ia,loading:!0,error:null},Sm();try{const{data:r,error:s}=await Pe.from(mC).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=>Fz(m)),l=sp(ol),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=Kz(d);t===_m&&(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."},Ou=!0,Sm())}catch(r){const s=r instanceof Error?r.message:String(r||""),o=Yz(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===_m&&(Ia={rows:sp(ol),catalog:ol,source:"fallback",loading:!1,error:o},Ou=!0,Sm())}return Ia}function Wz(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return Mu.push(t),!Ou&&!Ia.loading&&ex(),()=>{Mu=Mu.filter(r=>r!==t)}},[]),{...Ia,refresh:()=>ex(!0)}}function bu(e){const t=Number(e.replace(/,/g,"").trim());return Number.isFinite(t)?t:0}function Em(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function Xz(e){return(e==null?void 0:e.workTypes[0])||null}function tx(e){return(e==null?void 0:e.levels[0])||null}function Cm(e){return e.trim()}function Jz({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(""),[T,C]=v.useState(""),[A,N]=v.useState(""),[P,F]=v.useState(""),{catalog:$,loading:L,error:q}=Wz(),ie=xm.map(z=>z.label),he=((Z=xm.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=xm.find(ae=>ae.label===z);l((ee==null?void 0:ee.id)||"grafico"),M()},J=z=>{d(z);const ee=$.find(Ce=>Ce.section===o&&`${Ce.category} · ${Ce.service}`===z),ae=Xz(ee),xe=tx(ae);m((ae==null?void 0:ae.id)||""),g((xe==null?void 0:xe.id)||""),_(vu(xe)),S("")},ne=z=>{if(!oe)return;const ee=oe.workTypes.find(xe=>xe.label===z),ae=tx(ee);m((ee==null?void 0:ee.id)||""),g((ae==null?void 0:ae.id)||""),_(vu(ae))},X=z=>{if(!ue)return;const ee=ue.levels.find(ae=>ae.label===z);g((ee==null?void 0:ee.id)||""),_(vu(ee))},k=()=>{if(!oe||!ue||!ce)return;const z=bu(w);z<=0||(t([...e,{source:"tariff",category:oe.category,serviceName:oe.service,workType:ue.label,complexityLevel:ce.label,referenceLabel:Qw(ce),referenceMin:ce.min??null,referenceMax:ce.max??null,amount:z,description:Cm(E)}]),S(""),_(vu(ce)))},j=()=>{const z=bu(P),ee=Cm(T)||"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:Cm(A)}]),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(J2,{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: ",Em(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(RM,{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:"})," ",Qw(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(td,{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||bu(w)<=0,className:"gap-1.5 rounded-full",children:[y.jsx(vl,{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:T,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(td,{value:A,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:bu(P)<=0,className:"w-full gap-1.5 rounded-full sm:w-auto sm:min-w-[240px]",children:[y.jsx(vl,{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:Em(Number(z.amount||0))}),y.jsxs(ut,{type:"button",variant:"ghost",size:"sm",onClick:()=>I(ee),className:Ee("h-8 rounded-full px-2 text-muted-foreground hover:text-destructive"),children:[y.jsx(T_,{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(Rp,{className:"h-4 w-4"}),y.jsxs("span",{className:"text-sm font-semibold",children:["Total interno estimado: ",Em(fe)]})]})]})]})]})}const $i={clientes:RP,marcas:NP,bus:AP,buCm:Xp,status:[...kP]};let Du=[],ip=$i,Sl=!1,yC=!1,hg=null,cl=null,Ss=null,wu=0;function op(){Du.forEach(e=>e())}function Pa(e){return pt(e)}function Qz(e){return String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function Zz(e){const t=Qz(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 eU(e){return Ft(String(e.label||e.value||""))}function tU(e){const t=[],r=[],s=[],o=[],l={...Xp};for(const u of e){if(u.is_active===!1)continue;const d=Zz(u.category),f=eU(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 nU(e){hg=e,op()}async function lp(){Sl=!0,nU(null),op();try{const{data:e,error:t}=await Pe.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;ip=tU(e||[]),yC=!0}catch(e){console.error("Error cargando listas desde Supabase:",e),hg=e instanceof Error?e.message:"No se pudieron cargar los desplegables desde Supabase.",ip=$i}finally{Sl=!1,op()}}function rU(){Ss&&clearTimeout(Ss),Ss=setTimeout(()=>{Ss=null,Sl||lp()},350)}function aU(){cl||(cl=Pe.channel("tablero-cdc-app-lists").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_lists"},()=>rU()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a tablero_cdc_app_lists:",e)}))}function sU(){Ss&&(clearTimeout(Ss),Ss=null),cl&&(Pe.removeChannel(cl),cl=null)}function vC(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return Du.push(t),wu+=1,aU(),!yC&&!Sl&&lp(),()=>{Du=Du.filter(r=>r!==t),wu=Math.max(0,wu-1),wu===0&&sU()}},[]),{lists:ip,loading:Sl,error:hg,refresh:lp}}const bC="blue",jd="Activo",Jr={tab:"todos",search:"",page:1,pageSize:24,country:"",brand:"",client:"",cm:""};let Lu=[],aa=[],ad=0,wC={countries:[],brands:[],clients:[],cms:[]},El=!1,xC=!1,mg=null,ul=null,Es=null,xu=0,vn={...Jr},Tr=0,_u=0;function Cl(){Lu.forEach(e=>e())}function sd(e,t=""){return typeof e=="string"?e:t}function iU(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function oU(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 lU(e,t){return sd(e.legacy_month,"")||sd(e.mes,"")||t.toLocaleString("es-DO",{month:"long"})}function cU(e,t){return oU(e.legacy_year,iU(e.anio,t.getFullYear()))}function uU(e){return!e||e===jd?"":e}function dU(e){return e&&e.trim()?e:jd}function _C(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 SC(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:sd(t.color,bC),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:uU(e.status),monto:e.internal_amount==null?null:Number(e.internal_amount),mes:lU(t,u),anio:cU(t,u),createdAt:Number.isFinite(l)?l:Date.now(),extraData:t}}function fU(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 hU(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 EC(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 nx(e){return e&&e.trim()?e:jd}function Su(e,t,r){return`${e} ${e===1?t:r}`}function rx(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=rx(r),u=rx(s);if(l!==u){if(o!=null&&o.privateValue){e.push(`${t} actualizado.`);return}e.push(`${t}: ${l||"—"} → ${u||"—"}`)}}function mU(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",nx(e.status),nx(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: ${Su(e.propuestaLinks.length,"link","links")} → ${Su(t.propuestaLinks.length,"link","links")}.`),e.afLinks.join("|")!==t.afLinks.join("|")&&s.push(`Links de artes finales: ${Su(e.afLinks.length,"link","links")} → ${Su(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 pg(){const{data:e,error:t}=await Pe.auth.getUser();if(t||!e.user)throw new Error("No hay una sesión activa de Supabase.");return e.user}async function CC(){return(await pg()).id}async function pU(){return(await xp()).role==="director_creativo"}async function TC(){return(await xp()).canManageInternalPricing}async function gU(){return(await xp()).canDeleteProjects}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:dU(e.status),internal_amount:e.monto??null,brief_link:e.briefLink,extra_data:{...t,color:e.color??sd(t.color,bC),mes:e.mes,anio:e.anio}}}function yU(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 AC(e){aa=e,Cl()}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 vU(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){mg=e,Cl()}function NC(e){aa.some(r=>r.id===e.id)&&AC(aa.map(r=>r.id===e.id?e:r))}function bU(e){aa.some(t=>t.id===e)&&(AC(aa.filter(t=>t.id!==e)),ad=Math.max(0,ad-1),Cl())}function wU(){return"https://agenteit.digitalcompass.agency/webhook/tablero-cdc-sync-proyecto".trim()||""}async function Od(e,t){const r=wU();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 ax(){Es&&clearTimeout(Es),Es=setTimeout(()=>{Es=null,!El&&Tr===0&&Ts(vn)},350)}function xU(){ul||(ul=Pe.channel("tablero-cdc-projects").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_projects"},()=>ax()).on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_project_links"},()=>ax()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a proyectos:",e)}))}function _U(){Es&&(clearTimeout(Es),Es=null),ul&&(Pe.removeChannel(ul),ul=null)}async function kC(e,t){const r=yU(e,t);try{const{error:l}=await Pe.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(!NU(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 Pe.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw s;if(r.length===0)return;const{error:o}=await Pe.from("tablero_cdc_project_links").insert(r);if(o)throw o}async function jC(e,t){if(!Array.isArray(t))return;const{error:r}=await Pe.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 Pe.from("tablero_cdc_project_pricing_items").insert(s);if(o)throw o}async function SU(e){const{data:t,error:r}=await Pe.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(hU)}async function sx(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 Pe.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(fU)}function EU(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 CU(e,t,r,s,o,l){const{data:u,error:d}=await Pe.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=EU(t,r,s,l),b=f?`${f}
|
||
|
||
${m}`:m,{error:g}=await Pe.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&&NC({...w,comentarios:b}),b}async function TU(e,t){const r=t.trim();if(!r)throw new Error("Escribe una nota antes de agregarla al historial.");const s=await pg(),o=EC(s),l=s.email||"",u=new Date,{error:d}=await Pe.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 CU(e,r,o,l,s.id,u),m=await Od(e,"update");return{comments:f,...m}}async function OC(e,t,r,s="",o=!1){try{const l=await pg(),u=EC(l),{error:d}=await Pe.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 RU(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 gg(e){return e instanceof Error?e.message:e&&typeof e=="object"&&"message"in e?String(e.message||""):String(e||"")}function AU(e){const t=gg(e);return t.includes("tablero_cdc_get_projects_paginated")||t.includes("Could not find the function")}function NU(e){const t=gg(e);return t.includes("tablero_cdc_replace_project_links")||t.includes("Could not find the function")}function kU(e){const t=gg(e);return t.includes("tablero_cdc_get_pricing_summary")||t.includes("Could not find the function")}function Zo(e){return e.replace(/[%_]/g,"\\$&").replace(/,/g," ")}function MC(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",jd));const s=t.search.trim();if(s){const l=`%${Zo(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=`%${Zo(t.country)}%`;r=r.or(`country.ilike.${o}`)}if(t.brand){const o=`%${Zo(t.brand)}%`;r=r.or(`brand.ilike.${o}`)}if(t.client){const o=`%${Zo(t.client)}%`;r=r.or(`client.ilike.${o}`)}if(t.cm){const o=`%${Zo(t.cm)}%`;r=r.or(`country_manager.ilike.${o}`)}return r}async function jU(e,t){const r=(e.page-1)*e.pageSize,s=r+e.pageSize-1;let o=Pe.from("tablero_cdc_projects").select(RU(t),{count:"exact"}).order("created_at",{ascending:!1});o=MC(o,e);const{data:l,error:u,count:d}=await o.range(r,s);if(u)throw u;const f=(l||[]).map(m=>SC(m));return{projects:f,totalProjects:d??0,filterOptions:vU(f)}}async function OU(e){var l,u,d,f;const{data:t,error:r}=await Pe.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=>SC(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 Ts(e){const t=_C(e),r=_u+=1;vn=t,El=!0,nr(null),Cl();try{const s=await TC();let o;try{o=await OU(t)}catch(l){if(!AU(l))throw l;console.warn("RPC tablero_cdc_get_projects_paginated no existe todavía. Usando consulta directa como respaldo temporal.",l),o=await jU(t,s)}if(r!==_u)return;ad=o.totalProjects,aa=o.projects,wC=o.filterOptions,xC=!0}catch(s){if(r!==_u)return;console.error("Error cargando proyectos desde Supabase:",s),mg=s instanceof Error?s.message:"No se pudieron cargar los proyectos desde Supabase."}finally{r===_u&&(El=!1,Cl())}}async function MU(e){nr(null),Tr+=1;try{const t=await CC(),r={...RC(e),created_by:t,updated_by:t},{data:s,error:o}=await Pe.from("tablero_cdc_projects").insert(r).select("id").single();if(o)throw nr(o.message),o;await kC(s.id,e),await jC(s.id,e.pricingItems),await OC(s.id,"created","Proyecto creado",`${e.nombre||"Proyecto sin título"} quedó registrado en el tablero.`);const l=await Od(s.id,"create");return await Ts(vn),{projectId:s.id,...l}}finally{Tr=Math.max(0,Tr-1)}}async function DU(e,t){nr(null),Tr+=1;try{const r=await CC(),s=await pU(),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 Pe.from("tablero_cdc_projects").update(f).eq("id",e);if(m)throw nr(m.message),m;NC(u),await kC(e,u),o&&await jC(e,t.pricingItems);const b=mU(l,u,o);b.length>0&&await OC(e,"updated","Proyecto actualizado",b.slice(0,8).join(`
|
||
`));const g=await Od(e,"update");return await Ts(vn),{projectId:e,...g}}finally{Tr=Math.max(0,Tr-1)}}async function LU(e){nr(null),Tr+=1;try{if(!await gU()){const l="No tienes permiso para eliminar proyectos.";throw nr(l),new Error(l)}const r=await Od(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 Pe.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw nr(s.message),s;const{error:o}=await Pe.from("tablero_cdc_projects").delete().eq("id",e);if(o)throw nr(o.message),o;bU(e),await Ts(vn)}finally{Tr=Math.max(0,Tr-1)}}async function PU(e){const{data:t,error:r}=await Pe.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 zU(e){let r=0,s=null,o=0;for(;s===null||r<s;){let l=Pe.from("tablero_cdc_projects").select("id, internal_amount",{count:"exact"}).order("created_at",{ascending:!1});l=MC(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 ix(e){const t=_C({...e,page:1,pageSize:1e3});try{return await PU(t)}catch(r){if(!kU(r))throw r;return console.warn("RPC tablero_cdc_get_pricing_summary no existe todavía. Usando suma directa como respaldo temporal.",r),zU(t)}}function UU(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),ix({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:()=>ix(e).then(E=>(s(E),E))}}function DC(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 Lu.push(b),xu+=1,xU(),()=>{Lu=Lu.filter(g=>g!==b),xu=Math.max(0,xu-1),xu===0&&_U()}},[]),v.useEffect(()=>{if(r&&o&&l){Ts({tab:r,search:s??"",page:o,pageSize:l,country:u??"",brand:d??"",client:f??"",cm:m??""});return}!xC&&!El&&Ts()},[r,s,o,l,u,d,f,m]),{projects:aa,totalProjects:ad,filterOptions:wC,loading:El,error:mg,refresh:()=>Ts(e??vn),add:MU,update:DU,remove:LU}}function IU(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 $U=e=>{switch(e){case"success":return qU;case"info":return GU;case"warning":return VU;case"error":return FU;default:return null}},BU=Array(12).fill(0),HU=({visible:e,className:t})=>le.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},le.createElement("div",{className:"sonner-spinner"},BU.map((r,s)=>le.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),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:"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"})),VU=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"})),GU=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"})),FU=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"})),KU=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"})),YU=()=>{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 cp=1;class WU{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:cp++,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(JU(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)||cp++;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 WU,XU=(e,t)=>{const r=(t==null?void 0:t.id)||cp++;return yn.addToast({title:e,...t,id:r}),r},JU=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",QU=XU,ZU=()=>yn.toasts,eI=()=>yn.getActiveToasts(),br=Object.assign(QU,{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:ZU,getToasts:eI});IU("[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 Eu(e){return e.label!==void 0}const tI=3,nI="24px",rI="16px",ox=4e3,aI=356,sI=14,iI=45,oI=200;function wr(...e){return e.filter(Boolean).join(" ")}function lI(e){const[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}const cI=e=>{var t,r,s,o,l,u,d,f,m;const{invert:b,toast:g,unstyled:w,interacting:_,setHeights:E,visibleToasts:S,heights:T,index:C,toasts:A,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),[Ce,Re]=le.useState(!1),[nt,He]=le.useState(0),[Kt,Yt]=le.useState(0),Ot=le.useRef(g.duration||oe||ox),wn=le.useRef(null),yt=le.useRef(null),cr=C===0,ze=C+1<=S,ot=g.type,rt=g.dismissible!==!1,ht=g.className||"",to=g.descriptionClassName||"",Nr=le.useMemo(()=>T.findIndex(ke=>ke.toastId===g.id)||0,[T,g.id]),ur=le.useMemo(()=>{var ke;return(ke=g.closeButton)!=null?ke:$},[g.closeButton,$]),dr=le.useMemo(()=>g.duration||oe||ox,[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(()=>T.reduce((ke,dt,Dt)=>Dt>=Nr?ke:ke+dt.height,0),[T,Nr]),Mt=YU(),no=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 Te=le.useCallback(()=>{Z(!0),He(Fn.current),E(ke=>ke.filter(dt=>dt.toastId!==g.id)),setTimeout(()=>{P(g)},oI)},[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),Te()},Ot.current))})(),()=>clearTimeout(ke)},[N,_,g,ot,Mt,Te]),le.useEffect(()=>{g.delete&&(Te(),g.onDismiss==null||g.onDismiss.call(g,g))},[Te,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(HU,{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])||$U(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":Ce,"data-removed":V,"data-visible":ze,"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":no,"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":A.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,He(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)>=iI||Za>.11){He(Fn.current),g.onDismiss==null||g.onDismiss.call(g,g),j(ne==="x"?Xt>0?"right":"left":ua>0?"down":"up"),Te(),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")}Re(!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:lI(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)&&Re(!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?()=>{}:()=>{Te(),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:KU):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,to,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&&Eu(g.cancel)?le.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||q,onClick:ke=>{Eu(g.cancel)&&rt&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,ke),Te())},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&&Eu(g.action)?le.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||ie,onClick:ke=>{Eu(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,ke),!ke.defaultPrevented&&Te())},className:wr(M==null?void 0:M.actionButton,g==null||(m=g.classNames)==null?void 0:m.actionButton)},g.action.label):null)};function lx(){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 uI(e,t){const r={};return[e,t].forEach((s,o)=>{const l=o===1,u=l?"--mobile-offset":"--offset",d=l?rI:nI;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 dI=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:T=tI,toastOptions:C,dir:A=lx(),gap:N=sI,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(()=>{Dx.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:A==="auto"?lx():A,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":`${aI}px`,"--gap":`${N}px`,...S,...uI(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,Ce;return le.createElement(cI,{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:T,closeButton:(Ce=C==null?void 0:C.closeButton)!=null?Ce: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(Re=>Re.position==ee.position),heights:he.filter(Re=>Re.position==ee.position),setHeights:pe,expandByDefault:d,gap:N,expanded:oe,swipeDirections:t.swipeDirections})})):null}))}),fI="Walmart Connect WMC",ki=15;function hI(e){return new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function mI(e){return e.split(`
|
||
`).map(t=>t.trim()).filter(Boolean)}function LC(e){return e.reduce((t,r)=>t+Number(r.amount||0),0)}function pI(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 gI(e,t){if(!t.length||e==null)return!1;const r=Number(e);if(!Number.isFinite(r)||r<=0)return!1;const s=LC(t);return Math.abs(r-s)>.01}function yI(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 vI(e){return pt(e.map(t=>Ft(t)).filter(Boolean)).join(", ")}function bI(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 wI(e){return pt(e.map(t=>Ft(t)).filter(Boolean)).join(", ")}function Cu(e){return it(e)===it(fI)}const cx=()=>{const e=new Date;return{nombre:"",color:"blue",cliente:"",bu:"",cm:"",marca:"",solicitante:"",comentarios:"",briefLink:"",propuestaLinks:[],afLinks:[],status:"",monto:null,mes:jP[e.getMonth()],anio:e.getFullYear()}};function xI({open:e,onOpenChange:t,project:r,onDelete:s,deleting:o=!1}){const{add:l,update:u}=DC(),{lists:d,loading:f,error:m,refresh:b}=vC(),{isGerardo:g,canDeleteProjects:w,canManageInternalPricing:_}=jl(),E=!!r,[S,T]=v.useState(cx()),[C,A]=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),[Ce,Re]=v.useState(!1),nt=yI(S.marca,d.marcas),He=bI(S.bu,d.bus),Kt=pt(Ww(d.clientes,S.cliente)),Yt=pt([...d.marcas,...nt]),Ot=pt([...d.bus,...He]),wn=pt(Ww(d.status,S.status)),yt=Ot.filter(se=>it(se).includes(it(F))),cr=LC(V);v.useEffect(()=>{if(he(null),q(null),r){const{id:se,createdAt:Te,...Ge}=r,Ye=Ft(Ge.bu);T({...Ge,bu:Ye}),A(Ye?[Ye]:[]),$(""),oe([]),X(!1),M(null),J(""),Z([]),xe(null),Re(!1)}else e&&(T(cx()),A([]),$(""),oe([]),X(!1),M(null),J(""),Z([]),xe(null),Re(!1))},[r,e]);const ze=v.useCallback(async()=>{if(r!=null&&r.id)try{ce(!0),M(null);const se=await sx(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 sx(r.id,ki+1,pe.length);oe(Te=>[...Te,...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)||ze()},[e,r==null?void 0:r.id,ze]),v.useEffect(()=>{if(!e||!(r!=null&&r.id)||!_)return;let se=!1;return(async()=>{try{ee(!0),xe(null);const Ge=await SU(r.id),Ye=pI(Ge);se||(Re(gI(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,Te)=>T(Ge=>({...Ge,[se]:Te}));v.useEffect(()=>{if(!_||!V.length||Ce)return;const se=Number(cr.toFixed(2));T(Te=>Te.monto===se?Te:{...Te,monto:se})},[_,Ce,V.length,cr]);const ht=se=>{const Te=d.buCm[se];if(Te)return Te;const Ge=it(se),Ye=Object.entries(d.buCm).find(([Wt])=>it(Wt)===Ge);return(Ye==null?void 0:Ye[1])??""},to=se=>{const Te=pt(se.map(Ye=>Ft(Ye)).filter(Boolean)),Ge=pt(Te.map(ht).filter(Boolean));T(Ye=>({...Ye,bu:wI(Te),cm:Ge.join(", ")}))},Nr=se=>{const Te=Ft(se);T(Ge=>({...Ge,cliente:Te,...Cu(Te)&&!E?{bu:"",cm:""}:Ge.cliente&&Cu(Ge.cliente)?{bu:"",cm:""}:{}})),Cu(Te)||(A([]),$(""))},ur=!E&&Cu(S.cliente),dr=ur?C:He,kr=!E&&dr.length>1,Fn=(se,Te)=>{const Ge=Ft(se);A(Ye=>Te?pt([...Ye,Ge]):Ye.filter(Wt=>it(Wt)!==it(Ge)))},Qa=C.map(se=>({country:se,manager:ht(se)})),Kn=He.map(se=>({country:se,manager:ht(se)})),fr=S.nombre.trim()&&S.cliente&&S.marca&&S.solicitante.trim()&&(ur?C.length>0:He.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 TU(r.id,K);rt("comentarios",se.comments),J(""),await ze(),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 Te=se instanceof Error?se.message:"No se pudo agregar el comentario al historial.";br.error("No se pudo agregar el comentario",{description:Te})}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 Te=dr,Ge=[];for(const[Wt,nn]of Te.entries()){q(`Guardando país ${Wt+1} de ${Te.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 ${Te.length} proyectos y ${Te.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 ${Te.length} sincronizaciones con Google Sheet requieren revisión.`})}else{const Te=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(Te)}t(!1)}catch(Te){console.error("Error guardando proyecto:",Te);const Ge=Te instanceof Error?Te.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)}},no=!!S.status;return y.jsx(XP,{open:e,onOpenChange:t,children:y.jsxs(BE,{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:wE(S.color)}}),y.jsxs("div",{className:"px-7 pt-6 pb-7",children:[y.jsx(HE,{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(VE,{className:"text-2xl tracking-tight",children:E?S.nombre||"Sin título":"Nuevo proyecto"}),y.jsxs(GE,{className:"mt-1 flex items-center gap-2 text-xs",children:[y.jsx(Z2,{className:"w-3.5 h-3.5"}),S.mes," · ",S.anio,no&&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(J4,{value:S.color,onChange:se=>rt("color",se)})]}),y.jsx(Ii,{className:"md:col-span-2 my-1"}),(f||m)&&y.jsxs("div",{className:Ee("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(Fu,{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(Jw,{values:nt,options:Yt,onValuesChange:se=>rt("marca",vI(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(Ku,{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 Te=C.some(Ye=>it(Ye)===it(se)),Ge=ht(se);return y.jsxs("label",{className:Ee("flex cursor-pointer items-start gap-2 rounded-lg border bg-card px-3 py-2 text-sm transition-colors",Te?"border-primary/50 bg-primary/10":"border-border hover:bg-muted/40"),children:[y.jsx(n1,{checked:Te,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(Jw,{values:He,options:Ot,onValuesChange:to,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:Ee("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:Te})=>y.jsxs(Cs,{variant:"secondary",className:"font-normal",children:[se,": ",Te||"—"]},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:Te})=>y.jsxs(Cs,{variant:"secondary",className:"font-normal",children:[se,": ",Te||"—"]},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(_I,{isEdit:E,items:pe,loading:ue,error:fe,note:K,hasMore:ne,loadingMore:k,addingNote:I,onNoteChange:J,onAddNote:xn,onRefresh:ze,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(Gw,{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(Gw,{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(Jz,{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(PM,{className:"w-3 h-3 text-muted-foreground"})]}),g?y.jsxs(H4,{value:S.status||"_none",onValueChange:se=>rt("status",se==="_none"?"":se),children:[y.jsx(I1,{className:"h-10",children:y.jsx(q4,{placeholder:"Sin estatus"})}),y.jsxs(H1,{children:[y.jsx(tp,{value:"_none",children:"Sin estatus"}),wn.map(se=>y.jsx(tp,{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(Rp,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),y.jsx(jn,{type:"number",value:S.monto??"",onChange:se=>{Re(!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.",Ce&&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:Ee("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(Fu,{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(qE,{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(T_,{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 _I({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(CM,{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(td,{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(HM,{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(Fu,{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 _=mI(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(mM,{className:"h-3.5 w-3.5"}),hI(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 PC="pricing_summary_public";function zC(e){var t;return!!((t=e==null?void 0:e.value)!=null&&t.enabled)}async function SI(){const{data:e,error:t}=await Pe.from("tablero_cdc_app_settings").select("key, value").eq("key",PC).maybeSingle();if(t)throw t;return zC(e)}async function EI(e){const{error:t}=await Pe.rpc("tablero_cdc_set_pricing_summary_public",{p_enabled:e});if(t)throw t}function CI(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 SI();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 EI(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=Pe.channel("tablero-cdc-pricing-summary-visibility").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_settings",filter:`key=eq.${PC}`},w=>{const _=w.new||w.old;r(zC(_))}).subscribe();return()=>{Pe.removeChannel(g)}},[e]),{isPublic:t,loading:s,saving:l,error:d,refresh:m,setPublicVisibility:b}}const ji=24,ux={country:"",brand:"",client:"",cm:""};function TI(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 RI(){const[e,t]=v.useState(!1),[r,s]=v.useState(null),[o,l]=v.useState(""),[u,d]=v.useState("todos"),[f,m]=v.useState(ux),[b,g]=v.useState({todos:1,abiertos:1,cerrados:1}),[w,_]=v.useState(null),E=b[u],{lists:S}=vC(),{projects:T,totalProjects:C,filterOptions:A,loading:N,error:P,refresh:F,remove:$}=DC({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}=jl(),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}=CI(!!L),K=ie||oe,{summary:J,loading:ne,error:X}=UU(pe,K),k=Object.values(S.buCm),j=pt([...S.bus,...A.countries,f.country]),I=pt([...S.marcas,...A.brands,f.brand]),Y=pt([...S.clientes,...A.clients,f.client]),V=pt([...k,...A.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,Ce=Math.min(ae+ji,C);v.useEffect(()=>{g(ze=>({...ze,[u]:1}))},[o,u,f.country,f.brand,f.client,f.cm]),v.useEffect(()=>{E>z&&g(ze=>({...ze,[u]:z}))},[E,u,z]);const Re=ze=>{const ot=Math.min(Math.max(ze,1),z);ot!==E&&(g(rt=>({...rt,[u]:ot})),window.scrollTo({top:0,behavior:"smooth"}))},nt=(ze,ot)=>{m(rt=>({...rt,[ze]:ot}))},He=()=>{m(ux)},Kt=()=>{s(null),t(!0)},Yt=ze=>{s(ze),t(!0)},Ot=async ze=>{if(window.confirm(`¿Seguro que deseas eliminar el proyecto "${ze.nombre||"Sin título"}"?
|
||
|
||
Esta acción eliminará el proyecto del tablero y del Google Sheet.`)){_(ze.id);try{await $(ze.id),(r==null?void 0:r.id)===ze.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=TI(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-4",children:[y.jsx(Cp,{size:"sm"}),y.jsx("div",{className:"h-7 w-px bg-border"}),y.jsx("h1",{className:"text-[15px] font-semibold tracking-tight text-[#4F758B]",children:"Tablero CDC"})]}),y.jsxs("div",{className:"flex-1 max-w-md ml-4 relative hidden md:block",children:[y.jsx(Ku,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),y.jsx(jn,{value:o,onChange:ze=>l(ze.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(lP,{children:[y.jsx(cP,{asChild:!0,children:y.jsxs(ut,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2.5",children:[y.jsxs(yE,{className:"w-7 h-7",children:[(L==null?void 0:L.photoURL)&&y.jsx(vE,{src:L.photoURL,alt:wn,referrerPolicy:"no-referrer"}),y.jsx(bE,{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(Tp,{className:"w-3.5 h-3.5 text-muted-foreground"})]})}),y.jsxs(sE,{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(oE,{}),y.jsxs(iE,{onClick:he,className:"gap-2 text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer",children:[y.jsx(UM,{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(vl,{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(([ze,ot])=>y.jsx("button",{onClick:()=>d(ze),className:`px-3.5 py-1.5 rounded-full transition-colors font-medium ${u===ze?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:ot},ze))})})]}),y.jsxs("div",{className:"relative md:hidden",children:[y.jsx(Ku,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),y.jsx(jn,{value:o,onChange:ze=>l(ze.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(kI,{filters:f,activeCount:Z,countryOptions:j,brandOptions:I,clientOptions:Y,cmOptions:V,onFilterChange:nt,onClear:He}),K&&y.jsx(NI,{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(Fu,{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(GM,{className:"h-3.5 w-3.5"})," Reintentar"]})]}),N&&T.length===0?y.jsx(MI,{}):T.length===0?y.jsx(DI,{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:T.map(ze=>y.jsx(OP,{project:ze,onClick:()=>Yt(ze)},ze.id))}),C>ji&&y.jsx(jI,{currentPage:ee,totalPages:z,visibleStart:xe,visibleEnd:Ce,totalItems:C,onPageChange:Re})]}),y.jsx(xI,{open:e,onOpenChange:t,project:r,onDelete:Ot,deleting:!!r&&w===r.id})]})}function AI(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function NI({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(Rp,{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…":AI(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(bM,{className:"h-3.5 w-3.5"}):y.jsx(xM,{className:"h-3.5 w-3.5"}),d?"Actualizando…":u?"Ocultar a todos":"Mostrar a todos"]})]})]})})}function kI({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(YM,{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(bl,{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(bl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]})})}function jI({currentPage:e,totalPages:t,visibleStart:r,visibleEnd:s,totalItems:o,onPageChange:l}){const u=OI(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(rM,{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(E_,{className:"h-4 w-4"})]})]})]})}function OI(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 MI(){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 DI({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(NM,{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(vl,{className:"w-4 h-4"})," Crear proyecto"]})]})}const LI=({...e})=>y.jsx(dI,{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 PI 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 zI(){const{user:e,loading:t}=jl();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:"animate-pulse",children:y.jsx(Cp,{showWordmark:!1})}),y.jsx("p",{className:"text-sm text-muted-foreground",children:"Cargando tablero…"})]})}):e?y.jsx(rN,{children:y.jsx(Nx,{path:"/*",element:y.jsx(RI,{})})}):y.jsx(V2,{})}function UI(){return y.jsx(PI,{children:y.jsx(qO,{children:y.jsxs(RN,{basename:"/tablero-cdc/",children:[y.jsx(zI,{}),y.jsx(LI,{richColors:!0,position:"top-right"})]})})})}aA.createRoot(document.getElementById("root")).render(y.jsx(v.StrictMode,{children:y.jsx(UI,{})}));
|