399 lines
766 KiB
JavaScript
399 lines
766 KiB
JavaScript
function fA(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 bx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yh={exports:{}},Yo={};/**
|
||
* @license React
|
||
* react-jsx-runtime.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var p0;function hA(){if(p0)return Yo;p0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:s,key:u,ref:o!==void 0?o:null,props:l}}return Yo.Fragment=t,Yo.jsx=r,Yo.jsxs=r,Yo}var g0;function mA(){return g0||(g0=1,Yh.exports=hA()),Yh.exports}var y=mA(),Wh={exports:{}},Me={};/**
|
||
* @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 y0;function pA(){if(y0)return Me;y0=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 Me.Activity=g,Me.Children=X,Me.Component=C,Me.Fragment=r,Me.Profiler=o,Me.PureComponent=N,Me.StrictMode=s,Me.Suspense=f,Me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Me.__COMPILER_RUNTIME={__proto__:null,c:function(k){return L.H.useMemoCache(k)}},Me.cache=function(k){return function(){return k.apply(null,arguments)}},Me.cacheSignal=function(){return null},Me.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)},Me.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},Me.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)},Me.createRef=function(){return{current:null}},Me.forwardRef=function(k){return{$$typeof:d,render:k}},Me.isValidElement=pe,Me.lazy=function(k){return{$$typeof:b,_payload:{_status:-1,_result:k},_init:J}},Me.memo=function(k,j){return{$$typeof:m,type:k,compare:j===void 0?null:j}},Me.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}},Me.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Me.use=function(k){return L.H.use(k)},Me.useActionState=function(k,j,I){return L.H.useActionState(k,j,I)},Me.useCallback=function(k,j){return L.H.useCallback(k,j)},Me.useContext=function(k){return L.H.useContext(k)},Me.useDebugValue=function(){},Me.useDeferredValue=function(k,j){return L.H.useDeferredValue(k,j)},Me.useEffect=function(k,j){return L.H.useEffect(k,j)},Me.useEffectEvent=function(k){return L.H.useEffectEvent(k)},Me.useId=function(){return L.H.useId()},Me.useImperativeHandle=function(k,j,I){return L.H.useImperativeHandle(k,j,I)},Me.useInsertionEffect=function(k,j){return L.H.useInsertionEffect(k,j)},Me.useLayoutEffect=function(k,j){return L.H.useLayoutEffect(k,j)},Me.useMemo=function(k,j){return L.H.useMemo(k,j)},Me.useOptimistic=function(k,j){return L.H.useOptimistic(k,j)},Me.useReducer=function(k,j,I){return L.H.useReducer(k,j,I)},Me.useRef=function(k){return L.H.useRef(k)},Me.useState=function(k){return L.H.useState(k)},Me.useSyncExternalStore=function(k,j,I){return L.H.useSyncExternalStore(k,j,I)},Me.useTransition=function(){return L.H.useTransition()},Me.version="19.2.6",Me}var v0;function od(){return v0||(v0=1,Wh.exports=pA()),Wh.exports}var v=od();const le=bx(v),gp=fA({__proto__:null,default:le},[v]);var Xh={exports:{}},Wo={},Jh={exports:{}},Qh={};/**
|
||
* @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 b0;function gA(){return b0||(b0=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}}}})(Qh)),Qh}var w0;function yA(){return w0||(w0=1,Jh.exports=gA()),Jh.exports}var Zh={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 x0;function vA(){if(x0)return Jt;x0=1;var e=od();function t(f){var m="https://react.dev/errors/"+f;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)m+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+f+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(f,m,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:f,containerInfo:m,implementation:b}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,m){if(f==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Jt.createPortal=function(f,m){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(f,m,null,b)},Jt.flushSync=function(f){var m=u.T,b=s.p;try{if(u.T=null,s.p=2,f)return f()}finally{u.T=m,s.p=b,s.d.f()}},Jt.preconnect=function(f,m){typeof f=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,s.d.C(f,m))},Jt.prefetchDNS=function(f){typeof f=="string"&&s.d.D(f)},Jt.preinit=function(f,m){if(typeof f=="string"&&m&&typeof m.as=="string"){var b=m.as,g=d(b,m.crossOrigin),w=typeof m.integrity=="string"?m.integrity:void 0,_=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;b==="style"?s.d.S(f,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:w,fetchPriority:_}):b==="script"&&s.d.X(f,{crossOrigin:g,integrity:w,fetchPriority:_,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Jt.preinitModule=function(f,m){if(typeof f=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var b=d(m.as,m.crossOrigin);s.d.M(f,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&s.d.M(f)},Jt.preload=function(f,m){if(typeof f=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var b=m.as,g=d(b,m.crossOrigin);s.d.L(f,b,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Jt.preloadModule=function(f,m){if(typeof f=="string")if(m){var b=d(m.as,m.crossOrigin);s.d.m(f,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(f)},Jt.requestFormReset=function(f){s.d.r(f)},Jt.unstable_batchedUpdates=function(f,m){return f(m)},Jt.useFormState=function(f,m,b){return u.H.useFormState(f,m,b)},Jt.useFormStatus=function(){return u.H.useHostTransitionStatus()},Jt.version="19.2.6",Jt}var _0;function wx(){if(_0)return Zh.exports;_0=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(),Zh.exports=vA(),Zh.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 S0;function bA(){if(S0)return Wo;S0=1;var e=yA(),t=od(),r=wx();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)?Ub(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=Ub(a),n=Ib(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=Ib(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),Vo._currentValue=J)}var Re,Ze;function Ke(n){if(Re===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",Ze=-1<i.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Re+n+Ze}var St=!1;function Wt(n,a){if(!n||St)return"";St=!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{St=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?Ke(i):""}function Bt(n,a){switch(n.tag){case 26:case 27:case 5:return Ke(n.type);case 16:return Ke("Lazy");case 13:return n.child!==a&&a!==null?Ke("Suspense Fallback"):Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 15:return Wt(n.type,!1);case 11:return Wt(n.type.render,!1);case 1:return Wt(n.type,!0);case 31:return Ke("Activity");default:return""}}function nn(n){try{var a="",i=null;do a+=Bt(n,i),i=n,n=n.return;while(n);return a}catch(c){return`
|
||
Error generating stack: `+c.message+`
|
||
`+c.stack}}var gt=Object.prototype.hasOwnProperty,Tr=e.unstable_scheduleCallback,He=e.unstable_cancelCallback,nt=e.unstable_shouldYield,Dt=e.unstable_requestPaint,rt=e.unstable_now,Rr=e.unstable_getCurrentPriorityLevel,Ar=e.unstable_ImmediatePriority,zs=e.unstable_UserBlockingPriority,wn=e.unstable_NormalPriority,la=e.unstable_LowPriority,xn=e.unstable_IdlePriority,Us=e.log,Kn=e.unstable_setDisableYieldValue,cr=null,Lt=null;function _n(n){if(typeof Us=="function"&&Kn(n),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(cr,n)}catch{}}var Pt=Math.clz32?Math.clz32:se,ro=Math.log,Xa=Math.LN2;function se(n){return n>>>=0,n===0?32:31-(ro(n)/Xa|0)|0}var Te=256,Ge=262144,Ye=4194304;function Nt(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 Ne(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=Nt(c):(x&=R,x!==0?h=Nt(x):i||(i=R&~n,i!==0&&(h=Nt(i))))):(R=c&~p,R!==0?h=Nt(R):x!==0?h=Nt(x):i||(i=c&~n,i!==0&&(h=Nt(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 lt(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function zt(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=Ye;return Ye<<=1,(Ye&62914560)===0&&(Ye=4194304),n}function ca(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-Pt(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&&Ja(n,c,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(x&~a))}function Ja(n,a,i){n.pendingLanes|=a,n.suspendedLanes&=~a;var c=31-Pt(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-Pt(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:Is(i),(i&(n.suspendedLanes|a))!==0?0:i}function Is(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 zd(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:l0(n.type))}function Eg(n,a){var i=K.p;try{return K.p=n,a()}finally{K.p=i}}var ua=Math.random().toString(36).slice(2),Ht="__reactFiber$"+ua,on="__reactProps$"+ua,$s="__reactContainer$"+ua,Ud="__reactEvents$"+ua,tT="__reactListeners$"+ua,nT="__reactHandles$"+ua,Cg="__reactResources$"+ua,ao="__reactMarker$"+ua;function Id(n){delete n[Ht],delete n[on],delete n[Ud],delete n[tT],delete n[nT]}function Bs(n){var a=n[Ht];if(a)return a;for(var i=n.parentNode;i;){if(a=i[$s]||i[Ht]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(n=Fb(n);n!==null;){if(i=n[Ht])return i;n=Fb(n)}return a}n=i,i=n.parentNode}return null}function Hs(n){if(n=n[Ht]||n[$s]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function so(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(s(33))}function qs(n){var a=n[Cg];return a||(a=n[Cg]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Ut(n){n[ao]=!0}var Tg=new Set,Rg={};function Qa(n,a){Vs(n,a),Vs(n+"Capture",a)}function Vs(n,a){for(Rg[n]=a,n=0;n<a.length;n++)Tg.add(a[n])}var rT=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]*$"),Ag={},Ng={};function aT(n){return gt.call(Ng,n)?!0:gt.call(Ag,n)?!1:rT.test(n)?Ng[n]=!0:(Ag[n]=!0,!1)}function Hl(n,a,i){if(aT(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 Nr(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 Dn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function kg(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function sT(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 $d(n){if(!n._valueTracker){var a=kg(n)?"checked":"value";n._valueTracker=sT(n,a,""+n[a])}}function jg(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var i=a.getValue(),c="";return n&&(c=kg(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 iT=/[\n"\\]/g;function Ln(n){return n.replace(iT,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Bd(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=""+Dn(a)):n.value!==""+Dn(a)&&(n.value=""+Dn(a)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),a!=null?Hd(n,x,Dn(a)):i!=null?Hd(n,x,Dn(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=""+Dn(R):n.removeAttribute("name")}function Og(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)){$d(n);return}i=i!=null?""+Dn(i):"",a=a!=null?""+Dn(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),$d(n)}function Hd(n,a,i){a==="number"&&Vl(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function Gs(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=""+Dn(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 Mg(n,a,i){if(a!=null&&(a=""+Dn(a),a!==n.value&&(n.value=a),i==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=i!=null?""+Dn(i):""}function Dg(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=Dn(a),n.defaultValue=i,c=n.textContent,c===i&&c!==""&&c!==null&&(n.value=c),$d(n)}function Fs(n,a){if(a){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=a;return}}n.textContent=a}var oT=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 Lg(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||oT.has(a)?a==="float"?n.cssFloat=i:n[a]=(""+i).trim():n[a]=i+"px"}function Pg(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&&Lg(n,h,c)}else for(var p in a)a.hasOwnProperty(p)&&Lg(n,p,a[p])}function qd(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 lT=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"]]),cT=/^[\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 cT.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function kr(){}var Vd=null;function Gd(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ks=null,Ys=null;function zg(n){var a=Hs(n);if(a&&(n=a.stateNode)){var i=n[on]||null;e:switch(n=a.stateNode,a.type){case"input":if(Bd(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="'+Ln(""+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));Bd(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&&jg(c)}break e;case"textarea":Mg(n,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Gs(n,!!i.multiple,a,!1)}}}var Fd=!1;function Ug(n,a,i){if(Fd)return n(a,i);Fd=!0;try{var c=n(a);return c}finally{if(Fd=!1,(Ks!==null||Ys!==null)&&(Oc(),Ks&&(a=Ks,n=Ys,Ys=Ks=null,zg(a),n)))for(a=0;a<n.length;a++)zg(n[a])}}function io(n,a){var i=n.stateNode;if(i===null)return null;var c=i[on]||null;if(c===null)return null;i=c[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(s(231,a,typeof i));return i}var jr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kd=!1;if(jr)try{var oo={};Object.defineProperty(oo,"passive",{get:function(){Kd=!0}}),window.addEventListener("test",oo,oo),window.removeEventListener("test",oo,oo)}catch{Kd=!1}var da=null,Yd=null,Fl=null;function Ig(){if(Fl)return Fl;var n,a=Yd,i=a.length,c,h="value"in da?da.value:da.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 $g(){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:$g,this.isPropagationStopped=$g,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 Za={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wl=ln(Za),lo=g({},Za,{view:0,detail:0}),uT=ln(lo),Wd,Xd,co,Xl=g({},lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qd,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==co&&(co&&n.type==="mousemove"?(Wd=n.screenX-co.screenX,Xd=n.screenY-co.screenY):Xd=Wd=0,co=n),Wd)},movementY:function(n){return"movementY"in n?n.movementY:Xd}}),Bg=ln(Xl),dT=g({},Xl,{dataTransfer:0}),fT=ln(dT),hT=g({},lo,{relatedTarget:0}),Jd=ln(hT),mT=g({},Za,{animationName:0,elapsedTime:0,pseudoElement:0}),pT=ln(mT),gT=g({},Za,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),yT=ln(gT),vT=g({},Za,{data:0}),Hg=ln(vT),bT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wT={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"},xT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _T(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=xT[n])?!!a[n]:!1}function Qd(){return _T}var ST=g({},lo,{key:function(n){if(n.key){var a=bT[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"?wT[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qd,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}}),ET=ln(ST),CT=g({},Xl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qg=ln(CT),TT=g({},lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qd}),RT=ln(TT),AT=g({},Za,{propertyName:0,elapsedTime:0,pseudoElement:0}),NT=ln(AT),kT=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}),jT=ln(kT),OT=g({},Za,{newState:0,oldState:0}),MT=ln(OT),DT=[9,13,27,32],Zd=jr&&"CompositionEvent"in window,uo=null;jr&&"documentMode"in document&&(uo=document.documentMode);var LT=jr&&"TextEvent"in window&&!uo,Vg=jr&&(!Zd||uo&&8<uo&&11>=uo),Gg=" ",Fg=!1;function Kg(n,a){switch(n){case"keyup":return DT.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ws=!1;function PT(n,a){switch(n){case"compositionend":return Yg(a);case"keypress":return a.which!==32?null:(Fg=!0,Gg);case"textInput":return n=a.data,n===Gg&&Fg?null:n;default:return null}}function zT(n,a){if(Ws)return n==="compositionend"||!Zd&&Kg(n,a)?(n=Ig(),Fl=Yd=da=null,Ws=!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 Vg&&a.locale!=="ko"?null:a.data;default:return null}}var UT={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 Wg(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!UT[n.type]:a==="textarea"}function Xg(n,a,i,c){Ks?Ys?Ys.push(c):Ys=[c]:Ks=c,a=Ic(a,"onChange"),0<a.length&&(i=new Wl("onChange","change",null,i,c),n.push({event:i,listeners:a}))}var fo=null,ho=null;function IT(n){Ob(n,0)}function Jl(n){var a=so(n);if(jg(a))return n}function Jg(n,a){if(n==="change")return a}var Qg=!1;if(jr){var ef;if(jr){var tf="oninput"in document;if(!tf){var Zg=document.createElement("div");Zg.setAttribute("oninput","return;"),tf=typeof Zg.oninput=="function"}ef=tf}else ef=!1;Qg=ef&&(!document.documentMode||9<document.documentMode)}function ey(){fo&&(fo.detachEvent("onpropertychange",ty),ho=fo=null)}function ty(n){if(n.propertyName==="value"&&Jl(ho)){var a=[];Xg(a,ho,n,Gd(n)),Ug(IT,a)}}function $T(n,a,i){n==="focusin"?(ey(),fo=a,ho=i,fo.attachEvent("onpropertychange",ty)):n==="focusout"&&ey()}function BT(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Jl(ho)}function HT(n,a){if(n==="click")return Jl(a)}function qT(n,a){if(n==="input"||n==="change")return Jl(a)}function VT(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Sn=typeof Object.is=="function"?Object.is:VT;function mo(n,a){if(Sn(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(!gt.call(a,h)||!Sn(n[h],a[h]))return!1}return!0}function ny(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function ry(n,a){var i=ny(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=ny(i)}}function ay(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?ay(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function sy(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 nf(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 GT=jr&&"documentMode"in document&&11>=document.documentMode,Xs=null,rf=null,po=null,af=!1;function iy(n,a,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;af||Xs==null||Xs!==Vl(c)||(c=Xs,"selectionStart"in c&&nf(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),po&&mo(po,c)||(po=c,c=Ic(rf,"onSelect"),0<c.length&&(a=new Wl("onSelect","select",null,a,i),n.push({event:a,listeners:c}),a.target=Xs)))}function es(n,a){var i={};return i[n.toLowerCase()]=a.toLowerCase(),i["Webkit"+n]="webkit"+a,i["Moz"+n]="moz"+a,i}var Js={animationend:es("Animation","AnimationEnd"),animationiteration:es("Animation","AnimationIteration"),animationstart:es("Animation","AnimationStart"),transitionrun:es("Transition","TransitionRun"),transitionstart:es("Transition","TransitionStart"),transitioncancel:es("Transition","TransitionCancel"),transitionend:es("Transition","TransitionEnd")},sf={},oy={};jr&&(oy=document.createElement("div").style,"AnimationEvent"in window||(delete Js.animationend.animation,delete Js.animationiteration.animation,delete Js.animationstart.animation),"TransitionEvent"in window||delete Js.transitionend.transition);function ts(n){if(sf[n])return sf[n];if(!Js[n])return n;var a=Js[n],i;for(i in a)if(a.hasOwnProperty(i)&&i in oy)return sf[n]=a[i];return n}var ly=ts("animationend"),cy=ts("animationiteration"),uy=ts("animationstart"),FT=ts("transitionrun"),KT=ts("transitionstart"),YT=ts("transitioncancel"),dy=ts("transitionend"),fy=new Map,of="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(" ");of.push("scrollEnd");function Wn(n,a){fy.set(n,a),Qa(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)},Pn=[],Qs=0,lf=0;function Zl(){for(var n=Qs,a=lf=Qs=0;a<n;){var i=Pn[a];Pn[a++]=null;var c=Pn[a];Pn[a++]=null;var h=Pn[a];Pn[a++]=null;var p=Pn[a];if(Pn[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&&hy(i,h,p)}}function ec(n,a,i,c){Pn[Qs++]=n,Pn[Qs++]=a,Pn[Qs++]=i,Pn[Qs++]=c,lf|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function cf(n,a,i,c){return ec(n,a,i,c),tc(n)}function ns(n,a){return ec(n,null,null,a),tc(n)}function hy(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-Pt(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<zo)throw zo=0,vh=null,Error(s(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var Zs={};function WT(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 En(n,a,i,c){return new WT(n,a,i,c)}function uf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Or(n,a){var i=n.alternate;return i===null?(i=En(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 my(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")uf(n)&&(x=1);else if(typeof n=="string")x=eA(n,i,Y.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case ie:return n=En(31,i,a,h),n.elementType=ie,n.lanes=p,n;case S:return rs(i.children,h,p,a);case T:x=8,h|=24;break;case C:return n=En(12,i,a,h|2),n.elementType=C,n.lanes=p,n;case F:return n=En(13,i,a,h),n.elementType=F,n.lanes=p,n;case $:return n=En(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=En(x,i,a,h),a.elementType=n,a.type=c,a.lanes=p,a}function rs(n,a,i,c){return n=En(7,n,c,a),n.lanes=i,n}function df(n,a,i){return n=En(6,n,null,a),n.lanes=i,n}function py(n){var a=En(18,null,null,0);return a.stateNode=n,a}function ff(n,a,i){return a=En(4,n.children!==null?n.children:[],n.key,a),a.lanes=i,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var gy=new WeakMap;function zn(n,a){if(typeof n=="object"&&n!==null){var i=gy.get(n);return i!==void 0?i:(a={value:n,source:a,stack:nn(a)},gy.set(n,a),a)}return{value:n,source:a,stack:nn(a)}}var ei=[],ti=0,rc=null,go=0,Un=[],In=0,fa=null,ur=1,dr="";function Mr(n,a){ei[ti++]=go,ei[ti++]=rc,rc=n,go=a}function yy(n,a,i){Un[In++]=ur,Un[In++]=dr,Un[In++]=fa,fa=n;var c=ur;n=dr;var h=32-Pt(c)-1;c&=~(1<<h),i+=1;var p=32-Pt(a)+h;if(30<p){var x=h-h%5;p=(c&(1<<x)-1).toString(32),c>>=x,h-=x,ur=1<<32-Pt(a)+h|i<<h|c,dr=p+n}else ur=1<<p|i<<h|c,dr=n}function hf(n){n.return!==null&&(Mr(n,1),yy(n,1,0))}function mf(n){for(;n===rc;)rc=ei[--ti],ei[ti]=null,go=ei[--ti],ei[ti]=null;for(;n===fa;)fa=Un[--In],Un[In]=null,dr=Un[--In],Un[In]=null,ur=Un[--In],Un[In]=null}function vy(n,a){Un[In++]=ur,Un[In++]=dr,Un[In++]=fa,ur=a.id,dr=a.overflow,fa=n}var qt=null,ut=null,qe=!1,ha=null,$n=!1,pf=Error(s(519));function ma(n){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yo(zn(a,n)),pf}function by(n){var a=n.stateNode,i=n.type,c=n.memoizedProps;switch(a[Ht]=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<Io.length;i++)Ie(Io[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),Og(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),Dg(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||Pb(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=kr),a=!0):a=!1,a||ma(n,!0)}function wy(n){for(qt=n.return;qt;)switch(qt.tag){case 5:case 31:case 13:$n=!1;return;case 27:case 3:$n=!0;return;default:qt=qt.return}}function ni(n){if(n!==qt)return!1;if(!qe)return wy(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")||Mh(n.type,n.memoizedProps)),i=!i),i&&ut&&ma(n),wy(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));ut=Gb(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));ut=Gb(n)}else a===27?(a=ut,Aa(n.type)?(n=Uh,Uh=null,ut=n):ut=a):ut=qt?Hn(n.stateNode.nextSibling):null;return!0}function as(){ut=qt=null,qe=!1}function gf(){var n=ha;return n!==null&&(fn===null?fn=n:fn.push.apply(fn,n),ha=null),n}function yo(n){ha===null?ha=[n]:ha.push(n)}var yf=k(null),ss=null,Dr=null;function pa(n,a,i){I(yf,a._currentValue),a._currentValue=i}function Lr(n){n._currentValue=yf.current,j(yf)}function vf(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 bf(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),vf(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),vf(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 ri(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;Sn(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(Vo):n=[Vo])}h=h.return}n!==null&&bf(a,n,i,c),a.flags|=262144}function ac(n){for(n=n.firstContext;n!==null;){if(!Sn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function is(n){ss=n,Dr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Vt(n){return xy(ss,n)}function sc(n,a){return ss===null&&is(n),xy(n,a)}function xy(n,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},Dr===null){if(n===null)throw Error(s(308));Dr=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Dr=Dr.next=a;return i}var XT=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()})}},JT=e.unstable_scheduleCallback,QT=e.unstable_NormalPriority,Et={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wf(){return{controller:new XT,data:new Map,refCount:0}}function vo(n){n.refCount--,n.refCount===0&&JT(QT,function(){n.controller.abort()})}var bo=null,xf=0,ai=0,si=null;function ZT(n,a){if(bo===null){var i=bo=[];xf=0,ai=Eh(),si={status:"pending",value:void 0,then:function(c){i.push(c)}}}return xf++,a.then(_y,_y),a}function _y(){if(--xf===0&&bo!==null){si!==null&&(si.status="fulfilled");var n=bo;bo=null,ai=0,si=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function eR(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 Sy=M.S;M.S=function(n,a){ib=rt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&ZT(n,a),Sy!==null&&Sy(n,a)};var os=k(null);function _f(){var n=os.current;return n!==null?n:ot.pooledCache}function ic(n,a){a===null?I(os,os.current):I(os,a.pool)}function Ey(){var n=_f();return n===null?null:{parent:Et._currentValue,pool:n}}var ii=Error(s(460)),Sf=Error(s(474)),oc=Error(s(542)),lc={then:function(){}};function Cy(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Ty(n,a,i){switch(i=n[i],i===void 0?n.push(a):i!==a&&(a.then(kr,kr),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Ay(n),n;default:if(typeof a.status=="string")a.then(kr,kr);else{if(n=ot,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,Ay(n),n}throw cs=a,ii}}function ls(n){try{var a=n._init;return a(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(cs=i,ii):i}}var cs=null;function Ry(){if(cs===null)throw Error(s(459));var n=cs;return cs=null,n}function Ay(n){if(n===ii||n===oc)throw Error(s(483))}var oi=null,wo=0;function cc(n){var a=wo;return wo+=1,oi===null&&(oi=[]),Ty(oi,n,a)}function xo(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 Ny(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=Or(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=df(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&&ls(Se)===D.type)?(D=h(D,B.props),xo(D,B),D.return=U,D):(D=nc(B.type,B.key,B.props,null,U.mode,te),xo(D,B),D.return=U,D)}function H(U,D,B,te){return D===null||D.tag!==4||D.stateNode.containerInfo!==B.containerInfo||D.stateNode.implementation!==B.implementation?(D=ff(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=rs(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=df(""+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),xo(B,D),B.return=U,B;case E:return D=ff(D,U.mode,B),D.return=U,D;case q:return D=ls(D),re(U,D,B)}if(fe(D)||oe(D))return D=rs(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=ls(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=ls(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,We=null,_e=D,Le=D=0,Be=null;_e!==null&&Le<B.length;Le++){_e.index>Le?(Be=_e,_e=null):Be=_e.sibling;var Xe=G(U,_e,B[Le],te);if(Xe===null){_e===null&&(_e=Be);break}n&&_e&&Xe.alternate===null&&a(U,_e),D=p(Xe,D,Le),We===null?Se=Xe:We.sibling=Xe,We=Xe,_e=Be}if(Le===B.length)return i(U,_e),qe&&Mr(U,Le),Se;if(_e===null){for(;Le<B.length;Le++)_e=re(U,B[Le],te),_e!==null&&(D=p(_e,D,Le),We===null?Se=_e:We.sibling=_e,We=_e);return qe&&Mr(U,Le),Se}for(_e=c(_e);Le<B.length;Le++)Be=W(_e,U,Le,B[Le],te),Be!==null&&(n&&Be.alternate!==null&&_e.delete(Be.key===null?Le:Be.key),D=p(Be,D,Le),We===null?Se=Be:We.sibling=Be,We=Be);return n&&_e.forEach(function(Ma){return a(U,Ma)}),qe&&Mr(U,Le),Se}function Ae(U,D,B,te){if(B==null)throw Error(s(151));for(var Se=null,We=null,_e=D,Le=D=0,Be=null,Xe=B.next();_e!==null&&!Xe.done;Le++,Xe=B.next()){_e.index>Le?(Be=_e,_e=null):Be=_e.sibling;var Ma=G(U,_e,Xe.value,te);if(Ma===null){_e===null&&(_e=Be);break}n&&_e&&Ma.alternate===null&&a(U,_e),D=p(Ma,D,Le),We===null?Se=Ma:We.sibling=Ma,We=Ma,_e=Be}if(Xe.done)return i(U,_e),qe&&Mr(U,Le),Se;if(_e===null){for(;!Xe.done;Le++,Xe=B.next())Xe=re(U,Xe.value,te),Xe!==null&&(D=p(Xe,D,Le),We===null?Se=Xe:We.sibling=Xe,We=Xe);return qe&&Mr(U,Le),Se}for(_e=c(_e);!Xe.done;Le++,Xe=B.next())Xe=W(_e,U,Le,Xe.value,te),Xe!==null&&(n&&Xe.alternate!==null&&_e.delete(Xe.key===null?Le:Xe.key),D=p(Xe,D,Le),We===null?Se=Xe:We.sibling=Xe,We=Xe);return n&&_e.forEach(function(dA){return a(U,dA)}),qe&&Mr(U,Le),Se}function it(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&&ls(Se)===D.type){i(U,D.sibling),te=h(D,B.props),xo(te,B),te.return=U,U=te;break e}i(U,D);break}else a(U,D);D=D.sibling}B.type===S?(te=rs(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),xo(te,B),te.return=U,U=te)}return x(U);case E:e:{for(Se=B.key;D!==null;){if(D.key===Se)if(D.tag===4&&D.stateNode.containerInfo===B.containerInfo&&D.stateNode.implementation===B.implementation){i(U,D.sibling),te=h(D,B.children||[]),te.return=U,U=te;break e}else{i(U,D);break}else a(U,D);D=D.sibling}te=ff(B,U.mode,te),te.return=U,U=te}return x(U);case q:return B=ls(B),it(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 it(U,D,cc(B),te);if(B.$$typeof===N)return it(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=df(B,U.mode,te),te.return=U,U=te),x(U)):i(U,D)}return function(U,D,B,te){try{wo=0;var Se=it(U,D,B,te);return oi=null,Se}catch(_e){if(_e===ii||_e===oc)throw _e;var We=En(29,_e,null,U.mode);return We.lanes=te,We.return=U,We}finally{}}}var us=Ny(!0),ky=Ny(!1),ga=!1;function Ef(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cf(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 ya(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function va(n,a,i){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(Je&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),hy(n,null,i),a}return ec(n,c,a,i),tc(n)}function _o(n,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,i|=c,a.lanes=i,an(n,i)}}function Tf(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 Rf=!1;function So(){if(Rf){var n=si;if(n!==null)throw n}}function Eo(n,a,i,c){Rf=!1;var h=n.updateQueue;ga=!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===ai&&(Rf=!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 it=i;switch(Ae.tag){case 1:if(ve=Ae.payload,typeof ve=="function"){re=ve.call(it,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(it,re,G):ve,G==null)break e;re=g({},re,G);break e;case 2:ga=!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),Sa|=x,n.lanes=x,n.memoizedState=re}}function jy(n,a){if(typeof n!="function")throw Error(s(191,n));n.call(a)}function Oy(n,a){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)jy(i[n],a)}var li=k(null),dc=k(0);function My(n,a){n=Vr,I(dc,n),I(li,a),Vr=n|a.baseLanes}function Af(){I(dc,Vr),I(li,li.current)}function Nf(){Vr=dc.current,j(li),j(dc)}var Cn=k(null),Bn=null;function ba(n){var a=n.alternate;I(xt,xt.current&1),I(Cn,n),Bn===null&&(a===null||li.current!==null||a.memoizedState!==null)&&(Bn=n)}function kf(n){I(xt,xt.current),I(Cn,n),Bn===null&&(Bn=n)}function Dy(n){n.tag===22?(I(xt,xt.current),I(Cn,n),Bn===null&&(Bn=n)):wa()}function wa(){I(xt,xt.current),I(Cn,Cn.current)}function Tn(n){j(Cn),Bn===n&&(Bn=null),j(xt)}var xt=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||Ph(i)||zh(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 Pr=0,De=null,at=null,Ct=null,hc=!1,ci=!1,ds=!1,mc=0,Co=0,ui=null,tR=0;function yt(){throw Error(s(321))}function jf(n,a){if(a===null)return!1;for(var i=0;i<a.length&&i<n.length;i++)if(!Sn(n[i],a[i]))return!1;return!0}function Of(n,a,i,c,h,p){return Pr=p,De=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,M.H=n===null||n.memoizedState===null?yv:Kf,ds=!1,p=i(c,h),ds=!1,ci&&(p=Py(a,i,c,h)),Ly(n),p}function Ly(n){M.H=Ao;var a=at!==null&&at.next!==null;if(Pr=0,Ct=at=De=null,hc=!1,Co=0,ui=null,a)throw Error(s(300));n===null||Tt||(n=n.dependencies,n!==null&&ac(n)&&(Tt=!0))}function Py(n,a,i,c){De=n;var h=0;do{if(ci&&(ui=null),Co=0,ci=!1,25<=h)throw Error(s(301));if(h+=1,Ct=at=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=vv,p=a(i,c)}while(ci);return p}function nR(){var n=M.H,a=n.useState()[0];return a=typeof a.then=="function"?To(a):a,n=n.useState()[0],(at!==null?at.memoizedState:null)!==n&&(De.flags|=1024),a}function Mf(){var n=mc!==0;return mc=0,n}function Df(n,a,i){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~i}function Lf(n){if(hc){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}hc=!1}Pr=0,Ct=at=De=null,ci=!1,Co=mc=0,ui=null}function Zt(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?De.memoizedState=Ct=n:Ct=Ct.next=n,Ct}function _t(){if(at===null){var n=De.alternate;n=n!==null?n.memoizedState:null}else n=at.next;var a=Ct===null?De.memoizedState:Ct.next;if(a!==null)Ct=a,at=n;else{if(n===null)throw De.alternate===null?Error(s(467)):Error(s(310));at=n,n={memoizedState:at.memoizedState,baseState:at.baseState,baseQueue:at.baseQueue,queue:at.queue,next:null},Ct===null?De.memoizedState=Ct=n:Ct=Ct.next=n}return Ct}function pc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function To(n){var a=Co;return Co+=1,ui===null&&(ui=[]),n=Ty(ui,n,a),a=De,(Ct===null?a.memoizedState:Ct.next)===null&&(a=a.alternate,M.H=a===null||a.memoizedState===null?yv:Kf),n}function gc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return To(n);if(n.$$typeof===N)return Vt(n)}throw Error(s(438,String(n)))}function Pf(n){var a=null,i=De.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var c=De.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(),De.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 zr(n,a){return typeof a=="function"?a(n):a}function yc(n){var a=_t();return zf(a,at,n)}function zf(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:(Pr&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===ai&&(Q=!0);else if((Pr&G)===G){H=H.next,G===ai&&(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,De.lanes|=G,Sa|=G;re=H.action,ds&&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,De.lanes|=re,Sa|=re;H=H.next}while(H!==null&&H!==a);if(O===null?x=p:O.next=R,!Sn(p,n.memoizedState)&&(Tt=!0,Q&&(i=si,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 Uf(n){var a=_t(),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);Sn(p,a.memoizedState)||(Tt=!0),a.memoizedState=p,a.baseQueue===null&&(a.baseState=p),i.lastRenderedState=p}return[p,c]}function zy(n,a,i){var c=De,h=_t(),p=qe;if(p){if(i===void 0)throw Error(s(407));i=i()}else i=a();var x=!Sn((at||h).memoizedState,i);if(x&&(h.memoizedState=i,Tt=!0),h=h.queue,Bf($y.bind(null,c,h,n),[n]),h.getSnapshot!==a||x||Ct!==null&&Ct.memoizedState.tag&1){if(c.flags|=2048,di(9,{destroy:void 0},Iy.bind(null,c,h,i,a),null),ot===null)throw Error(s(349));p||(Pr&127)!==0||Uy(c,a,i)}return i}function Uy(n,a,i){n.flags|=16384,n={getSnapshot:a,value:i},a=De.updateQueue,a===null?(a=pc(),De.updateQueue=a,a.stores=[n]):(i=a.stores,i===null?a.stores=[n]:i.push(n))}function Iy(n,a,i,c){a.value=i,a.getSnapshot=c,By(a)&&Hy(n)}function $y(n,a,i){return i(function(){By(a)&&Hy(n)})}function By(n){var a=n.getSnapshot;n=n.value;try{var i=a();return!Sn(n,i)}catch{return!0}}function Hy(n){var a=ns(n,2);a!==null&&hn(a,n,2)}function If(n){var a=Zt();if(typeof n=="function"){var i=n;if(n=i(),ds){_n(!0);try{i()}finally{_n(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zr,lastRenderedState:n},a}function qy(n,a,i,c){return n.baseState=i,zf(n,at,typeof c=="function"?c:zr)}function rR(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,Vy(a,p)):(p.next=i.next,a.pending=i.next=p)}}function Vy(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),Gy(n,a,R)}catch(H){$f(n,a,H)}finally{p!==null&&x.types!==null&&(p.types=x.types),M.T=p}}else try{p=i(h,c),Gy(n,a,p)}catch(H){$f(n,a,H)}}function Gy(n,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(c){Fy(n,a,c)},function(c){return $f(n,a,c)}):Fy(n,a,i)}function Fy(n,a,i){a.status="fulfilled",a.value=i,Ky(a),n.state=i,a=n.pending,a!==null&&(i=a.next,i===a?n.pending=null:(i=i.next,a.next=i,Vy(n,i)))}function $f(n,a,i){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=i,Ky(a),a=a.next;while(a!==c)}n.action=null}function Ky(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Yy(n,a){return a}function Wy(n,a){if(qe){var i=ot.formState;if(i!==null){e:{var c=De;if(qe){if(ut){t:{for(var h=ut,p=$n;h.nodeType!==8;){if(!p){h=null;break t}if(h=Hn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){ut=Hn(h.nextSibling),c=h.data==="F!";break e}}ma(c)}c=!1}c&&(a=i[0])}}return i=Zt(),i.memoizedState=i.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yy,lastRenderedState:a},i.queue=c,i=mv.bind(null,De,c),c.dispatch=i,c=If(!1),p=Ff.bind(null,De,!1,c.queue),c=Zt(),h={state:a,dispatch:null,action:n,pending:null},c.queue=h,i=rR.bind(null,De,h,p,i),h.dispatch=i,c.memoizedState=n,[a,i,!1]}function Xy(n){var a=_t();return Jy(a,at,n)}function Jy(n,a,i){if(a=zf(n,a,Yy)[0],n=yc(zr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=To(a)}catch(x){throw x===ii?oc:x}else c=a;a=_t();var h=a.queue,p=h.dispatch;return i!==a.memoizedState&&(De.flags|=2048,di(9,{destroy:void 0},aR.bind(null,h,i),null)),[c,p,n]}function aR(n,a){n.action=a}function Qy(n){var a=_t(),i=at;if(i!==null)return Jy(a,i,n);_t(),a=a.memoizedState,i=_t();var c=i.queue.dispatch;return i.memoizedState=n,[a,c,!1]}function di(n,a,i,c){return n={tag:n,create:i,deps:c,inst:a,next:null},a=De.updateQueue,a===null&&(a=pc(),De.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 Zy(){return _t().memoizedState}function vc(n,a,i,c){var h=Zt();De.flags|=n,h.memoizedState=di(1|a,{destroy:void 0},i,c===void 0?null:c)}function bc(n,a,i,c){var h=_t();c=c===void 0?null:c;var p=h.memoizedState.inst;at!==null&&c!==null&&jf(c,at.memoizedState.deps)?h.memoizedState=di(a,p,i,c):(De.flags|=n,h.memoizedState=di(1|a,p,i,c))}function ev(n,a){vc(8390656,8,n,a)}function Bf(n,a){bc(2048,8,n,a)}function sR(n){De.flags|=4;var a=De.updateQueue;if(a===null)a=pc(),De.updateQueue=a,a.events=[n];else{var i=a.events;i===null?a.events=[n]:i.push(n)}}function tv(n){var a=_t().memoizedState;return sR({ref:a,nextImpl:n}),function(){if((Je&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function nv(n,a){return bc(4,2,n,a)}function rv(n,a){return bc(4,4,n,a)}function av(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 sv(n,a,i){i=i!=null?i.concat([n]):null,bc(4,4,av.bind(null,a,n),i)}function Hf(){}function iv(n,a){var i=_t();a=a===void 0?null:a;var c=i.memoizedState;return a!==null&&jf(a,c[1])?c[0]:(i.memoizedState=[n,a],n)}function ov(n,a){var i=_t();a=a===void 0?null:a;var c=i.memoizedState;if(a!==null&&jf(a,c[1]))return c[0];if(c=n(),ds){_n(!0);try{n()}finally{_n(!1)}}return i.memoizedState=[c,a],c}function qf(n,a,i){return i===void 0||(Pr&1073741824)!==0&&($e&261930)===0?n.memoizedState=a:(n.memoizedState=i,n=lb(),De.lanes|=n,Sa|=n,i)}function lv(n,a,i,c){return Sn(i,a)?i:li.current!==null?(n=qf(n,i,c),Sn(n,a)||(Tt=!0),n):(Pr&42)===0||(Pr&1073741824)!==0&&($e&261930)===0?(Tt=!0,n.memoizedState=i):(n=lb(),De.lanes|=n,Sa|=n,a)}function cv(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,Ff(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=eR(O,c);Ro(n,a,Q,Nn(n))}else Ro(n,a,c,Nn(n))}catch(re){Ro(n,a,{then:function(){},status:"rejected",reason:re},Nn())}finally{K.p=p,x!==null&&R.types!==null&&(x.types=R.types),M.T=x}}function iR(){}function Vf(n,a,i,c){if(n.tag!==5)throw Error(s(476));var h=uv(n).queue;cv(n,h,a,J,i===null?iR:function(){return dv(n),i(c)})}function uv(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:zr,lastRenderedState:J},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zr,lastRenderedState:i},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function dv(n){var a=uv(n);a.next===null&&(a=n.alternate.memoizedState),Ro(n,a.next.queue,{},Nn())}function Gf(){return Vt(Vo)}function fv(){return _t().memoizedState}function hv(){return _t().memoizedState}function oR(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var i=Nn();n=ya(i);var c=va(a,n,i);c!==null&&(hn(c,a,i),_o(c,a,i)),a={cache:wf()},n.payload=a;return}a=a.return}}function lR(n,a,i){var c=Nn();i={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},wc(n)?pv(a,i):(i=cf(n,a,i,c),i!==null&&(hn(i,n,c),gv(i,a,c)))}function mv(n,a,i){var c=Nn();Ro(n,a,i,c)}function Ro(n,a,i,c){var h={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(wc(n))pv(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,Sn(R,x))return ec(n,a,h,0),ot===null&&Zl(),!1}catch{}finally{}if(i=cf(n,a,h,c),i!==null)return hn(i,n,c),gv(i,a,c),!0}return!1}function Ff(n,a,i,c){if(c={lane:2,revertLane:Eh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},wc(n)){if(a)throw Error(s(479))}else a=cf(n,i,c,2),a!==null&&hn(a,n,2)}function wc(n){var a=n.alternate;return n===De||a!==null&&a===De}function pv(n,a){ci=hc=!0;var i=n.pending;i===null?a.next=a:(a.next=i.next,i.next=a),n.pending=a}function gv(n,a,i){if((i&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,i|=c,a.lanes=i,an(n,i)}}var Ao={readContext:Vt,use:gc,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useLayoutEffect:yt,useInsertionEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useSyncExternalStore:yt,useId:yt,useHostTransitionStatus:yt,useFormState:yt,useActionState:yt,useOptimistic:yt,useMemoCache:yt,useCacheRefresh:yt};Ao.useEffectEvent=yt;var yv={readContext:Vt,use:gc,useCallback:function(n,a){return Zt().memoizedState=[n,a===void 0?null:a],n},useContext:Vt,useEffect:ev,useImperativeHandle:function(n,a,i){i=i!=null?i.concat([n]):null,vc(4194308,4,av.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(ds){_n(!0);try{n()}finally{_n(!1)}}return i.memoizedState=[c,a],c},useReducer:function(n,a,i){var c=Zt();if(i!==void 0){var h=i(a);if(ds){_n(!0);try{i(a)}finally{_n(!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=lR.bind(null,De,n),[c.memoizedState,n]},useRef:function(n){var a=Zt();return n={current:n},a.memoizedState=n},useState:function(n){n=If(n);var a=n.queue,i=mv.bind(null,De,a);return a.dispatch=i,[n.memoizedState,i]},useDebugValue:Hf,useDeferredValue:function(n,a){var i=Zt();return qf(i,n,a)},useTransition:function(){var n=If(!1);return n=cv.bind(null,De,n.queue,!0,!1),Zt().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,i){var c=De,h=Zt();if(qe){if(i===void 0)throw Error(s(407));i=i()}else{if(i=a(),ot===null)throw Error(s(349));($e&127)!==0||Uy(c,a,i)}h.memoizedState=i;var p={value:i,getSnapshot:a};return h.queue=p,ev($y.bind(null,c,p,n),[n]),c.flags|=2048,di(9,{destroy:void 0},Iy.bind(null,c,p,i,a),null),i},useId:function(){var n=Zt(),a=ot.identifierPrefix;if(qe){var i=dr,c=ur;i=(c&~(1<<32-Pt(c)-1)).toString(32)+i,a="_"+a+"R_"+i,i=mc++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=tR++,a="_"+a+"r_"+i.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:Gf,useFormState:Wy,useActionState:Wy,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=Ff.bind(null,De,!0,i),i.dispatch=a,[n,a]},useMemoCache:Pf,useCacheRefresh:function(){return Zt().memoizedState=oR.bind(null,De)},useEffectEvent:function(n){var a=Zt(),i={impl:n};return a.memoizedState=i,function(){if((Je&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}},Kf={readContext:Vt,use:gc,useCallback:iv,useContext:Vt,useEffect:Bf,useImperativeHandle:sv,useInsertionEffect:nv,useLayoutEffect:rv,useMemo:ov,useReducer:yc,useRef:Zy,useState:function(){return yc(zr)},useDebugValue:Hf,useDeferredValue:function(n,a){var i=_t();return lv(i,at.memoizedState,n,a)},useTransition:function(){var n=yc(zr)[0],a=_t().memoizedState;return[typeof n=="boolean"?n:To(n),a]},useSyncExternalStore:zy,useId:fv,useHostTransitionStatus:Gf,useFormState:Xy,useActionState:Xy,useOptimistic:function(n,a){var i=_t();return qy(i,at,n,a)},useMemoCache:Pf,useCacheRefresh:hv};Kf.useEffectEvent=tv;var vv={readContext:Vt,use:gc,useCallback:iv,useContext:Vt,useEffect:Bf,useImperativeHandle:sv,useInsertionEffect:nv,useLayoutEffect:rv,useMemo:ov,useReducer:Uf,useRef:Zy,useState:function(){return Uf(zr)},useDebugValue:Hf,useDeferredValue:function(n,a){var i=_t();return at===null?qf(i,n,a):lv(i,at.memoizedState,n,a)},useTransition:function(){var n=Uf(zr)[0],a=_t().memoizedState;return[typeof n=="boolean"?n:To(n),a]},useSyncExternalStore:zy,useId:fv,useHostTransitionStatus:Gf,useFormState:Qy,useActionState:Qy,useOptimistic:function(n,a){var i=_t();return at!==null?qy(i,at,n,a):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:Pf,useCacheRefresh:hv};vv.useEffectEvent=tv;function Yf(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 Wf={enqueueSetState:function(n,a,i){n=n._reactInternals;var c=Nn(),h=ya(c);h.payload=a,i!=null&&(h.callback=i),a=va(n,h,c),a!==null&&(hn(a,n,c),_o(a,n,c))},enqueueReplaceState:function(n,a,i){n=n._reactInternals;var c=Nn(),h=ya(c);h.tag=1,h.payload=a,i!=null&&(h.callback=i),a=va(n,h,c),a!==null&&(hn(a,n,c),_o(a,n,c))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var i=Nn(),c=ya(i);c.tag=2,a!=null&&(c.callback=a),a=va(n,c,i),a!==null&&(hn(a,n,i),_o(a,n,i))}};function bv(n,a,i,c,h,p,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,p,x):a.prototype&&a.prototype.isPureReactComponent?!mo(i,c)||!mo(h,p):!0}function wv(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&&Wf.enqueueReplaceState(a,a.state,null)}function fs(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 xv(n){Ql(n)}function _v(n){console.error(n)}function Sv(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 Ev(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 Xf(n,a,i){return i=ya(i),i.tag=3,i.payload={element:null},i.callback=function(){xc(n,a)},i}function Cv(n){return n=ya(n),n.tag=3,n}function Tv(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(){Ev(a,i,c)}}var x=i.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){Ev(a,i,c),typeof h!="function"&&(Ea===null?Ea=new Set([this]):Ea.add(this));var R=c.stack;this.componentDidCatch(c.value,{componentStack:R!==null?R:""})})}function cR(n,a,i,c,h){if(i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=i.alternate,a!==null&&ri(a,i,h,!0),i=Cn.current,i!==null){switch(i.tag){case 31:case 13:return Bn===null?Mc():i.alternate===null&&vt===0&&(vt=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),xh(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)),xh(n,c,h)),!1}throw Error(s(435,i.tag))}return xh(n,c,h),Mc(),!1}if(qe)return a=Cn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=h,c!==pf&&(n=Error(s(422),{cause:c}),yo(zn(n,i)))):(c!==pf&&(a=Error(s(423),{cause:c}),yo(zn(a,i))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,c=zn(c,i),h=Xf(n.stateNode,c,h),Tf(n,h),vt!==4&&(vt=2)),!1;var p=Error(s(520),{cause:c});if(p=zn(p,i),Po===null?Po=[p]:Po.push(p),vt!==4&&(vt=2),a===null)return!0;c=zn(c,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,n=h&-h,i.lanes|=n,n=Xf(i.stateNode,c,n),Tf(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"&&(Ea===null||!Ea.has(p))))return i.flags|=65536,h&=-h,i.lanes|=h,h=Cv(h),Tv(h,n,i,c),Tf(i,h),!1}i=i.return}while(i!==null);return!1}var Jf=Error(s(461)),Tt=!1;function Gt(n,a,i,c){a.child=n===null?ky(a,null,i,c):us(a,n.child,i,c)}function Rv(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 is(a),c=Of(n,a,i,x,p,h),R=Mf(),n!==null&&!Tt?(Df(n,a,h),Ur(n,a,h)):(qe&&R&&hf(a),a.flags|=1,Gt(n,a,c,h),a.child)}function Av(n,a,i,c,h){if(n===null){var p=i.type;return typeof p=="function"&&!uf(p)&&p.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=p,Nv(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,!sh(n,h)){var x=p.memoizedProps;if(i=i.compare,i=i!==null?i:mo,i(x,c)&&n.ref===a.ref)return Ur(n,a,h)}return a.flags|=1,n=Or(p,c),n.ref=a.ref,n.return=a,a.child=n}function Nv(n,a,i,c,h){if(n!==null){var p=n.memoizedProps;if(mo(p,c)&&n.ref===a.ref)if(Tt=!1,a.pendingProps=c=p,sh(n,h))(n.flags&131072)!==0&&(Tt=!0);else return a.lanes=n.lanes,Ur(n,a,h)}return Qf(n,a,i,c,h)}function kv(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 jv(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?My(a,p):Af(),Dy(a);else return c=a.lanes=536870912,jv(n,a,p!==null?p.baseLanes|i:i,i,c)}else p!==null?(ic(a,p.cachePool),My(a,p),wa(),a.memoizedState=null):(n!==null&&ic(a,null),Af(),wa());return Gt(n,a,h,i),a.child}function No(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function jv(n,a,i,c,h){var p=_f();return p=p===null?null:{parent:Et._currentValue,pool:p},a.memoizedState={baseLanes:i,cachePool:p},n!==null&&ic(a,null),Af(),Dy(a),n!==null&&ri(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 Ov(n,a,i){return us(a,n.child,null,i),n=_c(a,a.pendingProps),n.flags|=2,Tn(a),a.memoizedState=null,n}function uR(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,No(null,n);if(kf(a),(n=ut)?(n=Vb(n,$n),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:fa!==null?{id:ur,overflow:dr}:null,retryLane:536870912,hydrationErrors:null},i=py(n),i.return=a,a.child=i,qt=a,ut=null)):n=null,n===null)throw ma(a);return a.lanes=536870912,null}return _c(a,c)}var p=n.memoizedState;if(p!==null){var x=p.dehydrated;if(kf(a),h)if(a.flags&256)a.flags&=-257,a=Ov(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||ri(n,a,i,!1),h=(i&n.childLanes)!==0,Tt||h){if(c=ot,c!==null&&(x=sn(c,i),x!==0&&x!==p.retryLane))throw p.retryLane=x,ns(n,x),hn(c,n,x),Jf;Mc(),a=Ov(n,a,i)}else n=p.treeContext,ut=Hn(x.nextSibling),qt=a,qe=!0,ha=null,$n=!1,n!==null&&vy(a,n),a=_c(a,c),a.flags|=4096;return a}return n=Or(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 Qf(n,a,i,c,h){return is(a),i=Of(n,a,i,c,void 0,h),c=Mf(),n!==null&&!Tt?(Df(n,a,h),Ur(n,a,h)):(qe&&c&&hf(a),a.flags|=1,Gt(n,a,i,h),a.child)}function Mv(n,a,i,c,h,p){return is(a),a.updateQueue=null,i=Py(a,c,i,h),Ly(n),c=Mf(),n!==null&&!Tt?(Df(n,a,p),Ur(n,a,p)):(qe&&c&&hf(a),a.flags|=1,Gt(n,a,i,p),a.child)}function Dv(n,a,i,c,h){if(is(a),a.stateNode===null){var p=Zs,x=i.contextType;typeof x=="object"&&x!==null&&(p=Vt(x)),p=new i(c,p),a.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Wf,a.stateNode=p,p._reactInternals=a,p=a.stateNode,p.props=c,p.state=a.memoizedState,p.refs={},Ef(a),x=i.contextType,p.context=typeof x=="object"&&x!==null?Vt(x):Zs,p.state=a.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&(Yf(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&&Wf.enqueueReplaceState(p,p.state,null),Eo(a,c,p,h),So(),p.state=a.memoizedState),typeof p.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(n===null){p=a.stateNode;var R=a.memoizedProps,O=fs(i,R);p.props=O;var H=p.context,Q=i.contextType;x=Zs,typeof Q=="object"&&Q!==null&&(x=Vt(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)&&wv(a,p,c,x),ga=!1;var G=a.memoizedState;p.state=G,Eo(a,c,p,h),So(),H=a.memoizedState,R||G!==H||ga?(typeof re=="function"&&(Yf(a,i,re,c),H=a.memoizedState),(O=ga||bv(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,Cf(n,a),x=a.memoizedProps,Q=fs(i,x),p.props=Q,re=a.pendingProps,G=p.context,H=i.contextType,O=Zs,typeof H=="object"&&H!==null&&(O=Vt(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)&&wv(a,p,c,O),ga=!1,G=a.memoizedState,p.state=G,Eo(a,c,p,h),So();var W=a.memoizedState;x!==re||G!==W||ga||n!==null&&n.dependencies!==null&&ac(n.dependencies)?(typeof R=="function"&&(Yf(a,i,R,c),W=a.memoizedState),(Q=ga||bv(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=us(a,n.child,null,h),a.child=us(a,null,i,h)):Gt(n,a,i,h),a.memoizedState=p.state,n=a.child):n=Ur(n,a,h),n}function Lv(n,a,i,c){return as(),a.flags|=256,Gt(n,a,i,c),a.child}var Zf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function eh(n){return{baseLanes:n,cachePool:Ey()}}function th(n,a,i){return n=n!==null?n.childLanes&~i:0,a&&(n|=An),n}function Pv(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:(xt.current&2)!==0),x&&(h=!0,a.flags&=-129),x=(a.flags&32)!==0,a.flags&=-33,n===null){if(qe){if(h?ba(a):wa(),(n=ut)?(n=Vb(n,$n),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:fa!==null?{id:ur,overflow:dr}:null,retryLane:536870912,hydrationErrors:null},i=py(n),i.return=a,a.child=i,qt=a,ut=null)):n=null,n===null)throw ma(a);return zh(n)?a.lanes=32:a.lanes=536870912,null}var R=c.children;return c=c.fallback,h?(wa(),h=a.mode,R=Ec({mode:"hidden",children:R},h),c=rs(c,h,i,null),R.return=a,c.return=a,R.sibling=c,a.child=R,c=a.child,c.memoizedState=eh(i),c.childLanes=th(n,x,i),a.memoizedState=Zf,No(null,c)):(ba(a),nh(a,R))}var O=n.memoizedState;if(O!==null&&(R=O.dehydrated,R!==null)){if(p)a.flags&256?(ba(a),a.flags&=-257,a=rh(n,a,i)):a.memoizedState!==null?(wa(),a.child=n.child,a.flags|=128,a=null):(wa(),R=c.fallback,h=a.mode,c=Ec({mode:"visible",children:c.children},h),R=rs(R,h,i,null),R.flags|=2,c.return=a,R.return=a,c.sibling=R,a.child=c,us(a,n.child,null,i),c=a.child,c.memoizedState=eh(i),c.childLanes=th(n,x,i),a.memoizedState=Zf,a=No(null,c));else if(ba(a),zh(R)){if(x=R.nextSibling&&R.nextSibling.dataset,x)var H=x.dgst;x=H,c=Error(s(419)),c.stack="",c.digest=x,yo({value:c,source:null,stack:null}),a=rh(n,a,i)}else if(Tt||ri(n,a,i,!1),x=(i&n.childLanes)!==0,Tt||x){if(x=ot,x!==null&&(c=sn(x,i),c!==0&&c!==O.retryLane))throw O.retryLane=c,ns(n,c),hn(x,n,c),Jf;Ph(R)||Mc(),a=rh(n,a,i)}else Ph(R)?(a.flags|=192,a.child=n.child,a=null):(n=O.treeContext,ut=Hn(R.nextSibling),qt=a,qe=!0,ha=null,$n=!1,n!==null&&vy(a,n),a=nh(a,c.children),a.flags|=4096);return a}return h?(wa(),R=c.fallback,h=a.mode,O=n.child,H=O.sibling,c=Or(O,{mode:"hidden",children:c.children}),c.subtreeFlags=O.subtreeFlags&65011712,H!==null?R=Or(H,R):(R=rs(R,h,i,null),R.flags|=2),R.return=a,c.return=a,c.sibling=R,a.child=c,No(null,c),c=a.child,R=n.child.memoizedState,R===null?R=eh(i):(h=R.cachePool,h!==null?(O=Et._currentValue,h=h.parent!==O?{parent:O,pool:O}:h):h=Ey(),R={baseLanes:R.baseLanes|i,cachePool:h}),c.memoizedState=R,c.childLanes=th(n,x,i),a.memoizedState=Zf,No(n.child,c)):(ba(a),i=n.child,n=i.sibling,i=Or(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 nh(n,a){return a=Ec({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Ec(n,a){return n=En(22,n,null,a),n.lanes=0,n}function rh(n,a,i){return us(a,n.child,null,i),n=nh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function zv(n,a,i){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a),vf(n.return,a,i)}function ah(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 Uv(n,a,i){var c=a.pendingProps,h=c.revealOrder,p=c.tail;c=c.children;var x=xt.current,R=(x&2)!==0;if(R?(x=x&1|2,a.flags|=128):x&=1,I(xt,x),Gt(n,a,c,i),c=qe?go:0,!R&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&zv(n,i,a);else if(n.tag===19)zv(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),ah(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}ah(a,!0,i,null,p,c);break;case"together":ah(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function Ur(n,a,i){if(n!==null&&(a.dependencies=n.dependencies),Sa|=a.lanes,(i&a.childLanes)===0)if(n!==null){if(ri(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=Or(n,n.pendingProps),a.child=i,i.return=a;n.sibling!==null;)n=n.sibling,i=i.sibling=Or(n,n.pendingProps),i.return=a;i.sibling=null}return a.child}function sh(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&ac(n)))}function dR(n,a,i){switch(a.tag){case 3:ee(a,a.stateNode.containerInfo),pa(a,Et,n.memoizedState.cache),as();break;case 27:case 5:xe(a);break;case 4:ee(a,a.stateNode.containerInfo);break;case 10:pa(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,kf(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(ba(a),a.flags|=128,null):(i&a.child.childLanes)!==0?Pv(n,a,i):(ba(a),n=Ur(n,a,i),n!==null?n.sibling:null);ba(a);break;case 19:var h=(n.flags&128)!==0;if(c=(i&a.childLanes)!==0,c||(ri(n,a,i,!1),c=(i&a.childLanes)!==0),h){if(c)return Uv(n,a,i);a.flags|=128}if(h=a.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),I(xt,xt.current),c)break;return null;case 22:return a.lanes=0,kv(n,a,i,a.pendingProps);case 24:pa(a,Et,n.memoizedState.cache)}return Ur(n,a,i)}function Iv(n,a,i){if(n!==null)if(n.memoizedProps!==a.pendingProps)Tt=!0;else{if(!sh(n,i)&&(a.flags&128)===0)return Tt=!1,dR(n,a,i);Tt=(n.flags&131072)!==0}else Tt=!1,qe&&(a.flags&1048576)!==0&&yy(a,go,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(n=ls(a.elementType),a.type=n,typeof n=="function")uf(n)?(c=fs(n,c),a.tag=1,a=Dv(null,a,n,c,i)):(a.tag=0,a=Qf(null,a,n,c,i));else{if(n!=null){var h=n.$$typeof;if(h===P){a.tag=11,a=Rv(null,a,n,c,i);break e}else if(h===L){a.tag=14,a=Av(null,a,n,c,i);break e}}throw a=ce(n)||n,Error(s(306,a,""))}}return a;case 0:return Qf(n,a,a.type,a.pendingProps,i);case 1:return c=a.type,h=fs(c,a.pendingProps),Dv(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,Cf(n,a),Eo(a,c,null,i);var x=a.memoizedState;if(c=x.cache,pa(a,Et,c),c!==p.cache&&bf(a,[Et],i,!0),So(),c=x.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:x.cache},a.updateQueue.baseState=p,a.memoizedState=p,a.flags&256){a=Lv(n,a,c,i);break e}else if(c!==h){h=zn(Error(s(424)),a),yo(h),a=Lv(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(ut=Hn(n.firstChild),qt=a,qe=!0,ha=null,$n=!0,i=ky(a,null,c,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(as(),c===h){a=Ur(n,a,i);break e}Gt(n,a,c,i)}a=a.child}return a;case 26:return Sc(n,a),n===null?(i=Xb(a.type,null,a.pendingProps,null))?a.memoizedState=i:qe||(i=a.type,n=a.pendingProps,c=$c(Z.current).createElement(i),c[Ht]=a,c[on]=n,Ft(c,i,n),Ut(c),a.stateNode=c):a.memoizedState=Xb(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return xe(a),n===null&&qe&&(c=a.stateNode=Kb(a.type,a.pendingProps,Z.current),qt=a,$n=!0,h=ut,Aa(a.type)?(Uh=h,ut=Hn(c.firstChild)):ut=h),Gt(n,a,a.pendingProps.children,i),Sc(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&qe&&((h=c=ut)&&(c=BR(c,a.type,a.pendingProps,$n),c!==null?(a.stateNode=c,qt=a,ut=Hn(c.firstChild),$n=!1,h=!0):h=!1),h||ma(a)),xe(a),h=a.type,p=a.pendingProps,x=n!==null?n.memoizedProps:null,c=p.children,Mh(h,p)?c=null:x!==null&&Mh(h,x)&&(a.flags|=32),a.memoizedState!==null&&(h=Of(n,a,nR,null,null,i),Vo._currentValue=h),Sc(n,a),Gt(n,a,c,i),a.child;case 6:return n===null&&qe&&((n=i=ut)&&(i=HR(i,a.pendingProps,$n),i!==null?(a.stateNode=i,qt=a,ut=null,n=!0):n=!1),n||ma(a)),null;case 13:return Pv(n,a,i);case 4:return ee(a,a.stateNode.containerInfo),c=a.pendingProps,n===null?a.child=us(a,null,c,i):Gt(n,a,c,i),a.child;case 11:return Rv(n,a,a.type,a.pendingProps,i);case 7:return Gt(n,a,a.pendingProps,i),a.child;case 8:return Gt(n,a,a.pendingProps.children,i),a.child;case 12:return Gt(n,a,a.pendingProps.children,i),a.child;case 10:return c=a.pendingProps,pa(a,a.type,c.value),Gt(n,a,c.children,i),a.child;case 9:return h=a.type._context,c=a.pendingProps.children,is(a),h=Vt(h),c=c(h),a.flags|=1,Gt(n,a,c,i),a.child;case 14:return Av(n,a,a.type,a.pendingProps,i);case 15:return Nv(n,a,a.type,a.pendingProps,i);case 19:return Uv(n,a,i);case 31:return uR(n,a,i);case 22:return kv(n,a,i,a.pendingProps);case 24:return is(a),c=Vt(Et),n===null?(h=_f(),h===null&&(h=ot,p=wf(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=i),h=p),a.memoizedState={parent:c,cache:h},Ef(a),pa(a,Et,h)):((n.lanes&i)!==0&&(Cf(n,a),Eo(a,null,null,i),So()),h=n.memoizedState,p=a.memoizedState,h.parent!==c?(h={parent:c,cache:c},a.memoizedState=h,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=h),pa(a,Et,c)):(c=p.cache,pa(a,Et,c),c!==h.cache&&bf(a,[Et],i,!0))),Gt(n,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function Ir(n){n.flags|=4}function ih(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(fb())n.flags|=8192;else throw cs=lc,Sf}else n.flags&=-16777217}function $v(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!t0(a))if(fb())n.flags|=8192;else throw cs=lc,Sf}function Cc(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Xt():536870912,n.lanes|=a,pi|=a)}function ko(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 dt(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 fR(n,a,i){var c=a.pendingProps;switch(mf(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(a),null;case 1:return dt(a),null;case 3:return i=a.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Lr(Et),ae(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(ni(a)?Ir(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,gf())),dt(a),null;case 26:var h=a.type,p=a.memoizedState;return n===null?(Ir(a),p!==null?(dt(a),$v(a,p)):(dt(a),ih(a,h,null,c,i))):p?p!==n.memoizedState?(Ir(a),dt(a),$v(a,p)):(dt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==c&&Ir(a),dt(a),ih(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&&Ir(a);else{if(!c){if(a.stateNode===null)throw Error(s(166));return dt(a),null}n=Y.current,ni(a)?by(a):(n=Kb(h,c,i),a.stateNode=n,Ir(a))}return dt(a),null;case 5:if(Ce(a),h=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&Ir(a);else{if(!c){if(a.stateNode===null)throw Error(s(166));return dt(a),null}if(p=Y.current,ni(a))by(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[Ht]=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(Ft(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&&Ir(a)}}return dt(a),ih(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,i),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&Ir(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(s(166));if(n=Z.current,ni(a)){if(n=a.stateNode,i=a.memoizedProps,c=null,h=qt,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}n[Ht]=a,n=!!(n.nodeValue===i||c!==null&&c.suppressHydrationWarning===!0||Pb(n.nodeValue,i)),n||ma(a,!0)}else n=$c(n).createTextNode(c),n[Ht]=a,a.stateNode=n}return dt(a),null;case 31:if(i=a.memoizedState,n===null||n.memoizedState!==null){if(c=ni(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[Ht]=a}else as(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;dt(a),n=!1}else i=gf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return a.flags&256?(Tn(a),a):(Tn(a),null);if((a.flags&128)!==0)throw Error(s(558))}return dt(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=ni(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[Ht]=a}else as(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;dt(a),h=!1}else h=gf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return a.flags&256?(Tn(a),a):(Tn(a),null)}return Tn(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),dt(a),null);case 4:return ae(),n===null&&Ah(a.stateNode.containerInfo),dt(a),null;case 10:return Lr(a.type),dt(a),null;case 19:if(j(xt),c=a.memoizedState,c===null)return dt(a),null;if(h=(a.flags&128)!==0,p=c.rendering,p===null)if(h)ko(c,!1);else{if(vt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(p=fc(n),p!==null){for(a.flags|=128,ko(c,!1),n=p.updateQueue,a.updateQueue=n,Cc(a,n),a.subtreeFlags=0,n=i,i=a.child;i!==null;)my(i,n),i=i.sibling;return I(xt,xt.current&1|2),qe&&Mr(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&rt()>kc&&(a.flags|=128,h=!0,ko(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),ko(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!qe)return dt(a),null}else 2*rt()-c.renderingStartTime>kc&&i!==536870912&&(a.flags|=128,h=!0,ko(c,!1),a.lanes=4194304);c.isBackwards?(p.sibling=a.child,a.child=p):(n=c.last,n!==null?n.sibling=p:a.child=p,c.last=p)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=rt(),n.sibling=null,i=xt.current,I(xt,h?i&1|2:i&1),qe&&Mr(a,c.treeForkCount),n):(dt(a),null);case 22:case 23:return Tn(a),Nf(),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&&(dt(a),a.subtreeFlags&6&&(a.flags|=8192)):dt(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(os),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),Lr(Et),dt(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function hR(n,a){switch(mf(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Lr(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(Tn(a),a.alternate===null)throw Error(s(340));as()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(Tn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(s(340));as()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return j(xt),null;case 4:return ae(),null;case 10:return Lr(a.type),null;case 22:case 23:return Tn(a),Nf(),n!==null&&j(os),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Lr(Et),null;case 25:return null;default:return null}}function Bv(n,a){switch(mf(a),a.tag){case 3:Lr(Et),ae();break;case 26:case 27:case 5:Ce(a);break;case 4:ae();break;case 31:a.memoizedState!==null&&Tn(a);break;case 13:Tn(a);break;case 19:j(xt);break;case 10:Lr(a.type);break;case 22:case 23:Tn(a),Nf(),n!==null&&j(os);break;case 24:Lr(Et)}}function jo(n,a){try{var i=a.updateQueue,c=i!==null?i.lastEffect:null;if(c!==null){var h=c.next;i=h;do{if((i.tag&n)===n){c=void 0;var p=i.create,x=i.inst;c=p(),x.destroy=c}i=i.next}while(i!==h)}}catch(R){tt(a,a.return,R)}}function xa(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){tt(h,O,Q)}}}c=c.next}while(c!==p)}}catch(Q){tt(a,a.return,Q)}}function Hv(n){var a=n.updateQueue;if(a!==null){var i=n.stateNode;try{Oy(a,i)}catch(c){tt(n,n.return,c)}}}function qv(n,a,i){i.props=fs(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(c){tt(n,a,c)}}function Oo(n,a){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof i=="function"?n.refCleanup=i(c):i.current=c}}catch(h){tt(n,a,h)}}function fr(n,a){var i=n.ref,c=n.refCleanup;if(i!==null)if(typeof c=="function")try{c()}catch(h){tt(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){tt(n,a,h)}else i.current=null}function Vv(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){tt(n,n.return,h)}}function oh(n,a,i){try{var c=n.stateNode;LR(c,n.type,i,a),c[on]=a}catch(h){tt(n,n.return,h)}}function Gv(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Aa(n.type)||n.tag===4}function lh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Gv(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&&Aa(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 ch(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=kr));else if(c!==4&&(c===27&&Aa(n.type)&&(i=n.stateNode,a=null),n=n.child,n!==null))for(ch(n,a,i),n=n.sibling;n!==null;)ch(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&&Aa(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 Fv(n){var a=n.stateNode,i=n.memoizedProps;try{for(var c=n.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);Ft(a,c,i),a[Ht]=n,a[on]=i}catch(p){tt(n,n.return,p)}}var $r=!1,Rt=!1,uh=!1,Kv=typeof WeakSet=="function"?WeakSet:Set,It=null;function mR(n,a){if(n=n.containerInfo,jh=Kc,n=sy(n),nf(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(Oh={focusedElem:n,selectionRange:i},Kc=!1,It=a;It!==null;)if(a=It,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,It=n;else for(;It!==null;){switch(a=It,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=fs(i.type,h);n=c.getSnapshotBeforeUpdate(ve,p),c.__reactInternalSnapshotBeforeUpdate=n}catch(Ae){tt(i,i.return,Ae)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,i=n.nodeType,i===9)Lh(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Lh(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,It=n;break}It=a.return}}function Yv(n,a,i){var c=i.flags;switch(i.tag){case 0:case 11:case 15:Hr(n,i),c&4&&jo(5,i);break;case 1:if(Hr(n,i),c&4)if(n=i.stateNode,a===null)try{n.componentDidMount()}catch(x){tt(i,i.return,x)}else{var h=fs(i.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(h,a,n.__reactInternalSnapshotBeforeUpdate)}catch(x){tt(i,i.return,x)}}c&64&&Hv(i),c&512&&Oo(i,i.return);break;case 3:if(Hr(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{Oy(n,a)}catch(x){tt(i,i.return,x)}}break;case 27:a===null&&c&4&&Fv(i);case 26:case 5:Hr(n,i),a===null&&c&4&&Vv(i),c&512&&Oo(i,i.return);break;case 12:Hr(n,i);break;case 31:Hr(n,i),c&4&&Jv(n,i);break;case 13:Hr(n,i),c&4&&Qv(n,i),c&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=SR.bind(null,i),qR(n,i))));break;case 22:if(c=i.memoizedState!==null||$r,!c){a=a!==null&&a.memoizedState!==null||Rt,h=$r;var p=Rt;$r=c,(Rt=a)&&!p?qr(n,i,(i.subtreeFlags&8772)!==0):Hr(n,i),$r=h,Rt=p}break;case 30:break;default:Hr(n,i)}}function Wv(n){var a=n.alternate;a!==null&&(n.alternate=null,Wv(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&Id(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 ht=null,cn=!1;function Br(n,a,i){for(i=i.child;i!==null;)Xv(n,a,i),i=i.sibling}function Xv(n,a,i){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(cr,i)}catch{}switch(i.tag){case 26:Rt||fr(i,a),Br(n,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Rt||fr(i,a);var c=ht,h=cn;Aa(i.type)&&(ht=i.stateNode,cn=!1),Br(n,a,i),Bo(i.stateNode),ht=c,cn=h;break;case 5:Rt||fr(i,a);case 6:if(c=ht,h=cn,ht=null,Br(n,a,i),ht=c,cn=h,ht!==null)if(cn)try{(ht.nodeType===9?ht.body:ht.nodeName==="HTML"?ht.ownerDocument.body:ht).removeChild(i.stateNode)}catch(p){tt(i,a,p)}else try{ht.removeChild(i.stateNode)}catch(p){tt(i,a,p)}break;case 18:ht!==null&&(cn?(n=ht,Hb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),Si(n)):Hb(ht,i.stateNode));break;case 4:c=ht,h=cn,ht=i.stateNode.containerInfo,cn=!0,Br(n,a,i),ht=c,cn=h;break;case 0:case 11:case 14:case 15:xa(2,i,a),Rt||xa(4,i,a),Br(n,a,i);break;case 1:Rt||(fr(i,a),c=i.stateNode,typeof c.componentWillUnmount=="function"&&qv(i,a,c)),Br(n,a,i);break;case 21:Br(n,a,i);break;case 22:Rt=(c=Rt)||i.memoizedState!==null,Br(n,a,i),Rt=c;break;default:Br(n,a,i)}}function Jv(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Si(n)}catch(i){tt(a,a.return,i)}}}function Qv(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Si(n)}catch(i){tt(a,a.return,i)}}function pR(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new Kv),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new Kv),a;default:throw Error(s(435,n.tag))}}function Rc(n,a){var i=pR(n);a.forEach(function(c){if(!i.has(c)){i.add(c);var h=ER.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(Aa(R.type)){ht=R.stateNode,cn=!1;break e}break;case 5:ht=R.stateNode,cn=!1;break e;case 3:case 4:ht=R.stateNode.containerInfo,cn=!0;break e}R=R.return}if(ht===null)throw Error(s(160));Xv(p,x,h),ht=null,cn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Zv(a,n),a=a.sibling}var Xn=null;function Zv(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&&(xa(3,n,n.return),jo(3,n),xa(5,n,n.return));break;case 1:un(a,n),dn(n),c&512&&(Rt||i===null||fr(i,i.return)),c&64&&$r&&(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||fr(i,i.return)),c&4){var p=i!==null?i.memoizedState:null;if(c=n.memoizedState,i===null)if(c===null)if(n.stateNode===null){e:{c=n.type,i=n.memoizedProps,h=h.ownerDocument||h;t:switch(c){case"title":p=h.getElementsByTagName("title")[0],(!p||p[ao]||p[Ht]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(c),h.head.insertBefore(p,h.querySelector("head > title"))),Ft(p,c,i),p[Ht]=n,Ut(p),c=p;break e;case"link":var x=Zb("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),Ft(p,c,i),h.head.appendChild(p);break;case"meta":if(x=Zb("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),Ft(p,c,i),h.head.appendChild(p);break;default:throw Error(s(468,c))}p[Ht]=n,Ut(p),c=p}n.stateNode=c}else e0(h,n.type,n.stateNode);else n.stateNode=Qb(h,c,n.memoizedProps);else p!==c?(p===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):p.count--,c===null?e0(h,n.type,n.stateNode):Qb(h,c,n.memoizedProps)):c===null&&n.stateNode!==null&&oh(n,n.memoizedProps,i.memoizedProps)}break;case 27:un(a,n),dn(n),c&512&&(Rt||i===null||fr(i,i.return)),i!==null&&c&4&&oh(n,n.memoizedProps,i.memoizedProps);break;case 5:if(un(a,n),dn(n),c&512&&(Rt||i===null||fr(i,i.return)),n.flags&32){h=n.stateNode;try{Fs(h,"")}catch(ve){tt(n,n.return,ve)}}c&4&&n.stateNode!=null&&(h=n.memoizedProps,oh(n,h,i!==null?i.memoizedProps:h)),c&1024&&(uh=!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){tt(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{Si(a.containerInfo)}catch(ve){tt(n,n.return,ve)}uh&&(uh=!1,eb(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=rt()),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=$r,Q=Rt;if($r=H||h,Rt=Q||O,un(a,n),Rt=Q,$r=H,dn(n),c&8192)e:for(a=n.stateNode,a._visibility=h?a._visibility&-2:a._visibility|1,h&&(i===null||O||$r||Rt||hs(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){tt(O,O.return,ve)}}}else if(a.tag===6){if(i===null){O=a;try{O.stateNode.nodeValue=h?"":O.memoizedProps}catch(ve){tt(O,O.return,ve)}}}else if(a.tag===18){if(i===null){O=a;try{var W=O.stateNode;h?qb(W,!0):qb(O.stateNode,!1)}catch(ve){tt(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(Gv(c)){i=c;break}c=c.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var h=i.stateNode,p=lh(n);Tc(n,p,h);break;case 5:var x=i.stateNode;i.flags&32&&(Fs(x,""),i.flags&=-33);var R=lh(n);Tc(n,R,x);break;case 3:case 4:var O=i.stateNode.containerInfo,H=lh(n);ch(n,H,O);break;default:throw Error(s(161))}}catch(Q){tt(n,n.return,Q)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function eb(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;eb(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function Hr(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Yv(n,a.alternate,a),a=a.sibling}function hs(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:xa(4,a,a.return),hs(a);break;case 1:fr(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&qv(a,a.return,i),hs(a);break;case 27:Bo(a.stateNode);case 26:case 5:fr(a,a.return),hs(a);break;case 22:a.memoizedState===null&&hs(a);break;case 30:hs(a);break;default:hs(a)}n=n.sibling}}function qr(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:qr(h,p,i),jo(4,p);break;case 1:if(qr(h,p,i),c=p,h=c.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(H){tt(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++)jy(O[h],R)}catch(H){tt(c,c.return,H)}}i&&x&64&&Hv(p),Oo(p,p.return);break;case 27:Fv(p);case 26:case 5:qr(h,p,i),i&&c===null&&x&4&&Vv(p),Oo(p,p.return);break;case 12:qr(h,p,i);break;case 31:qr(h,p,i),i&&x&4&&Jv(h,p);break;case 13:qr(h,p,i),i&&x&4&&Qv(h,p);break;case 22:p.memoizedState===null&&qr(h,p,i),Oo(p,p.return);break;case 30:break;default:qr(h,p,i)}a=a.sibling}}function dh(n,a){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&vo(i))}function fh(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&vo(n))}function Jn(n,a,i,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)tb(n,a,i,c),a=a.sibling}function tb(n,a,i,c){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Jn(n,a,i,c),h&2048&&jo(9,a);break;case 1:Jn(n,a,i,c);break;case 3:Jn(n,a,i,c),h&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&vo(n)));break;case 12:if(h&2048){Jn(n,a,i,c),n=a.stateNode;try{var p=a.memoizedProps,x=p.id,R=p.onPostCommit;typeof R=="function"&&R(x,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(O){tt(a,a.return,O)}}else Jn(n,a,i,c);break;case 31:Jn(n,a,i,c);break;case 13:Jn(n,a,i,c);break;case 23:break;case 22:p=a.stateNode,x=a.alternate,a.memoizedState!==null?p._visibility&2?Jn(n,a,i,c):Mo(n,a):p._visibility&2?Jn(n,a,i,c):(p._visibility|=2,fi(n,a,i,c,(a.subtreeFlags&10256)!==0||!1)),h&2048&&dh(x,a);break;case 24:Jn(n,a,i,c),h&2048&&fh(a.alternate,a);break;default:Jn(n,a,i,c)}}function fi(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:fi(p,x,R,O,h),jo(8,x);break;case 23:break;case 22:var Q=x.stateNode;x.memoizedState!==null?Q._visibility&2?fi(p,x,R,O,h):Mo(p,x):(Q._visibility|=2,fi(p,x,R,O,h)),h&&H&2048&&dh(x.alternate,x);break;case 24:fi(p,x,R,O,h),h&&H&2048&&fh(x.alternate,x);break;default:fi(p,x,R,O,h)}a=a.sibling}}function Mo(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=n,c=a,h=c.flags;switch(c.tag){case 22:Mo(i,c),h&2048&&dh(c.alternate,c);break;case 24:Mo(i,c),h&2048&&fh(c.alternate,c);break;default:Mo(i,c)}a=a.sibling}}var Do=8192;function hi(n,a,i){if(n.subtreeFlags&Do)for(n=n.child;n!==null;)nb(n,a,i),n=n.sibling}function nb(n,a,i){switch(n.tag){case 26:hi(n,a,i),n.flags&Do&&n.memoizedState!==null&&tA(i,Xn,n.memoizedState,n.memoizedProps);break;case 5:hi(n,a,i);break;case 3:case 4:var c=Xn;Xn=Bc(n.stateNode.containerInfo),hi(n,a,i),Xn=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Do,Do=16777216,hi(n,a,i),Do=c):hi(n,a,i));break;default:hi(n,a,i)}}function rb(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Lo(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var c=a[i];It=c,sb(c,n)}rb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)ab(n),n=n.sibling}function ab(n){switch(n.tag){case 0:case 11:case 15:Lo(n),n.flags&2048&&xa(9,n,n.return);break;case 3:Lo(n);break;case 12:Lo(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Ac(n)):Lo(n);break;default:Lo(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];It=c,sb(c,n)}rb(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:xa(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 sb(n,a){for(;It!==null;){var i=It;switch(i.tag){case 0:case 11:case 15:xa(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var c=i.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:vo(i.memoizedState.cache)}if(c=i.child,c!==null)c.return=i,It=c;else e:for(i=n;It!==null;){c=It;var h=c.sibling,p=c.return;if(Wv(c),c===i){It=null;break e}if(h!==null){h.return=p,It=h;break e}It=p}}}var gR={getCacheForType:function(n){var a=Vt(Et),i=a.data.get(n);return i===void 0&&(i=n(),a.data.set(n,i)),i},cacheSignal:function(){return Vt(Et).controller.signal}},yR=typeof WeakMap=="function"?WeakMap:Map,Je=0,ot=null,Ue=null,$e=0,et=0,Rn=null,_a=!1,mi=!1,hh=!1,Vr=0,vt=0,Sa=0,ms=0,mh=0,An=0,pi=0,Po=null,fn=null,ph=!1,Nc=0,ib=0,kc=1/0,jc=null,Ea=null,kt=0,Ca=null,gi=null,Gr=0,gh=0,yh=null,ob=null,zo=0,vh=null;function Nn(){return(Je&2)!==0&&$e!==0?$e&-$e:M.T!==null?Eh():zd()}function lb(){if(An===0)if(($e&536870912)===0||qe){var n=Ge;Ge<<=1,(Ge&3932160)===0&&(Ge=262144),An=n}else An=536870912;return n=Cn.current,n!==null&&(n.flags|=32),An}function hn(n,a,i){(n===ot&&(et===2||et===9)||n.cancelPendingCommit!==null)&&(yi(n,0),Ta(n,$e,An,!1)),mt(n,i),((Je&2)===0||n!==ot)&&(n===ot&&((Je&2)===0&&(ms|=i),vt===4&&Ta(n,$e,An,!1)),hr(n))}function cb(n,a,i){if((Je&6)!==0)throw Error(s(327));var c=!i&&(a&127)===0&&(a&n.expiredLanes)===0||lt(n,a),h=c?wR(n,a):wh(n,a,!0),p=c;do{if(h===0){mi&&!c&&Ta(n,a,0,!1);break}else{if(i=n.current.alternate,p&&!vR(i)){h=wh(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=Po;var O=R.current.memoizedState.isDehydrated;if(O&&(yi(R,x).flags|=256),x=wh(R,x,!1),x!==2){if(hh&&!O){R.errorRecoveryDisabledLanes|=p,ms|=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){yi(n,0),Ta(n,a,0,!0);break}e:{switch(c=n,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:Ta(c,a,An,!_a);break e;case 2:fn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(h=Nc+300-rt(),10<h)){if(Ta(c,a,An,!_a),Ne(c,0,!0)!==0)break e;Gr=a,c.timeoutHandle=$b(ub.bind(null,c,i,fn,jc,ph,a,An,ms,pi,_a,p,"Throttled",-0,0),h);break e}ub(c,i,fn,jc,ph,a,An,ms,pi,_a,p,null,-0,0)}}break}while(!0);hr(n)}function ub(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:kr},nb(a,p,re);var ve=(p&62914560)===p?Nc-rt():(p&4194048)===p?ib-rt():0;if(ve=nA(re,ve),ve!==null){Gr=p,n.cancelPendingCommit=ve(vb.bind(null,n,a,p,i,c,h,x,R,O,Q,re,null,G,W)),Ta(n,p,x,!H);return}}vb(n,a,p,i,c,h,x,R,O)}function vR(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(!Sn(p(),h))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ta(n,a,i,c){a&=~mh,a&=~ms,n.suspendedLanes|=a,n.pingedLanes&=~a,c&&(n.warmLanes|=a),c=n.expirationTimes;for(var h=a;0<h;){var p=31-Pt(h),x=1<<p;c[p]=-1,h&=~x}i!==0&&Ja(n,i,a)}function Oc(){return(Je&6)===0?(Uo(0),!1):!0}function bh(){if(Ue!==null){if(et===0)var n=Ue.return;else n=Ue,Dr=ss=null,Lf(n),oi=null,wo=0,n=Ue;for(;n!==null;)Bv(n.alternate,n),n=n.return;Ue=null}}function yi(n,a){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,UR(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Gr=0,bh(),ot=n,Ue=i=Or(n.current,null),$e=a,et=0,Rn=null,_a=!1,mi=lt(n,a),hh=!1,pi=An=mh=ms=Sa=vt=0,fn=Po=null,ph=!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-Pt(c),p=1<<h;a|=n[h],c&=~p}return Vr=a,Zl(),i}function db(n,a){De=null,M.H=Ao,a===ii||a===oc?(a=Ry(),et=3):a===Sf?(a=Ry(),et=4):et=a===Jf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Rn=a,Ue===null&&(vt=1,xc(n,zn(a,n.current)))}function fb(){var n=Cn.current;return n===null?!0:($e&4194048)===$e?Bn===null:($e&62914560)===$e||($e&536870912)!==0?n===Bn:!1}function hb(){var n=M.H;return M.H=Ao,n===null?Ao:n}function mb(){var n=M.A;return M.A=gR,n}function Mc(){vt=4,_a||($e&4194048)!==$e&&Cn.current!==null||(mi=!0),(Sa&134217727)===0&&(ms&134217727)===0||ot===null||Ta(ot,$e,An,!1)}function wh(n,a,i){var c=Je;Je|=2;var h=hb(),p=mb();(ot!==n||$e!==a)&&(jc=null,yi(n,a)),a=!1;var x=vt;e:do try{if(et!==0&&Ue!==null){var R=Ue,O=Rn;switch(et){case 8:bh(),x=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(a=!0);var H=et;if(et=0,Rn=null,vi(n,R,O,H),i&&mi){x=0;break e}break;default:H=et,et=0,Rn=null,vi(n,R,O,H)}}bR(),x=vt;break}catch(Q){db(n,Q)}while(!0);return a&&n.shellSuspendCounter++,Dr=ss=null,Je=c,M.H=h,M.A=p,Ue===null&&(ot=null,$e=0,Zl()),x}function bR(){for(;Ue!==null;)pb(Ue)}function wR(n,a){var i=Je;Je|=2;var c=hb(),h=mb();ot!==n||$e!==a?(jc=null,kc=rt()+500,yi(n,a)):mi=lt(n,a);e:do try{if(et!==0&&Ue!==null){a=Ue;var p=Rn;t:switch(et){case 1:et=0,Rn=null,vi(n,a,p,1);break;case 2:case 9:if(Cy(p)){et=0,Rn=null,gb(a);break}a=function(){et!==2&&et!==9||ot!==n||(et=7),hr(n)},p.then(a,a);break e;case 3:et=7;break e;case 4:et=5;break e;case 7:Cy(p)?(et=0,Rn=null,gb(a)):(et=0,Rn=null,vi(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?t0(x):R.stateNode.complete){et=0,Rn=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}}et=0,Rn=null,vi(n,a,p,5);break;case 6:et=0,Rn=null,vi(n,a,p,6);break;case 8:bh(),vt=6;break e;default:throw Error(s(462))}}xR();break}catch(Q){db(n,Q)}while(!0);return Dr=ss=null,M.H=c,M.A=h,Je=i,Ue!==null?0:(ot=null,$e=0,Zl(),vt)}function xR(){for(;Ue!==null&&!nt();)pb(Ue)}function pb(n){var a=Iv(n.alternate,n,Vr);n.memoizedProps=n.pendingProps,a===null?Dc(n):Ue=a}function gb(n){var a=n,i=a.alternate;switch(a.tag){case 15:case 0:a=Mv(i,a,a.pendingProps,a.type,void 0,$e);break;case 11:a=Mv(i,a,a.pendingProps,a.type.render,a.ref,$e);break;case 5:Lf(a);default:Bv(i,a),a=Ue=my(a,Vr),a=Iv(i,a,Vr)}n.memoizedProps=n.pendingProps,a===null?Dc(n):Ue=a}function vi(n,a,i,c){Dr=ss=null,Lf(a),oi=null,wo=0;var h=a.return;try{if(cR(n,h,a,i,$e)){vt=1,xc(n,zn(i,n.current)),Ue=null;return}}catch(p){if(h!==null)throw Ue=h,p;vt=1,xc(n,zn(i,n.current)),Ue=null;return}a.flags&32768?(qe||c===1?n=!0:mi||($e&536870912)!==0?n=!1:(_a=n=!0,(c===2||c===9||c===3||c===6)&&(c=Cn.current,c!==null&&c.tag===13&&(c.flags|=16384))),yb(a,n)):Dc(a)}function Dc(n){var a=n;do{if((a.flags&32768)!==0){yb(a,_a);return}n=a.return;var i=fR(a.alternate,a,Vr);if(i!==null){Ue=i;return}if(a=a.sibling,a!==null){Ue=a;return}Ue=a=n}while(a!==null);vt===0&&(vt=5)}function yb(n,a){do{var i=hR(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);vt=6,Ue=null}function vb(n,a,i,c,h,p,x,R,O){n.cancelPendingCommit=null;do Lc();while(kt!==0);if((Je&6)!==0)throw Error(s(327));if(a!==null){if(a===n.current)throw Error(s(177));if(p=a.lanes|a.childLanes,p|=lf,rn(n,i,p,x,R,O),n===ot&&(Ue=ot=null,$e=0),gi=a,Ca=n,Gr=i,gh=p,yh=h,ob=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,CR(wn,function(){return Sb(),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=Je,Je|=4;try{mR(n,a,i)}finally{Je=x,K.p=h,M.T=c}}kt=1,bb(),wb(),xb()}}function bb(){if(kt===1){kt=0;var n=Ca,a=gi,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=Je;Je|=4;try{Zv(a,n);var p=Oh,x=sy(n.containerInfo),R=p.focusedElem,O=p.selectionRange;if(x!==R&&R&&R.ownerDocument&&ay(R.ownerDocument.documentElement,R)){if(O!==null&&nf(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),it=O.end===void 0?Ae:Math.min(O.end,ve);!W.extend&&Ae>it&&(x=it,it=Ae,Ae=x);var U=ry(R,Ae),D=ry(R,it);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>it?(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=!!jh,Oh=jh=null}finally{Je=h,K.p=c,M.T=i}}n.current=a,kt=2}}function wb(){if(kt===2){kt=0;var n=Ca,a=gi,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=Je;Je|=4;try{Yv(n,a.alternate,a)}finally{Je=h,K.p=c,M.T=i}}kt=3}}function xb(){if(kt===4||kt===3){kt=0,Dt();var n=Ca,a=gi,i=Gr,c=ob;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?kt=5:(kt=0,gi=Ca=null,_b(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(Ea=null),Yn(i),a=a.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(cr,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}}(Gr&3)!==0&&Lc(),hr(n),h=n.pendingLanes,(i&261930)!==0&&(h&42)!==0?n===vh?zo++:(zo=0,vh=n):zo=0,Uo(0)}}function _b(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,vo(a)))}function Lc(){return bb(),wb(),xb(),Sb()}function Sb(){if(kt!==5)return!1;var n=Ca,a=gh;gh=0;var i=Yn(Gr),c=M.T,h=K.p;try{K.p=32>i?32:i,M.T=null,i=yh,yh=null;var p=Ca,x=Gr;if(kt=0,gi=Ca=null,Gr=0,(Je&6)!==0)throw Error(s(331));var R=Je;if(Je|=4,ab(p.current),tb(p,p.current,x,i),Je=R,Uo(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(cr,p)}catch{}return!0}finally{K.p=h,M.T=c,_b(n,a)}}function Eb(n,a,i){a=zn(i,a),a=Xf(n.stateNode,a,2),n=va(n,a,2),n!==null&&(mt(n,2),hr(n))}function tt(n,a,i){if(n.tag===3)Eb(n,n,i);else for(;a!==null;){if(a.tag===3){Eb(a,n,i);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ea===null||!Ea.has(c))){n=zn(i,n),i=Cv(2),c=va(a,i,2),c!==null&&(Tv(i,c,a,n),mt(c,2),hr(c));break}}a=a.return}}function xh(n,a,i){var c=n.pingCache;if(c===null){c=n.pingCache=new yR;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)||(hh=!0,h.add(i),n=_R.bind(null,n,a,i),a.then(n,n))}function _R(n,a,i){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,ot===n&&($e&i)===i&&(vt===4||vt===3&&($e&62914560)===$e&&300>rt()-Nc?(Je&2)===0&&yi(n,0):mh|=i,pi===$e&&(pi=0)),hr(n)}function Cb(n,a){a===0&&(a=Xt()),n=ns(n,a),n!==null&&(mt(n,a),hr(n))}function SR(n){var a=n.memoizedState,i=0;a!==null&&(i=a.retryLane),Cb(n,i)}function ER(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),Cb(n,i)}function CR(n,a){return Tr(n,a)}var Pc=null,bi=null,_h=!1,zc=!1,Sh=!1,Ra=0;function hr(n){n!==bi&&n.next===null&&(bi===null?Pc=bi=n:bi=bi.next=n),zc=!0,_h||(_h=!0,RR())}function Uo(n,a){if(!Sh&&zc){Sh=!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-Pt(42|n)+1)-1,p&=h&~(x&~R),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(i=!0,Nb(c,p))}else p=$e,p=Ne(c,c===ot?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||lt(c,p)||(i=!0,Nb(c,p));c=c.next}while(i);Sh=!1}}function TR(){Tb()}function Tb(){zc=_h=!1;var n=0;Ra!==0&&zR()&&(n=Ra);for(var a=rt(),i=null,c=Pc;c!==null;){var h=c.next,p=Rb(c,a);p===0?(c.next=null,i===null?Pc=h:i.next=h,h===null&&(bi=i)):(i=c,(n!==0||(p&3)!==0)&&(zc=!0)),c=h}kt!==0&&kt!==5||Uo(n),Ra!==0&&(Ra=0)}function Rb(n,a){for(var i=n.suspendedLanes,c=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var x=31-Pt(p),R=1<<x,O=h[x];O===-1?((R&i)===0||(R&c)!==0)&&(h[x]=zt(R,a)):O<=a&&(n.expiredLanes|=R),p&=~R}if(a=ot,i=$e,i=Ne(n,n===a?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,i===0||n===a&&(et===2||et===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&He(c),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||lt(n,i)){if(a=i&-i,a===n.callbackPriority)return a;switch(c!==null&&He(c),Yn(i)){case 2:case 8:i=zs;break;case 32:i=wn;break;case 268435456:i=xn;break;default:i=wn}return c=Ab.bind(null,n),i=Tr(i,c),n.callbackPriority=a,n.callbackNode=i,a}return c!==null&&c!==null&&He(c),n.callbackPriority=2,n.callbackNode=null,2}function Ab(n,a){if(kt!==0&&kt!==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=Ne(n,n===ot?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(cb(n,c,a),Rb(n,rt()),n.callbackNode!=null&&n.callbackNode===i?Ab.bind(null,n):null)}function Nb(n,a){if(Lc())return null;cb(n,a,!0)}function RR(){IR(function(){(Je&6)!==0?Tr(Ar,TR):Tb()})}function Eh(){if(Ra===0){var n=ai;n===0&&(n=Te,Te<<=1,(Te&261888)===0&&(Te=256)),Ra=n}return Ra}function kb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Gl(""+n)}function jb(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 AR(n,a,i,c,h){if(a==="submit"&&i&&i.stateNode===h){var p=kb((h[on]||null).action),x=c.submitter;x&&(a=(a=x[on]||null)?kb(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(Ra!==0){var O=x?jb(h,x):new FormData(h);Vf(i,{pending:!0,data:O,method:h.method,action:p},null,O)}}else typeof p=="function"&&(R.preventDefault(),O=x?jb(h,x):new FormData(h),Vf(i,{pending:!0,data:O,method:h.method,action:p},p,O))},currentTarget:h}]})}}for(var Ch=0;Ch<of.length;Ch++){var Th=of[Ch],NR=Th.toLowerCase(),kR=Th[0].toUpperCase()+Th.slice(1);Wn(NR,"on"+kR)}Wn(ly,"onAnimationEnd"),Wn(cy,"onAnimationIteration"),Wn(uy,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(FT,"onTransitionRun"),Wn(KT,"onTransitionStart"),Wn(YT,"onTransitionCancel"),Wn(dy,"onTransitionEnd"),Vs("onMouseEnter",["mouseout","mouseover"]),Vs("onMouseLeave",["mouseout","mouseover"]),Vs("onPointerEnter",["pointerout","pointerover"]),Vs("onPointerLeave",["pointerout","pointerover"]),Qa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Io="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),jR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Io));function Ob(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[Ud];i===void 0&&(i=a[Ud]=new Set);var c=n+"__bubble";i.has(c)||(Mb(a,n,2,!1),i.add(c))}function Rh(n,a,i){var c=0;a&&(c|=4),Mb(i,n,c,a)}var Uc="_reactListening"+Math.random().toString(36).slice(2);function Ah(n){if(!n[Uc]){n[Uc]=!0,Tg.forEach(function(i){i!=="selectionchange"&&(jR.has(i)||Rh(i,!1,n),Rh(i,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Uc]||(a[Uc]=!0,Rh("selectionchange",!1,a))}}function Mb(n,a,i,c){switch(l0(a)){case 2:var h=sA;break;case 8:h=iA;break;default:h=qh}i=h.bind(null,a,i,n),h=void 0,!Kd||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 Nh(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=Bs(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}Ug(function(){var H=p,Q=Gd(i),re=[];e:{var G=fy.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=ET;break;case"focusin":ve="focus",W=Jd;break;case"focusout":ve="blur",W=Jd;break;case"beforeblur":case"afterblur":W=Jd;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=Bg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=fT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=RT;break;case ly:case cy:case uy:W=pT;break;case dy:W=NT;break;case"scroll":case"scrollend":W=uT;break;case"wheel":W=jT;break;case"copy":case"cut":case"paste":W=yT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=qg;break;case"toggle":case"beforetoggle":W=MT}var Ae=(a&4)!==0,it=!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=io(D,U),te!=null&&Ae.push($o(D,te,B))),it)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!==Vd&&(ve=i.relatedTarget||i.fromElement)&&(Bs(ve)||ve[$s]))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?Bs(ve):null,ve!==null&&(it=l(ve),Ae=ve.tag,ve!==it||Ae!==5&&Ae!==27&&Ae!==6)&&(ve=null)):(W=null,ve=H),W!==ve)){if(Ae=Bg,te="onMouseLeave",U="onMouseEnter",D="mouse",(n==="pointerout"||n==="pointerover")&&(Ae=qg,te="onPointerLeave",U="onPointerEnter",D="pointer"),it=W==null?G:so(W),B=ve==null?G:so(ve),G=new Ae(te,D+"leave",W,i,Q),G.target=it,G.relatedTarget=B,te=null,Bs(Q)===H&&(Ae=new Ae(U,D+"enter",ve,i,Q),Ae.target=B,Ae.relatedTarget=it,te=Ae),it=te,W&&ve)t:{for(Ae=OR,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&&Db(re,G,W,Ae,!1),ve!==null&&it!==null&&Db(re,it,ve,Ae,!0)}}e:{if(G=H?so(H):window,W=G.nodeName&&G.nodeName.toLowerCase(),W==="select"||W==="input"&&G.type==="file")var We=Jg;else if(Wg(G))if(Qg)We=qT;else{We=BT;var _e=$T}else W=G.nodeName,!W||W.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?H&&qd(H.elementType)&&(We=Jg):We=HT;if(We&&(We=We(n,H))){Xg(re,We,i,Q);break e}_e&&_e(n,G,H),n==="focusout"&&H&&G.type==="number"&&H.memoizedProps.value!=null&&Hd(G,"number",G.value)}switch(_e=H?so(H):window,n){case"focusin":(Wg(_e)||_e.contentEditable==="true")&&(Xs=_e,rf=H,po=null);break;case"focusout":po=rf=Xs=null;break;case"mousedown":af=!0;break;case"contextmenu":case"mouseup":case"dragend":af=!1,iy(re,i,Q);break;case"selectionchange":if(GT)break;case"keydown":case"keyup":iy(re,i,Q)}var Le;if(Zd)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 Ws?Kg(n,i)&&(Be="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(Be="onCompositionStart");Be&&(Vg&&i.locale!=="ko"&&(Ws||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&Ws&&(Le=Ig()):(da=Q,Yd="value"in da?da.value:da.textContent,Ws=!0)),_e=Ic(H,Be),0<_e.length&&(Be=new Hg(Be,n,null,i,Q),re.push({event:Be,listeners:_e}),Le?Be.data=Le:(Le=Yg(i),Le!==null&&(Be.data=Le)))),(Le=LT?PT(n,i):zT(n,i))&&(Be=Ic(H,"onBeforeInput"),0<Be.length&&(_e=new Hg("onBeforeInput","beforeinput",null,i,Q),re.push({event:_e,listeners:Be}),_e.data=Le)),AR(re,n,H,i,Q)}Ob(re,a)})}function $o(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=io(n,i),h!=null&&c.unshift($o(n,h,p)),h=io(n,a),h!=null&&c.push($o(n,h,p))),n.tag===3)return c;n=n.return}return[]}function OR(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Db(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=io(i,p),H!=null&&x.unshift($o(i,H,O))):h||(H=io(i,p),H!=null&&x.push($o(i,H,O)))),i=i.return}x.length!==0&&n.push({event:a,listeners:x})}var MR=/\r\n?/g,DR=/\u0000|\uFFFD/g;function Lb(n){return(typeof n=="string"?n:""+n).replace(MR,`
|
||
`).replace(DR,"")}function Pb(n,a){return a=Lb(a),Lb(n)===a}function st(n,a,i,c,h,p){switch(i){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||Fs(n,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&Fs(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":Pg(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"&&st(n,a,"name",h.name,h,null),st(n,a,"formEncType",h.formEncType,h,null),st(n,a,"formMethod",h.formMethod,h,null),st(n,a,"formTarget",h.formTarget,h,null)):(st(n,a,"encType",h.encType,h,null),st(n,a,"method",h.method,h,null),st(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=kr);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":Nr(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Nr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Nr(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Nr(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Nr(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Nr(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Nr(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Nr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Nr(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=lT.get(i)||i,Hl(n,i,c))}}function kh(n,a,i,c,h,p){switch(i){case"style":Pg(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"?Fs(n,c):(typeof c=="number"||typeof c=="bigint")&&Fs(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=kr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Rg.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 Ft(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:st(n,a,p,x,i,null)}}h&&st(n,a,"srcSet",i.srcSet,i,null),c&&st(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:st(n,a,c,Q,i,null)}}Og(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:st(n,a,h,R,i,null)}a=p,i=x,n.multiple=!!c,a!=null?Gs(n,!!c,a,!1):i!=null&&Gs(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:st(n,a,x,R,i,null)}Dg(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:st(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<Io.length;c++)Ie(Io[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:st(n,a,H,c,i,null)}return;default:if(qd(a)){for(Q in i)i.hasOwnProperty(Q)&&(c=i[Q],c!==void 0&&kh(n,a,Q,c,i,void 0));return}}for(R in i)i.hasOwnProperty(R)&&(c=i[R],c!=null&&st(n,a,R,c,i,null))}function LR(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)||st(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&&st(n,a,G,W,c,re)}}Bd(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)||st(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&&st(n,a,h,p,c,O)}a=R,i=x,c=W,G!=null?Gs(n,!!i,G,!1):!!c!=!!i&&(a!=null?Gs(n,!!i,a,!0):Gs(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:st(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&&st(n,a,x,h,c,p)}Mg(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:st(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:st(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)&&st(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:st(n,a,H,G,c,W)}return;default:if(qd(a)){for(var it in i)G=i[it],i.hasOwnProperty(it)&&G!==void 0&&!c.hasOwnProperty(it)&&kh(n,a,it,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||kh(n,a,Q,G,c,W);return}}for(var U in i)G=i[U],i.hasOwnProperty(U)&&G!=null&&!c.hasOwnProperty(U)&&st(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||st(n,a,re,G,c,W)}function zb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function PR(){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&&zb(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&&zb(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 jh=null,Oh=null;function $c(n){return n.nodeType===9?n:n.ownerDocument}function Ub(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 Ib(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 Mh(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 Dh=null;function zR(){var n=window.event;return n&&n.type==="popstate"?n===Dh?!1:(Dh=n,!0):(Dh=null,!1)}var $b=typeof setTimeout=="function"?setTimeout:void 0,UR=typeof clearTimeout=="function"?clearTimeout:void 0,Bb=typeof Promise=="function"?Promise:void 0,IR=typeof queueMicrotask=="function"?queueMicrotask:typeof Bb<"u"?function(n){return Bb.resolve(null).then(n).catch($R)}:$b;function $R(n){setTimeout(function(){throw n})}function Aa(n){return n==="head"}function Hb(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),Si(a);return}c--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")c++;else if(i==="html")Bo(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,Bo(i);for(var p=i.firstChild;p;){var x=p.nextSibling,R=p.nodeName;p[ao]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&p.rel.toLowerCase()==="stylesheet"||i.removeChild(p),p=x}}else i==="body"&&Bo(n.ownerDocument.body);i=h}while(i);Si(a)}function qb(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 Lh(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":Lh(i),Id(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function BR(n,a,i,c){for(;n.nodeType===1;){var h=i;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[ao])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(p=n.getAttribute("rel"),p==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(p!==h.rel||n.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||n.getAttribute("title")!==(h.title==null?null:h.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(p=n.getAttribute("src"),(p!==(h.src==null?null:h.src)||n.getAttribute("type")!==(h.type==null?null:h.type)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&n.getAttribute("name")===p)return n}else return n;if(n=Hn(n.nextSibling),n===null)break}return null}function HR(n,a,i){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Hn(n.nextSibling),n===null))return null;return n}function Vb(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Hn(n.nextSibling),n===null))return null;return n}function Ph(n){return n.data==="$?"||n.data==="$~"}function zh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function qR(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 Hn(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 Uh=null;function Gb(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(a===0)return Hn(n.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}n=n.nextSibling}return null}function Fb(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 Kb(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 Bo(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Id(n)}var qn=new Map,Yb=new Set;function Bc(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Fr=K.d;K.d={f:VR,r:GR,D:FR,C:KR,L:YR,m:WR,X:JR,S:XR,M:QR};function VR(){var n=Fr.f(),a=Oc();return n||a}function GR(n){var a=Hs(n);a!==null&&a.tag===5&&a.type==="form"?dv(a):Fr.r(n)}var wi=typeof document>"u"?null:document;function Wb(n,a,i){var c=wi;if(c&&typeof a=="string"&&a){var h=Ln(a);h='link[rel="'+n+'"][href="'+h+'"]',typeof i=="string"&&(h+='[crossorigin="'+i+'"]'),Yb.has(h)||(Yb.add(h),n={rel:n,crossOrigin:i,href:a},c.querySelector(h)===null&&(a=c.createElement("link"),Ft(a,"link",n),Ut(a),c.head.appendChild(a)))}}function FR(n){Fr.D(n),Wb("dns-prefetch",n,null)}function KR(n,a){Fr.C(n,a),Wb("preconnect",n,a)}function YR(n,a,i){Fr.L(n,a,i);var c=wi;if(c&&n&&a){var h='link[rel="preload"][as="'+Ln(a)+'"]';a==="image"&&i&&i.imageSrcSet?(h+='[imagesrcset="'+Ln(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(h+='[imagesizes="'+Ln(i.imageSizes)+'"]')):h+='[href="'+Ln(n)+'"]';var p=h;switch(a){case"style":p=xi(n);break;case"script":p=_i(n)}qn.has(p)||(n=g({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:n,as:a},i),qn.set(p,n),c.querySelector(h)!==null||a==="style"&&c.querySelector(Ho(p))||a==="script"&&c.querySelector(qo(p))||(a=c.createElement("link"),Ft(a,"link",n),Ut(a),c.head.appendChild(a)))}}function WR(n,a){Fr.m(n,a);var i=wi;if(i&&n){var c=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+Ln(c)+'"][href="'+Ln(n)+'"]',p=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=_i(n)}if(!qn.has(p)&&(n=g({rel:"modulepreload",href:n},a),qn.set(p,n),i.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(qo(p)))return}c=i.createElement("link"),Ft(c,"link",n),Ut(c),i.head.appendChild(c)}}}function XR(n,a,i){Fr.S(n,a,i);var c=wi;if(c&&n){var h=qs(c).hoistableStyles,p=xi(n);a=a||"default";var x=h.get(p);if(!x){var R={loading:0,preload:null};if(x=c.querySelector(Ho(p)))R.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":a},i),(i=qn.get(p))&&Ih(n,i);var O=x=c.createElement("link");Ut(O),Ft(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 JR(n,a){Fr.X(n,a);var i=wi;if(i&&n){var c=qs(i).hoistableScripts,h=_i(n),p=c.get(h);p||(p=i.querySelector(qo(h)),p||(n=g({src:n,async:!0},a),(a=qn.get(h))&&$h(n,a),p=i.createElement("script"),Ut(p),Ft(p,"link",n),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function QR(n,a){Fr.M(n,a);var i=wi;if(i&&n){var c=qs(i).hoistableScripts,h=_i(n),p=c.get(h);p||(p=i.querySelector(qo(h)),p||(n=g({src:n,async:!0,type:"module"},a),(a=qn.get(h))&&$h(n,a),p=i.createElement("script"),Ut(p),Ft(p,"link",n),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function Xb(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=xi(i.href),i=qs(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=xi(i.href);var p=qs(h).hoistableStyles,x=p.get(n);if(x||(h=h.ownerDocument||h,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,x),(p=h.querySelector(Ho(n)))&&!p._p&&(x.instance=p,x.state.loading=5),qn.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},qn.set(n,i),p||ZR(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=_i(i),i=qs(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 xi(n){return'href="'+Ln(n)+'"'}function Ho(n){return'link[rel="stylesheet"]['+n+"]"}function Jb(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function ZR(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}),Ft(a,"link",i),Ut(a),n.head.appendChild(a))}function _i(n){return'[src="'+Ln(n)+'"]'}function qo(n){return"script[async]"+n}function Qb(n,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+Ln(i.href)+'"]');if(c)return a.instance=c,Ut(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"),Ut(c),Ft(c,"style",h),Hc(c,i.precedence,n),a.instance=c;case"stylesheet":h=xi(i.href);var p=n.querySelector(Ho(h));if(p)return a.state.loading|=4,a.instance=p,Ut(p),p;c=Jb(i),(h=qn.get(h))&&Ih(c,h),p=(n.ownerDocument||n).createElement("link"),Ut(p);var x=p;return x._p=new Promise(function(R,O){x.onload=R,x.onerror=O}),Ft(p,"link",c),a.state.loading|=4,Hc(p,i.precedence,n),a.instance=p;case"script":return p=_i(i.src),(h=n.querySelector(qo(p)))?(a.instance=h,Ut(h),h):(c=i,(h=qn.get(p))&&(c=g({},i),$h(c,h)),n=n.ownerDocument||n,h=n.createElement("script"),Ut(h),Ft(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 Ih(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function $h(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 Zb(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[ao]||p[Ht]||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 e0(n,a,i){n=n.ownerDocument||n,n.head.insertBefore(i,a==="title"?n.querySelector("head > title"):null)}function eA(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 t0(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function tA(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=xi(c.href),p=a.querySelector(Ho(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,Ut(p);return}p=a.ownerDocument||a,c=Jb(c),(h=qn.get(h))&&Ih(c,h),p=p.createElement("link"),Ut(p);var x=p;x._p=new Promise(function(R,O){x.onload=R,x.onerror=O}),Ft(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 Bh=0;function nA(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&&Bh===0&&(Bh=62500*PR());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>Bh?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(rA,n),Gc=null,Vc.call(n))}function rA(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 Vo={$$typeof:N,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function aA(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=ca(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ca(0),this.hiddenUpdates=ca(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 n0(n,a,i,c,h,p,x,R,O,H,Q,re){return n=new aA(n,a,i,x,O,H,Q,re,R),a=1,p===!0&&(a|=24),p=En(3,null,null,a),n.current=p,p.stateNode=n,a=wf(),a.refCount++,n.pooledCache=a,a.refCount++,p.memoizedState={element:c,isDehydrated:i,cache:a},Ef(p),n}function r0(n){return n?(n=Zs,n):Zs}function a0(n,a,i,c,h,p){h=r0(h),c.context===null?c.context=h:c.pendingContext=h,c=ya(a),c.payload={element:i},p=p===void 0?null:p,p!==null&&(c.callback=p),i=va(n,c,a),i!==null&&(hn(i,n,a),_o(i,n,a))}function s0(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<a?i:a}}function Hh(n,a){s0(n,a),(n=n.alternate)&&s0(n,a)}function i0(n){if(n.tag===13||n.tag===31){var a=ns(n,67108864);a!==null&&hn(a,n,67108864),Hh(n,67108864)}}function o0(n){if(n.tag===13||n.tag===31){var a=Nn();a=Is(a);var i=ns(n,a);i!==null&&hn(i,n,a),Hh(n,a)}}var Kc=!0;function sA(n,a,i,c){var h=M.T;M.T=null;var p=K.p;try{K.p=2,qh(n,a,i,c)}finally{K.p=p,M.T=h}}function iA(n,a,i,c){var h=M.T;M.T=null;var p=K.p;try{K.p=8,qh(n,a,i,c)}finally{K.p=p,M.T=h}}function qh(n,a,i,c){if(Kc){var h=Vh(c);if(h===null)Nh(n,a,c,Yc,i),c0(n,c);else if(lA(h,n,a,i,c))c.stopPropagation();else if(c0(n,c),a&4&&-1<oA.indexOf(n)){for(;h!==null;){var p=Hs(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=Nt(p.pendingLanes);if(x!==0){var R=p;for(R.pendingLanes|=2,R.entangledLanes|=2;x;){var O=1<<31-Pt(x);R.entanglements[1]|=O,x&=~O}hr(p),(Je&6)===0&&(kc=rt()+500,Uo(0))}}break;case 31:case 13:R=ns(p,2),R!==null&&hn(R,p,2),Oc(),Hh(p,2)}if(p=Vh(c),p===null&&Nh(n,a,c,Yc,i),p===h)break;h=p}h!==null&&c.stopPropagation()}else Nh(n,a,c,null,i)}}function Vh(n){return n=Gd(n),Gh(n)}var Yc=null;function Gh(n){if(Yc=null,n=Bs(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 l0(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(Rr()){case Ar:return 2;case zs:return 8;case wn:case la:return 32;case xn:return 268435456;default:return 32}default:return 32}}var Fh=!1,Na=null,ka=null,ja=null,Go=new Map,Fo=new Map,Oa=[],oA="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 c0(n,a){switch(n){case"focusin":case"focusout":Na=null;break;case"dragenter":case"dragleave":ka=null;break;case"mouseover":case"mouseout":ja=null;break;case"pointerover":case"pointerout":Go.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fo.delete(a.pointerId)}}function Ko(n,a,i,c,h,p){return n===null||n.nativeEvent!==p?(n={blockedOn:a,domEventName:i,eventSystemFlags:c,nativeEvent:p,targetContainers:[h]},a!==null&&(a=Hs(a),a!==null&&i0(a)),n):(n.eventSystemFlags|=c,a=n.targetContainers,h!==null&&a.indexOf(h)===-1&&a.push(h),n)}function lA(n,a,i,c,h){switch(a){case"focusin":return Na=Ko(Na,n,a,i,c,h),!0;case"dragenter":return ka=Ko(ka,n,a,i,c,h),!0;case"mouseover":return ja=Ko(ja,n,a,i,c,h),!0;case"pointerover":var p=h.pointerId;return Go.set(p,Ko(Go.get(p)||null,n,a,i,c,h)),!0;case"gotpointercapture":return p=h.pointerId,Fo.set(p,Ko(Fo.get(p)||null,n,a,i,c,h)),!0}return!1}function u0(n){var a=Bs(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,Eg(n.priority,function(){o0(i)});return}}else if(a===31){if(a=d(i),a!==null){n.blockedOn=a,Eg(n.priority,function(){o0(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=Vh(n.nativeEvent);if(i===null){i=n.nativeEvent;var c=new i.constructor(i.type,i);Vd=c,i.target.dispatchEvent(c),Vd=null}else return a=Hs(i),a!==null&&i0(a),n.blockedOn=i,!1;a.shift()}return!0}function d0(n,a,i){Wc(n)&&i.delete(a)}function cA(){Fh=!1,Na!==null&&Wc(Na)&&(Na=null),ka!==null&&Wc(ka)&&(ka=null),ja!==null&&Wc(ja)&&(ja=null),Go.forEach(d0),Fo.forEach(d0)}function Xc(n,a){n.blockedOn===a&&(n.blockedOn=null,Fh||(Fh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,cA)))}var Jc=null;function f0(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(Gh(c||i)===null)continue;break}var p=Hs(i);p!==null&&(n.splice(a,3),a-=3,Vf(p,{pending:!0,data:h,method:i.method,action:c},c,h))}}))}function Si(n){function a(O){return Xc(O,n)}Na!==null&&Xc(Na,n),ka!==null&&Xc(ka,n),ja!==null&&Xc(ja,n),Go.forEach(a),Fo.forEach(a);for(var i=0;i<Oa.length;i++){var c=Oa[i];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Oa.length&&(i=Oa[0],i.blockedOn===null);)u0(i),i.blockedOn===null&&Oa.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||f0(i);else if(x){var R=null;if(p&&p.hasAttribute("formAction")){if(h=p,x=p[on]||null)R=x.formAction;else if(Gh(h)!==null)continue}else R=x.action;typeof R=="function"?i[c+1]=R:(i.splice(c,3),c-=3),f0(i)}}}function h0(){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 Kh(n){this._internalRoot=n}Qc.prototype.render=Kh.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(s(409));var i=a.current,c=Nn();a0(i,c,n,a,null,null)},Qc.prototype.unmount=Kh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;a0(n.current,2,null,n,null,null),Oc(),a[$s]=null}};function Qc(n){this._internalRoot=n}Qc.prototype.unstable_scheduleHydration=function(n){if(n){var a=zd();n={blockedOn:null,target:n,priority:a};for(var i=0;i<Oa.length&&a!==0&&a<Oa[i].priority;i++);Oa.splice(i,0,n),i===0&&u0(n)}};var m0=t.version;if(m0!=="19.2.6")throw Error(s(527,m0,"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 uA={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{cr=Zc.inject(uA),Lt=Zc}catch{}}return Wo.createRoot=function(n,a){if(!o(n))throw Error(s(299));var i=!1,c="",h=xv,p=_v,x=Sv;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=n0(n,1,!1,null,null,i,c,null,h,p,x,h0),n[$s]=a.current,Ah(n),new Kh(a)},Wo.hydrateRoot=function(n,a,i){if(!o(n))throw Error(s(299));var c=!1,h="",p=xv,x=_v,R=Sv,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=n0(n,1,!0,a,i??null,c,h,O,p,x,R,h0),a.context=r0(null),i=a.current,c=Nn(),c=Is(c),h=ya(c),h.callback=null,va(i,h,c),i=c,a.current.lanes=i,mt(a,i),hr(a),n[$s]=a.current,Ah(n),new Qc(a)},Wo.version="19.2.6",Wo}var E0;function wA(){if(E0)return Xh.exports;E0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Xh.exports=bA(),Xh.exports}var xA=wA();/**
|
||
* 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 C0="popstate";function T0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function _A(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 jm("",{pathname:u,search:d,hash:f},o.state&&o.state.usr||null,o.state&&o.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,o){return typeof o=="string"?o:fl(o)}return EA(t,r,null,e)}function pt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Er(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function SA(){return Math.random().toString(36).substring(2,10)}function R0(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 jm(e,t,r=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Wi(t):t,state:r,key:t&&t.key||s||SA(),mask:o}}function fl({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Wi(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 EA(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=T0(T)?T:jm(S.location,T,C);m=b()+1;let N=R0(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=T0(T)?T:jm(S.location,T,C);m=b();let N=R0(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 CA(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(C0,g),f=T,()=>{o.removeEventListener(C0,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 CA(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),pt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:fl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function xx(e,t,r="/"){return TA(e,t,r,!1)}function TA(e,t,r,s,o){let l=typeof t=="string"?Wi(t):t,u=Zr(l.pathname||"/",r);if(u==null)return null;let d=RA(e),f=null,m=IA(u);for(let b=0;f==null&&b<d.length;++b)f=zA(d[b],m,s);return f}function RA(e){let t=_x(e);return AA(t),t}function _x(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;pt(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&&(pt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),_x(u.children,t,w,g,f)),!(u.path==null&&!u.index)&&t.push({path:g,score:LA(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 Sx(u.path))l(u,d,!0,m)}),t}function Sx(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=Sx(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 AA(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:PA(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var NA=/^:[\w-]+$/,kA=3,jA=2,OA=1,MA=10,DA=-2,A0=e=>e==="*";function LA(e,t){let r=e.split("/"),s=r.length;return r.some(A0)&&(s+=DA),t&&(s+=jA),r.filter(o=>!A0(o)).reduce((o,l)=>o+(NA.test(l)?kA:l===""?OA:MA),s)}function PA(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 zA(e,t,r=!1){let{routesMeta:s}=e,o={},l="/",u=[];for(let d=0;d<s.length;++d){let f=s[d],m=d===s.length-1,b=l==="/"?t:t.slice(l.length)||"/",g=zu({path:f.relativePath,caseSensitive:f.caseSensitive,end:m},b),w=f.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=zu({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},b)),!g)return null;Object.assign(o,g.params),u.push({params:o,pathname:rr([l,g.pathname]),pathnameBase:qA(rr([l,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(l=rr([l,g.pathnameBase]))}return u}function zu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=UA(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 UA(e,t=!1,r=!0){Er(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 IA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Er(!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 Zr(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 $A=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function BA(e,t="/"){let{pathname:r,search:s="",hash:o=""}=typeof e=="string"?Wi(e):e,l;return r?(r=Cx(r),r.startsWith("/")?l=N0(r.substring(1),"/"):l=N0(r,t)):l=t,{pathname:l,search:VA(s),hash:GA(o)}}function N0(e,t){let r=Uu(t).split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function em(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 HA(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Ex(e){let t=HA(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function yp(e,t,r,s=!1){let o;typeof e=="string"?o=Wi(e):(o={...e},pt(!o.pathname||!o.pathname.includes("?"),em("?","pathname","search",o)),pt(!o.pathname||!o.pathname.includes("#"),em("#","pathname","hash",o)),pt(!o.search||!o.search.includes("#"),em("#","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=BA(o,d),m=u&&u!=="/"&&u.endsWith("/"),b=(l||u===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(m||b)&&(f.pathname+="/"),f}var Cx=e=>e.replace(/\/\/+/g,"/"),rr=e=>Cx(e.join("/")),Uu=e=>e.replace(/\/+$/,""),qA=e=>Uu(e).replace(/^\/*/,"/"),VA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,GA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,FA=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 YA(e){let t=e.map(r=>r.route.path).filter(Boolean);return rr(t)||"/"}var Tx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Rx(e,t){let r=e;if(typeof r!="string"||!$A.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,o=!1;if(Tx)try{let l=new URL(window.location.href),u=r.startsWith("//")?new URL(l.protocol+r):new URL(r),d=Zr(u.pathname,t);u.origin===l.origin&&d!=null?r=d+u.search+u.hash:o=!0}catch{Er(!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 Ax=["POST","PUT","PATCH","DELETE"];new Set(Ax);var WA=["GET",...Ax];new Set(WA);var Xi=v.createContext(null);Xi.displayName="DataRouter";var ld=v.createContext(null);ld.displayName="DataRouterState";var Nx=v.createContext(!1);function XA(){return v.useContext(Nx)}var kx=v.createContext({isTransitioning:!1});kx.displayName="ViewTransition";var JA=v.createContext(new Map);JA.displayName="Fetchers";var QA=v.createContext(null);QA.displayName="Await";var Fn=v.createContext(null);Fn.displayName="Navigation";var Rl=v.createContext(null);Rl.displayName="Location";var ra=v.createContext({outlet:null,matches:[],isDataRoute:!1});ra.displayName="Route";var vp=v.createContext(null);vp.displayName="RouteError";var jx="REACT_ROUTER_ERROR",ZA="REDIRECT",eN="ROUTE_ERROR_RESPONSE";function tN(e){if(e.startsWith(`${jx}:${ZA}:{`))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 nN(e){if(e.startsWith(`${jx}:${eN}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new FA(t.status,t.statusText,t.data)}catch{}}function rN(e,{relative:t}={}){pt(Al(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=v.useContext(Fn),{hash:o,pathname:l,search:u}=Nl(e,{relative:t}),d=l;return r!=="/"&&(d=l==="/"?r:rr([r,l])),s.createHref({pathname:d,search:u,hash:o})}function Al(){return v.useContext(Rl)!=null}function aa(){return pt(Al(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Rl).location}var Ox="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Mx(e){v.useContext(Fn).static||v.useLayoutEffect(e)}function aN(){let{isDataRoute:e}=v.useContext(ra);return e?yN():sN()}function sN(){pt(Al(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Xi),{basename:t,navigator:r}=v.useContext(Fn),{matches:s}=v.useContext(ra),{pathname:o}=aa(),l=JSON.stringify(Ex(s)),u=v.useRef(!1);return Mx(()=>{u.current=!0}),v.useCallback((f,m={})=>{if(Er(u.current,Ox),!u.current)return;if(typeof f=="number"){r.go(f);return}let b=yp(f,JSON.parse(l),o,m.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:rr([t,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[t,r,l,o,e])}v.createContext(null);function Nl(e,{relative:t}={}){let{matches:r}=v.useContext(ra),{pathname:s}=aa(),o=JSON.stringify(Ex(r));return v.useMemo(()=>yp(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function iN(e,t){return Dx(e,t)}function Dx(e,t,r){var T;pt(Al(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(Fn),{matches:o}=v.useContext(ra),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||"";Px(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=aa(),g;if(t){let C=typeof t=="string"?Wi(t):t;pt(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})):xx(e,{pathname:_});Er(m||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Er(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=dN(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(Rl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},S):S}function oN(){let e=gN(),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 lN=v.createElement(oN,null),Lx=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=nN(e.digest);r&&(e=r)}let t=e!==void 0?v.createElement(ra.Provider,{value:this.props.routeContext},v.createElement(vp.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(cN,{error:e},t):t}};Lx.contextType=Nx;var tm=new WeakMap;function cN({children:e,error:t}){let{basename:r}=v.useContext(Fn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=tN(t.digest);if(s){let o=tm.get(t);if(o)throw o;let l=Rx(s.location,r);if(Tx&&!tm.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 tm.set(t,u),u}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function uN({routeContext:e,match:t,children:r}){let s=v.useContext(Xi);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(ra.Provider,{value:e},r)}function dN(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);pt(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:YA(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||lN,u&&(d<0&&w===0?(Px("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(uN,{match:g,routeContext:{outlet:b,matches:C,isDataRoute:s!=null},children:N})};return s&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?v.createElement(Lx,{location:s.location,revalidation:s.revalidation,component:S,error:_,children:A(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:m}):A()},null)}function bp(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fN(e){let t=v.useContext(Xi);return pt(t,bp(e)),t}function hN(e){let t=v.useContext(ld);return pt(t,bp(e)),t}function mN(e){let t=v.useContext(ra);return pt(t,bp(e)),t}function wp(e){let t=mN(e),r=t.matches[t.matches.length-1];return pt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function pN(){return wp("useRouteId")}function gN(){var s;let e=v.useContext(vp),t=hN("useRouteError"),r=wp("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function yN(){let{router:e}=fN("useNavigate"),t=wp("useNavigate"),r=v.useRef(!1);return Mx(()=>{r.current=!0}),v.useCallback(async(o,l={})=>{Er(r.current,Ox),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...l}))},[e,t])}var k0={};function Px(e,t,r){!t&&!k0[e]&&(k0[e]=!0,Er(!1,r))}v.memo(vN);function vN({routes:e,manifest:t,future:r,state:s,isStatic:o,onError:l}){return Dx(e,void 0,{manifest:t,state:s,isStatic:o,onError:l})}function zx(e){pt(!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 bN({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:o,static:l=!1,useTransitions:u}){pt(!Al(),"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=Wi(r));let{pathname:m="/",search:b="",hash:g="",state:w=null,key:_="default",mask:E}=r,S=v.useMemo(()=>{let T=Zr(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 Er(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(Fn.Provider,{value:f},v.createElement(Rl.Provider,{children:t,value:S}))}function wN({children:e,location:t}){return iN(Om(e),t)}function Om(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,Om(s.props.children,l));return}pt(s.type===zx,`[${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>`),pt(!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=Om(s.props.children,l)),r.push(u)}),r}var Ru="get",Au="application/x-www-form-urlencoded";function cd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function xN(e){return cd(e)&&e.tagName.toLowerCase()==="button"}function _N(e){return cd(e)&&e.tagName.toLowerCase()==="form"}function SN(e){return cd(e)&&e.tagName.toLowerCase()==="input"}function EN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function CN(e,t){return e.button===0&&(!t||t==="_self")&&!EN(e)}var eu=null;function TN(){if(eu===null)try{new FormData(document.createElement("form"),0),eu=!1}catch{eu=!0}return eu}var RN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function nm(e){return e!=null&&!RN.has(e)?(Er(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Au}"`),null):e}function AN(e,t){let r,s,o,l,u;if(_N(e)){let d=e.getAttribute("action");s=d?Zr(d,t):null,r=e.getAttribute("method")||Ru,o=nm(e.getAttribute("enctype"))||Au,l=new FormData(e)}else if(xN(e)||SN(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?Zr(f,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Ru,o=nm(e.getAttribute("formenctype"))||nm(d.getAttribute("enctype"))||Au,l=new FormData(d,e),!TN()){let{name:m,type:b,value:g}=e;if(b==="image"){let w=m?`${m}.`:"";l.append(`${w}x`,"0"),l.append(`${w}y`,"0")}else m&&l.append(m,g)}}else{if(cd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Ru,s=null,o=Au,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 xp(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ux(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&&Zr(o.pathname,t)==="/"?o.pathname=`${Uu(t)}/_root.${s}`:o.pathname=`${Uu(o.pathname)}.${s}`,o}async function NN(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 kN(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 jN(e,t,r){let s=await Promise.all(e.map(async o=>{let l=t.routes[o.route.id];if(l){let u=await NN(l,r);return u.links?u.links():[]}return[]}));return LN(s.flat(1).filter(kN).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function j0(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 ON(e,t,{includeHydrateFallback:r}={}){return MN(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 MN(e){return[...new Set(e)]}function DN(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function LN(e,t){let r=new Set;return new Set(t),e.reduce((s,o)=>{let l=JSON.stringify(DN(o));return r.has(l)||(r.add(l),s.push({key:l,link:o})),s},[])}function _p(){let e=v.useContext(Xi);return xp(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function PN(){let e=v.useContext(ld);return xp(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Sp=v.createContext(void 0);Sp.displayName="FrameworkContext";function Ep(){let e=v.useContext(Sp);return xp(e,"You must render this element inside a <HydratedRouter> element"),e}function zN(e,t){let r=v.useContext(Sp),[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:Xo(d,_),onBlur:Xo(f,E),onMouseEnter:Xo(m,_),onMouseLeave:Xo(b,E),onTouchStart:Xo(g,_)}]:[!1,w,{}]}function Xo(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function UN({page:e,...t}){let r=XA(),{router:s}=_p(),o=v.useMemo(()=>xx(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?r?v.createElement($N,{page:e,matches:o,...t}):v.createElement(BN,{page:e,matches:o,...t}):null}function IN(e){let{manifest:t,routeModules:r}=Ep(),[s,o]=v.useState([]);return v.useEffect(()=>{let l=!1;return jN(e,t,r).then(u=>{l||o(u)}),()=>{l=!0}},[e,t,r]),s}function $N({page:e,matches:t,...r}){let s=aa(),{future:o}=Ep(),{basename:l}=_p(),u=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let d=Ux(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 BN({page:e,matches:t,...r}){let s=aa(),{future:o,manifest:l,routeModules:u}=Ep(),{basename:d}=_p(),{loaderData:f,matches:m}=PN(),b=v.useMemo(()=>j0(e,t,m,l,s,"data"),[e,t,m,l,s]),g=v.useMemo(()=>j0(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=Ux(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(()=>ON(g,l),[g,l]),E=IN(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 HN(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var qN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{qN&&(window.__reactRouterVersion="7.15.1")}catch{}function VN({basename:e,children:t,useTransitions:r,window:s}){let o=v.useRef();o.current==null&&(o.current=_A({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(bN,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,useTransitions:r})}var Ix=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$x=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(Fn),N=typeof b=="string"&&Ix.test(b),P=Rx(b,T);b=P.to;let F=rN(b,{relative:o}),$=aa(),L=null;if(d){let fe=yp(d,[],$.mask?$.mask.pathname:"/",!0);T!=="/"&&(fe.pathname=fe.pathname==="/"?T:rr([T,fe.pathname])),L=C.createHref(fe)}let[q,ie,he]=zN(s,E),pe=YN(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:HN(S,ie),target:m,"data-discover":!N&&r==="render"?"true":void 0});return q&&!N?v.createElement(v.Fragment,null,ce,v.createElement(UN,{page:F})):ce});$x.displayName="Link";var GN=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:o=!1,style:l,to:u,viewTransition:d,children:f,...m},b){let g=Nl(u,{relative:m.relative}),w=aa(),_=v.useContext(ld),{navigator:E,basename:S}=v.useContext(Fn),T=_!=null&&ZN(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=Zr(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($x,{...m,"aria-current":q,className:ie,ref:b,style:he,to:u,viewTransition:d},typeof f=="function"?f(L):f)});GN.displayName="NavLink";var FN=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:o,state:l,method:u=Ru,action:d,onSubmit:f,relative:m,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:w,..._},E)=>{let{useTransitions:S}=v.useContext(Fn),T=JN(),C=QN(d,{relative:m}),A=u.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&Ix.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})});FN.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 Bx(e){let t=v.useContext(Xi);return pt(t,KN(e)),t}function YN(e,{target:t,replace:r,mask:s,state:o,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:m}={}){let b=aN(),g=aa(),w=Nl(e,{relative:u});return v.useCallback(_=>{if(CN(_,t)){_.preventDefault();let E=r!==void 0?r:fl(g)===fl(w),S=()=>b(e,{replace:E,mask:s,state:o,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f});m?v.startTransition(()=>S()):S()}},[g,b,w,r,s,o,t,e,l,u,d,f,m])}var WN=0,XN=()=>`__${String(++WN)}__`;function JN(){let{router:e}=Bx("useSubmit"),{basename:t}=v.useContext(Fn),r=pN(),s=e.fetch,o=e.navigate;return v.useCallback(async(l,u={})=>{let{action:d,method:f,encType:m,formData:b,body:g}=AN(l,t);if(u.navigate===!1){let w=u.fetcherKey||XN();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 QN(e,{relative:t}={}){let{basename:r}=v.useContext(Fn),s=v.useContext(ra);pt(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),l={...Nl(e||".",{relative:t})},u=aa();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),f=d.getAll("index");if(f.some(b=>b==="")){d.delete("index"),f.filter(g=>g).forEach(g=>d.append("index",g));let b=d.toString();l.search=b?`?${b}`:""}}return(!e||e===".")&&o.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(l.pathname=l.pathname==="/"?r:rr([r,l.pathname])),fl(l)}function ZN(e,{relative:t}={}){let r=v.useContext(kx);pt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Bx("useViewTransitionState"),o=Nl(e,{relative:t});if(!r.isTransitioning)return!1;let l=Zr(r.currentLocation.pathname,s)||r.currentLocation.pathname,u=Zr(r.nextLocation.pathname,s)||r.nextLocation.pathname;return zu(o.pathname,u)!=null||zu(o.pathname,l)!=null}var kl=wx();const Hx=bx(kl);var wr=function(){return wr=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},wr.apply(this,arguments)};function Ji(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 ek(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 tk(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 nk=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Cp 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 rk extends Cp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class O0 extends Cp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class M0 extends Cp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Mm;(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"})(Mm||(Mm={}));class ak{constructor(t,{headers:r={},customFetch:s,region:o=Mm.Any}={}){this.url=t,this.headers=r,this.region=o,this.fetch=nk(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return ek(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 rk(F)}),A=C.headers.get("x-relay-error");if(A&&A==="true")throw new O0(C);if(!C.ok)throw new M0(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 M0||d instanceof O0?d.context:void 0}}finally{l&&clearTimeout(l)}})}}const qx=3,D0=e=>Math.min(1e3*2**e,3e4),sk=[520,503],Vx=["GET","HEAD","OPTIONS"];var ik=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 L0(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 ok(e,t,r,s){return!(!s||r>=qx||!Vx.includes(e)||!sk.includes(t))}var lk=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"||!Vx.includes(r.method))throw g;if(r.retryEnabled&&u<qx){const w=D0(u);u++,await L0(w,r.signal);continue}throw g}if(ok(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:D0(u);await b.text(),u++,await L0(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 ik(r)}return{success:r===null,error:r,data:s,count:o,status:l,statusText:u}}returns(){return this}overrideTypes(){return this}},ck=class extends lk{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 P0=new RegExp("[,()]");var Di=class extends ck{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"&&P0.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"&&P0.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}},uk=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 Di({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 Di({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 Di({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 Di({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 Di({method:r,url:s,headers:o,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function hl(e){"@babel/helpers - typeof";return hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hl(e)}function dk(e,t){if(hl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(hl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fk(e){var t=dk(e,"string");return hl(t)=="symbol"?t:t+""}function hk(e,t,r){return(t=fk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,s)}return r}function tu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?z0(Object(r),!0).forEach(function(s){hk(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var mk=class Gx{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 uk(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 Gx(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 Di({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 pk{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 gk="2.106.2",yk=`realtime-js/${gk}`,vk="1.0.0",Fx="2.0.0",bk=Fx,wk=1e4,xk=100,Ua={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Kx={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Dm={connecting:"connecting",closing:"closing",closed:"closed"};class _k{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 ct;(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"})(ct||(ct={}));const U0=(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]=Sk(u,e,t,o),l),{}):{}},Sk=(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)?Yx(l,u):Lm(u)},Yx=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return Rk(t,r)}switch(e){case ct.bool:return Ek(t);case ct.float4:case ct.float8:case ct.int2:case ct.int4:case ct.int8:case ct.numeric:case ct.oid:return Ck(t);case ct.json:case ct.jsonb:return Tk(t);case ct.timestamp:return Ak(t);case ct.abstime:case ct.date:case ct.daterange:case ct.int4range:case ct.int8range:case ct.money:case ct.reltime:case ct.text:case ct.time:case ct.timestamptz:case ct.timetz:case ct.tsrange:case ct.tstzrange:return Lm(t);default:return Lm(t)}},Lm=e=>e,Ek=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Ck=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Tk=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Rk=(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=>Yx(t,d))}return e},Ak=e=>typeof e=="string"?e.replace(" ","T"):e,Wx=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var sl=e=>typeof e=="function"?e:function(){return e},Nk=typeof self<"u"?self:null,Li=typeof window<"u"?window:null,vr=Nk||Li||globalThis,kk="2.0.0",jk=1e4,Ok=1e3,br={connecting:0,open:1,closing:2,closed:3},mn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Xr={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Pm={longpoll:"longpoll",websocket:"websocket"},Mk={complete:4},zm="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})}},Xx=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))}},Dk=class{constructor(e,t,r){this.state=mn.closed,this.topic=e,this.params=sl(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new nu(this,Xr.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Xx(()=>{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,Xr.leave,sl({}),this.timeout).send(),this.state=mn.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Xr.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(Xr.close,e)}onError(e){return this.on(Xr.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(Xr.close,"leave")},r=new nu(this,Xr.leave,sl({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,s){return this.topic!==e?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=mn.joining,this.joinPush.resend(e))}trigger(e,t,r,s){let o=this.onMessage(e,t,r,s);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let l=this.bindings.filter(u=>u.event===e&&this.filterBindings(u,t,r));for(let u=0;u<l.length;u++)l[u].callback(o,r,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===mn.closed}isErrored(){return this.state===mn.errored}isJoined(){return this.state===mn.joined}isJoining(){return this.state===mn.joining}isLeaving(){return this.state===mn.leaving}},Iu=class{static request(e,t,r,s,o,l,u){if(vr.XDomainRequest){let d=new vr.XDomainRequest;return this.xdomainRequest(d,e,t,s,o,l,u)}else if(vr.XMLHttpRequest){let d=new vr.XMLHttpRequest;return this.xhrRequest(d,e,t,r,s,o,l,u)}else{if(vr.fetch&&vr.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),vr.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===Mk.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)}`}},Lk=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)},Ei=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(zm)&&(this.authToken=atob(t[1].slice(zm.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=br.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Pm.websocket),"$1/"+Pm.longpoll)}endpointURL(){return Iu.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=br.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===br.open||this.readyState===br.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=br.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=Lk(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=br.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,r,s,o){let l,u=()=>{this.reqs.delete(l),s()};l=Iu.request(e,this.endpointURL(),t,r,this.timeout,u,d=>{this.reqs.delete(l),this.isActive()&&o(d)}),this.reqs.add(l)}},Pk=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:Xr.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}}},zk=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||jk,this.transport=t.transport||vr.WebSocket||Ei,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=vr&&vr.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!==Ei?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;Li&&Li.addEventListener&&(Li.addEventListener("pagehide",o=>{this.conn&&(this.disconnect(),s=this.connectClock)}),Li.addEventListener("pageshow",o=>{s===this.connectClock&&(s=null,this.connect())}),Li.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=o=>t.rejoinAfterMs?t.rejoinAfterMs(o):[1e3,2e3,5e3][o-1]||1e4,this.reconnectAfterMs=o=>t.reconnectAfterMs?t.reconnectAfterMs(o):[10,50,100,150,200,250,500,1e3,2e3][o-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(o,l,u)=>{console.log(`${o}: ${l}`,u)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=sl(t.params||{}),this.endPoint=`${e}/${Pm.websocket}`,this.vsn=t.vsn||kk,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Xx(()=>{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 Ei}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Iu.appendParams(Iu.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=sl(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Ei?this.connectWithFallback(Ei,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 Ei:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${zm}${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(),Ok,"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===br.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(Xr.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case br.connecting:return"connecting";case br.open:return"open";case br.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 Dk(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:s,ref:o,join_ref:l}=e;this.log("push",`${t} ${r} (${l}, ${o})`,s)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:r,event:s,payload:o,ref:l,join_ref:u}=t;if(l&&l===this.pendingHeartbeatRef){const d=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(o.status==="ok"?"ok":"error",d)}catch(f){this.log("error","error in heartbeat callback",f)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${o.status||""} ${r} ${s} ${l&&"("+l+")"||""}`.trim(),o);for(let d=0;d<this.channels.length;d++){const f=this.channels[d];f.isMember(r,s,o,u)&&f.trigger(s,o,l,u)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,s])=>{try{s(...t)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class il{constructor(t,r){const s=Ik(r);this.presence=new Pk(t.getChannel(),s),this.presence.onJoin((o,l,u)=>{const d=il.onJoinPayload(o,l,u);t.getChannel().trigger("presence",d)}),this.presence.onLeave((o,l,u)=>{const d=il.onLeavePayload(o,l,u);t.getChannel().trigger("presence",d)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return il.transformState(this.presence.state)}static transformState(t){return t=Uk(t),Object.getOwnPropertyNames(t).reduce((r,s)=>{const o=t[s];return r[s]=Nu(o),r},{})}static onJoinPayload(t,r,s){const o=I0(r),l=Nu(s);return{event:"join",key:t,currentPresences:o,newPresences:l}}static onLeavePayload(t,r,s){const o=I0(r),l=Nu(s);return{event:"leave",key:t,currentPresences:o,leftPresences:l}}}function Nu(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function Uk(e){return JSON.parse(JSON.stringify(e))}function Ik(e){return(e==null?void 0:e.events)&&{events:e.events}}function I0(e){return e!=null&&e.metas?Nu(e):[]}var $0;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})($0||($0={}));class $k{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new il(this.channel.channelAdapter,r)}}function Bk(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 Hk{constructor(t,r,s){const o=qk(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>xk){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===Ua.joined}isJoined(){return this.state===Ua.joined}isJoining(){return this.state===Ua.joining}isClosed(){return this.state===Ua.closed}isLeaving(){return this.state===Ua.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function qk(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var B0;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(B0||(B0={}));var $i;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})($i||($i={}));var Jr;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Jr||(Jr={}));class ol{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,r={config:{}},s){var o,l;if(this.topic=t,this.params=r,this.socket=s,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Hk(this.socket.socketAdapter,t,this.params),this.presence=new $k(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Wx(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[$i.PRESENCE]&&this.bindings[$i.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(Jr.CHANNEL_ERROR,Bk(_))}),this._onClose(()=>t==null?void 0:t(Jr.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(Jr.SUBSCRIBED);return}this._updatePostgresBindings(_,t)}).receive("error",_=>{this.state=Ua.errored;const E=Object.values(_).join(", ")||"error";t==null||t(Jr.CHANNEL_ERROR,new Error(E,{cause:_}))}).receive("timeout",()=>{t==null||t(Jr.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var s;const o=this.bindings.postgres_changes,l=(s=o==null?void 0:o.length)!==null&&s!==void 0?s:0,u=[];for(let d=0;d<l;d++){const f=o[d],{filter:{event:m,schema:b,table:g,filter:w}}=f,_=t&&t[d];if(_&&_.event===m&&ol.isFilterValueEqual(_.schema,b)&&ol.isFilterValueEqual(_.table,g)&&ol.isFilterValueEqual(_.filter,w))u.push(Object.assign(Object.assign({},f),{id:_.id}));else{this.unsubscribe(),this.state=Ua.errored,r==null||r(Jr.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=u,this.state!=Ua.errored&&r&&r(Jr.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===$i.PRESENCE||t===$i.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}=Kx;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=U0(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=U0(t.columns,t.old_record)),r}}class Vk{constructor(t,r){this.socket=new zk(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()==Dm.connecting}isDisconnecting(){return this.socket.connectionState()==Dm.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const H0={HEARTBEAT_INTERVAL:25e3},Gk=[1e3,2e3,5e3,1e4],Fk=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 Yk(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Kk()}const Wk=`
|
||
addEventListener("message", (e) => {
|
||
if (e.data.event === "start") {
|
||
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
||
}
|
||
});`;class Xk{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 _k,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 Vk(t,o),this.httpEndpoint=Wx(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()||Dm.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const s=`realtime:${t}`,o=this.getChannels().find(l=>l.topic===s);if(o)return o;{const l=new ol(`realtime:${t}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(l),l}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let r,s=!1;if(t)r=t,s=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),r=this.accessTokenValue}else r=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(o=>{const l={access_token:r,version:yk};r&&o.updateJoinPayload(l),o.joinedOnce&&o.channelAdapter.isJoined()&&o.channelAdapter.push(Kx.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([Wk],{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:wk,E.heartbeatIntervalMs=(l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:H0.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:H0.HEARTBEAT_INTERVAL),E.transport=(f=t==null?void 0:t.transport)!==null&&f!==void 0?f:pk.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:Yk(),E.reconnectAfterMs=(b=t==null?void 0:t.reconnectAfterMs)!==null&&b!==void 0?b:(A=>Gk[A-1]||Fk);let S,T;const C=(g=t==null?void 0:t.vsn)!==null&&g!==void 0?g:bk;switch(C){case vk:S=(A,N)=>N(JSON.stringify(A)),T=(A,N)=>N(JSON.parse(A));break;case Fx: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 ml=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((r=t.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Jk(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 Qk(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function Zk(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:o,body:l,headers:u}){const d=Jk(e.baseUrl,s,o),f=await Qk(e.auth),m=await t(d,{method:r,headers:{...l?{"Content-Type":"application/json"}:{},...f,...u},body:l?JSON.stringify(l):void 0}),b=await m.text(),g=(m.headers.get("content-type")||"").includes("application/json"),w=g&&b?JSON.parse(b):b;if(!m.ok){const _=g?w:void 0,E=_==null?void 0:_.error;throw new ml((E==null?void 0:E.message)??`Request failed with status ${m.status}`,{status:m.status,icebergType:E==null?void 0:E.type,icebergCode:E==null?void 0:E.code,details:_})}return{status:m.status,headers:m.headers,data:w}}}}function au(e){return e.join("")}var ej=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 ml&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof ml&&r.status===409)return;throw r}}};function Ci(e){return e.join("")}var tj=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/${Ci(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/${Ci(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/${Ci(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/${Ci(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/${Ci(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/${Ci(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof ml&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof ml&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},nj=class{constructor(e){var s;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Zk({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(s=e.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new ej(this.client,t),this.tableOps=new tj(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}function rj(e,t){if(pl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(pl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function aj(e){var t=rj(e,"string");return pl(t)=="symbol"?t:t+""}function sj(e,t,r){return(t=aj(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q0(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 ke(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?q0(Object(r),!0).forEach(function(s){sj(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q0(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var ud=class extends Error{constructor(e,t="storage",r,s){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function dd(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Um=class extends ud{constructor(e,t,r,s="storage"){super(e,s,t,r),this.name=s==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return ke({},super.toJSON())}},Jx=class extends ud{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function $u(e,t,r){const s=ke({},e),o=t.toLowerCase();for(const l of Object.keys(s))l.toLowerCase()===o&&delete s[l];return s[o]=r,s}function ij(e){const t={};for(const[r,s]of Object.entries(e))t[r.toLowerCase()]=s;return t}const oj=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),lj=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)},Im=e=>{if(Array.isArray(e))return e.map(r=>Im(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]=Im(s)}),t},cj=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),V0=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)},uj=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 Um(V0(u),l,d,s))}).catch(()=>{const u=l+"";t(new Um(o.statusText||`HTTP ${l} error`,l,u,s))})}else t(new Jx(V0(e),e,s))},dj=(e,t,r,s)=>{const o={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!s)return ke(ke({},o),r);if(lj(s)){var l;const u=(t==null?void 0:t.headers)||{};let d;for(const[f,m]of Object.entries(u))f.toLowerCase()==="content-type"&&(d=m);o.headers=$u(u,"Content-Type",(l=d)!==null&&l!==void 0?l:"application/json"),o.body=JSON.stringify(s)}else o.body=s;return t!=null&&t.duplex&&(o.duplex=t.duplex),ke(ke({},o),r)};async function Jo(e,t,r,s,o,l,u){return new Promise((d,f)=>{e(r,dj(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=>uj(m,f,s,u))})}function Qx(e="storage"){return{get:async(t,r,s,o)=>Jo(t,"GET",r,s,o,void 0,e),post:async(t,r,s,o,l)=>Jo(t,"POST",r,o,l,s,e),put:async(t,r,s,o,l)=>Jo(t,"PUT",r,o,l,s,e),head:async(t,r,s,o)=>Jo(t,"HEAD",r,ke(ke({},s),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,s,o,l)=>Jo(t,"DELETE",r,o,l,s,e)}}const fj=Qx("storage"),{get:gl,post:er,put:$m,head:hj,remove:Tp}=fj,jn=Qx("vectors");var Qi=class{constructor(e,t={},r,s="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=ij(t),this.fetch=oj(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=$u(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(dd(r))return{data:null,error:r};throw r}}};let Zx;Zx=Symbol.toStringTag;var mj=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Zx]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(dd(t))return{data:null,error:t};throw t}}};let e_;e_=Symbol.toStringTag;var pj=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[e_]="BlobDownloadBuilder",this.promise=null}asStream(){return new mj(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(dd(t))return{data:null,error:t};throw t}}};const gj={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},G0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var yj=class extends Qi{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=ke(ke({},G0),s);let d=ke(ke({},o.headers),e==="POST"&&{"x-upsert":String(u.upsert)});const f=u.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),f&&l.append("metadata",o.encodeMetadata(f)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),f&&!l.has("metadata")&&l.append("metadata",o.encodeMetadata(f))):(l=r,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,f&&(d["x-metadata"]=o.toBase64(o.encodeMetadata(f))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),s!=null&&s.headers)for(const[w,_]of Object.entries(s.headers))d=$u(d,w,_);const m=o._removeEmptyFolders(t),b=o._getFinalPath(m),g=await(e=="PUT"?$m:er)(o.fetch,`${o.url}/object/${b}`,l,ke({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=ke(ke({},G0),s);let b=ke(ke({},o.headers),{"x-upsert":String(m.upsert)});const g=m.metadata;if(typeof Blob<"u"&&r instanceof Blob?(f=new FormData,f.append("cacheControl",m.cacheControl),g&&f.append("metadata",o.encodeMetadata(g)),f.append("",r)):typeof FormData<"u"&&r instanceof FormData?(f=r,f.has("cacheControl")||f.append("cacheControl",m.cacheControl),g&&!f.has("metadata")&&f.append("metadata",o.encodeMetadata(g))):(f=r,b["cache-control"]=`max-age=${m.cacheControl}`,b["content-type"]=m.contentType,g&&(b["x-metadata"]=o.toBase64(o.encodeMetadata(g))),(typeof ReadableStream<"u"&&f instanceof ReadableStream||f&&typeof f=="object"&&"pipe"in f&&typeof f.pipe=="function")&&!m.duplex&&(m.duplex="half")),s!=null&&s.headers)for(const[w,_]of Object.entries(s.headers))b=$u(b,w,_);return{path:l,fullPath:(await $m(o.fetch,d.toString(),f,ke({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=ke({},r.headers);t!=null&&t.upsert&&(o["x-upsert"]="true");const l=await er(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:o}),u=new URL(r.url+l.url),d=u.searchParams.get("token");if(!d)throw new ud("No token returned by API");return{signedUrl:u.toString(),path:e,token:d}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var s=this;return s.handleOperation(async()=>await er(s.fetch,`${s.url}/object/move`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers}))}async copy(e,t,r){var s=this;return s.handleOperation(async()=>({path:(await er(s.fetch,`${s.url}/object/copy`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers})).Key}))}async createSignedUrl(e,t,r){var s=this;return s.handleOperation(async()=>{let o=s._getFinalPath(e);const l=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let u=await er(s.fetch,`${s.url}/object/sign/${o}`,ke({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=>ke(ke({},d),{},{signedUrl:d.signedURL?encodeURI(`${s.url}${d.signedURL}${u?`&${u}`:""}`):null}))})}download(e,t,r){const s=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(o,t.transform),(t==null?void 0:t.cacheNonce)!=null&&o.set("cacheNonce",String(t.cacheNonce));const l=o.toString(),u=this._getFinalPath(e),d=()=>gl(this.fetch,`${this.url}/${s}/${u}${l?`?${l}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new pj(d,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>Im(await gl(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await hj(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(o){if(t.shouldThrowOnError)throw o;if(dd(o)){var s;const l=o instanceof Um?o.status:o instanceof Jx?(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 Tp(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=ke(ke(ke({},gj),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=ke({},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 vj="2.106.2",jl={"X-Client-Info":`storage-js/${vj}`};var bj=class extends Qi{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=ke(ke({},jl),t);super(l,u,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await gl(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await gl(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await er(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await $m(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 Tp(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():""}},wj=class extends Qi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=ke(ke({},jl),t);super(s,o,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await er(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&r.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&r.set("sortOrder",e.sortOrder),e!=null&&e.search&&r.set("search",e.search);const s=r.toString(),o=s?`${t.url}/bucket?${s}`:`${t.url}/bucket`;return await gl(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Tp(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!cj(e))throw new ud("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new nj({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}}}}})}},xj=class extends Qi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=ke(ke({},jl),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await jn.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await jn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await jn.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await jn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},_j=class extends Qi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=ke(ke({},jl),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await jn.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await jn.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 jn.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await jn.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 jn.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Sj=class extends Qi{constructor(e,t={},r){const s=e.replace(/\/$/,""),o=ke(ke({},jl),{},{"Content-Type":"application/json"},t);super(s,o,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await jn.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await jn.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await jn.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await jn.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},Ej=class extends Sj{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Cj(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},Cj=class extends xj{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,ke(ke({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,ke(ke({},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 Tj(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Tj=class extends _j{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,ke(ke({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,ke(ke({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,ke(ke({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,ke(ke({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,ke(ke({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},Rj=class extends bj{constructor(e,t={},r,s){super(e,t,r,s)}from(e){return new yj(this.url,this.headers,e,this.fetch)}get vectors(){return new Ej(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new wj(this.url+"/iceberg",this.headers,this.fetch)}};const t_="2.106.2",Pi=30*1e3,Bm=3,rm=Bm*Pi,Aj="http://localhost:9999",Nj="supabase.auth.token",kj={"X-Client-Info":`gotrue-js/${t_}`},Hm="X-Supabase-Api-Version",n_={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},jj=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Oj=600*1e3;class Gi 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 Mj extends Gi{constructor(t,r,s){super(t,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function Dj(e){return de(e)&&e.name==="AuthApiError"}class tr extends Gi{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class sa extends Gi{constructor(t,r,s,o){super(t,s,o),this.name=r,this.status=s}}class $t extends sa{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function su(e){return de(e)&&e.name==="AuthSessionMissingError"}class Ti extends sa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class iu extends sa{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ou extends sa{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 Lj(e){return de(e)&&e.name==="AuthImplicitGrantRedirectError"}class F0 extends sa{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 Pj extends sa{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 qm extends sa{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function am(e){return de(e)&&e.name==="AuthRetryableFetchError"}class K0 extends sa{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 Vm extends sa{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Bu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Y0=`
|
||
\r=`.split(""),zj=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Y0.length;t+=1)e[Y0[t].charCodeAt(0)]=-2;for(let t=0;t<Bu.length;t+=1)e[Bu[t].charCodeAt(0)]=t;return e})();function W0(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;r(Bu[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;r(Bu[s]),t.queuedBits-=6}}function r_(e,t,r){const s=zj[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 X0(e){const t=[],r=u=>{t.push(String.fromCodePoint(u))},s={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{$j(u,s,r)};for(let u=0;u<e.length;u+=1)r_(e.charCodeAt(u),o,l);return t.join("")}function Uj(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 Ij(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}Uj(s,t)}}function $j(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 Hi(e){const t=[],r={queue:0,queuedBits:0},s=o=>{t.push(o)};for(let o=0;o<e.length;o+=1)r_(e.charCodeAt(o),r,s);return new Uint8Array(t)}function Bj(e){const t=[];return Ij(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=>W0(o,r,s)),W0(null,r,s),t.join("")}function Hj(e){return Math.round(Date.now()/1e3)+e}function qj(){return Symbol("auth-callback")}const Yt=()=>typeof window<"u"&&typeof document<"u",ps={tested:!1,writable:!1},a_=()=>{if(!Yt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ps.tested)return ps.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),ps.tested=!0,ps.writable=!0}catch{ps.tested=!0,ps.writable=!1}return ps.writable};function Vj(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 s_=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Gj=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",zi=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},gs=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},Kt=async(e,t)=>{await e.removeItem(t)};class fd{constructor(){this.promise=new fd.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}fd.promiseConstructor=Promise;function lu(e){const t=e.split(".");if(t.length!==3)throw new Vm("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!jj.test(t[s]))throw new Vm("JWT not in base64url format");return{header:JSON.parse(X0(t[0])),payload:JSON.parse(X0(t[1])),signature:Hi(t[2]),raw:{header:t[0],payload:t[1]}}}async function Fj(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 Yj(e){return("0"+e.toString(16)).substr(-2)}function Wj(){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,Yj).join("")}async function Xj(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 Jj(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 Xj(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ri(e,t,r=!1){const s=Wj();let o=s;r&&(o+="/recovery"),await zi(e,`${t}-code-verifier`,o);const l=await Jj(s);return[l,s===l?"plain":"s256"]}const Qj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Zj(e){const t=e.headers.get(Hm);if(!t||!t.match(Qj))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function eO(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 tO(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 nO=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Kr(e){if(!nO.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 sm(){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 rO(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 J0(e){return JSON.parse(JSON.stringify(e))}const ws=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)},aO=[502,503,504,520,521,522,523,524,530];async function Q0(e){var t;if(!Gj(e))throw new qm(ws(e),0);if(aO.includes(e.status))throw new qm(ws(e),e.status);let r;try{r=await e.json()}catch(l){throw new tr(ws(l),l)}let s;const o=Zj(e);if(o&&o.getTime()>=n_["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 K0(ws(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new $t}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 K0(ws(r),e.status,r.weak_password.reasons);throw new Mj(ws(r),e.status||500,s)}const sO=(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[Hm]||(l[Hm]=n_["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 iO(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 iO(e,t,r,s,o,l){const u=sO(t,s,o,l);let d;try{d=await e(r,Object.assign({},u))}catch(f){throw console.error(f),new qm(ws(f),0)}if(d.ok||await Q0(d),s!=null&&s.noResolveJson)return d;try{return await d.json()}catch(f){await Q0(f)}}function Vn(e){var t;let r=null;cO(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=Hj(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 Z0(e){const t=Vn(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 Ia(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function oO(e){return{data:e,error:null}}function lO(e){const{action_link:t,email_otp:r,hashed_token:s,redirect_to:o,verification_type:l}=e,u=Ji(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 ew(e){return e}function cO(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const im=["global","local","others"];class uO{_encodePathSegment(t){if(t==="."||t==="..")throw new Gi("Invalid path segment");return encodeURIComponent(t)}constructor({url:t="",headers:r={},fetch:s,experimental:o}){this.url=t,this.headers=r,this.fetch=s_(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=im[0]){if(im.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${im.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:Ia})}catch(s){if(de(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:r}=t,s=Ji(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:lO,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:Ia})}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:ew});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){Kr(t);try{return await be(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Ia})}catch(r){if(de(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){Kr(t);try{return await be(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Ia})}catch(s){if(de(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,r=!1){Kr(t);try{return await be(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ia})}catch(s){if(de(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){Kr(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){Kr(t.userId),Kr(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:ew});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),Kr(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),Kr(t.userId),Kr(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 tw(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const mr={debug:!!(globalThis&&a_()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class i_ extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class nw extends i_{}async function dO(e,t,r){mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;let o;t>0&&(o=setTimeout(()=>{s.abort(),mr.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),mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,l.name);try{return await r()}finally{mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,l.name)}}else{if(t===0)throw mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new nw(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(mr.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 mr.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){mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,u.name);try{return await r()}finally{mr.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 mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new nw(`Lock "${e}" was released because another request stole it`)}throw l}}function fO(){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 o_(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function hO(e){return parseInt(e,16)}function mO(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function pO(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 _=o_(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 Hu extends At{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function gO({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(l_(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 yO({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(l_(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 vO{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 Gm=new vO;function rw(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=Ji(e,["challenge","user","excludeCredentials"]),l=Hi(t).buffer,u=Object.assign(Object.assign({},r),{id:Hi(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:Hi(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function aw(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=Ji(e,["challenge","allowCredentials"]),o=Hi(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:Hi(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function sw(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 iw(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 l_(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function qu(){var e,t;return!!(Yt()&&"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 c_(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Hu("Browser returned unexpected credential type",t)}:{data:null,error:new Hu("Empty credential response",t)}}catch(t){return{data:null,error:gO({error:t,options:e})}}}async function u_(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Hu("Browser returned unexpected credential type",t)}:{data:null,error:new Hu("Empty credential response",t)}}catch(t){return{data:null,error:yO({error:t,options:e})}}}const bO={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},wO={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Vu(...e){const t=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),r=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),s={};for(const o of e)if(o)for(const l in o){const u=o[l];if(u!==void 0)if(Array.isArray(u))s[l]=u;else if(r(u))s[l]=u;else if(t(u)){const d=s[l];t(d)?s[l]=Vu(d,u):s[l]=Vu(u)}else s[l]=u}return s}function xO(e,t){return Vu(bO,e,t||{})}function _O(e,t){return Vu(wO,e,t||{})}class SO{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??Gm.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=xO(d.webauthn.credential_options.publicKey,l==null?void 0:l.create),{data:g,error:w}=await c_({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=_O(d.webauthn.credential_options.publicKey,l==null?void 0:l.request),{data:g,error:w}=await u_(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 Gi("rpId is required for WebAuthn authentication")};try{if(!qu())return{data:null,error:new tr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:s},signal:o},{request:l});if(!u)return{data:null,error:d};const{webauthn:f}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:f.type,rpId:r,rpOrigins:s,credential_response:f.credential_response}})}catch(u){return de(u)?{data:null,error:u}:{data:null,error:new tr("Unexpected error in authenticate",u)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!r)return{data:null,error:new Gi("rpId is required for WebAuthn registration")};try{if(!qu())return{data:null,error:new tr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(b=>{var g;return(g=b.data)===null||g===void 0?void 0:g.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===t&&w.status!=="unverified")}).then(b=>b?this.client.mfa.unenroll({factorId:b==null?void 0:b.id}):void 0),{data:null,error:d};const{data:f,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:o},{create:l});return f?this._verify({factorId:u.id,challengeId:f.challengeId,webauthn:{rpId:r,rpOrigins:s,type:f.webauthn.type,credential_response:f.webauthn.credential_response}}):{data:null,error:m}}catch(u){return de(u)?{data:null,error:u}:{data:null,error:new tr("Unexpected error in register",u)}}}}fO();const EO={url:Aj,storageKey:Nj,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:kj,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function ow(e,t,r){return await r()}const Ai={};class yl{get jwks(){var t,r;return(r=(t=Ai[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Ai[this.storageKey]=Object.assign(Object.assign({},Ai[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Ai[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ai[this.storageKey]=Object.assign(Object.assign({},Ai[this.storageKey]),{cachedAt:t})}constructor(t){var r,s,o,l;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const u=Object.assign(Object.assign({},EO),t);if(this.storageKey=u.storageKey,this.instanceID=(r=yl.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,yl.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!u.debug,typeof u.debug=="function"&&(this.logger=u.debug),this.instanceID>0&&Yt()){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 uO({url:u.url,headers:u.headers,fetch:u.fetch,experimental:this.experimental}),this.url=u.url,this.headers=u.headers,this.fetch=s_(u.fetch),this.lock=u.lock||ow,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&&Yt()&&(!((o=globalThis==null?void 0:globalThis.navigator)===null||o===void 0)&&o.locks)?this.lock=dO:this.lock=ow,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 SO(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:a_()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=tw(this.memoryStorage)),u.userStorage&&(this.userStorage=u.userStorage)):(this.memoryStorage={},this.storage=tw(this.memoryStorage)),Yt()&&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} (${t_}) ${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(Yt()&&(r=Vj(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),Yt()&&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),Lj(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:Vn}),{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 Ri(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:Vn})}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:Vn})}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 Kt(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 Kt(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:Z0})}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:Z0})}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 Ti;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(Yt())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 $=o_(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=hO(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};_=pO(q),E=await N.request({method:"personal_sign",params:[mO(_),$]})}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:Vn});if(T)throw T;if(!S||!S.session||!S.user){const C=new Ti;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(Yt())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:Vn});if(C)throw C;if(!T||!T.session||!T.user){const A=new Ti;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 gs(this.storage,`${this.storageKey}-code-verifier`),[s,o]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new Pj;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:Vn});if(await Kt(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Ti;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 Kt(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:Vn}),{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 Ti;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 Ri(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 Kt(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:Vn});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 Ri(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:oO});return!((l=m.data)===null||l===void 0)&&l.url&&Yt()&&!(!((u=t.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await Kt(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 $t;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 gs(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()<rm:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){const u=await gs(this.userStorage,this.storageKey+"-user");u!=null&&u.user?t.user=u.user:t.user=sm()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};t.user=rO(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:Ia}):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 $t}: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:Ia})})}catch(r){if(de(r))return su(r)&&(await this._removeSession(),await Kt(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 $t;const u=o.session;let d=null,f=null;this.flowType==="pkce"&&t.email!=null&&([d,f]=await Ri(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:Ia});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 Kt(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 $t;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 $t;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(!Yt())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 F0("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 F0("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<=Pi&&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 gs(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&&!(Dj(d)&&(d.status===404||d.status===401||d.status===403)||su(d)))return this._returnResult({error:d})}return t!=="others"&&(await this._removeSession(),await Kt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=qj(),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 Ri(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 Kt(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 Yt()&&!(!((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:Vn}),{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 Ti}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:_}))}catch(o){if(await Kt(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 Fj(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:Vn})),(o,l)=>{const u=200*Math.pow(2,o);return l&&am(l)&&Date.now()+u-s<Pi})}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),Yt()&&!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 gs(this.storage,this.storageKey);if(o&&this.userStorage){let u=await gs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:o.user},await zi(this.userStorage,this.storageKey+"-user",u)),o.user=(t=u==null?void 0:u.user)!==null&&t!==void 0?t:sm()}else if(o&&!o.user&&!o.user){const u=await gs(this.storage,this.storageKey+"-user");u&&(u!=null&&u.user)?(o.user=u.user,await Kt(this.storage,this.storageKey+"-user"),await zi(this.storage,this.storageKey,o)):o.user=sm()}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()<rm;if(this._debug(s,`session has${l?"":" not"} expired with margin of ${rm}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),am(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 $t;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new fd;const{data:l,error:u}=await this._refreshAccessToken(t);if(u)throw u;if(!l.session)throw new $t;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 am(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 Kt(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 zi(this.userStorage,this.storageKey+"-user",{user:r.user});const o=Object.assign({},r);delete o.user;const l=J0(o);await zi(this.storage,this.storageKey,l)}else{const o=J0(r);await zi(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Kt(this.storage,this.storageKey),await Kt(this.storage,this.storageKey+"-code-verifier"),await Kt(this.storage,this.storageKey+"-user"),this.userStorage&&await Kt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Yt()&&(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(),Pi);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)/Pi);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${Pi}ms, refresh threshold is ${Bm} ticks`),o<=Bm&&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 i_)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Yt()||!(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 Ri(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"?sw(t.webauthn.credential_response):iw(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:rw(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:aw(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 $t})})}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 $t});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&&Yt()&&!(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 $t});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&&Yt()&&!(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 $t})})}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 $t})})}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+Oj>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||eO(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=tO(o.alg),g=await crypto.subtle.importKey("jwk",m,b,!0,["verify"]);if(!await crypto.subtle.verify(b,g,u,Bj(`${d}.${f}`)))throw new Vm("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(s){if(de(s))return this._returnResult({data:null,error:s});throw s}}async signInWithPasskey(t){var r,s,o;Qn(this.experimental);try{if(!qu())return this._returnResult({data:null,error:new tr("Browser does not support WebAuthn",null)});const{data:l,error:u}=await this._startPasskeyAuthentication({options:{captchaToken:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}});if(u||!l)return this._returnResult({data:null,error:u});const d=aw(l.options),f=(o=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&o!==void 0?o:Gm.createNewAbortSignal(),{data:m,error:b}=await u_({publicKey:d,signal:f});if(b||!m)return this._returnResult({data:null,error:b??new tr("WebAuthn ceremony failed",null)});const g=iw(m);return this._verifyPasskeyAuthentication({challengeId:l.challenge_id,credential:g})}catch(l){if(de(l))return this._returnResult({data:null,error:l});throw l}}async registerPasskey(t){var r,s;Qn(this.experimental);try{if(!qu())return this._returnResult({data:null,error:new tr("Browser does not support WebAuthn",null)});const{data:o,error:l}=await this._startPasskeyRegistration();if(l||!o)return this._returnResult({data:null,error:l});const u=rw(o.options),d=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:Gm.createNewAbortSignal(),{data:f,error:m}=await c_({publicKey:u,signal:d});if(m||!f)return this._returnResult({data:null,error:m??new tr("WebAuthn ceremony failed",null)});const b=sw(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 $t});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 $t});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:Vn});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 $t});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 $t});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 $t});const{error:l}=await be(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return l?this._returnResult({data:null,error:l}):this._returnResult({data:null,error:null})})}catch(r){if(de(r))return this._returnResult({data:null,error:r});throw r}}}yl.nextInstanceID={};const CO=yl,TO="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 RO={"X-Client-Info":`supabase-js-${tl}/${TO}`},AO={headers:RO},NO={schema:"public"},kO={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},jO={},OO={enabled:!1,respectSamplingDecision:!0};function MO(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 om=null;const DO="@opentelemetry/api";function LO(){return om===null&&(om=import(DO).catch(()=>null)),om}function PO(){return MO(this,void 0,void 0,function*(){try{const e=yield LO();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 zO(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 UO(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(IO(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 IO(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 $O(e){const t=[];try{const r=new URL(e);t.push(r.hostname)}catch{}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function vl(e){"@babel/helpers - typeof";return vl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vl(e)}function BO(e,t){if(vl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(vl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HO(e){var t=BO(e,"string");return vl(t)=="symbol"?t:t+""}function qO(e,t,r){return(t=HO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lw(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 bt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lw(Object(r),!0).forEach(function(s){qO(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lw(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const VO=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),GO=()=>Headers,FO=(e,t,r,s,o)=>{const l=VO(s),u=GO(),d=(o==null?void 0:o.enabled)===!0,f=(o==null?void 0:o.respectSamplingDecision)!==!1,m=d?$O(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,bt(bt({},g),{},{headers:E}))}};async function KO(e,t,r){if(!UO(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const s=await PO();if(!s||!s.traceparent)return null;if(r){const o=zO(s.traceparent);if(o&&!o.isSampled)return null}return s}function cw(e){return typeof e=="boolean"?{enabled:e}:e}function YO(e){return e.endsWith("/")?e:e+"/"}function WO(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=cw(e.tracePropagation),C=cw(t.tracePropagation),A={db:bt(bt({},w),f),auth:bt(bt({},_),m),realtime:bt(bt({},E),b),storage:{},global:bt(bt(bt({},S),g),{},{headers:bt(bt({},(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 XO(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(YO(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var JO=class extends CO{constructor(e){super(e)}},QO=class{constructor(e,t,r){var s,o;this.supabaseUrl=e,this.supabaseKey=t;const l=XO(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:NO,realtime:jO,auth:bt(bt({},kO),{},{storageKey:u}),global:AO,tracePropagation:OO},f=WO(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=FO(t,e,this._getAccessToken.bind(this),f.global.fetch,f.tracePropagation),this.realtime=this._initRealtimeClient(bt({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 mk(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 Rj(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new ak(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 JO({url:this.authUrl.href,headers:bt(bt({},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 Xk(this.realtimeUrl.href,bt(bt({},e),{},{params:bt(bt({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const ZO=(e,t,r)=>new QO(e,t,r);function e2(){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}e2()&&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 t2={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"},n2=["VITE_SUPABASE_URL","VITE_SUPABASE_ANON_KEY"],uw=n2.filter(e=>!t2[e]);if(uw.length>0)throw new Error(`Faltan variables de entorno de Supabase. Revisa tu archivo .env.
|
||
Variables faltantes: ${uw.join(", ")}`);const Pe=ZO("https://dbit.digitalcompass.agency","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE",{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}});function d_(e){return String(e??"").trim().toLowerCase()}function r2(e){return!(e!=null&&e.email)||e.is_active!==!0?null:{email:d_(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 f_(e){const t=d_(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 r2(r)}async function Rp(){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 f_(e.user.email);if(!r)throw new Error("Tu correo no está autorizado para acceder al Tablero CDC.");return r}function a2(){return typeof window>"u"?"/tablero-cdc/":new URL("/tablero-cdc/",window.location.origin).toString()}function s2(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 h_=v.createContext(null);function i2({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 f_(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(s2(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:a2(),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(h_.Provider,{value:{user:t,loading:l,error:d,isGerardo:w,canDeleteProjects:E,canManageInternalPricing:_,canControlPricingSummary:S,loginWithGoogle:b,logout:g},children:e})}function hd(){const e=v.useContext(h_);if(!e)throw new Error("useAuth debe usarse dentro de <AuthProvider>");return e}function dw(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=dw(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():dw(e[o],null)}}}}function Qe(...e){return v.useCallback(en(...e),e)}var o2=Symbol.for("react.lazy"),Gu=gp[" use ".trim().toString()];function l2(e){return typeof e=="object"&&e!==null&&"then"in e}function m_(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===o2&&"_payload"in e&&l2(e._payload)}function md(e){const t=u2(e),r=v.forwardRef((s,o)=>{let{children:l,...u}=s;m_(l)&&typeof Gu=="function"&&(l=Gu(l._payload));const d=v.Children.toArray(l),f=d.find(f2);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 c2=md("Slot");function u2(e){const t=v.forwardRef((r,s)=>{let{children:o,...l}=r;if(m_(o)&&typeof Gu=="function"&&(o=Gu(o._payload)),v.isValidElement(o)){const u=m2(o),d=h2(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 d2=Symbol("radix.slottable");function f2(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===d2}function h2(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 m2(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 p_(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=p_(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function g_(){for(var e,t,r=0,s="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=p_(e))&&(s&&(s+=" "),s+=t);return s}const fw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,hw=g_,Ap=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return hw(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=fw(b)||fw(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 hw(e,u,f,r==null?void 0:r.class,r==null?void 0:r.className)},p2=(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},g2=(e,t)=>({classGroupId:e,validator:t}),y_=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Fu="-",mw=[],y2="arbitrary..",v2=e=>{const t=w2(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return b2(u);const d=u.split(Fu),f=d[0]===""&&d.length>1?1:0;return v_(d,f,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const f=s[u],m=r[u];return f?m?p2(m,f):f:m||mw}return r[u]||mw}}},v_=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],l=r.nextPart.get(o);if(l){const m=v_(e,t+1,l);if(m)return m}const u=r.validators;if(u===null)return;const d=t===0?e.join(Fu):e.slice(t).join(Fu),f=u.length;for(let m=0;m<f;m++){const b=u[m];if(b.validator(d))return b.classGroupId}},b2=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?y2+s:void 0})(),w2=e=>{const{theme:t,classGroups:r}=e;return x2(r,t)},x2=(e,t)=>{const r=y_();for(const s in e){const o=e[s];Np(o,r,s,t)}return r},Np=(e,t,r,s)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];_2(u,t,r,s)}},_2=(e,t,r,s)=>{if(typeof e=="string"){S2(e,t,r);return}if(typeof e=="function"){E2(e,t,r,s);return}C2(e,t,r,s)},S2=(e,t,r)=>{const s=e===""?t:b_(t,e);s.classGroupId=r},E2=(e,t,r,s)=>{if(T2(e)){Np(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(g2(r,e))},C2=(e,t,r,s)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[d,f]=o[u];Np(f,b_(t,d),r,s)}},b_=(e,t)=>{let r=e;const s=t.split(Fu),o=s.length;for(let l=0;l<o;l++){const u=s[l];let d=r.nextPart.get(u);d||(d=y_(),r.nextPart.set(u,d)),r=d}return r},T2=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,R2=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)}}},Fm="!",pw=":",A2=[],gw=(e,t,r,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:o}),N2=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===pw){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(Fm)?(w=g.slice(0,-1),_=!0):g.startsWith(Fm)&&(w=g.slice(1),_=!0);const E=m&&m>f?m-f:void 0;return gw(l,_,w,E)};if(t){const o=t+pw,l=s;s=u=>u.startsWith(o)?l(u.slice(o.length)):gw(A2,!1,u,void 0,!0)}if(r){const o=s;s=l=>r({className:l,parseClassName:o})}return s},k2=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}},j2=e=>({cache:R2(e.cacheSize),parseClassName:N2(e),sortModifiers:k2(e),postfixLookupClassGroupIds:O2(e),...v2(e)}),O2=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},M2=/\s+/,D2=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,d=[],f=e.trim().split(M2);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+Fm: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},L2=(...e)=>{let t=0,r,s,o="";for(;t<e.length;)(r=e[t++])&&(s=w_(r))&&(o&&(o+=" "),o+=s);return o},w_=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=w_(e[s]))&&(r&&(r+=" "),r+=t);return r},P2=(e,...t)=>{let r,s,o,l;const u=f=>{const m=t.reduce((b,g)=>g(b),e());return r=j2(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=D2(f,r);return o(f,b),b};return l=u,(...f)=>l(L2(...f))},z2=[],jt=e=>{const t=r=>r[e]||z2;return t.isThemeGetter=!0,t},x_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,__=/^\((?:(\w[\w-]*):)?(.+)\)$/i,U2=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,I2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$2=/\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$/,B2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,H2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,q2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Da=e=>U2.test(e),ze=e=>!!e&&!Number.isNaN(Number(e)),pr=e=>!!e&&Number.isInteger(Number(e)),lm=e=>e.endsWith("%")&&ze(e.slice(0,-1)),Yr=e=>I2.test(e),S_=()=>!0,V2=e=>$2.test(e)&&!B2.test(e),kp=()=>!1,G2=e=>H2.test(e),F2=e=>q2.test(e),K2=e=>!ge(e)&&!ye(e),Y2=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)),W2=e=>Fa(e,T_,kp),ge=e=>x_.test(e),ys=e=>Fa(e,R_,V2),yw=e=>Fa(e,rM,ze),X2=e=>Fa(e,N_,S_),J2=e=>Fa(e,A_,kp),vw=e=>Fa(e,E_,kp),Q2=e=>Fa(e,C_,F2),cu=e=>Fa(e,k_,G2),ye=e=>__.test(e),Qo=e=>Ds(e,R_),Z2=e=>Ds(e,A_),bw=e=>Ds(e,E_),eM=e=>Ds(e,T_),tM=e=>Ds(e,C_),uu=e=>Ds(e,k_,!0),nM=e=>Ds(e,N_,!0),Fa=(e,t,r)=>{const s=x_.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Ds=(e,t,r=!1)=>{const s=__.exec(e);return s?s[1]?t(s[1]):r:!1},E_=e=>e==="position"||e==="percentage",C_=e=>e==="image"||e==="url",T_=e=>e==="length"||e==="size"||e==="bg-size",R_=e=>e==="length",rM=e=>e==="number",A_=e=>e==="family-name",N_=e=>e==="number"||e==="weight",k_=e=>e==="shadow",aM=()=>{const e=jt("color"),t=jt("font"),r=jt("text"),s=jt("font-weight"),o=jt("tracking"),l=jt("leading"),u=jt("breakpoint"),d=jt("container"),f=jt("spacing"),m=jt("radius"),b=jt("shadow"),g=jt("inset-shadow"),w=jt("text-shadow"),_=jt("drop-shadow"),E=jt("blur"),S=jt("perspective"),T=jt("aspect"),C=jt("ease"),A=jt("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=()=>[Da,"full","auto",...q()],he=()=>[pr,"none","subgrid",ye,ge],pe=()=>["auto",{span:["full",pr,ye,ge]},pr,ye,ge],oe=()=>[pr,"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=()=>[Da,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],J=()=>[Da,"screen","full","dvw","lvw","svw","min","max","fit",...q()],ne=()=>[Da,"screen","full","lh","dvh","lvh","svh","min","max","fit",...q()],X=()=>[e,ye,ge],k=()=>[...P(),bw,vw,{position:[ye,ge]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",eM,W2,{size:[ye,ge]}],Y=()=>[lm,Qo,ys],V=()=>["","none","full",m,ye,ge],Z=()=>["",ze,Qo,ys],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=()=>[ze,lm,bw,vw],xe=()=>["","none",E,ye,ge],Ce=()=>["none",ze,ye,ge],Re=()=>["none",ze,ye,ge],Ze=()=>[ze,ye,ge],Ke=()=>[Da,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yr],breakpoint:[Yr],color:[S_],container:[Yr],"drop-shadow":[Yr],ease:["in","out","in-out"],font:[K2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yr],shadow:[Yr],spacing:["px",ze],text:[Yr],"text-shadow":[Yr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Da,ge,ye,T]}],container:["container"],"container-type":[{"@container":["","normal","size",ye,ge]}],"container-named":[Y2],columns:[{columns:[ze,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:[pr,"auto",ye,ge]}],basis:[{basis:[Da,"full","auto",d,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ze,Da,"auto","initial","none",ge]}],grow:[{grow:["",ze,ye,ge]}],shrink:[{shrink:["",ze,ye,ge]}],order:[{order:[pr,"first","last","none",ye,ge]}],"grid-cols":[{"grid-cols":he()}],"col-start-end":[{col:pe()}],"col-start":[{"col-start":oe()}],"col-end":[{"col-end":oe()}],"grid-rows":[{"grid-rows":he()}],"row-start-end":[{row:pe()}],"row-start":[{"row-start":oe()}],"row-end":[{"row-end":oe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...ce(),"normal"]}],"justify-items":[{"justify-items":[...fe(),"normal"]}],"justify-self":[{"justify-self":["auto",...fe()]}],"align-content":[{content:["normal",...ce()]}],"align-items":[{items:[...fe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...fe(),{baseline:["","last"]}]}],"place-content":[{"place-content":ce()}],"place-items":[{"place-items":[...fe(),"baseline"]}],"place-self":[{"place-self":["auto",...fe()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pbs:[{pbs:q()}],pbe:[{pbe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...ne()]}],"min-block-size":[{"min-block":["auto",...ne()]}],"max-block-size":[{"max-block":["none",...ne()]}],w:[{w:[d,"screen",...K()]}],"min-w":[{"min-w":[d,"screen","none",...K()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Qo,ys]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,nM,X2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lm,ge]}],"font-family":[{font:[Z2,J2,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":[ze,"none",ye,yw]}],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:[ze,"from-font","auto",ye,ys]}],"text-decoration-color":[{decoration:X()}],"underline-offset":[{"underline-offset":[ze,"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:[pr,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"]},pr,ye,ge],radial:["",ye,ge],conic:[pr,ye,ge]},tM,Q2]}],"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":[ze,ye,ge]}],"outline-w":[{outline:["",ze,Qo,ys]}],"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":[ze,ys]}],"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:[ze,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":[ze]}],"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":[ze]}],"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:[ze,ye,ge]}],contrast:[{contrast:[ze,ye,ge]}],"drop-shadow":[{"drop-shadow":["","none",_,uu,cu]}],"drop-shadow-color":[{"drop-shadow":X()}],grayscale:[{grayscale:["",ze,ye,ge]}],"hue-rotate":[{"hue-rotate":[ze,ye,ge]}],invert:[{invert:["",ze,ye,ge]}],saturate:[{saturate:[ze,ye,ge]}],sepia:[{sepia:["",ze,ye,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,ge]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[ze,ye,ge]}],"backdrop-contrast":[{"backdrop-contrast":[ze,ye,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ze,ye,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ze,ye,ge]}],"backdrop-invert":[{"backdrop-invert":["",ze,ye,ge]}],"backdrop-opacity":[{"backdrop-opacity":[ze,ye,ge]}],"backdrop-saturate":[{"backdrop-saturate":[ze,ye,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",ze,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:[ze,"initial",ye,ge]}],ease:[{ease:["linear","initial",C,ye,ge]}],delay:[{delay:[ze,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:Ze()}],"skew-x":[{"skew-x":Ze()}],"skew-y":[{"skew-y":Ze()}],transform:[{transform:[ye,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ke()}],"translate-x":[{"translate-x":Ke()}],"translate-y":[{"translate-y":Ke()}],"translate-z":[{"translate-z":Ke()}],"translate-none":["translate-none"],zoom:[{zoom:[pr,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:[ze,Qo,ys,yw]}],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"]}},sM=P2(aM);function Ee(...e){return sM(g_(e))}const iM=Ap("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ft=v.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,...o},l)=>{const u=s?c2:"button";return y.jsx(u,{className:Ee(iM({variant:t,size:r,className:e})),ref:l,...o})});ft.displayName="Button";function jp({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 oM(){const{loginWithGoogle:e,error:t,loading:r}=hd();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(jp,{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(ft,{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 j_=(...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 lM=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 cM=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 ww=e=>{const t=cM(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 uM={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 dM=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 fM=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,...uM,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:j_("lucide",o),...!l&&!dM(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(fM,{ref:l,iconNode:t,className:j_(`lucide-${lM(ww(e))}`,`lucide-${e}`,s),...o}));return r.displayName=ww(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 hM=[["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"}]],mM=Ve("calculator",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=[["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"}]],gM=Ve("calendar",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 yM=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Rs=Ve("check",yM);/**
|
||
* @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:"m6 9 6 6 6-6",key:"qrunsl"}]],Op=Ve("chevron-down",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 bM=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],wM=Ve("chevron-left",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 xM=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],O_=Ve("chevron-right",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 _M=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],SM=Ve("chevron-up",_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:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],M_=Ve("chevrons-up-down",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 CM=[["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"}]],Ku=Ve("circle-alert",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 TM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],RM=Ve("circle-check",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],NM=Ve("circle",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],jM=Ve("clock-3",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=[["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"}]],Mp=Ve("dollar-sign",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 MM=[["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"}]],DM=Ve("external-link",MM);/**
|
||
* @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=[["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"}]],PM=Ve("eye-off",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:"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"}]],UM=Ve("eye",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:"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"}]],$M=Ve("file-check-corner",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:"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"}]],HM=Ve("history",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],VM=Ve("info",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 GM=[["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"}]],FM=Ve("layout-grid",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 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"}]],YM=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 WM=[["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"}]],XM=Ve("link",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 JM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$a=Ve("loader-circle",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 QM=[["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"}]],ZM=Ve("lock",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 eD=[["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"}]],tD=Ve("log-out",eD);/**
|
||
* @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 nD=[["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"}]],rD=Ve("map-pin",nD);/**
|
||
* @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 aD=[["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"}]],sD=Ve("message-square-plus",aD);/**
|
||
* @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 iD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bl=Ve("plus",iD);/**
|
||
* @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 oD=[["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"}]],lD=Ve("refresh-cw",oD);/**
|
||
* @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 cD=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Yu=Ve("search",cD);/**
|
||
* @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 uD=[["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"}]],dD=Ve("sliders-horizontal",uD);/**
|
||
* @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 fD=[["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"}]],xw=Ve("tag",fD);/**
|
||
* @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 hD=[["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"}]],D_=Ve("trash-2",hD);/**
|
||
* @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 mD=[["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"}]],pD=Ve("user",mD);/**
|
||
* @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 gD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],wl=Ve("x",gD),On=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}));On.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 yD(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 ia(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,vD(o,...t)]}function vD(...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 Mt=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},bD=gp[" useInsertionEffect ".trim().toString()]||Mt;function As({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[o,l,u]=wD({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=xD(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 wD({defaultProp:e,onChange:t}){const[r,s]=v.useState(e),o=v.useRef(r),l=v.useRef(t);return bD(()=>{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 xD(e){return typeof e=="function"}function _D(e){const t=SD(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(CD);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 SD(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=RD(o),d=TD(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 ED=Symbol("radix.slottable");function CD(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ED}function TD(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 RD(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var AD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],je=AD.reduce((e,t)=>{const r=_D(`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 L_(e,t){e&&kl.flushSync(()=>e.dispatchEvent(t))}function _w(e){const t=ND(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(jD);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 ND(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=MD(o),d=OD(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 kD=Symbol("radix.slottable");function jD(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kD}function OD(e,t){const r={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?r[s]=(...d)=>{const f=l(...d);return o(...d),f}:o&&(r[s]=o):s==="style"?r[s]={...o,...l}:s==="className"&&(r[s]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function MD(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Dp(e){const t=e+"CollectionProvider",[r,s]=ia(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=_w(d),m=le.forwardRef((S,T)=>{const{scope:C,children:A}=S,N=l(d,C),P=Qe(T,N.collectionRef);return y.jsx(f,{ref:P,children:A})});m.displayName=d;const b=e+"CollectionItemSlot",g="data-radix-collection-item",w=_w(b),_=le.forwardRef((S,T)=>{const{scope:C,children:A,...N}=S,P=le.useRef(null),F=Qe(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 DD=v.createContext(void 0);function Lp(e){const t=v.useContext(DD);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 LD(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 PD="DismissableLayer",Km="dismissableLayer.update",zD="dismissableLayer.pointerDownOutside",UD="dismissableLayer.focusOutside",Sw,P_=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(P_),[b,g]=v.useState(null),w=(b==null?void 0:b.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=v.useState({}),E=Qe(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=BD(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),$=HD(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 LD(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&&(Sw=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(b)),m.layers.add(b),Ew(),()=>{r&&m.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=Sw)}},[b,w,r,m]),v.useEffect(()=>()=>{b&&(m.layers.delete(b),m.layersWithOutsidePointerEventsDisabled.delete(b),Ew())},[b,m]),v.useEffect(()=>{const L=()=>_({});return document.addEventListener(Km,L),()=>document.removeEventListener(Km,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=PD;var ID="DismissableLayerBranch",$D=v.forwardRef((e,t)=>{const r=v.useContext(P_),s=v.useRef(null),o=Qe(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})});$D.displayName=ID;function BD(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(){z_(zD,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 HD(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&&z_(UD,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 Ew(){const e=new CustomEvent(Km);document.dispatchEvent(e)}function z_(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?L_(o,l):o.dispatchEvent(l)}var cm=0;function pd(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Cw()),document.body.insertAdjacentElement("beforeend",e[1]??Cw()),cm++,()=>{cm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),cm--}},[])}function Cw(){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 um="focusScope.autoFocusOnMount",dm="focusScope.autoFocusOnUnmount",Tw={bubbles:!1,cancelable:!0},qD="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=Qe(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:Pa(g.current,{select:!0})},T=function(N){if(_.paused||!d)return;const P=N.relatedTarget;P!==null&&(d.contains(P)||Pa(g.current,{select:!0}))},C=function(N){if(document.activeElement===document.body)for(const F of N)F.removedNodes.length>0&&Pa(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){Aw.add(_);const S=document.activeElement;if(!d.contains(S)){const C=new CustomEvent(um,Tw);d.addEventListener(um,m),d.dispatchEvent(C),C.defaultPrevented||(VD(WD(U_(d)),{select:!0}),document.activeElement===S&&Pa(d))}return()=>{d.removeEventListener(um,m),setTimeout(()=>{const C=new CustomEvent(dm,Tw);d.addEventListener(dm,b),d.dispatchEvent(C),C.defaultPrevented||Pa(S??document.body,{select:!0}),d.removeEventListener(dm,b),Aw.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]=GD(A);N&&P?!S.shiftKey&&C===P?(S.preventDefault(),r&&Pa(N,{select:!0})):S.shiftKey&&C===N&&(S.preventDefault(),r&&Pa(P,{select:!0})):C===A&&S.preventDefault()}},[r,s,_.paused]);return y.jsx(je.div,{tabIndex:-1,...u,ref:w,onKeyDown:E})});Ml.displayName=qD;function VD(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(Pa(s,{select:t}),document.activeElement!==r)return}function GD(e){const t=U_(e),r=Rw(t,e),s=Rw(t.reverse(),e);return[r,s]}function U_(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 Rw(e,t){for(const r of e)if(!FD(r,{upTo:t}))return r}function FD(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 Pa(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&KD(e)&&t&&e.select()}}var Aw=YD();function YD(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Nw(e,t),e.unshift(t)},remove(t){var r;e=Nw(e,t),(r=e[0])==null||r.resume()}}}function Nw(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function WD(e){return e.filter(t=>t.tagName!=="A")}var XD=gp[" useId ".trim().toString()]||(()=>{}),JD=0;function Qt(e){const[t,r]=v.useState(XD());return Mt(()=>{r(s=>s??String(JD++))},[e]),t?`radix-${t}`:""}const QD=["top","right","bottom","left"],qa=Math.min,kn=Math.max,Wu=Math.round,du=Math.floor,_r=e=>({x:e,y:e}),ZD={left:"right",right:"left",bottom:"top",top:"bottom"};function Ym(e,t,r){return kn(e,qa(t,r))}function ea(e,t){return typeof e=="function"?e(t):e}function ta(e){return e.split("-")[0]}function Zi(e){return e.split("-")[1]}function Pp(e){return e==="x"?"y":"x"}function zp(e){return e==="y"?"height":"width"}function xr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Up(e){return Pp(xr(e))}function eL(e,t,r){r===void 0&&(r=!1);const s=Zi(e),o=Up(e),l=zp(o);let u=o==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=Xu(u)),[u,Xu(u)]}function tL(e){const t=Xu(e);return[Wm(e),t,Wm(t)]}function Wm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kw=["left","right"],jw=["right","left"],nL=["top","bottom"],rL=["bottom","top"];function aL(e,t,r){switch(e){case"top":case"bottom":return r?t?jw:kw:t?kw:jw;case"left":case"right":return t?nL:rL;default:return[]}}function sL(e,t,r,s){const o=Zi(e);let l=aL(ta(e),r==="start",s);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(Wm)))),l}function Xu(e){const t=ta(e);return ZD[t]+e.slice(t.length)}function iL(e){return{top:0,right:0,bottom:0,left:0,...e}}function I_(e){return typeof e!="number"?iL(e):{top:e,right:e,bottom:e,left:e}}function Ju(e){const{x:t,y:r,width:s,height:o}=e;return{width:s,height:o,top:r,left:t,right:t+s,bottom:r+o,x:t,y:r}}function Ow(e,t,r){let{reference:s,floating:o}=e;const l=xr(t),u=Up(t),d=zp(u),f=ta(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(Zi(t)){case"start":_[u]-=w*(r&&m?-1:1);break;case"end":_[u]+=w*(r&&m?-1:1);break}return _}async function oL(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}=ea(t,e),E=I_(_),T=d[w?g==="floating"?"reference":"floating":g],C=Ju(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=Ju(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 lL=50,cL=async(e,t,r)=>{const{placement:s="bottom",strategy:o="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:oL},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}=Ow(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},$&&_<lL&&(_++,typeof $=="object"&&($.placement&&(w=$.placement),$.rects&&(m=$.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):$.rects),{x:b,y:g}=Ow(m,w,f)),S=-1)}return{x:b,y:g,placement:w,strategy:o,middlewareData:E}},uL=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}=ea(e,t)||{};if(m==null)return{};const g=I_(b),w={x:r,y:s},_=Up(o),E=zp(_),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=qa(g[C],ie),pe=qa(g[A],ie),oe=he,ue=L-S[E]-pe,ce=L/2-S[E]/2+q,fe=Ym(oe,ce,ue),M=!f.arrow&&Zi(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}}}),dL=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}=ea(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const C=ta(o),A=xr(d),N=ta(d)===d,P=await(f.isRTL==null?void 0:f.isRTL(m.floating)),F=w||(N||!S?[Xu(d)]:tL(d)),$=E!=="none";!w&&$&&F.push(...sL(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=eL(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!==xr(fe):!1)||he.every(J=>xr(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=xr(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 Mw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Dw(e){return QD.some(t=>e[t]>=0)}const fL=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:o="referenceHidden",...l}=ea(e,t);switch(o){case"referenceHidden":{const u=await s.detectOverflow(t,{...l,elementContext:"reference"}),d=Mw(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Dw(d)}}}case"escaped":{const u=await s.detectOverflow(t,{...l,altBoundary:!0}),d=Mw(u,r.floating);return{data:{escapedOffsets:d,escaped:Dw(d)}}}default:return{}}}}},$_=new Set(["left","top"]);async function hL(e,t){const{placement:r,platform:s,elements:o}=e,l=await(s.isRTL==null?void 0:s.isRTL(o.floating)),u=ta(r),d=Zi(r),f=xr(r)==="y",m=$_.has(u)?-1:1,b=l&&f?-1:1,g=ea(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 mL=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 hL(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}}}}},pL=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}=ea(e,t),b={x:r,y:s},g=await l.detectOverflow(t,m),w=xr(ta(o)),_=Pp(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=Ym(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=Ym(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}}}}}},gL=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}=ea(e,t),b={x:r,y:s},g=xr(o),w=Pp(g);let _=b[w],E=b[g];const S=ea(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=$_.has(ta(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}}}},yL=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}=ea(e,t),b=await u.detectOverflow(t,m),g=ta(o),w=Zi(o),_=xr(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=qa(S-b[T],A),F=qa(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=kn(b.left,0),pe=kn(b.right,0),oe=kn(b.top,0),ue=kn(b.bottom,0);_?q=E-2*(he!==0||pe!==0?he+pe:kn(b.left,b.right)):L=S-2*(oe!==0||ue!==0?oe+ue:kn(b.top,b.bottom))}await f({...t,availableWidth:q,availableHeight:L});const ie=await u.getDimensions(d.floating);return E!==ie.width||S!==ie.height?{reset:{rects:!0}}:{}}}};function gd(){return typeof window<"u"}function eo(e){return B_(e)?(e.nodeName||"").toLowerCase():"#document"}function Mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Cr(e){var t;return(t=(B_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function B_(e){return gd()?e instanceof Node||e instanceof Mn(e).Node:!1}function sr(e){return gd()?e instanceof Element||e instanceof Mn(e).Element:!1}function oa(e){return gd()?e instanceof HTMLElement||e instanceof Mn(e).HTMLElement:!1}function Lw(e){return!gd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mn(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 vL(e){return/^(table|td|th)$/.test(eo(e))}function yd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const bL=/transform|translate|scale|rotate|perspective|filter/,wL=/paint|layout|strict|content/,vs=e=>!!e&&e!=="none";let fm;function Ip(e){const t=sr(e)?ir(e):e;return vs(t.transform)||vs(t.translate)||vs(t.scale)||vs(t.rotate)||vs(t.perspective)||!$p()&&(vs(t.backdropFilter)||vs(t.filter))||bL.test(t.willChange||"")||wL.test(t.contain||"")}function xL(e){let t=Va(e);for(;oa(t)&&!Fi(t);){if(Ip(t))return t;if(yd(t))return null;t=Va(t)}return null}function $p(){return fm==null&&(fm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fm}function Fi(e){return/^(html|body|#document)$/.test(eo(e))}function ir(e){return Mn(e).getComputedStyle(e)}function vd(e){return sr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Va(e){if(eo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Lw(e)&&e.host||Cr(e);return Lw(t)?t.host:t}function H_(e){const t=Va(e);return Fi(t)?e.ownerDocument?e.ownerDocument.body:e.body:oa(t)&&Dl(t)?t:H_(t)}function xl(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=H_(e),l=o===((s=e.ownerDocument)==null?void 0:s.body),u=Mn(o);if(l){const d=Xm(u);return t.concat(u,u.visualViewport||[],Dl(o)?o:[],d&&r?xl(d):[])}else return t.concat(o,xl(o,[],r))}function Xm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function q_(e){const t=ir(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=oa(e),l=o?e.offsetWidth:r,u=o?e.offsetHeight:s,d=Wu(r)!==l||Wu(s)!==u;return d&&(r=l,s=u),{width:r,height:s,$:d}}function Bp(e){return sr(e)?e:e.contextElement}function qi(e){const t=Bp(e);if(!oa(t))return _r(1);const r=t.getBoundingClientRect(),{width:s,height:o,$:l}=q_(t);let u=(l?Wu(r.width):r.width)/s,d=(l?Wu(r.height):r.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const _L=_r(0);function V_(e){const t=Mn(e);return!$p()||!t.visualViewport?_L:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function SL(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Mn(e)?!1:t}function Ns(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),l=Bp(e);let u=_r(1);t&&(s?sr(s)&&(u=qi(s)):u=qi(e));const d=SL(l,r,s)?V_(l):_r(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=Mn(l),_=s&&sr(s)?Mn(s):s;let E=w,S=Xm(E);for(;S&&s&&_!==E;){const T=qi(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=Mn(S),S=Xm(E)}}return Ju({width:b,height:g,x:f,y:m})}function bd(e,t){const r=vd(e).scrollLeft;return t?t.left+r:Ns(Cr(e)).left+r}function G_(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-bd(e,r),o=r.top+t.scrollTop;return{x:s,y:o}}function EL(e){let{elements:t,rect:r,offsetParent:s,strategy:o}=e;const l=o==="fixed",u=Cr(s),d=t?yd(t.floating):!1;if(s===u||d&&l)return r;let f={scrollLeft:0,scrollTop:0},m=_r(1);const b=_r(0),g=oa(s);if((g||!g&&!l)&&((eo(s)!=="body"||Dl(u))&&(f=vd(s)),g)){const _=Ns(s);m=qi(s),b.x=_.x+s.clientLeft,b.y=_.y+s.clientTop}const w=u&&!g&&!l?G_(u,f):_r(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 CL(e){return Array.from(e.getClientRects())}function TL(e){const t=Cr(e),r=vd(e),s=e.ownerDocument.body,o=kn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=kn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-r.scrollLeft+bd(e);const d=-r.scrollTop;return ir(s).direction==="rtl"&&(u+=kn(t.clientWidth,s.clientWidth)-o),{width:o,height:l,x:u,y:d}}const Pw=25;function RL(e,t){const r=Mn(e),s=Cr(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=$p();(!b||b&&t==="fixed")&&(d=o.offsetLeft,f=o.offsetTop)}const m=bd(s);if(m<=0){const b=s.ownerDocument,g=b.body,w=getComputedStyle(g),_=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,E=Math.abs(s.clientWidth-g.clientWidth-_);E<=Pw&&(l-=E)}else m<=Pw&&(l+=m);return{width:l,height:u,x:d,y:f}}function AL(e,t){const r=Ns(e,!0,t==="fixed"),s=r.top+e.clientTop,o=r.left+e.clientLeft,l=oa(e)?qi(e):_r(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 zw(e,t,r){let s;if(t==="viewport")s=RL(e,r);else if(t==="document")s=TL(Cr(e));else if(sr(t))s=AL(t,r);else{const o=V_(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ju(s)}function F_(e,t){const r=Va(e);return r===t||!sr(r)||Fi(r)?!1:ir(r).position==="fixed"||F_(r,t)}function NL(e,t){const r=t.get(e);if(r)return r;let s=xl(e,[],!1).filter(d=>sr(d)&&eo(d)!=="body"),o=null;const l=ir(e).position==="fixed";let u=l?Va(e):e;for(;sr(u)&&!Fi(u);){const d=ir(u),f=Ip(u);!f&&d.position==="fixed"&&(o=null),(l?!f&&!o:!f&&d.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Dl(u)&&!f&&F_(e,u))?s=s.filter(b=>b!==u):o=d,u=Va(u)}return t.set(e,s),s}function kL(e){let{element:t,boundary:r,rootBoundary:s,strategy:o}=e;const u=[...r==="clippingAncestors"?yd(t)?[]:NL(t,this._c):[].concat(r),s],d=zw(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 _=zw(t,u[w],o);f=kn(_.top,f),m=qa(_.right,m),b=qa(_.bottom,b),g=kn(_.left,g)}return{width:m-g,height:b-f,x:g,y:f}}function jL(e){const{width:t,height:r}=q_(e);return{width:t,height:r}}function OL(e,t,r){const s=oa(t),o=Cr(t),l=r==="fixed",u=Ns(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const f=_r(0);function m(){f.x=bd(o)}if(s||!s&&!l)if((eo(t)!=="body"||Dl(o))&&(d=vd(t)),s){const _=Ns(t,!0,l,t);f.x=_.x+t.clientLeft,f.y=_.y+t.clientTop}else o&&m();l&&!s&&o&&m();const b=o&&!s&&!l?G_(o,d):_r(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 hm(e){return ir(e).position==="static"}function Uw(e,t){if(!oa(e)||ir(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Cr(e)===r&&(r=r.ownerDocument.body),r}function K_(e,t){const r=Mn(e);if(yd(e))return r;if(!oa(e)){let o=Va(e);for(;o&&!Fi(o);){if(sr(o)&&!hm(o))return o;o=Va(o)}return r}let s=Uw(e,t);for(;s&&vL(s)&&hm(s);)s=Uw(s,t);return s&&Fi(s)&&hm(s)&&!Ip(s)?r:s||xL(e)||r}const ML=async function(e){const t=this.getOffsetParent||K_,r=this.getDimensions,s=await r(e.floating);return{reference:OL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function DL(e){return ir(e).direction==="rtl"}const LL={convertOffsetParentRelativeRectToViewportRelativeRect:EL,getDocumentElement:Cr,getClippingRect:kL,getOffsetParent:K_,getElementRects:ML,getClientRects:CL,getDimensions:jL,getScale:qi,isElement:sr,isRTL:DL};function Y_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function PL(e,t){let r=null,s;const o=Cr(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:kn(0,qa(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&&!Y_(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 zL(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=Bp(e),b=o||l?[...m?xl(m):[],...t?xl(t):[]]:[];b.forEach(C=>{o&&C.addEventListener("scroll",r,{passive:!0}),l&&C.addEventListener("resize",r)});const g=m&&d?PL(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&&!Y_(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 UL=mL,IL=pL,$L=dL,BL=yL,HL=fL,Iw=uL,qL=gL,VL=(e,t,r)=>{const s=new Map,o={platform:LL,...r},l={...o.platform,_c:s};return cL(e,t,{...o,platform:l})};var GL=typeof document<"u",FL=function(){},ku=GL?v.useLayoutEffect:FL;function Qu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!Qu(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=r;s--!==0;){const l=o[s];if(!(l==="_owner"&&e.$$typeof)&&!Qu(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function W_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $w(e,t){const r=W_(e);return Math.round(t*r)/r}function mm(e){const t=v.useRef(e);return ku(()=>{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);Qu(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=mm(f),pe=mm(o),oe=mm(m),ue=v.useCallback(()=>{if(!$.current||!L.current)return;const J={placement:t,strategy:r,middleware:w};pe.current&&(J.platform=pe.current),VL($.current,L.current,J).then(ne=>{const X={...ne,isPositioned:oe.current!==!1};ce.current&&!Qu(q.current,X)&&(q.current=X,kl.flushSync(()=>{g(X)}))})},[w,t,r,pe,oe]);ku(()=>{m===!1&&q.current.isPositioned&&(q.current.isPositioned=!1,g(J=>({...J,isPositioned:!1})))},[m]);const ce=v.useRef(!1);ku(()=>(ce.current=!0,()=>{ce.current=!1}),[]),ku(()=>{if(P&&($.current=P),F&&(L.current=F),P&&F){if(he.current)return he.current(P,F,ue);ue()}},[P,F,ue,he,ie]);const fe=v.useMemo(()=>({reference:$,floating:L,setReference: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=$w(M.floating,b.x),X=$w(M.floating,b.y);return d?{...J,transform:"translate("+ne+"px, "+X+"px)",...W_(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 YL=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?Iw({element:s.current,padding:o}).fn(r):{}:s?Iw({element:s,padding:o}).fn(r):{}}}},WL=(e,t)=>{const r=UL(e);return{name:r.name,fn:r.fn,options:[e,t]}},XL=(e,t)=>{const r=IL(e);return{name:r.name,fn:r.fn,options:[e,t]}},JL=(e,t)=>({fn:qL(e).fn,options:[e,t]}),QL=(e,t)=>{const r=$L(e);return{name:r.name,fn:r.fn,options:[e,t]}},ZL=(e,t)=>{const r=BL(e);return{name:r.name,fn:r.fn,options:[e,t]}},e5=(e,t)=>{const r=HL(e);return{name:r.name,fn:r.fn,options:[e,t]}},t5=(e,t)=>{const r=YL(e);return{name:r.name,fn:r.fn,options:[e,t]}};var n5="Arrow",X_=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"})})});X_.displayName=n5;var r5=X_;function J_(e){const[t,r]=v.useState(void 0);return Mt(()=>{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 Hp="Popper",[Q_,to]=ia(Hp),[a5,Z_]=Q_(Hp),eS=e=>{const{__scopePopper:t,children:r}=e,[s,o]=v.useState(null);return y.jsx(a5,{scope:t,anchor:s,onAnchorChange:o,children:r})};eS.displayName=Hp;var tS="PopperAnchor",nS=v.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...o}=e,l=Z_(tS,r),u=v.useRef(null),d=Qe(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})});nS.displayName=tS;var qp="PopperContent",[s5,i5]=Q_(qp),rS=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=Z_(qp,r),[C,A]=v.useState(null),N=Qe(t,Ze=>A(Ze)),[P,F]=v.useState(null),$=J_(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(l5),altBoundary:oe},{refs:ce,floatingStyles:fe,placement:M,isPositioned:K,middlewareData:J}=KL({strategy:"fixed",placement:ie,whileElementsMounted:(...Ze)=>zL(...Ze,{animationFrame:_==="always"}),elements:{reference:T.anchor},middleware:[WL({mainAxis:o+q,alignmentAxis:u}),f&&XL({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?JL():void 0,...ue}),f&&QL({...ue}),ZL({...ue,apply:({elements:Ze,rects:Ke,availableWidth:St,availableHeight:Wt})=>{const{width:Bt,height:nn}=Ke.reference,gt=Ze.floating.style;gt.setProperty("--radix-popper-available-width",`${St}px`),gt.setProperty("--radix-popper-available-height",`${Wt}px`),gt.setProperty("--radix-popper-anchor-width",`${Bt}px`),gt.setProperty("--radix-popper-anchor-height",`${nn}px`)}}),P&&t5({element:P,padding:d}),c5({arrowWidth:L,arrowHeight:q}),w&&e5({strategy:"referenceHidden",...ue})]}),[ne,X]=iS(M),k=ar(E);Mt(()=>{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 Mt(()=>{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(s5,{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"}})})})});rS.displayName=qp;var aS="PopperArrow",o5={top:"bottom",right:"left",bottom:"top",left:"right"},sS=v.forwardRef(function(t,r){const{__scopePopper:s,...o}=t,l=i5(aS,s),u=o5[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(r5,{...o,ref:r,style:{...o.style,display:"block"}})})});sS.displayName=aS;function l5(e){return e!==null}var c5=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]=iS(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 iS(e){const[t,r="center"]=e.split("-");return[t,r]}var Vp=eS,wd=nS,Gp=rS,Fp=sS,u5="Portal",Ll=v.forwardRef((e,t)=>{var d;const{container:r,...s}=e,[o,l]=v.useState(!1);Mt(()=>l(!0),[]);const u=r||o&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?Hx.createPortal(y.jsx(je.div,{...s,ref:t}),u):null});Ll.displayName=u5;function d5(e,t){return v.useReducer((r,s)=>t[r][s]??r,e)}var or=e=>{const{present:t,children:r}=e,s=f5(t),o=typeof r=="function"?r({present:s.isPresent}):v.Children.only(r),l=Qe(s.ref,h5(o));return typeof r=="function"||s.isPresent?v.cloneElement(o,{ref:l}):null};or.displayName="Presence";function f5(e){const[t,r]=v.useState(),s=v.useRef(null),o=v.useRef(e),l=v.useRef("none"),u=e?"mounted":"unmounted",[d,f]=d5(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]),Mt(()=>{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]),Mt(()=>{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 h5(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 pm="rovingFocusGroup.onEntryFocus",m5={bubbles:!1,cancelable:!0},Pl="RovingFocusGroup",[Jm,oS,p5]=Dp(Pl),[g5,lS]=ia(Pl,[p5]),[y5,v5]=g5(Pl),cS=v.forwardRef((e,t)=>y.jsx(Jm.Provider,{scope:e.__scopeRovingFocusGroup,children:y.jsx(Jm.Slot,{scope:e.__scopeRovingFocusGroup,children:y.jsx(b5,{...e,ref:t})})}));cS.displayName=Pl;var b5=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),_=Qe(t,w),E=Lp(l),[S,T]=As({prop:u,defaultProp:d??null,onChange:f,caller:Pl}),[C,A]=v.useState(!1),N=ar(m),P=oS(r),F=v.useRef(!1),[$,L]=v.useState(0);return v.useEffect(()=>{const q=w.current;if(q)return q.addEventListener(pm,N),()=>q.removeEventListener(pm,N)},[N]),y.jsx(y5,{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(pm,m5);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);fS(fe,b)}}F.current=!1}),onBlur:we(e.onBlur,()=>A(!1))})})}),uS="RovingFocusGroupItem",dS=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=v5(uS,r),g=b.currentTabStopId===m,w=oS(r),{onFocusableItemAdd:_,onFocusableItemRemove:E,currentTabStopId:S}=b;return v.useEffect(()=>{if(s)return _(),()=>E()},[s,_,E]),y.jsx(Jm.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=_5(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?S5(N,P+1):N.slice(P+1)}setTimeout(()=>fS(N))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:S!=null}):u})})});dS.displayName=uS;var w5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function x5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _5(e,t,r){const s=x5(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return w5[s]}function fS(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function S5(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var E5=cS,C5=dS;function T5(e){const t=R5(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(N5);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 R5(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=j5(o),d=k5(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 A5=Symbol("radix.slottable");function N5(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===A5}function k5(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 j5(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 O5=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ni=new WeakMap,hu=new WeakMap,mu={},gm=0,hS=function(e){return e&&(e.host||hS(e.parentNode))},M5=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=hS(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})},D5=function(e,t,r,s){var o=M5(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=(Ni.get(w)||0)+1,T=(l.get(w)||0)+1;Ni.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(),gm++,function(){u.forEach(function(g){var w=Ni.get(g)-1,_=l.get(g)-1;Ni.set(g,w),l.set(g,_),w||(hu.has(g)||g.removeAttribute(s),hu.delete(g)),_||g.removeAttribute(r)}),gm--,gm||(Ni=new WeakMap,Ni=new WeakMap,hu=new WeakMap,mu={})}},xd=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=O5(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),D5(s,o,r,"aria-hidden")):function(){return null}},ju="right-scroll-bar-position",Ou="width-before-scroll-bar",L5="with-scroll-bars-hidden",P5="--removed-body-scroll-bar-size";function ym(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function z5(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 U5=typeof window<"u"?v.useLayoutEffect:v.useEffect,Bw=new WeakMap;function I5(e,t){var r=z5(null,function(s){return e.forEach(function(o){return ym(o,s)})});return U5(function(){var s=Bw.get(r);if(s){var o=new Set(s),l=new Set(e),u=r.current;o.forEach(function(d){l.has(d)||ym(d,null)}),l.forEach(function(d){o.has(d)||ym(d,u)})}Bw.set(r,e)},[e]),r}function $5(e){return e}function B5(e,t){t===void 0&&(t=$5);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 H5(e){e===void 0&&(e={});var t=B5(null);return t.options=wr({async:!0,ssr:!1},e),t}var mS=function(e){var t=e.sideCar,r=Ji(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,wr({},r))};mS.isSideCarExport=!0;function q5(e,t){return e.useMedium(t),mS}var pS=H5(),vm=function(){},_d=v.forwardRef(function(e,t){var r=v.useRef(null),s=v.useState({onScrollCapture:vm,onWheelCapture:vm,onTouchMoveCapture:vm}),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=Ji(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=w,$=I5([r,t]),L=wr(wr({},P),o);return v.createElement(v.Fragment,null,b&&v.createElement(F,{sideCar:pS,removeScrollBar:m,shards:g,noRelative:_,noIsolation:E,inert:S,setCallbacks:l,allowPinchZoom:!!T,lockRef:r,gapMode:N}),u?v.cloneElement(v.Children.only(d),wr(wr({},L),{ref:$})):v.createElement(A,wr({},L,{className:f,ref:$}),d))});_d.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_d.classNames={fullWidth:Ou,zeroRight:ju};var V5=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function G5(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=V5();return t&&e.setAttribute("nonce",t),e}function F5(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 Y5=function(){var e=0,t=null;return{add:function(r){e==0&&(t=G5())&&(F5(t,r),K5(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},W5=function(){var e=Y5();return function(t,r){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},gS=function(){var e=W5(),t=function(r){var s=r.styles,o=r.dynamic;return e(s,o),null};return t},X5={left:0,top:0,right:0,gap:0},bm=function(e){return parseInt(e||"",10)||0},J5=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[bm(r),bm(s),bm(o)]},Q5=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return X5;var t=J5(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])}},Z5=gS(),Vi="data-scroll-locked",e3=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(L5,` {
|
||
overflow: hidden `).concat(s,`;
|
||
padding-right: `).concat(d,"px ").concat(s,`;
|
||
}
|
||
body[`).concat(Vi,`] {
|
||
overflow: hidden `).concat(s,`;
|
||
overscroll-behavior: contain;
|
||
`).concat([t&&"position: relative ".concat(s,";"),r==="margin"&&`
|
||
padding-left: `.concat(o,`px;
|
||
padding-top: `).concat(l,`px;
|
||
padding-right: `).concat(u,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(d,"px ").concat(s,`;
|
||
`),r==="padding"&&"padding-right: ".concat(d,"px ").concat(s,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(ju,` {
|
||
right: `).concat(d,"px ").concat(s,`;
|
||
}
|
||
|
||
.`).concat(Ou,` {
|
||
margin-right: `).concat(d,"px ").concat(s,`;
|
||
}
|
||
|
||
.`).concat(ju," .").concat(ju,` {
|
||
right: 0 `).concat(s,`;
|
||
}
|
||
|
||
.`).concat(Ou," .").concat(Ou,` {
|
||
margin-right: 0 `).concat(s,`;
|
||
}
|
||
|
||
body[`).concat(Vi,`] {
|
||
`).concat(P5,": ").concat(d,`px;
|
||
}
|
||
`)},Hw=function(){var e=parseInt(document.body.getAttribute(Vi)||"0",10);return isFinite(e)?e:0},t3=function(){v.useEffect(function(){return document.body.setAttribute(Vi,(Hw()+1).toString()),function(){var e=Hw()-1;e<=0?document.body.removeAttribute(Vi):document.body.setAttribute(Vi,e.toString())}},[])},n3=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;t3();var l=v.useMemo(function(){return Q5(o)},[o]);return v.createElement(Z5,{styles:e3(l,!t,o,r?"":"!important")})},Qm=!1;if(typeof window<"u")try{var pu=Object.defineProperty({},"passive",{get:function(){return Qm=!0,!0}});window.addEventListener("test",pu,pu),window.removeEventListener("test",pu,pu)}catch{Qm=!1}var ki=Qm?{passive:!1}:!1,r3=function(e){return e.tagName==="TEXTAREA"},yS=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!r3(e)&&r[t]==="visible")},a3=function(e){return yS(e,"overflowY")},s3=function(e){return yS(e,"overflowX")},qw=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=vS(e,s);if(o){var l=bS(e,s),u=l[1],d=l[2];if(u>d)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},i3=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},o3=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},vS=function(e,t){return e==="v"?a3(t):s3(t)},bS=function(e,t){return e==="v"?i3(t):o3(t)},l3=function(e,t){return e==="h"&&t==="rtl"?-1:1},c3=function(e,t,r,s,o){var l=l3(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 _=bS(e,d),E=_[0],S=_[1],T=_[2],C=S-T-l*E;(E||C)&&vS(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]},Vw=function(e){return[e.deltaX,e.deltaY]},Gw=function(e){return e&&"current"in e?e.current:e},u3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},d3=function(e){return`
|
||
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
||
`)},f3=0,ji=[];function h3(e){var t=v.useRef([]),r=v.useRef([0,0]),s=v.useRef(),o=v.useState(f3++)[0],l=v.useState(gS)[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=tk([e.lockRef.current],(e.shards||[]).map(Gw),!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=qw(L,$);if(!pe)return!0;if(pe?F=L:(F=L==="v"?"h":"v",pe=qw(L,$)),!pe)return!1;if(!s.current&&"changedTouches"in S&&(N||P)&&(s.current=F),!F)return!0;var oe=s.current||F;return c3(oe,T,S,oe==="h"?N:P)},[]),f=v.useCallback(function(S){var T=S;if(!(!ji.length||ji[ji.length-1]!==l)){var C="deltaY"in T?Vw(T):gu(T),A=t.current.filter(function(F){return F.name===T.type&&(F.target===T.target||T.target===F.shadowParent)&&u3(F.delta,C)})[0];if(A&&A.should){T.cancelable&&T.preventDefault();return}if(!A){var N=(u.current.shards||[]).map(Gw).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:m3(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,Vw(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 ji.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:w}),document.addEventListener("wheel",f,ki),document.addEventListener("touchmove",f,ki),document.addEventListener("touchstart",b,ki),function(){ji=ji.filter(function(S){return S!==l}),document.removeEventListener("wheel",f,ki),document.removeEventListener("touchmove",f,ki),document.removeEventListener("touchstart",b,ki)}},[]);var _=e.removeScrollBar,E=e.inert;return v.createElement(v.Fragment,null,E?v.createElement(l,{styles:d3(o)}):null,_?v.createElement(n3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function m3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const p3=q5(pS,h3);var zl=v.forwardRef(function(e,t){return v.createElement(_d,wr({},e,{ref:t,sideCar:p3}))});zl.classNames=_d.classNames;var Zm=["Enter"," "],g3=["ArrowDown","PageUp","Home"],wS=["ArrowUp","PageDown","End"],y3=[...g3,...wS],v3={ltr:[...Zm,"ArrowRight"],rtl:[...Zm,"ArrowLeft"]},b3={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ul="Menu",[_l,w3,x3]=Dp(Ul),[Ls,xS]=ia(Ul,[x3,to,lS]),Sd=to(),_S=lS(),[_3,Ps]=Ls(Ul),[S3,Il]=Ls(Ul),SS=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:o,onOpenChange:l,modal:u=!0}=e,d=Sd(t),[f,m]=v.useState(null),b=v.useRef(!1),g=ar(l),w=Lp(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(Vp,{...d,children:y.jsx(_3,{scope:t,open:r,onOpenChange:g,content:f,onContentChange:m,children:y.jsx(S3,{scope:t,onClose:v.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:b,dir:w,modal:u,children:s})})})};SS.displayName=Ul;var E3="MenuAnchor",Kp=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,o=Sd(r);return y.jsx(wd,{...o,...s,ref:t})});Kp.displayName=E3;var Yp="MenuPortal",[C3,ES]=Ls(Yp,{forceMount:void 0}),CS=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:o}=e,l=Ps(Yp,t);return y.jsx(C3,{scope:t,forceMount:r,children:y.jsx(or,{present:r||l.open,children:y.jsx(Ll,{asChild:!0,container:o,children:s})})})};CS.displayName=Yp;var Gn="MenuContent",[T3,Wp]=Ls(Gn),TS=v.forwardRef((e,t)=>{const r=ES(Gn,e.__scopeMenu),{forceMount:s=r.forceMount,...o}=e,l=Ps(Gn,e.__scopeMenu),u=Il(Gn,e.__scopeMenu);return y.jsx(_l.Provider,{scope:e.__scopeMenu,children:y.jsx(or,{present:s||l.open,children:y.jsx(_l.Slot,{scope:e.__scopeMenu,children:u.modal?y.jsx(R3,{...o,ref:t}):y.jsx(A3,{...o,ref:t})})})})}),R3=v.forwardRef((e,t)=>{const r=Ps(Gn,e.__scopeMenu),s=v.useRef(null),o=Qe(t,s);return v.useEffect(()=>{const l=s.current;if(l)return xd(l)},[]),y.jsx(Xp,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:we(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),A3=v.forwardRef((e,t)=>{const r=Ps(Gn,e.__scopeMenu);return y.jsx(Xp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),N3=T5("MenuContent.ScrollLock"),Xp=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(Gn,r),C=Il(Gn,r),A=Sd(r),N=_S(r),P=w3(r),[F,$]=v.useState(null),L=v.useRef(null),q=Qe(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:N3,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=B3(Y,X,I),Z=(ee=k.find(ae=>ae.textValue===V))==null?void 0:ee.ref.current;(function ae(xe){he.current=xe,window.clearTimeout(ie.current),xe!==""&&(ie.current=window.setTimeout(()=>ae(""),1e3))})(X),Z&&setTimeout(()=>Z.focus())};v.useEffect(()=>()=>window.clearTimeout(ie.current),[]),pd();const J=v.useCallback(ne=>{var k,j;return ue.current===((k=oe.current)==null?void 0:k.side)&&q3(ne,(j=oe.current)==null?void 0:j.area)},[]);return y.jsx(T3,{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(E5,{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(Gp,{role:"menu","aria-orientation":"vertical","data-state":HS(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||!y3.includes(ne.key))return;ne.preventDefault();const Z=P().filter(z=>!z.disabled).map(z=>z.ref.current);wS.includes(ne.key)&&Z.reverse(),I3(Z)}),onBlur:we(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(ie.current),he.current="")}),onPointerMove:we(e.onPointerMove,Sl(ne=>{const X=ne.target,k=ce.current!==ne.clientX;if(ne.currentTarget.contains(X)&&k){const j=ne.clientX>ce.current?"right":"left";ue.current=j,ce.current=ne.clientX}}))})})})})})})});TS.displayName=Gn;var k3="MenuGroup",Jp=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{role:"group",...s,ref:t})});Jp.displayName=k3;var j3="MenuLabel",RS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{...s,ref:t})});RS.displayName=j3;var Zu="MenuItem",Fw="menu.itemSelect",Ed=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...o}=e,l=v.useRef(null),u=Il(Zu,e.__scopeMenu),d=Wp(Zu,e.__scopeMenu),f=Qe(t,l),m=v.useRef(!1),b=()=>{const g=l.current;if(!r&&g){const w=new CustomEvent(Fw,{bubbles:!0,cancelable:!0});g.addEventListener(Fw,_=>s==null?void 0:s(_),{once:!0}),L_(g,w),w.defaultPrevented?m.current=!1:u.onClose()}};return y.jsx(AS,{...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===" "||Zm.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});Ed.displayName=Zu;var AS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:o,...l}=e,u=Wp(Zu,r),d=_S(r),f=v.useRef(null),m=Qe(t,f),[b,g]=v.useState(!1),[w,_]=v.useState("");return v.useEffect(()=>{const E=f.current;E&&_((E.textContent??"").trim())},[l.children]),y.jsx(_l.ItemSlot,{scope:r,disabled:s,textValue:o??w,children:y.jsx(C5,{asChild:!0,...d,focusable:!s,children:y.jsx(je.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:m,onPointerMove:we(e.onPointerMove,Sl(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:we(e.onPointerLeave,Sl(E=>u.onItemLeave(E))),onFocus:we(e.onFocus,()=>g(!0)),onBlur:we(e.onBlur,()=>g(!1))})})})}),O3="MenuCheckboxItem",NS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...o}=e;return y.jsx(DS,{scope:e.__scopeMenu,checked:r,children:y.jsx(Ed,{role:"menuitemcheckbox","aria-checked":ed(r)?"mixed":r,...o,ref:t,"data-state":Zp(r),onSelect:we(o.onSelect,()=>s==null?void 0:s(ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});NS.displayName=O3;var kS="MenuRadioGroup",[M3,D3]=Ls(kS,{value:void 0,onValueChange:()=>{}}),jS=v.forwardRef((e,t)=>{const{value:r,onValueChange:s,...o}=e,l=ar(s);return y.jsx(M3,{scope:e.__scopeMenu,value:r,onValueChange:l,children:y.jsx(Jp,{...o,ref:t})})});jS.displayName=kS;var OS="MenuRadioItem",MS=v.forwardRef((e,t)=>{const{value:r,...s}=e,o=D3(OS,e.__scopeMenu),l=r===o.value;return y.jsx(DS,{scope:e.__scopeMenu,checked:l,children:y.jsx(Ed,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":Zp(l),onSelect:we(s.onSelect,()=>{var u;return(u=o.onValueChange)==null?void 0:u.call(o,r)},{checkForDefaultPrevented:!1})})})});MS.displayName=OS;var Qp="MenuItemIndicator",[DS,L3]=Ls(Qp,{checked:!1}),LS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...o}=e,l=L3(Qp,r);return y.jsx(or,{present:s||ed(l.checked)||l.checked===!0,children:y.jsx(je.span,{...o,ref:t,"data-state":Zp(l.checked)})})});LS.displayName=Qp;var P3="MenuSeparator",PS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return y.jsx(je.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});PS.displayName=P3;var z3="MenuArrow",zS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,o=Sd(r);return y.jsx(Fp,{...o,...s,ref:t})});zS.displayName=z3;var U3="MenuSub",[o$,US]=Ls(U3),nl="MenuSubTrigger",IS=v.forwardRef((e,t)=>{const r=Ps(nl,e.__scopeMenu),s=Il(nl,e.__scopeMenu),o=US(nl,e.__scopeMenu),l=Wp(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(Kp,{asChild:!0,...m,children:y.jsx(AS,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":HS(r.open),...e,ref:en(t,o.onTriggerChange),onClick:g=>{var w;(w=e.onClick)==null||w.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:we(e.onPointerMove,Sl(g=>{l.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),b()},100))})),onPointerLeave:we(e.onPointerLeave,Sl(g=>{var _,E;b();const w=(_=r.content)==null?void 0:_.getBoundingClientRect();if(w){const S=(E=r.content)==null?void 0:E.dataset.side,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===" "||v3[s.dir].includes(g.key)&&(r.onOpenChange(!0),(_=r.content)==null||_.focus(),g.preventDefault())})})})});IS.displayName=nl;var $S="MenuSubContent",BS=v.forwardRef((e,t)=>{const r=ES(Gn,e.__scopeMenu),{forceMount:s=r.forceMount,...o}=e,l=Ps(Gn,e.__scopeMenu),u=Il(Gn,e.__scopeMenu),d=US($S,e.__scopeMenu),f=v.useRef(null),m=Qe(t,f);return y.jsx(_l.Provider,{scope:e.__scopeMenu,children:y.jsx(or,{present:s||l.open,children:y.jsx(_l.Slot,{scope:e.__scopeMenu,children:y.jsx(Xp,{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=b3[u.dir].includes(b.key);g&&w&&(l.onOpenChange(!1),(_=d.trigger)==null||_.focus(),b.preventDefault())})})})})})});BS.displayName=$S;function HS(e){return e?"open":"closed"}function ed(e){return e==="indeterminate"}function Zp(e){return ed(e)?"indeterminate":e?"checked":"unchecked"}function I3(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function $3(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function B3(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=$3(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 H3(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 q3(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return H3(r,t)}function Sl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var V3=SS,G3=Kp,F3=CS,K3=TS,Y3=Jp,W3=RS,X3=Ed,J3=NS,Q3=jS,Z3=MS,eP=LS,tP=PS,nP=zS,rP=IS,aP=BS,Cd="DropdownMenu",[sP]=ia(Cd,[xS]),tn=xS(),[iP,qS]=sP(Cd),VS=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:Cd});return y.jsx(iP,{scope:t,triggerId:Qt(),triggerRef:m,contentId:Qt(),open:b,onOpenChange:g,onOpenToggle:v.useCallback(()=>g(w=>!w),[g]),modal:d,children:y.jsx(V3,{...f,open:b,onOpenChange:g,dir:s,modal:d,children:r})})};VS.displayName=Cd;var GS="DropdownMenuTrigger",FS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...o}=e,l=qS(GS,r),u=tn(r);return y.jsx(G3,{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())})})})});FS.displayName=GS;var oP="DropdownMenuPortal",KS=e=>{const{__scopeDropdownMenu:t,...r}=e,s=tn(t);return y.jsx(F3,{...s,...r})};KS.displayName=oP;var YS="DropdownMenuContent",WS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=qS(YS,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)"}})});WS.displayName=YS;var lP="DropdownMenuGroup",cP=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(Y3,{...o,...s,ref:t})});cP.displayName=lP;var uP="DropdownMenuLabel",XS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(W3,{...o,...s,ref:t})});XS.displayName=uP;var dP="DropdownMenuItem",JS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(X3,{...o,...s,ref:t})});JS.displayName=dP;var fP="DropdownMenuCheckboxItem",QS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(J3,{...o,...s,ref:t})});QS.displayName=fP;var hP="DropdownMenuRadioGroup",mP=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(Q3,{...o,...s,ref:t})});mP.displayName=hP;var pP="DropdownMenuRadioItem",ZS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(Z3,{...o,...s,ref:t})});ZS.displayName=pP;var gP="DropdownMenuItemIndicator",eE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(eP,{...o,...s,ref:t})});eE.displayName=gP;var yP="DropdownMenuSeparator",tE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(tP,{...o,...s,ref:t})});tE.displayName=yP;var vP="DropdownMenuArrow",bP=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(nP,{...o,...s,ref:t})});bP.displayName=vP;var wP="DropdownMenuSubTrigger",nE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(rP,{...o,...s,ref:t})});nE.displayName=wP;var xP="DropdownMenuSubContent",rE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,o=tn(r);return y.jsx(aP,{...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)"}})});rE.displayName=xP;var _P=VS,SP=FS,EP=KS,aE=WS,sE=XS,iE=JS,oE=QS,lE=ZS,cE=eE,uE=tE,dE=nE,fE=rE;const CP=_P,TP=SP,RP=v.forwardRef(({className:e,inset:t,children:r,...s},o)=>y.jsxs(dE,{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(O_,{className:"ml-auto"})]}));RP.displayName=dE.displayName;const AP=v.forwardRef(({className:e,...t},r)=>y.jsx(fE,{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}));AP.displayName=fE.displayName;const hE=v.forwardRef(({className:e,sideOffset:t=4,...r},s)=>y.jsx(EP,{children:y.jsx(aE,{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})}));hE.displayName=aE.displayName;const mE=v.forwardRef(({className:e,inset:t,...r},s)=>y.jsx(iE,{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}));mE.displayName=iE.displayName;const NP=v.forwardRef(({className:e,children:t,checked:r,...s},o)=>y.jsxs(oE,{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(cE,{children:y.jsx(Rs,{className:"h-4 w-4"})})}),t]}));NP.displayName=oE.displayName;const kP=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(lE,{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(cE,{children:y.jsx(NM,{className:"h-2 w-2 fill-current"})})}),t]}));kP.displayName=lE.displayName;const jP=v.forwardRef(({className:e,inset:t,...r},s)=>y.jsx(sE,{ref:s,className:Ee("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));jP.displayName=sE.displayName;const pE=v.forwardRef(({className:e,...t},r)=>y.jsx(uE,{ref:r,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));pE.displayName=uE.displayName;function OP(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,MP(o,...t)]}function MP(...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 DP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eg=DP.reduce((e,t)=>{const r=md(`Primitive.${t}`),s=v.forwardRef((o,l)=>{const{asChild:u,...d}=o,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),wm={exports:{}},xm={};/**
|
||
* @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 Kw;function LP(){if(Kw)return xm;Kw=1;var e=od();function t(g,w){return g===w&&(g!==0||1/g===1/w)||g!==g&&w!==w}var r=typeof Object.is=="function"?Object.is:t,s=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function d(g,w){var _=w(),E=s({inst:{value:_,getSnapshot:w}}),S=E[0].inst,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 xm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,xm}var Yw;function PP(){return Yw||(Yw=1,wm.exports=LP()),wm.exports}var zP=PP();function UP(){return zP.useSyncExternalStore(IP,()=>!0,()=>!1)}function IP(){return()=>{}}var tg="Avatar",[$P]=OP(tg),[BP,gE]=$P(tg),yE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[o,l]=v.useState("idle");return y.jsx(BP,{scope:r,imageLoadingStatus:o,onImageLoadingStatusChange:l,children:y.jsx(eg.span,{...s,ref:t})})});yE.displayName=tg;var vE="AvatarImage",bE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:o=()=>{},...l}=e,u=gE(vE,r),d=HP(s,l),f=ar(m=>{o(m),u.onImageLoadingStatusChange(m)});return Mt(()=>{d!=="idle"&&f(d)},[d,f]),d==="loaded"?y.jsx(eg.img,{...l,ref:t,src:s}):null});bE.displayName=vE;var wE="AvatarFallback",xE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...o}=e,l=gE(wE,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(eg.span,{...o,ref:t}):null});xE.displayName=wE;function Ww(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function HP(e,{referrerPolicy:t,crossOrigin:r}){const s=UP(),o=v.useRef(null),l=s?(o.current||(o.current=new window.Image),o.current):null,[u,d]=v.useState(()=>Ww(l,e));return Mt(()=>{d(Ww(l,e))},[l,e]),Mt(()=>{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 _E=yE,SE=bE,EE=xE;const CE=v.forwardRef(({className:e,...t},r)=>y.jsx(_E,{ref:r,className:Ee("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));CE.displayName=_E.displayName;const TE=v.forwardRef(({className:e,...t},r)=>y.jsx(SE,{ref:r,className:Ee("aspect-square h-full w-full",e),...t}));TE.displayName=SE.displayName;const RE=v.forwardRef(({className:e,...t},r)=>y.jsx(EE,{ref:r,className:Ee("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));RE.displayName=EE.displayName;const qP=Ap("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Cs({className:e,variant:t,...r}){return y.jsx("div",{className:Ee(qP({variant:t}),e),...r})}const VP=["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(),ng={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",WMC:"Willy"},AE=Object.keys(ng).sort(),GP=["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"],FP=["Aprobado","No aprobado","Stand by","Aprobado /no ejecutado","Pre aprobado","On going","Sin respuesta"],ep=[{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"}],KP=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];function NE(e){var t;return((t=ep.find(r=>r.id===e))==null?void 0:t.hex)??ep[0].hex}function YP({project:e,onClick:t}){const r=!!e.status,s=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t())};return y.jsxs("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:s,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:o=>{r||(o.currentTarget.style.boxShadow="var(--shadow-hover)")},onMouseLeave:o=>{o.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":NE(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(xw,{className:"w-3.5 h-3.5"}),label:"Cliente",value:e.cliente}),y.jsx(yu,{icon:y.jsx(xw,{className:"w-3.5 h-3.5"}),label:"Marca",value:e.marca}),y.jsx(yu,{icon:y.jsx(rD,{className:"w-3.5 h-3.5"}),label:"País",value:e.bu}),y.jsx(yu,{icon:y.jsx(pD,{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(YM,{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($M,{className:"w-3 h-3"})," AF·",e.afLinks.length]})]}),y.jsx("div",{className:"flex items-center gap-1.5",children: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(RM,{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 WP(e){const t=XP(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(QP);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 XP(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=e4(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 JP=Symbol("radix.slottable");function QP(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JP}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 e4(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 Td="Dialog",[kE]=ia(Td),[t4,lr]=kE(Td),jE=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:Td});return y.jsx(t4,{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})};jE.displayName=Td;var OE="DialogTrigger",n4=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(OE,r),l=Qe(t,o.triggerRef);return y.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":sg(o.open),...s,ref:l,onClick:we(e.onClick,o.onOpenToggle)})});n4.displayName=OE;var rg="DialogPortal",[r4,ME]=kE(rg,{forceMount:void 0}),DE=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:o}=e,l=lr(rg,t);return y.jsx(r4,{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})}))})};DE.displayName=rg;var td="DialogOverlay",LE=v.forwardRef((e,t)=>{const r=ME(td,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,l=lr(td,e.__scopeDialog);return l.modal?y.jsx(or,{present:s||l.open,children:y.jsx(s4,{...o,ref:t})}):null});LE.displayName=td;var a4=WP("DialogOverlay.RemoveScroll"),s4=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(td,r);return y.jsx(zl,{as:a4,allowPinchZoom:!0,shards:[o.contentRef],children:y.jsx(je.div,{"data-state":sg(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ks="DialogContent",PE=v.forwardRef((e,t)=>{const r=ME(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(i4,{...o,ref:t}):y.jsx(o4,{...o,ref:t})})});PE.displayName=ks;var i4=v.forwardRef((e,t)=>{const r=lr(ks,e.__scopeDialog),s=v.useRef(null),o=Qe(t,r.contentRef,s);return v.useEffect(()=>{const l=s.current;if(l)return xd(l)},[]),y.jsx(zE,{...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())})}),o4=v.forwardRef((e,t)=>{const r=lr(ks,e.__scopeDialog),s=v.useRef(!1),o=v.useRef(!1);return y.jsx(zE,{...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()}})}),zE=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,...u}=e,d=lr(ks,r),f=v.useRef(null),m=Qe(t,f);return pd(),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":sg(d.open),...u,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),y.jsxs(y.Fragment,{children:[y.jsx(l4,{titleId:d.titleId}),y.jsx(u4,{contentRef:f,descriptionId:d.descriptionId})]})]})}),ag="DialogTitle",UE=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(ag,r);return y.jsx(je.h2,{id:o.titleId,...s,ref:t})});UE.displayName=ag;var IE="DialogDescription",$E=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(IE,r);return y.jsx(je.p,{id:o.descriptionId,...s,ref:t})});$E.displayName=IE;var BE="DialogClose",HE=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=lr(BE,r);return y.jsx(je.button,{type:"button",...s,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});HE.displayName=BE;function sg(e){return e?"open":"closed"}var qE="DialogTitleWarning",[l$,VE]=yD(qE,{contentName:ks,titleName:ag,docsSlug:"dialog"}),l4=({titleId:e})=>{const t=VE(qE),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},c4="DialogDescriptionWarning",u4=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${VE(c4).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},GE=jE,FE=DE,ig=LE,og=PE,KE=UE,YE=$E,d4=HE;const f4=GE,h4=FE,WE=v.forwardRef(({className:e,...t},r)=>y.jsx(ig,{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}));WE.displayName=ig.displayName;const XE=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(h4,{children:[y.jsx(WE,{}),y.jsxs(og,{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(d4,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background cursor-pointer transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[y.jsx(wl,{className:"h-4 w-4"}),y.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));XE.displayName=og.displayName;const JE=({className:e,...t})=>y.jsx("div",{className:Ee("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});JE.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 ZE=v.forwardRef(({className:e,...t},r)=>y.jsx(KE,{ref:r,className:Ee("text-lg font-semibold leading-none tracking-tight",e),...t}));ZE.displayName=KE.displayName;const e1=v.forwardRef(({className:e,...t},r)=>y.jsx(YE,{ref:r,className:Ee("text-sm text-muted-foreground",e),...t}));e1.displayName=YE.displayName;var m4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],p4=m4.reduce((e,t)=>{const r=md(`Primitive.${t}`),s=v.forwardRef((o,l)=>{const{asChild:u,...d}=o,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),g4="Label",t1=v.forwardRef((e,t)=>y.jsx(p4.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())}}));t1.displayName=g4;var n1=t1;const y4=Ap("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),wt=v.forwardRef(({className:e,...t},r)=>y.jsx(n1,{ref:r,className:Ee(y4(),e),...t}));wt.displayName=n1.displayName;const nd=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}));nd.displayName="Textarea";function r1(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 Rd="Checkbox",[v4]=ia(Rd),[b4,lg]=v4(Rd);function w4(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:Rd}),[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:Ha(o)?!1:o,isFormControl:N,bubbleInput:T,setBubbleInput:C};return y.jsx(b4,{scope:t,...P,children:x4(g)?g(P):s})}var a1="CheckboxTrigger",s1=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}=lg(a1,e),S=Qe(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":Ha(f)?"mixed":f,"aria-required":m,"data-state":u1(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=>Ha(A)?!0:!A),E&&_&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})})});s1.displayName=a1;var cg=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(w4,{__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(s1,{...g,ref:t,__scopeCheckbox:r}),w&&y.jsx(c1,{__scopeCheckbox:r})]})})});cg.displayName=Rd;var i1="CheckboxIndicator",o1=v.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...o}=e,l=lg(i1,r);return y.jsx(or,{present:s||Ha(l.checked)||l.checked===!0,children:y.jsx(je.span,{"data-state":u1(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});o1.displayName=i1;var l1="CheckboxBubbleInput",c1=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:_}=lg(l1,e),E=Qe(r,_),S=r1(l),T=J_(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=Ha(l),F.call(A,Ha(l)?!1:l),A.dispatchEvent(L)}},[w,S,l,o]);const C=v.useRef(Ha(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%)"}})});c1.displayName=l1;function x4(e){return typeof e=="function"}function Ha(e){return e==="indeterminate"}function u1(e){return Ha(e)?"indeterminate":e?"checked":"unchecked"}const d1=v.forwardRef(({className:e,...t},r)=>y.jsx(cg,{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(o1,{className:Ee("grid place-content-center text-current"),children:y.jsx(Rs,{className:"h-4 w-4"})})}));d1.displayName=cg.displayName;function Xw(e,[t,r]){return Math.min(r,Math.max(t,e))}function _4(e){const t=S4(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 S4(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=R4(o),d=T4(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 E4=Symbol("radix.slottable");function C4(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===E4}function T4(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 R4(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 f1=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"}),A4="VisuallyHidden",N4=v.forwardRef((e,t)=>y.jsx(je.span,{...e,ref:t,style:{...f1,...e.style}}));N4.displayName=A4;var k4=[" ","Enter","ArrowUp","ArrowDown"],j4=[" ","Enter"],js="Select",[Ad,Nd,O4]=Dp(js),[no]=ia(js,[O4,to]),kd=to(),[M4,Ka]=no(js),[D4,L4]=no(js),h1=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:f,dir:m,name:b,autoComplete:g,disabled:w,required:_,form:E}=e,S=kd(t),[T,C]=v.useState(null),[A,N]=v.useState(null),[P,F]=v.useState(!1),$=Lp(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(Vp,{...S,children:y.jsxs(M4,{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(Ad.Provider,{scope:t,children:y.jsx(D4,{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(z1,{"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]})})};h1.displayName=js;var m1="SelectTrigger",p1=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...o}=e,l=kd(r),u=Ka(m1,r),d=u.disabled||s,f=Qe(t,u.onTriggerChange),m=Nd(r),b=v.useRef("touch"),[g,w,_]=I1(S=>{const T=m().filter(N=>!N.disabled),C=T.find(N=>N.value===u.value),A=$1(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(wd,{asChild:!0,...l,children:y.jsx(je.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":U1(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===" ")&&k4.includes(S.key)&&(E(),S.preventDefault())})})})});p1.displayName=m1;var g1="SelectValue",y1=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,children:l,placeholder:u="",...d}=e,f=Ka(g1,r),{onValueNodeHasChildrenChange:m}=f,b=l!==void 0,g=Qe(t,f.onValueNodeChange);return Mt(()=>{m(b)},[m,b]),y.jsx(je.span,{...d,ref:g,style:{pointerEvents:"none"},children:U1(f.value)?y.jsx(y.Fragment,{children:u}):l})});y1.displayName=g1;var P4="SelectIcon",v1=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...o}=e;return y.jsx(je.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});v1.displayName=P4;var z4="SelectPortal",b1=e=>y.jsx(Ll,{asChild:!0,...e});b1.displayName=z4;var Os="SelectContent",w1=v.forwardRef((e,t)=>{const r=Ka(Os,e.__scopeSelect),[s,o]=v.useState();if(Mt(()=>{o(new DocumentFragment)},[]),!r.open){const l=s;return l?kl.createPortal(y.jsx(x1,{scope:e.__scopeSelect,children:y.jsx(Ad.Slot,{scope:e.__scopeSelect,children:y.jsx("div",{children:e.children})})}),l):null}return y.jsx(_1,{...e,ref:t})});w1.displayName=Os;var Zn=10,[x1,Ya]=no(Os),U4="SelectContentImpl",I4=_4("SelectContent.RemoveScroll"),_1=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=Ka(Os,r),[N,P]=v.useState(null),[F,$]=v.useState(null),L=Qe(t,z=>P(z)),[q,ie]=v.useState(null),[he,pe]=v.useState(null),oe=Nd(r),[ue,ce]=v.useState(!1),fe=v.useRef(!1);v.useEffect(()=>{if(N)return xd(N)},[N]),pd();const M=v.useCallback(z=>{const[ee,...ae]=oe().map(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]=I1(z=>{const ee=oe().filter(Ce=>!Ce.disabled),ae=ee.find(Ce=>Ce.ref.current===document.activeElement),xe=$1(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"?tp:S1,Z=V===tp?{side:d,sideOffset:f,align:m,alignOffset:b,arrowPadding:g,collisionBoundary:w,collisionPadding:_,sticky:E,hideWhenDetached:S,avoidCollisions:T}:{};return y.jsx(x1,{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:I4,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()}})})})})})})});_1.displayName=U4;var $4="SelectItemAlignedPosition",S1=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...o}=e,l=Ka(Os,r),u=Ya(Os,r),[d,f]=v.useState(null),[m,b]=v.useState(null),g=Qe(t,L=>b(L)),w=Nd(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,Ze=L.left-Re,Ke=L.width+Ze,St=Math.max(Ke,q.width),Wt=window.innerWidth-Zn,Bt=Xw(Re,[Zn,Math.max(Zn,Wt-St)]);d.style.minWidth=Ke+"px",d.style.left=Bt+"px"}else{const Ce=q.right-he.right,Re=window.innerWidth-ie.right-Ce,Ze=window.innerWidth-L.right-Re,Ke=L.width+Ze,St=Math.max(Ke,q.width),Wt=window.innerWidth-Zn,Bt=Xw(Re,[Zn,Math.max(Zn,Wt-St)]);d.style.minWidth=Ke+"px",d.style.right=Bt+"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,Ze=Math.max(V,Z+(Ce?I:0)+Re+K),Ke=ee+Ze;d.style.height=Ke+"px"}else{const Ce=pe.length>0&&T===pe[0].ref.current;d.style.top="0px";const Ze=Math.max(Y,fe+S.offsetTop+(Ce?j:0)+Z)+ae;d.style.height=Ze+"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]);Mt(()=>N(),[N]);const[P,F]=v.useState();Mt(()=>{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(H4,{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}})})})});S1.displayName=$4;var B4="SelectPopperPosition",tp=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:o=Zn,...l}=e,u=kd(r);return y.jsx(Gp,{...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)"}})});tp.displayName=B4;var[H4,ug]=no(Os,{}),np="SelectViewport",E1=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...o}=e,l=Ya(np,r),u=ug(np,r),d=Qe(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(Ad.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})})})]})});E1.displayName=np;var C1="SelectGroup",[q4,V4]=no(C1),G4=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=Qt();return y.jsx(q4,{scope:r,id:o,children:y.jsx(je.div,{role:"group","aria-labelledby":o,...s,ref:t})})});G4.displayName=C1;var T1="SelectLabel",R1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=V4(T1,r);return y.jsx(je.div,{id:o.id,...s,ref:t})});R1.displayName=T1;var rd="SelectItem",[F4,A1]=no(rd),N1=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:o=!1,textValue:l,...u}=e,d=Ka(rd,r),f=Ya(rd,r),m=d.value===s,[b,g]=v.useState(l??""),[w,_]=v.useState(!1),E=Qe(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(F4,{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(Ad.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===" "||(j4.includes(A.key)&&C(),A.key===" "&&A.preventDefault())})})})})});N1.displayName=rd;var rl="SelectItemText",k1=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,...l}=e,u=Ka(rl,r),d=Ya(rl,r),f=A1(rl,r),m=L4(rl,r),[b,g]=v.useState(null),w=Qe(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 Mt(()=>(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?kl.createPortal(l.children,u.valueNode):null]})});k1.displayName=rl;var j1="SelectItemIndicator",O1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return A1(j1,r).isSelected?y.jsx(je.span,{"aria-hidden":!0,...s,ref:t}):null});O1.displayName=j1;var rp="SelectScrollUpButton",M1=v.forwardRef((e,t)=>{const r=Ya(rp,e.__scopeSelect),s=ug(rp,e.__scopeSelect),[o,l]=v.useState(!1),u=Qe(t,s.onScrollButtonChange);return Mt(()=>{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(L1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=r;d&&f&&(d.scrollTop=d.scrollTop-f.offsetHeight)}}):null});M1.displayName=rp;var ap="SelectScrollDownButton",D1=v.forwardRef((e,t)=>{const r=Ya(ap,e.__scopeSelect),s=ug(ap,e.__scopeSelect),[o,l]=v.useState(!1),u=Qe(t,s.onScrollButtonChange);return Mt(()=>{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(L1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=r;d&&f&&(d.scrollTop=d.scrollTop+f.offsetHeight)}}):null});D1.displayName=ap;var L1=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...o}=e,l=Ya("SelectScrollButton",r),u=v.useRef(null),d=Nd(r),f=v.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return v.useEffect(()=>()=>f(),[f]),Mt(()=>{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()})})}),K4="SelectSeparator",P1=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return y.jsx(je.div,{"aria-hidden":!0,...s,ref:t})});P1.displayName=K4;var sp="SelectArrow",Y4=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=kd(r),l=Ka(sp,r),u=Ya(sp,r);return l.open&&u.position==="popper"?y.jsx(Fp,{...o,...s,ref:t}):null});Y4.displayName=sp;var W4="SelectBubbleInput",z1=v.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const o=v.useRef(null),l=Qe(s,o),u=r1(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:{...f1,...r.style},ref:l,defaultValue:t})});z1.displayName=W4;function U1(e){return e===""||e===void 0}function I1(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 $1(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=X4(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 X4(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var J4=h1,B1=p1,Q4=y1,Z4=v1,ez=b1,H1=w1,tz=E1,q1=R1,V1=N1,nz=k1,rz=O1,G1=M1,F1=D1,K1=P1;const az=J4,sz=Q4,Y1=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(B1,{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(Op,{className:"h-4 w-4 opacity-50"})})]}));Y1.displayName=B1.displayName;const W1=v.forwardRef(({className:e,...t},r)=>y.jsx(G1,{ref:r,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:y.jsx(SM,{className:"h-4 w-4"})}));W1.displayName=G1.displayName;const X1=v.forwardRef(({className:e,...t},r)=>y.jsx(F1,{ref:r,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:y.jsx(Op,{className:"h-4 w-4"})}));X1.displayName=F1.displayName;const J1=v.forwardRef(({className:e,children:t,position:r="popper",...s},o)=>y.jsx(ez,{children:y.jsxs(H1,{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(W1,{}),y.jsx(tz,{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(X1,{})]})}));J1.displayName=H1.displayName;const iz=v.forwardRef(({className:e,...t},r)=>y.jsx(q1,{ref:r,className:Ee("px-2 py-1.5 text-sm font-semibold",e),...t}));iz.displayName=q1.displayName;const ip=v.forwardRef(({className:e,children:t,...r},s)=>y.jsxs(V1,{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(rz,{children:y.jsx(Rs,{className:"h-4 w-4"})})}),y.jsx(nz,{children:t})]}));ip.displayName=V1.displayName;const oz=v.forwardRef(({className:e,...t},r)=>y.jsx(K1,{ref:r,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));oz.displayName=K1.displayName;var lz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cz=lz.reduce((e,t)=>{const r=md(`Primitive.${t}`),s=v.forwardRef((o,l)=>{const{asChild:u,...d}=o,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),uz="Separator",Jw="horizontal",dz=["horizontal","vertical"],Q1=v.forwardRef((e,t)=>{const{decorative:r,orientation:s=Jw,...o}=e,l=fz(s)?s:Jw,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return y.jsx(cz.div,{"data-orientation":l,...d,...o,ref:t})});Q1.displayName=uz;function fz(e){return dz.includes(e)}var Z1=Q1;const Bi=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},o)=>y.jsx(Z1,{ref:o,decorative:r,orientation:t,className:Ee("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Bi.displayName=Z1.displayName;function hz({value:e,onChange:t}){return y.jsx("div",{className:"flex flex-wrap gap-2",children:ep.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 Qw({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(XM,{className:"w-3.5 h-3.5 flex-shrink-0"}),y.jsx("span",{className:"truncate",children:g}),y.jsx(DM,{className:"w-3 h-3 flex-shrink-0 opacity-60"})]}):y.jsxs(y.Fragment,{children:[y.jsx(On,{value:g,onChange:_=>m(w,_.target.value),placeholder:"https://…",className:"h-9 text-sm"}),y.jsx(ft,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>b(w),children:y.jsx(wl,{className:"w-4 h-4"})})]})]},w))}),!o&&y.jsxs("div",{className:"flex gap-1.5 pt-1",children:[y.jsx(On,{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(ft,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-9",children:[y.jsx(bl,{className:"w-4 h-4 mr-1"})," Añadir"]})]})]})}var Zw=1,mz=.9,pz=.8,gz=.17,_m=.1,Sm=.999,yz=.9999,vz=.99,bz=/[\\\/_+.#"@\[\(\{&]/,wz=/[\\\/_+.#"@\[\(\{&]/g,xz=/[\s-]/,eC=/[\s-]/g;function op(e,t,r,s,o,l,u){if(l===t.length)return o===e.length?Zw:vz;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=op(e,t,r,s,m+1,l+1,u),g>b&&(m===o?g*=Zw:bz.test(e.charAt(m-1))?(g*=pz,_=e.slice(o,m-1).match(wz),_&&o>0&&(g*=Math.pow(Sm,_.length))):xz.test(e.charAt(m-1))?(g*=mz,E=e.slice(o,m-1).match(eC),E&&o>0&&(g*=Math.pow(Sm,E.length))):(g*=gz,o>0&&(g*=Math.pow(Sm,m-o))),e.charAt(m)!==t.charAt(l)&&(g*=yz)),(g<_m&&r.charAt(m-1)===s.charAt(l+1)||s.charAt(l+1)===s.charAt(l)&&r.charAt(m-1)!==s.charAt(l))&&(w=op(e,t,r,s,m+1,l+2,u),w*_m>g&&(g=w*_m)),g>b&&(b=g),m=r.indexOf(f,m+1);return u[d]=b,b}function ex(e){return e.toLowerCase().replace(eC," ")}function _z(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,op(e,t,ex(e),ex(t),0,0,{})}var Zo='[cmdk-group=""]',Em='[cmdk-group-items=""]',Sz='[cmdk-group-heading=""]',tC='[cmdk-item=""]',tx=`${tC}:not([aria-disabled="true"])`,lp="cmdk-item-select",Ui="data-value",Ez=(e,t,r)=>_z(e,t,r),nC=v.createContext(void 0),$l=()=>v.useContext(nC),rC=v.createContext(void 0),dg=()=>v.useContext(rC),aC=v.createContext(void 0),sC=v.forwardRef((e,t)=>{let r=Ii(()=>{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=Ii(()=>new Set),o=Ii(()=>new Map),l=Ii(()=>new Map),u=Ii(()=>new Set),d=iC(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),$=Lz();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:Ez;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(Em);Z?Z.appendChild(V.parentElement===Z?V:V.closest(`${Em} > *`)):Y.appendChild(V.parentElement===Y?V:V.closest(`${Em} > *`))}),I.sort((V,Z)=>Z[1]-V[1]).forEach(V=>{var Z;let z=(Z=F.current)==null?void 0:Z.querySelector(`${Zo}[${Ui}="${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(Ui);L.setState("value",I||void 0)}function oe(){var j,I,Y,V;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=s.current.size;return}r.current.filtered.groups=new Set;let Z=0;for(let z of s.current){let ee=(I=(j=l.current.get(z))==null?void 0:j.value)!=null?I:"",ae=(V=(Y=l.current.get(z))==null?void 0:Y.keywords)!=null?V:[],xe=ie(ee,ae);r.current.filtered.items.set(z,xe),xe>0&&Z++}for(let[z,ee]of o.current)for(let ae of ee)if(r.current.filtered.items.get(ae)>0){r.current.filtered.groups.add(z);break}r.current.filtered.count=Z}function ue(){var j,I,Y;let V=ce();V&&(((j=V.parentElement)==null?void 0:j.firstChild)===V&&((Y=(I=V.closest(Zo))==null?void 0:I.querySelector(Sz))==null||Y.scrollIntoView({block:"nearest"})),V.scrollIntoView({block:"nearest"}))}function ce(){var j;return(j=F.current)==null?void 0:j.querySelector(`${tC}[aria-selected="true"]`)}function fe(){var j;return Array.from(((j=F.current)==null?void 0:j.querySelectorAll(tx))||[])}function M(j){let I=fe()[j];I&&L.setState("value",I.getAttribute(Ui))}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(Ui))}function J(j){let I=ce(),Y=I==null?void 0:I.closest(Zo),V;for(;Y&&!V;)Y=j>0?Mz(Y,Zo):Dz(Y,Zo),V=Y==null?void 0:Y.querySelector(tx);V?L.setState("value",V.getAttribute(Ui)):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(lp);V.dispatchEvent(Z)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:q.inputId,id:q.labelId,style:zz},f),jd(e,j=>v.createElement(rC.Provider,{value:L},v.createElement(nC.Provider,{value:q},j))))}),Cz=v.forwardRef((e,t)=>{var r,s;let o=Qt(),l=v.useRef(null),u=v.useContext(aC),d=$l(),f=iC(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=oC(o,l,[e.value,e.children,l],e.keywords),g=dg(),w=Ga($=>$.value&&$.value===b.current),_=Ga($=>m||d.filter()===!1?!0:$.search?$.filtered.items.get(o)>0:!0);v.useEffect(()=>{let $=l.current;if(!(!$||e.disabled))return $.addEventListener(lp,E),()=>$.removeEventListener(lp,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)}),Tz=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=Ga(_=>o||b.filter()===!1?!0:_.search?_.filtered.groups.has(u):!0);Ms(()=>b.group(u),[]),oC(u,d,[e.value,e.heading,f]);let w=v.useMemo(()=>({id:u,forceMount:o}),[o]);return v.createElement(je.div,{ref:en(d,t),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&v.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:m},r),jd(e,_=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},v.createElement(aC.Provider,{value:w},_))))}),Rz=v.forwardRef((e,t)=>{let{alwaysRender:r,...s}=e,o=v.useRef(null),l=Ga(u=>!u.search);return!r&&!l?null:v.createElement(je.div,{ref:en(o,t),...s,"cmdk-separator":"",role:"separator"})}),Az=v.forwardRef((e,t)=>{let{onValueChange:r,...s}=e,o=e.value!=null,l=dg(),u=Ga(m=>m.search),d=Ga(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)}})}),Nz=v.forwardRef((e,t)=>{let{children:r,label:s="Suggestions",...o}=e,l=v.useRef(null),u=v.useRef(null),d=Ga(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},jd(e,m=>v.createElement("div",{ref:en(u,f.listInnerRef),"cmdk-list-sizer":""},m)))}),kz=v.forwardRef((e,t)=>{let{open:r,onOpenChange:s,overlayClassName:o,contentClassName:l,container:u,...d}=e;return v.createElement(GE,{open:r,onOpenChange:s},v.createElement(FE,{container:u},v.createElement(ig,{"cmdk-overlay":"",className:o}),v.createElement(og,{"aria-label":e.label,"cmdk-dialog":"",className:l},v.createElement(sC,{ref:t,...d}))))}),jz=v.forwardRef((e,t)=>Ga(r=>r.filtered.count===0)?v.createElement(je.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Oz=v.forwardRef((e,t)=>{let{progress:r,children:s,label:o="Loading...",...l}=e;return v.createElement(je.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},jd(e,u=>v.createElement("div",{"aria-hidden":!0},u)))}),bn=Object.assign(sC,{List:Nz,Item:Cz,Input:Az,Group:Tz,Separator:Rz,Dialog:kz,Empty:jz,Loading:Oz});function Mz(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Dz(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function iC(e){let t=v.useRef(e);return Ms(()=>{t.current=e}),t}var Ms=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Ii(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function Ga(e){let t=dg(),r=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,r,r)}function oC(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(Ui,d),o.current=d}),o}var Lz=()=>{let[e,t]=v.useState(),r=Ii(()=>new Map);return Ms(()=>{r.current.forEach(s=>s()),r.current=new Map},[e]),(s,o)=>{r.current.set(s,o),t({})}};function Pz(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function jd({asChild:e,children:t},r){return e&&v.isValidElement(t)?v.cloneElement(Pz(t),{ref:t.ref},r(t.props.children)):r(t)}var zz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const fg=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}));fg.displayName=bn.displayName;const hg=v.forwardRef(({className:e,...t},r)=>y.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[y.jsx(Yu,{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})]}));hg.displayName=bn.Input.displayName;const mg=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}));mg.displayName=bn.List.displayName;const pg=v.forwardRef((e,t)=>y.jsx(bn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));pg.displayName=bn.Empty.displayName;const gg=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}));gg.displayName=bn.Group.displayName;const lC=v.forwardRef(({className:e,...t},r)=>y.jsx(bn.Separator,{ref:r,className:Ee("-mx-1 h-px bg-border",e),...t}));lC.displayName=bn.Separator.displayName;const ad=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}));ad.displayName=bn.Item.displayName;function Uz(e){const t=Iz(e),r=v.forwardRef((s,o)=>{const{children:l,...u}=s,d=v.Children.toArray(l),f=d.find(Bz);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 Iz(e){const t=v.forwardRef((r,s)=>{const{children:o,...l}=r;if(v.isValidElement(o)){const u=qz(o),d=Hz(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 $z=Symbol("radix.slottable");function Bz(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$z}function Hz(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 qz(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Od="Popover",[cC]=ia(Od,[to]),Bl=to(),[Vz,Wa]=cC(Od),uC=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:Od});return y.jsx(Vp,{...d,children:y.jsx(Vz,{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})})};uC.displayName=Od;var dC="PopoverAnchor",Gz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Wa(dC,r),l=Bl(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=o;return v.useEffect(()=>(u(),()=>d()),[u,d]),y.jsx(wd,{...l,...s,ref:t})});Gz.displayName=dC;var fC="PopoverTrigger",hC=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Wa(fC,r),l=Bl(r),u=Qe(t,o.triggerRef),d=y.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":vC(o.open),...s,ref:u,onClick:we(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?d:y.jsx(wd,{asChild:!0,...l,children:d})});hC.displayName=fC;var yg="PopoverPortal",[Fz,Kz]=cC(yg,{forceMount:void 0}),mC=e=>{const{__scopePopover:t,forceMount:r,children:s,container:o}=e,l=Wa(yg,t);return y.jsx(Fz,{scope:t,forceMount:r,children:y.jsx(or,{present:r||l.open,children:y.jsx(Ll,{asChild:!0,container:o,children:s})})})};mC.displayName=yg;var Ki="PopoverContent",pC=v.forwardRef((e,t)=>{const r=Kz(Ki,e.__scopePopover),{forceMount:s=r.forceMount,...o}=e,l=Wa(Ki,e.__scopePopover);return y.jsx(or,{present:s||l.open,children:l.modal?y.jsx(Wz,{...o,ref:t}):y.jsx(Xz,{...o,ref:t})})});pC.displayName=Ki;var Yz=Uz("PopoverContent.RemoveScroll"),Wz=v.forwardRef((e,t)=>{const r=Wa(Ki,e.__scopePopover),s=v.useRef(null),o=Qe(t,s),l=v.useRef(!1);return v.useEffect(()=>{const u=s.current;if(u)return xd(u)},[]),y.jsx(zl,{as:Yz,allowPinchZoom:!0,children:y.jsx(gC,{...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})})})}),Xz=v.forwardRef((e,t)=>{const r=Wa(Ki,e.__scopePopover),s=v.useRef(!1),o=v.useRef(!1);return y.jsx(gC,{...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()}})}),gC=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=Wa(Ki,r),_=Bl(r);return pd(),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(Gp,{"data-state":vC(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)"}})})})}),yC="PopoverClose",Jz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Wa(yC,r);return y.jsx(je.button,{type:"button",...s,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});Jz.displayName=yC;var Qz="PopoverArrow",Zz=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,o=Bl(r);return y.jsx(Fp,{...o,...s,ref:t})});Zz.displayName=Qz;function vC(e){return e?"open":"closed"}var eU=uC,tU=hC,nU=mC,bC=pC;const wC=eU,xC=tU,vg=v.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},o)=>y.jsx(nU,{children:y.jsx(bC,{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})}));vg.displayName=bC.displayName;const rU=new RegExp("[\\u0000-\\u001F\\u007F-\\u009F\\u00AD\\u061C\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u206F\\uFEFF]","g");function _C(e){return String(e||"").replace(rU,"").replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function Oe(e){return _C(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function Ot(e){const t=_C(e),r=Oe(t);return["republica dominicana","rep dominicana","rep dom","rep dom lizbeth","dominicana"].includes(r)?"Republica Dominicana":t}function Fe(e){const t=new Map;for(const r of e){const s=Ot(r);if(!s)continue;const o=Oe(s);o&&(t.has(o)||t.set(o,s))}return Array.from(t.values())}function nx(e,t){const r=Fe(e),s=Ot(t);if(!s)return r;const o=Oe(s);return r.some(u=>Oe(u)===o)?r:[s,...r]}function aU(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function Qr({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(()=>{const w=new Map;for(const _ of Fe(t)){const E=Ot(_),S=Oe(E);!S||w.has(S)||w.set(S,E)}return Array.from(w.values())},[t]),g=v.useMemo(()=>{const w=Oe(e);return b.find(_=>Oe(_)===w)??e},[b,e]);return y.jsxs(wC,{open:f,onOpenChange:m,children:[y.jsx(xC,{asChild:!0,children:y.jsxs(ft,{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",!g&&"text-muted-foreground"),children:[y.jsx("span",{className:"truncate",children:g||s}),y.jsx(M_,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),y.jsx(vg,{align:"start",className:"w-[min(92vw,560px)] min-w-[var(--radix-popover-trigger-width)] p-0",children:y.jsxs(fg,{children:[y.jsx(hg,{placeholder:o}),y.jsxs(mg,{className:"overscroll-contain",onWheel:aU,children:[y.jsx(pg,{children:l}),y.jsxs(gg,{children:[d&&y.jsxs(y.Fragment,{children:[y.jsxs(ad,{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__"),b.length>0&&y.jsx(lC,{className:"my-1"})]}),b.map(w=>y.jsxs(ad,{value:`${Oe(w)} ${w}`,onSelect:()=>{r(w),m(!1)},children:[y.jsx(Rs,{className:Ee("mr-2 h-4 w-4",Oe(e)===Oe(w)?"opacity-100":"opacity-0")}),y.jsx("span",{className:"whitespace-normal break-words leading-snug",children:w})]},Oe(w)))]})]})]})})]})}function sU(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function rx(e){return Fe(e.map(t=>Ot(t)).filter(Boolean))}function ax({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(()=>rx(e),[e]),g=v.useMemo(()=>new Set(b.map(C=>Oe(C))),[b]),w=v.useMemo(()=>Fe([...t,...b].map(C=>Ot(C))),[t,b]),_=v.useMemo(()=>b.length===0?"":b.length<=2?b.join(", "):`${b.length} ${d}`,[b,d]),E=C=>{r(rx(C))},S=C=>{const A=Ot(C),N=Oe(A);if(g.has(N)){E(b.filter(P=>Oe(P)!==N));return}E([...b,A])},T=C=>{const A=Oe(C);E(b.filter(N=>Oe(N)!==A))};return y.jsxs("div",{className:"space-y-2",children:[y.jsxs(wC,{open:f,onOpenChange:m,children:[y.jsx(xC,{asChild:!0,children:y.jsxs(ft,{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(M_,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),y.jsx(vg,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:y.jsxs(fg,{children:[y.jsx(hg,{placeholder:o}),y.jsxs(mg,{className:"overscroll-contain",onWheel:sU,children:[y.jsx(pg,{children:l}),y.jsx(gg,{children:w.map(C=>{const A=g.has(Oe(C));return y.jsxs(ad,{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(wl,{className:"h-3 w-3"})})]},C))})]})}const Cm=[{id:"grafico",label:"Tarifario Gráfico CDC"},{id:"estrategia",label:"Estrategia y Creatividad"}],iU="design_final_art",oU="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:iU,label:"Diseño + Entregable Arte Final",shortLabel:"Diseño + AF",hourReference:e,levels:r}];return s!=null&&s.length&&o.push({id:oU,label:"Adaptación Arte Final",shortLabel:"Adaptación AF",hourReference:t,levels:s}),o}const ll=[{id:"pdv-materiales-basicos",section:"grafico",category:"Materiales de PDV estándar",service:"Cenefas, habladores, danglers, rompetráficos, afiches, backings, rollups, uniformes, piezas WhatsApp/web",notes:"Incluye diseño en alta resolución, troqueles y 3 rondas de cambios. Cambios adicionales pueden agregarse como Otros.",workTypes:pn({design:[me("basic","Básico","50 - 80",50,80),me("intermediate","Intermedio","100 - 150",100,150),me("advanced","Avanzado","150 - 300",150,300)],adaptation:[me("basic","Básico","30 - 50",30,50),me("intermediate","Intermedio","60 - 80",60,80),me("advanced","Avanzado","100 - 150",100,150)]})},{id:"pdv-promocion-pack",section:"grafico",category:"Promoción en PDV",service:"Quick counter + roll up + mecánica de canje + uniforme (pack 3 a 5 piezas o más)",notes:"Montos por paquete de 3 a 5 piezas. Piezas o solicitudes extra deben agregarse como Otros.",workTypes:pn({design:[me("basic","Básico","320 - 500",320,500),me("intermediate","Intermedio","500 - 700",500,700),me("advanced","Avanzado","800 - 1000",800,1e3)],adaptation:[me("basic","Básico","200 - 350",200,350),me("intermediate","Intermedio","350 - 550",350,550),me("advanced","Avanzado","600 - 800+",600,800,"Puede superar el rango si el caso lo requiere.")]})},{id:"ooh-gigantografias",section:"grafico",category:"OOH y gigantografías",service:"Vallas, mupies y gigantografías",notes:"Los niveles están asociados a tamaño aproximado: 6m², más de 10m² y más de 20m².",workTypes:pn({design:[me("basic","6m² aprox","250 - 350",250,350),me("intermediate","Más 10m²","400 - 650",400,650),me("advanced","Más de 20m²","700 - 1100",700,1100)],adaptation:[me("basic","6m² aprox","100 - 150",100,150),me("intermediate","Más 10m²","200 - 300",200,300),me("advanced","Más de 20m²","400 - 600",400,600)]})},{id:"stands-muebles-exhibidores",section:"grafico",category:"Stands, muebles y exhibidores",service:"One Way, cabeceras de góndola, revestimiento de islas y displays básicos",notes:"Incluye diseño en alta resolución, troqueles y 3 rondas de cambios.",workTypes:pn({design:[me("basic","Básico","300 - 400",300,400),me("intermediate","Intermedio","450 - 650",450,650),me("advanced","Avanzado","700 - 1000",700,1e3)],adaptation:[me("basic","Básico","200 - 300",200,300),me("intermediate","Intermedio","300 - 400",300,400),me("advanced","Avanzado","450 - 600",450,600)]})},{id:"proyectos-especiales-muebles",section:"grafico",category:"Proyectos especiales",service:"Diseño de muebles u otros proyectos especiales con planos estructurales y troqueles desde cero",notes:"Precio por proyecto. Incluye diseño gráfico/estructural, planos, troqueles, conceptualización y 4 rondas de cambios.",workTypes:pn({design:[me("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[me("project","Precio único","600 - 850",600,850)]})},{id:"stands-creativos-eventos",section:"grafico",category:"Proyectos especiales",service:"Stands creativos para ferias/eventos, montaje de eventos especiales y diseños de espacios especiales",notes:"Precio por proyecto. Incluye stand creativo, planos estructurales, visualizaciones 3D y 4 rondas de cambios.",workTypes:pn({design:[me("project","Precio único","1500 - 3000",1500,3e3)],adaptation:[me("project","Precio único","800 - 1200",800,1200)]})},{id:"empaque-simple",section:"grafico",category:"Diseño de empaques",service:"Empaque simple",notes:"Diseño gráfico original para empaques simples sin troqueles complejos.",workTypes:pn({design:[me("project","Precio único","700 - 1000",700,1e3)],adaptation:[me("project","Adaptación / SKU","100 - 300",100,300)]})},{id:"empaque-complejo",section:"grafico",category:"Diseño de empaques",service:"Empaque complejo",notes:"Diseño gráfico y estructural para empaques con troqueles personalizados o formas no convencionales.",workTypes:pn({design:[me("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[me("project","Adaptación / SKU","100 - 300",100,300)]})},{id:"brochures",section:"grafico",category:"Catálogos, brochures y folletos",service:"Brochures",notes:"Incluye diseño y 3 rondas de cambios.",workTypes:pn({design:[me("basic","Básico","200 - 400",200,400),me("intermediate","Intermedio","400 - 600",400,600),me("advanced","Avanzado","600 - 800",600,800)],adaptation:[me("basic","Básico","50 - 100",50,100),me("intermediate","Intermedio","100 - 150",100,150),me("advanced","Avanzado","150 - 350",150,350)]})},{id:"catalogos-folletos-pagina",section:"grafico",category:"Catálogos, brochures y folletos",service:"Catálogos y folletos (costo por página)",notes:"Costo por página. Incluye diseño y 3 rondas de cambios.",workTypes:pn({design:[me("basic","Básico","30 - 60",30,60),me("intermediate","Intermedio","60 - 90",60,90),me("advanced","Avanzado","90 - 120",90,120)],adaptation:[me("basic","Básico","15 - 30",15,30),me("intermediate","Intermedio","30 - 60",30,60),me("advanced","Avanzado","60 - 100",60,100)]})},{id:"web-landing",section:"grafico",category:"Páginas web",service:"Landing page o sitio simple hasta 5 páginas",notes:"Sitio web básico con diseño estático, contenido del cliente y hasta 2 rondas de cambios.",workTypes:[{id:gn,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[me("project","Precio único","800 - 1500",800,1500)]}]},{id:"web-intermedio",section:"grafico",category:"Páginas web",service:"Sitio corporativo intermedio de 6 a 15 páginas",notes:"Sitio mediano con páginas adicionales y diseño más personalizado. Hasta 3 rondas de cambios.",workTypes:[{id:gn,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[me("project","Precio único","2000 - 5000",2e3,5e3)]}]},{id:"web-avanzado",section:"grafico",category:"Páginas web",service:"Sitio avanzado: más de 15 páginas, interactividad o integraciones complejas",notes:"Incluye desarrollo a medida y hasta 5 rondas de cambios.",workTypes:[{id:gn,label:"Diseño web",shortLabel:"Web",hourReference:"36 - 50",levels:[me("project","Precio único","4000 - 8000",4e3,8e3)]}]},{id:"retoques-fotograficos",section:"grafico",category:"Otros servicios",service:"Retoques fotográficos",notes:"Incluye 2 rondas de ajustes.",workTypes:pn({design:[me("basic","Básico","20 - 40",20,40),me("intermediate","Intermedio","50 - 100",50,100),me("advanced","Avanzado","150 - 300",150,300)],adaptation:void 0})},{id:"videos",section:"grafico",category:"Otros servicios",service:"Videos",notes:"Referencia por complejidad del video.",workTypes:pn({designHour:"35 - 50",design:[me("basic","Básico","100 - 250",100,250),me("intermediate","Intermedio","250 - 500",250,500),me("advanced","Avanzado","500 - 1200",500,1200)]})},{id:"copy-puntual",section:"grafico",category:"Otros servicios",service:"Copy puntual para ADS, tarjetas o comunicaciones sueltas",notes:"Solo copy puntual. Si requiere concepto, presupuestar según proyecto/hora hombre.",workTypes:pn({designHour:"1 - 25",design:[me("basic","Básico","100",100,100),me("intermediate","Intermedio","100 - 200",100,200),me("advanced","Avanzado","200 - 500",200,500)]})},{id:"render-sencillo",section:"grafico",category:"Otros servicios",service:"Render sencillo de 1 solo plano por unidad",notes:"No aplica para eventos donde hay que conceptualizar el ambiente total.",workTypes:pn({designHour:"1 - 50",design:[me("basic","Básico","100",100,100),me("intermediate","Intermedio","100 - 150",100,150),me("advanced","Avanzado","150 - 300",150,300)]})},{id:"carnets",section:"grafico",category:"Otros servicios",service:"Carnets",notes:"Referencia especial: diseño base + réplicas. El Director Creativo calcula y escribe el monto final manualmente.",workTypes:[{id:gn,label:"Referencia manual",shortLabel:"Manual",levels:[me("base","Diseño base","20 base",20,20),me("replica","Réplicas","5 por réplica",5,5)]}]},{id:"identidad-basica",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo básico para pequeñas marcas o emprendimientos",notes:"Incluye logo, paleta, tipografía, identidad visual básica, hasta 2 conceptos y 3 rondas de cambios.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Básico","2000 - 4000",2e3,4e3)]}]},{id:"identidad-intermedia",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo intermedio para marcas medianas",notes:"Incluye nombre si aplica, logotipo, paleta, tipografía, key visuals y manual de marca detallado.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Intermedio","4000 - 8000",4e3,8e3)]}]},{id:"identidad-avanzada",section:"estrategia",category:"Desarrollo de Identidad Gráfica para Marca",service:"Desarrollo avanzado para grandes marcas o redes",notes:"Identidad visual robusta con aplicaciones de marca, investigación, key visuals y manual exhaustivo.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Avanzado","8000 - 15000 o más",8e3,15e3)]}]},{id:"campana-key-visual-basica",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Concepto y Key Visual básico para campañas pequeñas",notes:"Concepto creativo básico, key visual, línea gráfica y eslogan con aplicaciones limitadas.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Básico","2000 - 3000",2e3,3e3)]}]},{id:"campana-creativa-intermedia",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Campaña creativa intermedia para lanzamientos medianos",notes:"Concepto creativo completo, key visuals, eslogan y piezas para distintos medios.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Intermedio","3000 - 5000",3e3,5e3)]}]},{id:"campana-creativa-avanzada",section:"estrategia",category:"Desarrollo de Campaña Creativa",service:"Campaña creativa avanzada para lanzamientos grandes",notes:"Desarrollo estratégico y creativo de campaña grande con insights, key visuals y múltiples piezas.",workTypes:[{id:gn,label:"Tarifa fija",shortLabel:"Fija",levels:[me("project","Avanzado","5000 - 8000 o más",5e3,8e3)]}]},{id:"consultoria-estrategica",section:"estrategia",category:"Desarrollo Estratégico y Conceptual",service:"Consultoría estratégica y desarrollo de concepto",notes:"Investigación de mercado, análisis de competencia, concepto estratégico y alineación con objetivos del cliente.",workTypes:[{id:gn,label:"Tarifa fija o por hora",shortLabel:"Referencia",levels:[me("project","Por proyecto","1500 - 3000",1500,3e3),me("hour","Por hora","100 - 200 por hora",100,200)]}]},{id:"rondas-adicionales-estrategia",section:"estrategia",category:"Adicionales estratégicos",service:"Rondas adicionales de cambios",notes:"Referencia para trabajo adicional en estrategia o creatividad.",workTypes:[{id:gn,label:"Por hora",shortLabel:"Hora",levels:[me("hour","Por hora","50 - 150 por hora",50,150)]}]}];function sx(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 SC="tablero_cdc_tariff_catalog",cp="Referencia",EC="Precio único";let za={rows:up(ll),catalog:ll,source:"fallback",loading:!1,error:null},Mu=!1,Du=[],Tm=0;function Rm(){Du.forEach(e=>e())}function ix(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const t=Number(e.trim());if(Number.isFinite(t))return t}return null}function cl(e){return String(e||"").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function CC(e,t,r){return[e,t,r].map(cl).filter(Boolean).join("__")}function lU(e){const t=String(e.section||"grafico")==="estrategia"?"estrategia":"grafico",r=String(e.category||"").trim(),s=String(e.service||"").trim(),o=String(e.catalog_item_id||cl(`${t}-${r}-${s}`)).trim(),l=String(e.work_type_label||cp).trim(),u=String(e.level_label||EC).trim(),d=String(e.work_type_id||cl(l)||gn).trim(),f=String(e.level_id||cl(u)||"project").trim();return{id:String(e.id||CC(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:ix(e.reference_min),reference_max:ix(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 cU(e){const t=new Map,r=new Map,s=e.filter(o=>o.is_active).sort((o,l)=>o.sort_order-l.sort_order||o.category.localeCompare(l.category));for(const o of s){const l=o.catalog_item_id||cl(`${o.section}-${o.category}-${o.service}`);let u=t.get(l);u||(u={id:l,section:o.section,category:o.category,service:o.service,notes:o.notes,workTypes:[]},t.set(l,u),r.set(l,new Map));const d=o.work_type_id||gn,f=r.get(l);let m=f.get(d);m||(m={id:d,label:o.work_type_label||cp,shortLabel:o.work_type_short_label||o.work_type_label||cp,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||EC,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 up(e){const t=[];return e.forEach((r,s)=>{r.workTypes.forEach((o,l)=>{o.levels.forEach((u,d)=>{t.push({id:CC(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 uU(e){const t=e instanceof Error?e.message:String(e||"");return t.includes(SC)||t.includes("Could not find the table")||t.includes("relation")||t.includes("does not exist")}async function ox(e=!1){if(Mu&&!e)return za;const t=Tm+=1;za={...za,loading:!0,error:null},Rm();try{const{data:r,error:s}=await Pe.from(SC).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=>lU(m)),l=up(ll),u=new Map;l.forEach(m=>u.set(m.id,m)),o.forEach(m=>u.set(m.id,m));const d=Array.from(u.values()).sort((m,b)=>m.sort_order-b.sort_order||m.category.localeCompare(b.category)),f=cU(d);t===Tm&&(za={rows:d,catalog:f,source:o.length?"supabase":"fallback",loading:!1,error:o.length?null:"La tabla del tarifario está vacía. Se está usando el tarifario base de la app como respaldo."},Mu=!0,Rm())}catch(r){const s=r instanceof Error?r.message:String(r||""),o=uU(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===Tm&&(za={rows:up(ll),catalog:ll,source:"fallback",loading:!1,error:o},Mu=!0,Rm())}return za}function dU(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return Du.push(t),!Mu&&!za.loading&&ox(),()=>{Du=Du.filter(r=>r!==t)}},[]),{...za,refresh:()=>ox(!0)}}function bu(e){const t=Number(e.replace(/,/g,"").trim());return Number.isFinite(t)?t:0}function Am(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function fU(e){return(e==null?void 0:e.workTypes[0])||null}function lx(e){return(e==null?void 0:e.levels[0])||null}function Nm(e){return e.trim()}function hU({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}=dU(),ie=Cm.map(z=>z.label),he=((Z=Cm.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=Cm.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=fU(ee),xe=lx(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=lx(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:sx(ce),referenceMin:ce.min??null,referenceMax:ce.max??null,amount:z,description:Nm(E)}]),S(""),_(vu(ce)))},j=()=>{const z=bu(P),ee=Nm(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:Nm(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(mM,{className:"h-4 w-4"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"text-sm font-semibold",children:"Tarifario / Estimación interna"}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Agrega costos del tarifario o montos manuales. El total se guarda como Interno Cargado."})]})]}),y.jsxs("div",{className:"rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-sm font-semibold text-primary",children:["Total: ",Am(fe)]})]}),(s||q)&&y.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-xl border border-amber-300/50 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:[y.jsx(VM,{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(wt,{children:"Sección"}),y.jsx(Qr,{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(wt,{children:"Ítem a cobrar"}),y.jsx(Qr,{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(wt,{children:"Tipo de trabajo"}),y.jsx(Qr,{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(wt,{children:"Nivel / referencia"}),y.jsx(Qr,{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:"})," ",sx(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(wt,{children:"Monto final"}),y.jsx(On,{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(wt,{children:"Observación"}),y.jsx(nd,{value:E,onChange:z=>S(z.target.value),placeholder:"Ej: más rondas de cambios, piezas adicionales, complejidad especial…",disabled:!ce,rows:5,className:"min-h-[132px] resize-y"})]})]}),y.jsx("div",{className:"flex justify-end",children:y.jsxs(ft,{type:"button",onClick:k,disabled:!oe||!ue||!ce||bu(w)<=0,className:"gap-1.5 rounded-full",children:[y.jsx(bl,{className:"h-4 w-4"}),"Agregar tarifa"]})})]}),y.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[y.jsxs("div",{children:[y.jsx("p",{className:"text-sm font-medium",children:"Agregar costo manual"}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Para otros, adicionales o casos fuera del tarifario."})]}),y.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[minmax(0,1fr)_220px]",children:[y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(wt,{children:"Nombre"}),y.jsx(On,{value:T,onChange:z=>C(z.target.value),placeholder:"Ej: Piezas adicionales"})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsx(wt,{children:"Monto"}),y.jsx(On,{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(wt,{children:"Descripción"}),y.jsx(nd,{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(ft,{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(bl,{className:"h-4 w-4"}),"Agregar costo manual"]})})]})]}),y.jsx(Bi,{className:"my-4"}),y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y.jsx("p",{className:"text-sm font-medium",children:"Costos agregados"}),y.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.length," línea(s)"]})]}),e.length===0?y.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card/70 px-3 py-3 text-sm text-muted-foreground",children:"Aún no hay costos agregados. Puedes usar el tarifario, agregar otros manuales o ambos."}):y.jsxs("div",{className:"space-y-2",children:[e.map((z,ee)=>y.jsxs("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card px-3 py-3 sm:flex-row sm:items-start sm:justify-between",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y.jsx(Cs,{variant:z.source==="manual"?"outline":"secondary",children:z.source==="manual"?"Manual":"Tarifario"}),y.jsx("p",{className:"text-sm font-medium",children:z.serviceName})]}),y.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[z.category&&y.jsx("span",{children:z.category}),z.workType&&y.jsx("span",{children:z.workType}),z.complexityLevel&&y.jsx("span",{children:z.complexityLevel}),z.referenceLabel&&y.jsxs("span",{children:["Ref.: ",z.referenceLabel]})]}),z.description&&y.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:z.description})]}),y.jsxs("div",{className:"flex items-center justify-between gap-3 sm:flex-col sm:items-end",children:[y.jsx("p",{className:"text-sm font-semibold text-foreground",children:Am(Number(z.amount||0))}),y.jsxs(ft,{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(D_,{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(Mp,{className:"h-4 w-4"}),y.jsxs("span",{className:"text-sm font-semibold",children:["Total interno estimado: ",Am(fe)]})]})]})]})]})}const xs={clientes:VP,marcas:GP,bus:AE,buCm:ng,status:[...FP]};let Lu=[],dp=xs,El=!1,TC=!1,bg=null,ul=null,Ss=null,wu=0;function fp(){Lu.forEach(e=>e())}function bs(e){return Fe(e)}function mU(e){const t=new Map(AE.map(r=>[Oe(r),r]));return Fe(e).map(r=>t.get(Oe(r))||null).filter(r=>!!r)}function pU(e){return String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function gU(e){const t=pU(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 yU(e){return Ot(String(e.label||e.value||""))}function vU(e){const t=[],r=[],s=[],o=[],l={...ng};for(const u of e){if(u.is_active===!1)continue;const d=gU(u.category),f=yU(u),m=Ot(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?bs(t):bs(xs.clientes),marcas:r.length?bs(r):bs(xs.marcas),bus:s.length?mU([...xs.bus,...s]):bs(xs.bus),buCm:l,status:o.length?bs(o):bs(xs.status)}}function bU(e){bg=e,fp()}async function hp(){El=!0,bU(null),fp();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;dp=vU(e||[]),TC=!0}catch(e){console.error("Error cargando listas desde Supabase:",e),bg=e instanceof Error?e.message:"No se pudieron cargar los desplegables desde Supabase.",dp=xs}finally{El=!1,fp()}}function wU(){Ss&&clearTimeout(Ss),Ss=setTimeout(()=>{Ss=null,El||hp()},350)}function xU(){ul||(ul=Pe.channel("tablero-cdc-app-lists").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_lists"},()=>wU()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a tablero_cdc_app_lists:",e)}))}function _U(){Ss&&(clearTimeout(Ss),Ss=null),ul&&(Pe.removeChannel(ul),ul=null)}function RC(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return Lu.push(t),wu+=1,xU(),!TC&&!El&&hp(),()=>{Lu=Lu.filter(r=>r!==t),wu=Math.max(0,wu-1),wu===0&&_U()}},[]),{lists:dp,loading:El,error:bg,refresh:hp}}const SU={cr:"Costa Rica","costa rica":"Costa Rica",costarica:"Costa Rica",gt:"Guatemala",gua:"Guatemala",guate:"Guatemala",guatemala:"Guatemala",hn:"Honduras",honduras:"Honduras",ni:"Nicaragua",nicaragua:"Nicaragua",sv:"El Salvador",es:"El Salvador","el salvador":"El Salvador",elsalvador:"El Salvador",pa:"Panama",pty:"Panama",panama:"Panama",rd:"Republica Dominicana",repdom:"Republica Dominicana","republica dominicana":"Republica Dominicana",republicadominicana:"Republica Dominicana",do:"Republica Dominicana",mx:"Mexico",mexico:"Mexico",pr:"Puerto Rico","puerto rico":"Puerto Rico",puertorico:"Puerto Rico",co:"Colombia",colombia:"Colombia",jm:"Jamaica",jamaica:"Jamaica",tt:"Trinidad",trinidad:"Trinidad",ve:"Venezuela",venezuela:"Venezuela",latam:"Latam",wmc:"WMC"},EU=[[/(^|[_\-\s])cr([_\-\s]|$)/i,"Costa Rica"],[/(^|[_\-\s])(gt|gua|guate)([_\-\s]|$)/i,"Guatemala"],[/(^|[_\-\s])hn([_\-\s]|$)/i,"Honduras"],[/(^|[_\-\s])ni([_\-\s]|$)/i,"Nicaragua"],[/(^|[_\-\s])(sv|es)([_\-\s]|$)/i,"El Salvador"],[/(^|[_\-\s])(pa|pty|panama)([_\-\s]|$)/i,"Panama"],[/(^|[_\-\s])(rd|repdom|do)([_\-\s]|$)/i,"Republica Dominicana"],[/(^|[_\-\s])mx([_\-\s]|$)/i,"Mexico"],[/(^|[_\-\s])pr([_\-\s]|$)/i,"Puerto Rico"],[/(^|[_\-\s])co([_\-\s]|$)/i,"Colombia"],[/(^|[_\-\s])jm([_\-\s]|$)/i,"Jamaica"],[/(^|[_\-\s])tt([_\-\s]|$)/i,"Trinidad"],[/(^|[_\-\s])ve([_\-\s]|$)/i,"Venezuela"],[/(^|[_\-\s])latam([_\-\s]|$)/i,"Latam"],[/(^|[_\-\s])wmc([_\-\s]|$)/i,"WMC"]];function Yi(e){return Ot(String(e??""))}function cx(e,t,r=[]){const s=Yi(t);if(!s)return;const o=r.find(l=>Oe(l)===Oe(s));e.push(o||s)}function AC(e,t,r){const s=Yi(t),o=Oe(s);o&&r.forEach(l=>{const u=Oe(l);u&&(o===u||o.includes(u))&&e.push(l)})}function Md(e,t=[]){const r=Yi(e);if(!r)return[];const s=[];return AC(s,r,t),r.split(/[,;|/]+/).map(o=>Yi(o)).filter(Boolean).forEach(o=>cx(s,o,t)),s.length===0&&cx(s,r,t),Fe(s)}function mp(e,t=[]){const r=Yi(e);if(!r)return[];const s=[];return AC(s,r,t),r.split(/[,;|/]+/).map(o=>Yi(o)).filter(Boolean).forEach(o=>{const l=SU[Oe(o)],u=t.find(d=>Oe(d)===Oe(o));l?s.push(l):u&&s.push(u)}),EU.forEach(([o,l])=>{o.test(r)&&s.push(l)}),Fe(s)}function NC(e,t=[]){const r=[...mp(e.bu,t),...mp(e.nombre,t)],s=Oe(e.cliente),o=Oe(e.nombre);return(s.includes("walmartconnect")||s.includes("wmc")||o.includes("wmc"))&&r.push("WMC"),Fe(r)}function kC(e,t=[]){return Md(e.marca,t)}function jC(e,t=[]){return Md(e.cliente,t)}function OC(e,t=[]){return Md(e.cm,t)}function xu(e,t){const r=Oe(t);return r?e.some(s=>{const o=Oe(s);return o===r||o.includes(r)||r.includes(o)}):!0}function MC(e,t,r={}){if(t.country){const s=NC(e,r.countries||[]);if(!xu(s,t.country))return!1}if(t.brand){const s=kC(e,r.brands||[]);if(!xu(s,t.brand))return!1}if(t.client){const s=jC(e,r.clients||[]);if(!xu(s,t.client))return!1}if(t.cm){const s=OC(e,r.cms||[]);if(!xu(s,t.cm))return!1}return!0}function CU(e,t=[]){return Fe(e.flatMap(r=>mp(r,t)))}function km(e,t=[]){return Fe(e.flatMap(r=>Md(r,t)))}function DC(e,t={}){return{countries:Fe(e.flatMap(r=>NC(r,t.countries||[]))),brands:Fe(e.flatMap(r=>kC(r,t.brands||[]))),clients:Fe(e.flatMap(r=>jC(r,t.clients||[]))),cms:Fe(e.flatMap(r=>OC(r,t.cms||[])))}}function LC(e){return!!(e.country||e.brand||e.client||e.cm)}const PC="blue",Dd="Activo",Wr={tab:"todos",search:"",page:1,pageSize:24,country:"",brand:"",client:"",cm:""};let Pu=[],na=[],sd=0,zC={countries:[],brands:[],clients:[],cms:[]},Cl=!1,UC=!1,wg=null,dl=null,Es=null,_u=0,vn={...Wr},Sr=0,Su=0;function Tl(){Pu.forEach(e=>e())}function id(e,t=""){return typeof e=="string"?e:t}function TU(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function RU(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 AU(e,t){return id(e.legacy_month,"")||id(e.mes,"")||t.toLocaleString("es-DO",{month:"long"})}function NU(e,t){return RU(e.legacy_year,TU(e.anio,t.getFullYear()))}function kU(e){return!e||e===Dd?"":e}function jU(e){return e&&e.trim()?e:Dd}function IC(e){return{tab:(e==null?void 0:e.tab)??vn.tab??Wr.tab,search:String((e==null?void 0:e.search)??vn.search??Wr.search).trim(),page:Math.max(1,Math.floor(Number((e==null?void 0:e.page)??vn.page??Wr.page))),pageSize:Math.max(1,Math.min(100,Math.floor(Number((e==null?void 0:e.pageSize)??vn.pageSize??Wr.pageSize)))),country:String((e==null?void 0:e.country)??vn.country??Wr.country).trim(),brand:String((e==null?void 0:e.brand)??vn.brand??Wr.brand).trim(),client:String((e==null?void 0:e.client)??vn.client??Wr.client).trim(),cm:String((e==null?void 0:e.cm)??vn.cm??Wr.cm).trim()}}function Ld(e){const t=e.extra_data||{},r=e.project_links||[],s=r.filter(d=>d.link_type==="proposal").map(d=>d.url||"").filter(Boolean),o=r.filter(d=>d.link_type==="final_art").map(d=>d.url||"").filter(Boolean),l=e.created_at?new Date(e.created_at).getTime():Date.now(),u=Number.isFinite(l)?new Date(l):new Date;return{id:e.id,nombre:e.title||"",color:id(t.color,PC),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:kU(e.status),monto:e.internal_amount==null?null:Number(e.internal_amount),mes:AU(t,u),anio:NU(t,u),createdAt:Number.isFinite(l)?l:Date.now(),extraData:t}}function OU(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 MU(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 $C(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 ux(e){return e&&e.trim()?e:Dd}function Eu(e,t,r){return`${e} ${e===1?t:r}`}function dx(e){return Array.isArray(e)?e.map(t=>String(t||"").trim()).filter(Boolean).join(" | "):String(e??"").trim()}function La(e,t,r,s,o){const l=dx(r),u=dx(s);if(l!==u){if(o!=null&&o.privateValue){e.push(`${t} actualizado.`);return}e.push(`${t}: ${l||"—"} → ${u||"—"}`)}}function DU(e,t,r){const s=[];return La(s,"Nombre",e.nombre,t.nombre),La(s,"Cliente",e.cliente,t.cliente),La(s,"Marca",e.marca,t.marca),La(s,"País/BU",e.bu,t.bu),La(s,"CM",e.cm,t.cm),La(s,"Solicitado por",e.solicitante,t.solicitante),La(s,"Estatus",ux(e.status),ux(t.status)),e.color!==t.color&&s.push("Etiqueta de color actualizada."),(e.comentarios||"").trim()!==(t.comentarios||"").trim()&&s.push("Comentarios actualizados."),(e.briefLink||"").trim()!==(t.briefLink||"").trim()&&s.push("Link del brief actualizado."),e.propuestaLinks.join("|")!==t.propuestaLinks.join("|")&&s.push(`Links de propuestas: ${Eu(e.propuestaLinks.length,"link","links")} → ${Eu(t.propuestaLinks.length,"link","links")}.`),e.afLinks.join("|")!==t.afLinks.join("|")&&s.push(`Links de artes finales: ${Eu(e.afLinks.length,"link","links")} → ${Eu(t.afLinks.length,"link","links")}.`),r&&Number(e.monto??0)!==Number(t.monto??0)&&La(s,"Monto interno",e.monto,t.monto,{privateValue:!0}),s}async function xg(){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 BC(){return(await xg()).id}async function LU(){return(await Rp()).role==="director_creativo"}async function HC(){return(await Rp()).canManageInternalPricing}async function PU(){return(await Rp()).canDeleteProjects}function qC(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:jU(e.status),internal_amount:e.monto??null,brief_link:e.briefLink,extra_data:{...t,color:e.color??id(t.color,PC),mes:e.mes,anio:e.anio}}}function zU(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 VC(e){na=e,Tl()}function Ba(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 UU(e){return{countries:Ba(e.map(t=>t.bu)),brands:Ba(e.map(t=>t.marca)),clients:Ba(e.map(t=>t.cliente)),cms:Ba(e.map(t=>t.cm))}}function nr(e){wg=e,Tl()}function GC(e){na.some(r=>r.id===e.id)&&VC(na.map(r=>r.id===e.id?e:r))}function IU(e){na.some(t=>t.id===e)&&(VC(na.filter(t=>t.id!==e)),sd=Math.max(0,sd-1),Tl())}function $U(){return"https://agenteit.digitalcompass.agency/webhook/tablero-cdc-sync-proyecto".trim()||""}async function Pd(e,t){const r=$U();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 fx(){Es&&clearTimeout(Es),Es=setTimeout(()=>{Es=null,!Cl&&Sr===0&&Ts(vn)},350)}function BU(){dl||(dl=Pe.channel("tablero-cdc-projects").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_projects"},()=>fx()).on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_project_links"},()=>fx()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a proyectos:",e)}))}function HU(){Es&&(clearTimeout(Es),Es=null),dl&&(Pe.removeChannel(dl),dl=null)}async function FC(e,t){const r=zU(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(!YU(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 KC(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 qU(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(MU)}async function hx(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(OU)}function VU(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 GU(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=VU(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=na.find(_=>_.id===e);return w&&GC({...w,comentarios:b}),b}async function FU(e,t){const r=t.trim();if(!r)throw new Error("Escribe una nota antes de agregarla al historial.");const s=await xg(),o=$C(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 GU(e,r,o,l,s.id,u),m=await Pd(e,"update");return{comments:f,...m}}async function YC(e,t,r,s="",o=!1){try{const l=await xg(),u=$C(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 WC(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 _g(e){return e instanceof Error?e.message:e&&typeof e=="object"&&"message"in e?String(e.message||""):String(e||"")}function KU(e){const t=_g(e);return t.includes("tablero_cdc_get_projects_paginated")||t.includes("Could not find the function")}function YU(e){const t=_g(e);return t.includes("tablero_cdc_replace_project_links")||t.includes("Could not find the function")}function WU(e){const t=_g(e);return t.includes("tablero_cdc_get_pricing_summary")||t.includes("Could not find the function")}function al(e){return e.replace(/[%_]/g,"\\$&").replace(/,/g," ")}function Sg(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",Dd));const s=t.search.trim();if(s){const l=`%${al(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}`)}return r}function XC(e,t){let r=Sg(e,t);if(t.country){const s=`%${al(t.country)}%`;r=r.or(`country.ilike.${s}`)}if(t.brand){const s=`%${al(t.brand)}%`;r=r.or(`brand.ilike.${s}`)}if(t.client){const s=`%${al(t.client)}%`;r=r.or(`client.ilike.${s}`)}if(t.cm){const s=`%${al(t.cm)}%`;r=r.or(`country_manager.ilike.${s}`)}return r}async function XU(e,t){const r=(e.page-1)*e.pageSize,s=r+e.pageSize-1;let o=Pe.from("tablero_cdc_projects").select(WC(t),{count:"exact"}).order("created_at",{ascending:!1});o=XC(o,e);const{data:l,error:u,count:d}=await o.range(r,s);if(u)throw u;const f=(l||[]).map(m=>Ld(m));return{projects:f,totalProjects:d??0,filterOptions:UU(f)}}async function JU(e,t){let s=0,o=null;const l=[];for(;o===null||s<o;){let b=Pe.from("tablero_cdc_projects").select(WC(t),{count:"exact"}).order("created_at",{ascending:!1});b=Sg(b,e);const{data:g,error:w,count:_}=await b.range(s,s+1e3-1);if(w)throw w;o===null&&(o=_??(g||[]).length);const E=(g||[]).map(S=>Ld(S));if(l.push(...E),E.length<1e3)break;s+=1e3}const u=DC(l),d=l.filter(b=>MC(b,e,u)),f=(e.page-1)*e.pageSize,m=f+e.pageSize;return{projects:d.slice(f,m),totalProjects:d.length,filterOptions:u}}async function QU(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=>Ld(m)),filterOptions:{countries:Ba((l=s.filter_options)==null?void 0:l.countries),brands:Ba((u=s.filter_options)==null?void 0:u.brands),clients:Ba((d=s.filter_options)==null?void 0:d.clients),cms:Ba((f=s.filter_options)==null?void 0:f.cms)}}}async function Ts(e){const t=IC(e),r=Su+=1;vn=t,Cl=!0,nr(null),Tl();try{const s=await HC();let o;if(LC(t)||s)o=await JU(t,s);else try{o=await QU(t)}catch(l){if(!KU(l))throw l;console.warn("RPC tablero_cdc_get_projects_paginated no existe todavía. Usando consulta directa como respaldo temporal.",l),o=await XU(t,s)}if(r!==Su)return;sd=o.totalProjects,na=o.projects,zC=o.filterOptions,UC=!0}catch(s){if(r!==Su)return;console.error("Error cargando proyectos desde Supabase:",s),wg=s instanceof Error?s.message:"No se pudieron cargar los proyectos desde Supabase."}finally{r===Su&&(Cl=!1,Tl())}}async function ZU(e){nr(null),Sr+=1;try{const t=await BC(),r={...qC(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 FC(s.id,e),await KC(s.id,e.pricingItems),await YC(s.id,"created","Proyecto creado",`${e.nombre||"Proyecto sin título"} quedó registrado en el tablero.`);const l=await Pd(s.id,"create");return await Ts(vn),{projectId:s.id,...l}}finally{Sr=Math.max(0,Sr-1)}}async function eI(e,t){nr(null),Sr+=1;try{const r=await BC(),s=await LU(),o=await HC(),l=na.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=qC(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;GC(u),await FC(e,u),o&&await KC(e,t.pricingItems);const b=DU(l,u,o);b.length>0&&await YC(e,"updated","Proyecto actualizado",b.slice(0,8).join(`
|
||
`));const g=await Pd(e,"update");return await Ts(vn),{projectId:e,...g}}finally{Sr=Math.max(0,Sr-1)}}async function tI(e){nr(null),Sr+=1;try{if(!await PU()){const l="No tienes permiso para eliminar proyectos.";throw nr(l),new Error(l)}const r=await Pd(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;IU(e),await Ts(vn)}finally{Sr=Math.max(0,Sr-1)}}async function nI(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 rI(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=XC(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 aI(e){let r=0,s=null;const o=[];for(;s===null||r<s;){let f=Pe.from("tablero_cdc_projects").select("id, title, client, brand, country, requested_by, country_manager, description, status, internal_amount, brief_link, created_at, extra_data",{count:"exact"}).order("created_at",{ascending:!1});f=Sg(f,e);const{data:m,error:b,count:g}=await f.range(r,r+1e3-1);if(b)throw b;s===null&&(s=g??(m||[]).length);const w=(m||[]).map(_=>Ld(_));if(o.push(...w),w.length<1e3)break;r+=1e3}const l=DC(o),u=o.filter(f=>MC(f,e,l));return{totalAmount:u.reduce((f,m)=>{const b=Number(m.monto??0);return Number.isFinite(b)&&b>0?f+b:f},0),projectCount:u.length,loadedAt:Date.now()}}async function mx(e){const t=IC({...e,page:1,pageSize:1e3});if(LC(t))return aI(t);try{return await nI(t)}catch(r){if(!WU(r))throw r;return console.warn("RPC tablero_cdc_get_pricing_summary no existe todavía. Usando suma directa como respaldo temporal.",r),rI(t)}}function sI(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),mx({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:()=>mx(e).then(E=>(s(E),E))}}function JC(e){const[,t]=v.useState(0),r=e==null?void 0:e.tab,s=e==null?void 0:e.search,o=e==null?void 0:e.page,l=e==null?void 0:e.pageSize,u=e==null?void 0:e.country,d=e==null?void 0:e.brand,f=e==null?void 0:e.client,m=e==null?void 0:e.cm;return v.useEffect(()=>{const b=()=>t(g=>g+1);return Pu.push(b),_u+=1,BU(),()=>{Pu=Pu.filter(g=>g!==b),_u=Math.max(0,_u-1),_u===0&&HU()}},[]),v.useEffect(()=>{if(r&&o&&l){Ts({tab:r,search:s??"",page:o,pageSize:l,country:u??"",brand:d??"",client:f??"",cm:m??""});return}!UC&&!Cl&&Ts()},[r,s,o,l,u,d,f,m]),{projects:na,totalProjects:sd,filterOptions:zC,loading:Cl,error:wg,refresh:()=>Ts(e??vn),add:ZU,update:eI,remove:tI}}function iI(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 oI=e=>{switch(e){case"success":return uI;case"info":return fI;case"warning":return dI;case"error":return hI;default:return null}},lI=Array(12).fill(0),cI=({visible:e,className:t})=>le.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},le.createElement("div",{className:"sonner-spinner"},lI.map((r,s)=>le.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),uI=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"})),dI=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"})),fI=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"})),hI=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"})),mI=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"})),pI=()=>{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 pp=1;class gI{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:pp++,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(vI(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)||pp++;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 gI,yI=(e,t)=>{const r=(t==null?void 0:t.id)||pp++;return yn.addToast({title:e,...t,id:r}),r},vI=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",bI=yI,wI=()=>yn.toasts,xI=()=>yn.getActiveToasts(),gr=Object.assign(bI,{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:wI,getToasts:xI});iI("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Cu(e){return e.label!==void 0}const _I=3,SI="24px",EI="16px",px=4e3,CI=356,TI=14,RI=45,AI=200;function yr(...e){return e.filter(Boolean).join(" ")}function NI(e){const[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}const kI=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),[Ze,Ke]=le.useState(0),[St,Wt]=le.useState(0),Bt=le.useRef(g.duration||oe||px),nn=le.useRef(null),gt=le.useRef(null),Tr=C===0,He=C+1<=S,nt=g.type,Dt=g.dismissible!==!1,rt=g.className||"",Rr=g.descriptionClassName||"",Ar=le.useMemo(()=>T.findIndex(Ne=>Ne.toastId===g.id)||0,[T,g.id]),zs=le.useMemo(()=>{var Ne;return(Ne=g.closeButton)!=null?Ne:$},[g.closeButton,$]),wn=le.useMemo(()=>g.duration||oe||px,[g.duration,oe]),la=le.useRef(0),xn=le.useRef(0),Us=le.useRef(0),Kn=le.useRef(null),[cr,Lt]=ue.split("-"),_n=le.useMemo(()=>T.reduce((Ne,lt,zt)=>zt>=Ar?Ne:Ne+lt.height,0),[T,Ar]),Pt=pI(),ro=g.invert||b,Xa=nt==="loading";xn.current=le.useMemo(()=>Ar*ce+_n,[Ar,_n]),le.useEffect(()=>{Bt.current=wn},[wn]),le.useEffect(()=>{Y(!0)},[]),le.useEffect(()=>{const Ne=gt.current;if(Ne){const lt=Ne.getBoundingClientRect().height;return Wt(lt),E(zt=>[{toastId:g.id,height:lt,position:g.position},...zt]),()=>E(zt=>zt.filter(Xt=>Xt.toastId!==g.id))}},[E,g.id]),le.useLayoutEffect(()=>{if(!I)return;const Ne=gt.current,lt=Ne.style.height;Ne.style.height="auto";const zt=Ne.getBoundingClientRect().height;Ne.style.height=lt,Wt(zt),E(Xt=>Xt.find(mt=>mt.toastId===g.id)?Xt.map(mt=>mt.toastId===g.id?{...mt,height:zt}:mt):[{toastId:g.id,height:zt,position:g.position},...Xt])},[I,g.title,g.description,E,g.id,g.jsx,g.action,g.cancel]);const se=le.useCallback(()=>{Z(!0),Ke(xn.current),E(Ne=>Ne.filter(lt=>lt.toastId!==g.id)),setTimeout(()=>{P(g)},AI)},[g,P,E,xn]);le.useEffect(()=>{if(g.promise&&nt==="loading"||g.duration===1/0||g.type==="loading")return;let Ne;return N||_||Pt?(()=>{if(Us.current<la.current){const Xt=new Date().getTime()-la.current;Bt.current=Bt.current-Xt}Us.current=new Date().getTime()})():(()=>{Bt.current!==1/0&&(la.current=new Date().getTime(),Ne=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),se()},Bt.current))})(),()=>clearTimeout(Ne)},[N,_,g,nt,Pt,se]),le.useEffect(()=>{g.delete&&(se(),g.onDismiss==null||g.onDismiss.call(g,g))},[se,g.delete]);function Te(){var Ne;if(K!=null&&K.loading){var lt;return le.createElement("div",{className:yr(M==null?void 0:M.loader,g==null||(lt=g.classNames)==null?void 0:lt.loader,"sonner-loader"),"data-visible":nt==="loading"},K.loading)}return le.createElement(cI,{className:yr(M==null?void 0:M.loader,g==null||(Ne=g.classNames)==null?void 0:Ne.loader),visible:nt==="loading"})}const Ge=g.icon||(K==null?void 0:K[nt])||oI(nt);var Ye,Nt;return le.createElement("li",{tabIndex:0,ref:gt,className:yr(he,rt,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[nt],g==null||(r=g.classNames)==null?void 0:r[nt]),"data-sonner-toast":"","data-rich-colors":(Ye=g.richColors)!=null?Ye:F,"data-styled":!(g.jsx||g.unstyled||w),"data-mounted":I,"data-promise":!!g.promise,"data-swiped":Ce,"data-removed":V,"data-visible":He,"data-y-position":cr,"data-x-position":Lt,"data-index":C,"data-front":Tr,"data-swiping":z,"data-dismissible":Dt,"data-type":nt,"data-invert":ro,"data-swipe-out":ae,"data-swipe-direction":k,"data-expanded":!!(N||fe&&I),"data-testid":g.testId,style:{"--index":C,"--toasts-before":C,"--z-index":A.length-C,"--offset":`${V?Ze:xn.current}px`,"--initial-height":fe?"auto":`${St}px`,...L,...g.style},onDragEnd:()=>{ee(!1),X(null),Kn.current=null},onPointerDown:Ne=>{Ne.button!==2&&(Xa||!Dt||(nn.current=new Date,Ke(xn.current),Ne.target.setPointerCapture(Ne.pointerId),Ne.target.tagName!=="BUTTON"&&(ee(!0),Kn.current={x:Ne.clientX,y:Ne.clientY})))},onPointerUp:()=>{var Ne,lt,zt;if(ae||!Dt)return;Kn.current=null;const Xt=Number(((Ne=gt.current)==null?void 0:Ne.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ca=Number(((lt=gt.current)==null?void 0:lt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),mt=new Date().getTime()-((zt=nn.current)==null?void 0:zt.getTime()),rn=ne==="x"?Xt:ca,Ja=Math.abs(rn)/mt;if(Math.abs(rn)>=RI||Ja>.11){Ke(xn.current),g.onDismiss==null||g.onDismiss.call(g,g),j(ne==="x"?Xt>0?"right":"left":ca>0?"down":"up"),se(),xe(!0);return}else{var an,sn;(an=gt.current)==null||an.style.setProperty("--swipe-amount-x","0px"),(sn=gt.current)==null||sn.style.setProperty("--swipe-amount-y","0px")}Re(!1),ee(!1),X(null)},onPointerMove:Ne=>{var lt,zt,Xt;if(!Kn.current||!Dt||((lt=window.getSelection())==null?void 0:lt.toString().length)>0)return;const mt=Ne.clientY-Kn.current.y,rn=Ne.clientX-Kn.current.x;var Ja;const an=(Ja=e.swipeDirections)!=null?Ja:NI(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 Is=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*Is(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*Is(rn);sn.x=Math.abs(Yn)<Math.abs(rn)?Yn:rn}(Math.abs(sn.x)>0||Math.abs(sn.y)>0)&&Re(!0),(zt=gt.current)==null||zt.style.setProperty("--swipe-amount-x",`${sn.x}px`),(Xt=gt.current)==null||Xt.style.setProperty("--swipe-amount-y",`${sn.y}px`)}},zs&&!g.jsx&&nt!=="loading"?le.createElement("button",{"aria-label":J,"data-disabled":Xa,"data-close-button":!0,onClick:Xa||!Dt?()=>{}:()=>{se(),g.onDismiss==null||g.onDismiss.call(g,g)},className:yr(M==null?void 0:M.closeButton,g==null||(s=g.classNames)==null?void 0:s.closeButton)},(Nt=K==null?void 0:K.close)!=null?Nt:mI):null,(nt||g.icon||g.promise)&&g.icon!==null&&((K==null?void 0:K[nt])!==null||g.icon)?le.createElement("div",{"data-icon":"",className:yr(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||Te():null,g.type!=="loading"?Ge:null):null,le.createElement("div",{"data-content":"",className:yr(M==null?void 0:M.content,g==null||(l=g.classNames)==null?void 0:l.content)},le.createElement("div",{"data-title":"",className:yr(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:yr(pe,Rr,M==null?void 0:M.description,g==null||(d=g.classNames)==null?void 0:d.description)},typeof g.description=="function"?g.description():g.description):null),le.isValidElement(g.cancel)?g.cancel:g.cancel&&Cu(g.cancel)?le.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||q,onClick:Ne=>{Cu(g.cancel)&&Dt&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,Ne),se())},className:yr(M==null?void 0:M.cancelButton,g==null||(f=g.classNames)==null?void 0:f.cancelButton)},g.cancel.label):null,le.isValidElement(g.action)?g.action:g.action&&Cu(g.action)?le.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||ie,onClick:Ne=>{Cu(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,Ne),!Ne.defaultPrevented&&se())},className:yr(M==null?void 0:M.actionButton,g==null||(m=g.classNames)==null?void 0:m.actionButton)},g.action.label):null)};function gx(){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 jI(e,t){const r={};return[e,t].forEach((s,o)=>{const l=o===1,u=l?"--mobile-offset":"--offset",d=l?EI:SI;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 OI=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=_I,toastOptions:C,dir:A=gx(),gap:N=TI,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(()=>{Hx.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"?gx():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":`${CI}px`,"--gap":`${N}px`,...S,...jI(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(kI,{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}))}),MI="Walmart Connect WMC",DI=new Set(["wmc"]),Oi=15;function LI(e){return new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function PI(e){return e.split(`
|
||
`).map(t=>t.trim()).filter(Boolean)}function QC(e){return e.reduce((t,r)=>t+Number(r.amount||0),0)}function zI(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 UI(e,t){if(!t.length||e==null)return!1;const r=Number(e);if(!Number.isFinite(r)||r<=0)return!1;const s=QC(t);return Math.abs(r-s)>.01}function II(e,t=[]){const r=Ot(e);if(!r)return[];const s=new Map(Fe(t).map(f=>[Oe(f),f])),o=s.get(Oe(r));if(o)return[o];const l=r.split(/[,;]/).map(f=>Ot(f)).filter(Boolean);if(l.length<=1)return Fe([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(Oe(g));if(w){f=w,m=b;break}}u.push(f||l[d]),d=m}return Fe(u)}function $I(e){return Fe(e.map(t=>Ot(t)).filter(Boolean)).join(", ")}function BI(e,t=[]){const r=Ot(e);if(!r)return[];const s=new Map(Fe(t).map(u=>[Oe(u),u])),o=s.get(Oe(r));if(o)return[o];const l=r.split(/[,;]/).map(u=>Ot(u)).filter(Boolean);return l.length<=1?Fe([o||r]):Fe(l.map(u=>s.get(Oe(u))||u))}function HI(e){return Fe(e.map(t=>Ot(t)).filter(Boolean)).join(", ")}function Tu(e){return Oe(e)===Oe(MI)}const yx=()=>{const e=new Date;return{nombre:"",color:"blue",cliente:"",bu:"",cm:"",marca:"",solicitante:"",comentarios:"",briefLink:"",propuestaLinks:[],afLinks:[],status:"",monto:null,mes:KP[e.getMonth()],anio:e.getFullYear()}};function qI({open:e,onOpenChange:t,project:r,onDelete:s,deleting:o=!1}){const{add:l,update:u}=JC(),{lists:d,loading:f,error:m,refresh:b}=RC(),{isGerardo:g,canDeleteProjects:w,canManageInternalPricing:_}=hd(),E=!!r,[S,T]=v.useState(yx()),[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),Ze=v.useRef(!1),Ke=II(S.marca,d.marcas),St=BI(S.bu,d.bus),Wt=Fe(nx(d.clientes,S.cliente)),Bt=Fe([...d.marcas,...Ke]),nn=Fe([...d.bus,...St]),gt=Fe(nx(d.status,S.status)),Tr=nn.filter(se=>{const Te=Oe(se);return!DI.has(Te)&&Te.includes(Oe(F))}),He=QC(V);v.useEffect(()=>{if(he(null),q(null),r){const{id:se,createdAt:Te,...Ge}=r,Ye=Ot(Ge.bu);T({...Ge,bu:Ye}),A(Ye?[Ye]:[]),$(""),oe([]),X(!1),M(null),J(""),Z([]),xe(null),Re(!1)}else e&&(T(yx()),A([]),$(""),oe([]),X(!1),M(null),J(""),Z([]),xe(null),Re(!1))},[r,e]);const nt=v.useCallback(async()=>{if(r!=null&&r.id)try{ce(!0),M(null);const se=await hx(r.id,Oi+1);oe(se.slice(0,Oi)),X(se.length>Oi)}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]),Dt=v.useCallback(async()=>{if(!(!(r!=null&&r.id)||k||!ne))try{j(!0),M(null);const se=await hx(r.id,Oi+1,pe.length);oe(Te=>[...Te,...se.slice(0,Oi)]),X(se.length>Oi)}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)||nt()},[e,r==null?void 0:r.id,nt]),v.useEffect(()=>{if(!e||!(r!=null&&r.id)||!_)return;let se=!1;return(async()=>{try{ee(!0),xe(null);const Ge=await qU(r.id),Ye=zI(Ge);se||(Re(UI(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(He.toFixed(2));T(Te=>Te.monto===se?Te:{...Te,monto:se})},[_,Ce,V.length,He]);const Rr=se=>{const Te=d.buCm[se];if(Te)return Te;const Ge=Oe(se),Ye=Object.entries(d.buCm).find(([Nt])=>Oe(Nt)===Ge);return(Ye==null?void 0:Ye[1])??""},Ar=se=>{const Te=Fe(se.map(Ye=>Ot(Ye)).filter(Boolean)),Ge=Fe(Te.map(Rr).filter(Boolean));T(Ye=>({...Ye,bu:HI(Te),cm:Ge.join(", ")}))},zs=se=>{const Te=Ot(se);T(Ge=>({...Ge,cliente:Te,...Tu(Te)&&!E?{bu:"",cm:""}:Ge.cliente&&Tu(Ge.cliente)?{bu:"",cm:""}:{}})),Tu(Te)||(A([]),$(""))},wn=!E&&Tu(S.cliente),la=wn?C:St,xn=!E&&la.length>1,Us=(se,Te)=>{const Ge=Ot(se);A(Ye=>Te?Fe([...Ye,Ge]):Ye.filter(Nt=>Oe(Nt)!==Oe(Ge)))},Kn=C.map(se=>({country:se,manager:Rr(se)})),cr=St.map(se=>({country:se,manager:Rr(se)})),Lt=S.nombre.trim()&&S.cliente&&S.marca&&S.solicitante.trim()&&(wn?C.length>0:St.length>0),_n=se=>{if(se.sheetSyncStatus==="synced"){gr.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó y se sincronizó con el Google Sheet."});return}if(se.sheetSyncStatus==="skipped"){gr.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó. La sincronización con Google Sheet no está configurada."});return}gr.warning("Proyecto guardado con aviso",{description:se.sheetSyncMessage})},Pt=async()=>{if(!(!(r!=null&&r.id)||!K.trim()||I))try{Y(!0);const se=await FU(r.id,K);rt("comentarios",se.comments),J(""),await nt(),se.sheetSyncStatus==="synced"?gr.success("Comentario agregado al historial",{description:"También se actualizó la columna Comentarios del Google Sheet."}):se.sheetSyncStatus==="skipped"?gr.success("Comentario agregado al historial",{description:"Se guardó como comentario interno. La sincronización con Sheet no está configurada."}):gr.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.";gr.error("No se pudo agregar el comentario",{description:Te})}finally{Y(!1)}},ro=async()=>{if(!Lt||N||Ze.current)return;Ze.current=!0;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…"),xn){const Te=la,Ge=[];for(const[Nt,Ne]of Te.entries()){q(`Guardando país ${Nt+1} de ${Te.length}: ${Ne}…`);const lt={...se,bu:Ne,cm:Rr(Ne),id:crypto.randomUUID(),createdAt:Date.now()+Nt};Ge.push(await l({...lt,pricingItems:_?V:void 0}))}const Ye=Ge.filter(Nt=>Nt.sheetSyncStatus!=="synced");Ye.length===0?gr.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.`}):gr.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});_n(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),gr.error("No se pudo guardar el proyecto",{description:Ge})}finally{Ze.current=!1,P(!1),q(null)}},Xa=!!S.status;return y.jsx(f4,{open:e,onOpenChange:se=>{N||Ze.current||t(se)},children:y.jsxs(XE,{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:NE(S.color)}}),y.jsxs("div",{className:"px-7 pt-6 pb-7",children:[y.jsx(JE,{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(ZE,{className:"text-2xl tracking-tight",children:E?S.nombre||"Sin título":"Nuevo proyecto"}),y.jsxs(e1,{className:"mt-1 flex items-center gap-2 text-xs",children:[y.jsx(gM,{className:"w-3.5 h-3.5"}),S.mes," · ",S.anio,Xa&&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(wt,{children:["Nombre del proyecto ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(On,{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(wt,{children:"Etiqueta de color"}),y.jsx(hz,{value:S.color,onChange:se=>rt("color",se)})]}),y.jsx(Bi,{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($a,{className:"h-3.5 w-3.5 animate-spin"}),"Cargando listas…"]}):y.jsxs(y.Fragment,{children:[y.jsx(Ku,{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(wt,{children:["Cliente ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(Qr,{value:S.cliente,options:Wt,onValueChange:zs,placeholder:"Seleccionar…",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente."})]}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsxs(wt,{children:["Marca ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(ax,{values:Ke,options:Bt,onValuesChange:se=>rt("marca",$I(se)),placeholder:"Seleccionar una o varias marcas…",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",summaryLabel:"marcas seleccionadas"})]}),wn?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(wt,{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(Yu,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),y.jsx(On,{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:Tr.map(se=>{const Te=C.some(Ye=>Oe(Ye)===Oe(se)),Ge=Rr(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(d1,{checked:Te,onCheckedChange:Ye=>Us(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(wt,{children:["BU Solicita (Países) ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(ax,{values:St,options:nn,onValuesChange:Ar,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",wn&&"md:col-span-2"),children:[y.jsxs(wt,{className:"flex items-center gap-1.5",children:["Country Manager ",y.jsx("span",{className:"text-xs text-muted-foreground",children:"(automático)"})]}),wn?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))})}):y.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:cr.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:cr.map(({country:se,manager:Te})=>y.jsxs(Cs,{variant:"secondary",className:"font-normal",children:[se,": ",Te||"—"]},se))})})]}),xn&&_&&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(wt,{children:["Solicitado por ",y.jsx("span",{className:"text-destructive",children:"*"})]}),y.jsx(On,{value:S.solicitante,onChange:se=>rt("solicitante",se.target.value),placeholder:"Nombre de quien solicita",className:"h-10"})]}),y.jsx(VI,{isEdit:E,items:pe,loading:ue,error:fe,note:K,hasMore:ne,loadingMore:k,addingNote:I,onNoteChange:J,onAddNote:Pt,onRefresh:nt,onLoadMore:Dt}),y.jsx(Bi,{className:"md:col-span-2 my-1"}),y.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[y.jsxs(wt,{children:["Link del Brief"," ",y.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(carpeta de Fulgencio)"})]}),y.jsx(On,{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(Qw,{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(Qw,{label:"Links de Artes Finales",prefix:"AF",links:S.afLinks,onChange:se=>rt("afLinks",se),emptyText:"Aún no hay artes finales."})}),y.jsx(Bi,{className:"md:col-span-2 my-1"}),_&&y.jsx(hU,{items:V,onChange:Z,loading:z,error:ae}),y.jsx(Bi,{className:"md:col-span-2 my-1"}),y.jsxs("div",{className:"space-y-1.5",children:[y.jsxs(wt,{className:"flex items-center gap-1.5 pl-1",children:["Estatus",!g&&y.jsx(ZM,{className:"w-3 h-3 text-muted-foreground"})]}),g?y.jsxs(az,{value:S.status||"_none",onValueChange:se=>rt("status",se==="_none"?"":se),children:[y.jsx(Y1,{className:"h-10",children:y.jsx(sz,{placeholder:"Sin estatus"})}),y.jsxs(J1,{children:[y.jsx(ip,{value:"_none",children:"Sin estatus"}),gt.map(se=>y.jsx(ip,{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(wt,{className:"flex items-center gap-1.5 pl-1",children:["Interno Cargado ",y.jsx(Mp,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),y.jsx(On,{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(Ku,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}):y.jsx($a,{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(ft,{type:"button",variant:"destructive",onClick:()=>s(r),disabled:N||o,className:"gap-1.5 rounded-full",children:[o?y.jsx($a,{className:"h-4 w-4 animate-spin"}):y.jsx(D_,{className:"h-4 w-4"}),o?"Eliminando…":"Eliminar proyecto"]})}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx(ft,{variant:"ghost",onClick:()=>{N||Ze.current||t(!1)},disabled:N||o,children:"Cancelar"}),y.jsxs(ft,{onClick:ro,disabled:!Lt||N||o,children:[N&&y.jsx($a,{className:"mr-1.5 h-4 w-4 animate-spin"}),N?"Guardando…":E?"Guardar cambios":xn?"Crear proyectos":"Crear proyecto"]})]})]})})]})})}function VI({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(HM,{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(ft,{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($a,{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(wt,{className:"text-xs font-medium",children:"Agregar comentario o solicitud adicional"}),y.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[y.jsx(nd,{value:o,onChange:w=>f(w.target.value),placeholder:"Ej: CM pidió ajustar artes, agregar una marca o cambiar una fecha…",rows:2,className:"min-h-[64px] flex-1 resize-none"}),y.jsxs(ft,{type:"button",onClick:()=>void m(),disabled:!o.trim()||d,className:"gap-1.5 rounded-full sm:self-end",children:[d?y.jsx($a,{className:"h-4 w-4 animate-spin"}):y.jsx(sD,{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(Ku,{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($a,{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 _=PI(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(jM,{className:"h-3.5 w-3.5"}),LI(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(ft,{type:"button",variant:"outline",size:"sm",onClick:()=>void g(),disabled:u,className:"rounded-full",children:[u?y.jsx($a,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,u?"Cargando…":"Cargar más"]})})]})]}):y.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card/70 px-3 py-3 text-sm text-muted-foreground",children:"El historial se activará cuando el proyecto sea creado."})]})}const ZC="pricing_summary_public";function eT(e){var t;return!!((t=e==null?void 0:e.value)!=null&&t.enabled)}async function GI(){const{data:e,error:t}=await Pe.from("tablero_cdc_app_settings").select("key, value").eq("key",ZC).maybeSingle();if(t)throw t;return eT(e)}async function FI(e){const{error:t}=await Pe.rpc("tablero_cdc_set_pricing_summary_public",{p_enabled:e});if(t)throw t}function KI(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 GI();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 FI(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.${ZC}`},w=>{const _=w.new||w.old;r(eT(_))}).subscribe();return()=>{Pe.removeChannel(g)}},[e]),{isPublic:t,loading:s,saving:l,error:d,refresh:m,setPublicVisibility:b}}const Mi=24,vx={country:"",brand:"",client:"",cm:""};function YI(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 WI(){const[e,t]=v.useState(!1),[r,s]=v.useState(null),[o,l]=v.useState(""),[u,d]=v.useState("todos"),[f,m]=v.useState(vx),[b,g]=v.useState({todos:1,abiertos:1,cerrados:1}),[w,_]=v.useState(null),E=b[u],{lists:S}=RC(),{projects:T,totalProjects:C,filterOptions:A,loading:N,error:P,refresh:F,remove:$}=JC({tab:u,search:o,page:E,pageSize:Mi,country:f.country,brand:f.brand,client:f.client,cm:f.cm}),{user:L,isGerardo:q,canControlPricingSummary:ie,logout:he}=hd(),pe={tab:u,search:o,page:1,pageSize:Mi,country:f.country,brand:f.brand,client:f.client,cm:f.cm},{isPublic:oe,loading:ue,saving:ce,error:fe,setPublicVisibility:M}=KI(!!L),K=ie||oe,{summary:J,loading:ne,error:X}=sI(pe,K),k=Object.values(S.buCm),j=Fe([...S.bus,...CU(A.countries,S.bus),f.country]),I=Fe([...S.marcas,...km(A.brands,S.marcas),f.brand]),Y=Fe([...S.clientes,...km(A.clients,S.clientes),f.client]),V=Fe([...k,...km(A.cms,k),f.cm]),Z=Object.values(f).filter(Boolean).length,z=Math.max(1,Math.ceil(C/Mi)),ee=Math.min(E,z),ae=(ee-1)*Mi,xe=C===0?0:ae+1,Ce=Math.min(ae+Mi,C);v.useEffect(()=>{g(He=>({...He,[u]:1}))},[o,u,f.country,f.brand,f.client,f.cm]),v.useEffect(()=>{E>z&&g(He=>({...He,[u]:z}))},[E,u,z]);const Re=He=>{const nt=Math.min(Math.max(He,1),z);nt!==E&&(g(Dt=>({...Dt,[u]:nt})),window.scrollTo({top:0,behavior:"smooth"}))},Ze=(He,nt)=>{m(Dt=>({...Dt,[He]:nt}))},Ke=()=>{m(vx)},St=()=>{s(null),t(!0)},Wt=He=>{s(He),t(!0)},Bt=async He=>{if(window.confirm(`¿Seguro que deseas eliminar el proyecto "${He.nombre||"Sin título"}"?
|
||
|
||
Esta acción eliminará el proyecto del tablero y del Google Sheet.`)){_(He.id);try{await $(He.id),(r==null?void 0:r.id)===He.id&&(t(!1),s(null))}catch(Dt){console.error("Error eliminando proyecto:",Dt);const rt=Dt instanceof Error?Dt.message:"No se pudo eliminar el proyecto. Revisa n8n, Supabase o permisos.";window.alert(rt)}finally{_(null)}}},nn=(L==null?void 0:L.displayName)??(L==null?void 0:L.email)??"Usuario",gt=q?"Jefe CDC":"Usuario CDC",Tr=YI(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(jp,{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(Yu,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),y.jsx(On,{value:o,onChange:He=>l(He.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(CP,{children:[y.jsx(TP,{asChild:!0,children:y.jsxs(ft,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2.5",children:[y.jsxs(CE,{className:"w-7 h-7",children:[(L==null?void 0:L.photoURL)&&y.jsx(TE,{src:L.photoURL,alt:nn,referrerPolicy:"no-referrer"}),y.jsx(RE,{className:q?"bg-primary text-primary-foreground text-xs":"bg-accent text-accent-foreground text-xs",children:Tr})]}),y.jsxs("div",{className:"text-left leading-tight hidden sm:block",children:[y.jsx("div",{className:"text-xs font-medium",children:nn}),y.jsx("div",{className:"text-[10px] text-muted-foreground",children:gt})]}),y.jsx(Op,{className:"w-3.5 h-3.5 text-muted-foreground"})]})}),y.jsxs(hE,{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:nn}),y.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:L==null?void 0:L.email})]}),y.jsx(pE,{}),y.jsxs(mE,{onClick:he,className:"gap-2 text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer",children:[y.jsx(tD,{className:"w-3.5 h-3.5"}),"Cerrar sesión"]})]})]}),y.jsxs(ft,{onClick:St,className:"gap-1.5 h-9 rounded-full px-4 shadow-sm",children:[y.jsx(bl,{className:"w-4 h-4"})," Nuevo"]})]})}),y.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 pt-6 pb-3 space-y-3",children:[y.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[y.jsx("div",{children:y.jsx("h2",{className:"pl-3 text-2xl font-semibold tracking-tight",children:"Proyectos"})}),y.jsx("div",{className:"flex items-center gap-2",children:y.jsx("div",{className:"inline-flex bg-muted/60 rounded-full p-1 text-xs",children:[["todos","Todos"],["abiertos","Activos"],["cerrados","Cerrados"]].map(([He,nt])=>y.jsx("button",{onClick:()=>d(He),className:`px-3.5 py-1.5 rounded-full transition-colors font-medium ${u===He?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:nt},He))})})]}),y.jsxs("div",{className:"relative md:hidden",children:[y.jsx(Yu,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),y.jsx(On,{value:o,onChange:He=>l(He.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(QI,{filters:f,activeCount:Z,countryOptions:j,brandOptions:I,clientOptions:Y,cmOptions:V,onFilterChange:Ze,onClear:Ke}),K&&y.jsx(JI,{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(Ku,{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(ft,{variant:"outline",size:"sm",onClick:()=>void F(),className:"gap-1.5",children:[y.jsx(lD,{className:"h-3.5 w-3.5"})," Reintentar"]})]}),N&&T.length===0?y.jsx(t$,{}):T.length===0?y.jsx(n$,{onNew:St,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(He=>y.jsx(YP,{project:He,onClick:()=>Wt(He)},He.id))}),C>Mi&&y.jsx(ZI,{currentPage:ee,totalPages:z,visibleStart:xe,visibleEnd:Ce,totalItems:C,onPageChange:Re})]}),y.jsx(qI,{open:e,onOpenChange:t,project:r,onDelete:Bt,deleting:!!r&&w===r.id})]})}function XI(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function JI({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(Mp,{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…":XI(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(ft,{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(PM,{className:"h-3.5 w-3.5"}):y.jsx(UM,{className:"h-3.5 w-3.5"}),d?"Actualizando…":u?"Ocultar a todos":"Mostrar a todos"]})]})]})})}function QI({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(dD,{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(ft,{type:"button",variant:"ghost",size:"sm",onClick:d,className:"h-8 rounded-full px-2.5 text-xs text-muted-foreground hover:text-foreground lg:hidden",children:[y.jsx(wl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]}),y.jsxs("div",{className:"grid flex-1 grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[y.jsx(Qr,{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(Qr,{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(Qr,{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(Qr,{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(ft,{type:"button",variant:"ghost",size:"sm",onClick:d,disabled:t===0,className:"hidden h-9 rounded-full px-3 text-xs text-muted-foreground hover:text-foreground lg:inline-flex",children:[y.jsx(wl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]})})}function ZI({currentPage:e,totalPages:t,visibleStart:r,visibleEnd:s,totalItems:o,onPageChange:l}){const u=e$(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(ft,{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(wM,{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(ft,{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(ft,{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(O_,{className:"h-4 w-4"})]})]})]})}function e$(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 t$(){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 n$({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(FM,{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(ft,{onClick:e,className:"mt-5 gap-1.5 rounded-full",children:[y.jsx(bl,{className:"w-4 h-4"})," Crear proyecto"]})]})}const r$=({...e})=>y.jsx(OI,{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 a$ 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 s$(){const{user:e,loading:t}=hd();return t&&!e?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(jp,{showWordmark:!1})}),y.jsx("p",{className:"text-sm text-muted-foreground",children:"Cargando tablero…"})]})}):e?y.jsx(wN,{children:y.jsx(zx,{path:"/*",element:y.jsx(WI,{})})}):y.jsx(oM,{})}function i$(){return y.jsx(a$,{children:y.jsx(i2,{children:y.jsxs(VN,{basename:"/tablero-cdc/",children:[y.jsx(s$,{}),y.jsx(r$,{richColors:!0,position:"top-right"})]})})})}xA.createRoot(document.getElementById("root")).render(y.jsx(v.StrictMode,{children:y.jsx(i$,{})}));
|