Files
cdc-project-management/dist/assets/index-COXhoke_.js
T

434 lines
827 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function FR(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(s,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>s[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const l of i)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(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(i){if(i.ep)return;i.ep=!0;const l=r(i);fetch(i.href,l)}})();function y_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cm={exports:{}},il={};/**
* @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 dx;function KR(){if(dx)return il;dx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,i,l){var u=null;if(l!==void 0&&(u=""+l),i.key!==void 0&&(u=""+i.key),"key"in i){l={};for(var d in i)d!=="key"&&(l[d]=i[d])}else l=i;return i=l.ref,{$$typeof:e,type:s,key:u,ref:i!==void 0?i:null,props:l}}return il.Fragment=t,il.jsx=r,il.jsxs=r,il}var fx;function YR(){return fx||(fx=1,Cm.exports=KR()),Cm.exports}var m=YR(),Tm={exports:{}},Ue={};/**
* @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 hx;function WR(){if(hx)return Ue;hx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=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"),h=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function _(k){return k===null||typeof k!="object"?null:(k=x&&k[x]||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,O,U){this.props=k,this.context=O,this.refs=T,this.updater=U||E}C.prototype.isReactComponent={},C.prototype.setState=function(k,O){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,O,"setState")},C.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function R(){}R.prototype=C.prototype;function A(k,O,U){this.props=k,this.context=O,this.refs=T,this.updater=U||E}var D=A.prototype=new R;D.constructor=A,S(D,C.prototype),D.isPureReactComponent=!0;var B=Array.isArray;function I(){}var L={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function Z(k,O,U){var Y=U.ref;return{$$typeof:e,type:k,key:O,ref:Y!==void 0?Y:null,props:U}}function ue(k,O){return Z(k.type,O,k.props)}function ce(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function he(k){var O={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(U){return O[U]})}var de=/\/+/g;function me(k,O){return typeof k=="object"&&k!==null&&k.key!=null?he(""+k.key):O.toString(36)}function pe(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(I,I):(k.status="pending",k.then(function(O){k.status==="pending"&&(k.status="fulfilled",k.value=O)},function(O){k.status==="pending"&&(k.status="rejected",k.reason=O)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function j(k,O,U,Y,$){var re=typeof k;(re==="undefined"||re==="boolean")&&(k=null);var te=!1;if(k===null)te=!0;else switch(re){case"bigint":case"string":case"number":te=!0;break;case"object":switch(k.$$typeof){case e:case t:te=!0;break;case b:return te=k._init,j(te(k._payload),O,U,Y,$)}}if(te)return $=$(k),te=Y===""?"."+me(k,0):Y,B($)?(U="",te!=null&&(U=te.replace(de,"$&/")+"/"),j($,O,U,"",function(Se){return Se})):$!=null&&(ce($)&&($=ue($,U+($.key==null||k&&k.key===$.key?"":(""+$.key).replace(de,"$&/")+"/")+te)),O.push($)),1;te=0;var ee=Y===""?".":Y+":";if(B(k))for(var se=0;se<k.length;se++)Y=k[se],re=ee+me(Y,se),te+=j(Y,O,U,re,$);else if(se=_(k),typeof se=="function")for(k=se.call(k),se=0;!(Y=k.next()).done;)Y=Y.value,re=ee+me(Y,se++),te+=j(Y,O,U,re,$);else if(re==="object"){if(typeof k.then=="function")return j(pe(k),O,U,Y,$);throw O=String(k),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.")}return te}function K(k,O,U){if(k==null)return k;var Y=[],$=0;return j(k,Y,"","",function(re){return O.call(U,re,$++)}),Y}function W(k){if(k._status===-1){var O=k._result;O=O(),O.then(function(U){(k._status===0||k._status===-1)&&(k._status=1,k._result=U)},function(U){(k._status===0||k._status===-1)&&(k._status=2,k._result=U)}),k._status===-1&&(k._status=0,k._result=O)}if(k._status===1)return k._result.default;throw k._result}var J=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var O=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(O))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},G={map:K,forEach:function(k,O,U){K(k,function(){O.apply(this,arguments)},U)},count:function(k){var O=0;return K(k,function(){O++}),O},toArray:function(k){return K(k,function(O){return O})||[]},only:function(k){if(!ce(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return Ue.Activity=g,Ue.Children=G,Ue.Component=C,Ue.Fragment=r,Ue.Profiler=i,Ue.PureComponent=A,Ue.StrictMode=s,Ue.Suspense=f,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(k){return L.H.useMemoCache(k)}},Ue.cache=function(k){return function(){return k.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(k,O,U){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var Y=S({},k.props),$=k.key;if(O!=null)for(re in O.key!==void 0&&($=""+O.key),O)!H.call(O,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&O.ref===void 0||(Y[re]=O[re]);var re=arguments.length-2;if(re===1)Y.children=U;else if(1<re){for(var te=Array(re),ee=0;ee<re;ee++)te[ee]=arguments[ee+2];Y.children=te}return Z(k.type,$,Y)},Ue.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},Ue.createElement=function(k,O,U){var Y,$={},re=null;if(O!=null)for(Y in O.key!==void 0&&(re=""+O.key),O)H.call(O,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&($[Y]=O[Y]);var te=arguments.length-2;if(te===1)$.children=U;else if(1<te){for(var ee=Array(te),se=0;se<te;se++)ee[se]=arguments[se+2];$.children=ee}if(k&&k.defaultProps)for(Y in te=k.defaultProps,te)$[Y]===void 0&&($[Y]=te[Y]);return Z(k,re,$)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(k){return{$$typeof:d,render:k}},Ue.isValidElement=ce,Ue.lazy=function(k){return{$$typeof:b,_payload:{_status:-1,_result:k},_init:W}},Ue.memo=function(k,O){return{$$typeof:h,type:k,compare:O===void 0?null:O}},Ue.startTransition=function(k){var O=L.T,U={};L.T=U;try{var Y=k(),$=L.S;$!==null&&$(U,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(I,J)}catch(re){J(re)}finally{O!==null&&U.types!==null&&(O.types=U.types),L.T=O}},Ue.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Ue.use=function(k){return L.H.use(k)},Ue.useActionState=function(k,O,U){return L.H.useActionState(k,O,U)},Ue.useCallback=function(k,O){return L.H.useCallback(k,O)},Ue.useContext=function(k){return L.H.useContext(k)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(k,O){return L.H.useDeferredValue(k,O)},Ue.useEffect=function(k,O){return L.H.useEffect(k,O)},Ue.useEffectEvent=function(k){return L.H.useEffectEvent(k)},Ue.useId=function(){return L.H.useId()},Ue.useImperativeHandle=function(k,O,U){return L.H.useImperativeHandle(k,O,U)},Ue.useInsertionEffect=function(k,O){return L.H.useInsertionEffect(k,O)},Ue.useLayoutEffect=function(k,O){return L.H.useLayoutEffect(k,O)},Ue.useMemo=function(k,O){return L.H.useMemo(k,O)},Ue.useOptimistic=function(k,O){return L.H.useOptimistic(k,O)},Ue.useReducer=function(k,O,U){return L.H.useReducer(k,O,U)},Ue.useRef=function(k){return L.H.useRef(k)},Ue.useState=function(k){return L.H.useState(k)},Ue.useSyncExternalStore=function(k,O,U){return L.H.useSyncExternalStore(k,O,U)},Ue.useTransition=function(){return L.H.useTransition()},Ue.version="19.2.6",Ue}var mx;function jd(){return mx||(mx=1,Tm.exports=WR()),Tm.exports}var y=jd();const fe=y_(y),rg=FR({__proto__:null,default:fe},[y]);var Nm={exports:{}},ol={},Am={exports:{}},Rm={};/**
* @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 px;function XR(){return px||(px=1,(function(e){function t(j,K){var W=j.length;j.push(K);e:for(;0<W;){var J=W-1>>>1,G=j[J];if(0<i(G,K))j[J]=K,j[W]=G,W=J;else break e}}function r(j){return j.length===0?null:j[0]}function s(j){if(j.length===0)return null;var K=j[0],W=j.pop();if(W!==K){j[0]=W;e:for(var J=0,G=j.length,k=G>>>1;J<k;){var O=2*(J+1)-1,U=j[O],Y=O+1,$=j[Y];if(0>i(U,W))Y<G&&0>i($,U)?(j[J]=$,j[Y]=W,J=Y):(j[J]=U,j[O]=W,J=O);else if(Y<G&&0>i($,W))j[J]=$,j[Y]=W,J=Y;else break e}}return K}function i(j,K){var W=j.sortIndex-K.sortIndex;return W!==0?W:j.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=[],h=[],b=1,g=null,x=3,_=!1,E=!1,S=!1,T=!1,C=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function D(j){for(var K=r(h);K!==null;){if(K.callback===null)s(h);else if(K.startTime<=j)s(h),K.sortIndex=K.expirationTime,t(f,K);else break;K=r(h)}}function B(j){if(S=!1,D(j),!E)if(r(f)!==null)E=!0,I||(I=!0,he());else{var K=r(h);K!==null&&pe(B,K.startTime-j)}}var I=!1,L=-1,H=5,Z=-1;function ue(){return T?!0:!(e.unstable_now()-Z<H)}function ce(){if(T=!1,I){var j=e.unstable_now();Z=j;var K=!0;try{e:{E=!1,S&&(S=!1,R(L),L=-1),_=!0;var W=x;try{t:{for(D(j),g=r(f);g!==null&&!(g.expirationTime>j&&ue());){var J=g.callback;if(typeof J=="function"){g.callback=null,x=g.priorityLevel;var G=J(g.expirationTime<=j);if(j=e.unstable_now(),typeof G=="function"){g.callback=G,D(j),K=!0;break t}g===r(f)&&s(f),D(j)}else s(f);g=r(f)}if(g!==null)K=!0;else{var k=r(h);k!==null&&pe(B,k.startTime-j),K=!1}}break e}finally{g=null,x=W,_=!1}K=void 0}}finally{K?he():I=!1}}}var he;if(typeof A=="function")he=function(){A(ce)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,me=de.port2;de.port1.onmessage=ce,he=function(){me.postMessage(null)}}else he=function(){C(ce,0)};function pe(j,K){L=C(function(){j(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(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(j){switch(x){case 1:case 2:case 3:var K=3;break;default:K=x}var W=x;x=K;try{return j()}finally{x=W}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(j,K){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var W=x;x=j;try{return K()}finally{x=W}},e.unstable_scheduleCallback=function(j,K,W){var J=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?J+W:J):W=J,j){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=W+G,j={id:b++,callback:K,priorityLevel:j,startTime:W,expirationTime:G,sortIndex:-1},W>J?(j.sortIndex=W,t(h,j),r(f)===null&&j===r(h)&&(S?(R(L),L=-1):S=!0,pe(B,W-J))):(j.sortIndex=G,t(f,j),E||_||(E=!0,I||(I=!0,he()))),j},e.unstable_shouldYield=ue,e.unstable_wrapCallback=function(j){var K=x;return function(){var W=x;x=K;try{return j.apply(this,arguments)}finally{x=W}}}})(Rm)),Rm}var gx;function JR(){return gx||(gx=1,Am.exports=XR()),Am.exports}var jm={exports:{}},dn={};/**
* @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 vx;function QR(){if(vx)return dn;vx=1;var e=jd();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)h+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+f+"; visit "+h+" 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},i=Symbol.for("react.portal");function l(f,h,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:f,containerInfo:h,implementation:b}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,dn.createPortal=function(f,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(f,h,null,b)},dn.flushSync=function(f){var h=u.T,b=s.p;try{if(u.T=null,s.p=2,f)return f()}finally{u.T=h,s.p=b,s.d.f()}},dn.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(f,h))},dn.prefetchDNS=function(f){typeof f=="string"&&s.d.D(f)},dn.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var b=h.as,g=d(b,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,_=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;b==="style"?s.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:_}):b==="script"&&s.d.X(f,{crossOrigin:g,integrity:x,fetchPriority:_,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},dn.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var b=d(h.as,h.crossOrigin);s.d.M(f,{crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(f)},dn.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var b=h.as,g=d(b,h.crossOrigin);s.d.L(f,b,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},dn.preloadModule=function(f,h){if(typeof f=="string")if(h){var b=d(h.as,h.crossOrigin);s.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(f)},dn.requestFormReset=function(f){s.d.r(f)},dn.unstable_batchedUpdates=function(f,h){return f(h)},dn.useFormState=function(f,h,b){return u.H.useFormState(f,h,b)},dn.useFormStatus=function(){return u.H.useHostTransitionStatus()},dn.version="19.2.6",dn}var yx;function b_(){if(yx)return jm.exports;yx=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(),jm.exports=QR(),jm.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 bx;function ZR(){if(bx)return ol;bx=1;var e=JR(),t=jd(),r=b_();function s(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)a+="&args[]="+encodeURIComponent(arguments[o])}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 i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var a=n,o=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(o=a.return),n=a.return;while(n)}return a.tag===3?o: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 h(n){var a=n.alternate;if(!a){if(a=l(n),a===null)throw Error(s(188));return a!==n?null:n}for(var o=n,c=a;;){var p=o.return;if(p===null)break;var v=p.alternate;if(v===null){if(c=p.return,c!==null){o=c;continue}break}if(p.child===v.child){for(v=p.child;v;){if(v===o)return f(p),n;if(v===c)return f(p),a;v=v.sibling}throw Error(s(188))}if(o.return!==c.return)o=p,c=v;else{for(var w=!1,N=p.child;N;){if(N===o){w=!0,o=p,c=v;break}if(N===c){w=!0,c=p,o=v;break}N=N.sibling}if(!w){for(N=v.child;N;){if(N===o){w=!0,o=v,c=p;break}if(N===c){w=!0,c=v,o=p;break}N=N.sibling}if(!w)throw Error(s(189))}}if(o.alternate!==c)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?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,x=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"),R=Symbol.for("react.consumer"),A=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),ue=Symbol.for("react.memo_cache_sentinel"),ce=Symbol.iterator;function he(n){return n===null||typeof n!="object"?null:(n=ce&&n[ce]||n["@@iterator"],typeof n=="function"?n:null)}var de=Symbol.for("react.client.reference");function me(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===de?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 B:return"Suspense";case I:return"SuspenseList";case Z:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case E:return"Portal";case A:return n.displayName||"Context";case R:return(n._context.displayName||"Context")+".Consumer";case D: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:me(n.type)||"Memo";case H:a=n._payload,n=n._init;try{return me(n(a))}catch{}}return null}var pe=Array.isArray,j=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,W={pending:!1,data:null,method:null,action:null},J=[],G=-1;function k(n){return{current:n}}function O(n){0>G||(n.current=J[G],J[G]=null,G--)}function U(n,a){G++,J[G]=n.current,n.current=a}var Y=k(null),$=k(null),re=k(null),te=k(null);function ee(n,a){switch(U(re,a),U($,n),U(Y,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?D0(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=D0(a),n=P0(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}O(Y),U(Y,n)}function se(){O(Y),O($),O(re)}function Se(n){n.memoizedState!==null&&U(te,n);var a=Y.current,o=P0(a,n.type);a!==o&&(U($,n),U(Y,o))}function Te(n){$.current===n&&(O(Y),O($)),te.current===n&&(O(te),nl._currentValue=W)}var Re,nt;function Ze(n){if(Re===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",nt=-1<o.stack.indexOf(`
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Re+n+nt}var xt=!1;function oe(n,a){if(!n||xt)return"";xt=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(X){var F=X}Reflect.construct(n,[],ie)}else{try{ie.call()}catch(X){F=X}n.call(ie.prototype)}}else{try{throw Error()}catch(X){F=X}(ie=n())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(X){if(X&&F&&typeof X.stack=="string")return[X.stack,F.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=c.DetermineComponentFrameRoot(),w=v[0],N=v[1];if(w&&N){var M=w.split(`
`),V=N.split(`
`);for(p=c=0;c<M.length&&!M[c].includes("DetermineComponentFrameRoot");)c++;for(;p<V.length&&!V[p].includes("DetermineComponentFrameRoot");)p++;if(c===M.length||p===V.length)for(c=M.length-1,p=V.length-1;1<=c&&0<=p&&M[c]!==V[p];)p--;for(;1<=c&&0<=p;c--,p--)if(M[c]!==V[p]){if(c!==1||p!==1)do if(c--,p--,0>p||M[c]!==V[p]){var ne=`
`+M[c].replace(" at new "," at ");return n.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",n.displayName)),ne}while(1<=c&&0<=p);break}}}finally{xt=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?Ze(o):""}function je(n,a){switch(n.tag){case 26:case 27:case 5:return Ze(n.type);case 16:return Ze("Lazy");case 13:return n.child!==a&&a!==null?Ze("Suspense Fallback"):Ze("Suspense");case 19:return Ze("SuspenseList");case 0:case 15:return oe(n.type,!1);case 11:return oe(n.type.render,!1);case 1:return oe(n.type,!0);case 31:return Ze("Activity");default:return""}}function Ve(n){try{var a="",o=null;do a+=je(n,o),o=n,n=n.return;while(n);return a}catch(c){return`
Error generating stack: `+c.message+`
`+c.stack}}var $e=Object.prototype.hasOwnProperty,Nt=e.unstable_scheduleCallback,We=e.unstable_cancelCallback,it=e.unstable_shouldYield,Pt=e.unstable_requestPaint,Ie=e.unstable_now,Q=e.unstable_getCurrentPriorityLevel,Oe=e.unstable_ImmediatePriority,Xe=e.unstable_UserBlockingPriority,Lt=e.unstable_NormalPriority,ln=e.unstable_LowPriority,Kt=e.unstable_IdlePriority,gn=e.log,vn=e.unstable_setDisableYieldValue,yn=null,kt=null;function cn(n){if(typeof gn=="function"&&vn(n),kt&&typeof kt.setStrictMode=="function")try{kt.setStrictMode(yn,n)}catch{}}var Ot=Math.clz32?Math.clz32:le,Ur=Math.log,$r=Math.LN2;function le(n){return n>>>=0,n===0?32:31-(Ur(n)/$r|0)|0}var Me=256,at=262144,ot=4194304;function qt(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 Pe(n,a,o){var c=n.pendingLanes;if(c===0)return 0;var p=0,v=n.suspendedLanes,w=n.pingedLanes;n=n.warmLanes;var N=c&134217727;return N!==0?(c=N&~v,c!==0?p=qt(c):(w&=N,w!==0?p=qt(w):o||(o=N&~n,o!==0&&(p=qt(o))))):(N=c&~v,N!==0?p=qt(N):w!==0?p=qt(w):o||(o=c&~n,o!==0&&(p=qt(o)))),p===0?0:a!==0&&a!==p&&(a&v)===0&&(v=p&-p,o=a&-a,v>=o||v===32&&(o&4194048)!==0)?a:p}function yt(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Yt(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 un(){var n=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),n}function xa(n){for(var a=[],o=0;31>o;o++)a.push(n);return a}function Ct(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function bn(n,a,o,c,p,v){var w=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var N=n.entanglements,M=n.expirationTimes,V=n.hiddenUpdates;for(o=w&~o;0<o;){var ne=31-Ot(o),ie=1<<ne;N[ne]=0,M[ne]=-1;var F=V[ne];if(F!==null)for(V[ne]=null,ne=0;ne<F.length;ne++){var X=F[ne];X!==null&&(X.lane&=-536870913)}o&=~ie}c!==0&&us(n,c,0),v!==0&&p===0&&n.tag!==0&&(n.suspendedLanes|=v&~(w&~a))}function us(n,a,o){n.pendingLanes|=a,n.suspendedLanes&=~a;var c=31-Ot(a);n.entangledLanes|=a,n.entanglements[c]=n.entanglements[c]|1073741824|o&261930}function xn(n,a){var o=n.entangledLanes|=a;for(n=n.entanglements;o;){var c=31-Ot(o),p=1<<c;p&a|n[c]&a&&(n[c]|=a),o&=~p}}function wn(n,a){var o=a&-a;return o=(o&42)!==0?1:Ys(o),(o&(n.suspendedLanes|a))!==0?0:o}function Ys(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 cr(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function pf(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:ax(n.type))}function xv(n,a){var o=K.p;try{return K.p=n,a()}finally{K.p=o}}var wa=Math.random().toString(36).slice(2),Zt="__reactFiber$"+wa,_n="__reactProps$"+wa,Ws="__reactContainer$"+wa,gf="__reactEvents$"+wa,PN="__reactListeners$"+wa,LN="__reactHandles$"+wa,wv="__reactResources$"+wa,vo="__reactMarker$"+wa;function vf(n){delete n[Zt],delete n[_n],delete n[gf],delete n[PN],delete n[LN]}function Xs(n){var a=n[Zt];if(a)return a;for(var o=n.parentNode;o;){if(a=o[Ws]||o[Zt]){if(o=a.alternate,a.child!==null||o!==null&&o.child!==null)for(n=H0(n);n!==null;){if(o=n[Zt])return o;n=H0(n)}return a}n=o,o=n.parentNode}return null}function Js(n){if(n=n[Zt]||n[Ws]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function yo(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[wv];return a||(a=n[wv]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Wt(n){n[vo]=!0}var _v=new Set,Sv={};function ds(n,a){Zs(n,a),Zs(n+"Capture",a)}function Zs(n,a){for(Sv[n]=a,n=0;n<a.length;n++)_v.add(a[n])}var zN=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]*$"),Ev={},Cv={};function IN(n){return $e.call(Cv,n)?!0:$e.call(Ev,n)?!1:zN.test(n)?Cv[n]=!0:(Ev[n]=!0,!1)}function oc(n,a,o){if(IN(a))if(o===null)n.removeAttribute(a);else{switch(typeof o){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,""+o)}}function lc(n,a,o){if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+o)}}function Br(n,a,o,c){if(c===null)n.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(a,o,""+c)}}function Fn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Tv(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function UN(n,a,o){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var p=c.get,v=c.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return p.call(this)},set:function(w){o=""+w,v.call(this,w)}}),Object.defineProperty(n,a,{enumerable:c.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function yf(n){if(!n._valueTracker){var a=Tv(n)?"checked":"value";n._valueTracker=UN(n,a,""+n[a])}}function Nv(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var o=a.getValue(),c="";return n&&(c=Tv(n)?n.checked?"true":"false":n.value),n=c,n!==o?(a.setValue(n),!0):!1}function cc(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 $N=/[\n"\\]/g;function Kn(n){return n.replace($N,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function bf(n,a,o,c,p,v,w,N){n.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?n.type=w:n.removeAttribute("type"),a!=null?w==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Fn(a)):n.value!==""+Fn(a)&&(n.value=""+Fn(a)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),a!=null?xf(n,w,Fn(a)):o!=null?xf(n,w,Fn(o)):c!=null&&n.removeAttribute("value"),p==null&&v!=null&&(n.defaultChecked=!!v),p!=null&&(n.checked=p&&typeof p!="function"&&typeof p!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?n.name=""+Fn(N):n.removeAttribute("name")}function Av(n,a,o,c,p,v,w,N){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(n.type=v),a!=null||o!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){yf(n);return}o=o!=null?""+Fn(o):"",a=a!=null?""+Fn(a):o,N||a===n.value||(n.value=a),n.defaultValue=a}c=c??p,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=N?n.checked:!!c,n.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.name=w),yf(n)}function xf(n,a,o){a==="number"&&cc(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function ei(n,a,o,c){if(n=n.options,a){a={};for(var p=0;p<o.length;p++)a["$"+o[p]]=!0;for(o=0;o<n.length;o++)p=a.hasOwnProperty("$"+n[o].value),n[o].selected!==p&&(n[o].selected=p),p&&c&&(n[o].defaultSelected=!0)}else{for(o=""+Fn(o),a=null,p=0;p<n.length;p++){if(n[p].value===o){n[p].selected=!0,c&&(n[p].defaultSelected=!0);return}a!==null||n[p].disabled||(a=n[p])}a!==null&&(a.selected=!0)}}function Rv(n,a,o){if(a!=null&&(a=""+Fn(a),a!==n.value&&(n.value=a),o==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=o!=null?""+Fn(o):""}function jv(n,a,o,c){if(a==null){if(c!=null){if(o!=null)throw Error(s(92));if(pe(c)){if(1<c.length)throw Error(s(93));c=c[0]}o=c}o==null&&(o=""),a=o}o=Fn(a),n.defaultValue=o,c=n.textContent,c===o&&c!==""&&c!==null&&(n.value=c),yf(n)}function ti(n,a){if(a){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=a;return}}n.textContent=a}var BN=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 kv(n,a,o){var c=a.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?c?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":c?n.setProperty(a,o):typeof o!="number"||o===0||BN.has(a)?a==="float"?n.cssFloat=o:n[a]=(""+o).trim():n[a]=o+"px"}function Ov(n,a,o){if(a!=null&&typeof a!="object")throw Error(s(62));if(n=n.style,o!=null){for(var c in o)!o.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var p in a)c=a[p],a.hasOwnProperty(p)&&o[p]!==c&&kv(n,p,c)}else for(var v in a)a.hasOwnProperty(v)&&kv(n,v,a[v])}function wf(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 HN=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"]]),qN=/^[\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 uc(n){return qN.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Hr(){}var _f=null;function Sf(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ni=null,ri=null;function Mv(n){var a=Js(n);if(a&&(n=a.stateNode)){var o=n[_n]||null;e:switch(n=a.stateNode,a.type){case"input":if(bf(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),a=o.name,o.type==="radio"&&a!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Kn(""+a)+'"][type="radio"]'),a=0;a<o.length;a++){var c=o[a];if(c!==n&&c.form===n.form){var p=c[_n]||null;if(!p)throw Error(s(90));bf(c,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<o.length;a++)c=o[a],c.form===n.form&&Nv(c)}break e;case"textarea":Rv(n,o.value,o.defaultValue);break e;case"select":a=o.value,a!=null&&ei(n,!!o.multiple,a,!1)}}}var Ef=!1;function Dv(n,a,o){if(Ef)return n(a,o);Ef=!0;try{var c=n(a);return c}finally{if(Ef=!1,(ni!==null||ri!==null)&&(Jc(),ni&&(a=ni,n=ri,ri=ni=null,Mv(a),n)))for(a=0;a<n.length;a++)Mv(n[a])}}function bo(n,a){var o=n.stateNode;if(o===null)return null;var c=o[_n]||null;if(c===null)return null;o=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(o&&typeof o!="function")throw Error(s(231,a,typeof o));return o}var qr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cf=!1;if(qr)try{var xo={};Object.defineProperty(xo,"passive",{get:function(){Cf=!0}}),window.addEventListener("test",xo,xo),window.removeEventListener("test",xo,xo)}catch{Cf=!1}var _a=null,Tf=null,dc=null;function Pv(){if(dc)return dc;var n,a=Tf,o=a.length,c,p="value"in _a?_a.value:_a.textContent,v=p.length;for(n=0;n<o&&a[n]===p[n];n++);var w=o-n;for(c=1;c<=w&&a[o-c]===p[v-c];c++);return dc=p.slice(n,1<c?1-c:void 0)}function fc(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 hc(){return!0}function Lv(){return!1}function Sn(n){function a(o,c,p,v,w){this._reactName=o,this._targetInst=p,this.type=c,this.nativeEvent=v,this.target=w,this.currentTarget=null;for(var N in n)n.hasOwnProperty(N)&&(o=n[N],this[N]=o?o(v):v[N]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?hc:Lv,this.isPropagationStopped=Lv,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=hc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=hc)},persist:function(){},isPersistent:hc}),a}var fs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mc=Sn(fs),wo=g({},fs,{view:0,detail:0}),VN=Sn(wo),Nf,Af,_o,pc=g({},wo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jf,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!==_o&&(_o&&n.type==="mousemove"?(Nf=n.screenX-_o.screenX,Af=n.screenY-_o.screenY):Af=Nf=0,_o=n),Nf)},movementY:function(n){return"movementY"in n?n.movementY:Af}}),zv=Sn(pc),GN=g({},pc,{dataTransfer:0}),FN=Sn(GN),KN=g({},wo,{relatedTarget:0}),Rf=Sn(KN),YN=g({},fs,{animationName:0,elapsedTime:0,pseudoElement:0}),WN=Sn(YN),XN=g({},fs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),JN=Sn(XN),QN=g({},fs,{data:0}),Iv=Sn(QN),ZN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eA={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"},tA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nA(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=tA[n])?!!a[n]:!1}function jf(){return nA}var rA=g({},wo,{key:function(n){if(n.key){var a=ZN[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=fc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?eA[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jf,charCode:function(n){return n.type==="keypress"?fc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?fc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),aA=Sn(rA),sA=g({},pc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Uv=Sn(sA),iA=g({},wo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jf}),oA=Sn(iA),lA=g({},fs,{propertyName:0,elapsedTime:0,pseudoElement:0}),cA=Sn(lA),uA=g({},pc,{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}),dA=Sn(uA),fA=g({},fs,{newState:0,oldState:0}),hA=Sn(fA),mA=[9,13,27,32],kf=qr&&"CompositionEvent"in window,So=null;qr&&"documentMode"in document&&(So=document.documentMode);var pA=qr&&"TextEvent"in window&&!So,$v=qr&&(!kf||So&&8<So&&11>=So),Bv=" ",Hv=!1;function qv(n,a){switch(n){case"keyup":return mA.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vv(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ai=!1;function gA(n,a){switch(n){case"compositionend":return Vv(a);case"keypress":return a.which!==32?null:(Hv=!0,Bv);case"textInput":return n=a.data,n===Bv&&Hv?null:n;default:return null}}function vA(n,a){if(ai)return n==="compositionend"||!kf&&qv(n,a)?(n=Pv(),dc=Tf=_a=null,ai=!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 $v&&a.locale!=="ko"?null:a.data;default:return null}}var yA={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 Gv(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!yA[n.type]:a==="textarea"}function Fv(n,a,o,c){ni?ri?ri.push(c):ri=[c]:ni=c,a=au(a,"onChange"),0<a.length&&(o=new mc("onChange","change",null,o,c),n.push({event:o,listeners:a}))}var Eo=null,Co=null;function bA(n){A0(n,0)}function gc(n){var a=yo(n);if(Nv(a))return n}function Kv(n,a){if(n==="change")return a}var Yv=!1;if(qr){var Of;if(qr){var Mf="oninput"in document;if(!Mf){var Wv=document.createElement("div");Wv.setAttribute("oninput","return;"),Mf=typeof Wv.oninput=="function"}Of=Mf}else Of=!1;Yv=Of&&(!document.documentMode||9<document.documentMode)}function Xv(){Eo&&(Eo.detachEvent("onpropertychange",Jv),Co=Eo=null)}function Jv(n){if(n.propertyName==="value"&&gc(Co)){var a=[];Fv(a,Co,n,Sf(n)),Dv(bA,a)}}function xA(n,a,o){n==="focusin"?(Xv(),Eo=a,Co=o,Eo.attachEvent("onpropertychange",Jv)):n==="focusout"&&Xv()}function wA(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return gc(Co)}function _A(n,a){if(n==="click")return gc(a)}function SA(n,a){if(n==="input"||n==="change")return gc(a)}function EA(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Pn=typeof Object.is=="function"?Object.is:EA;function To(n,a){if(Pn(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var o=Object.keys(n),c=Object.keys(a);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var p=o[c];if(!$e.call(a,p)||!Pn(n[p],a[p]))return!1}return!0}function Qv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Zv(n,a){var o=Qv(n);n=0;for(var c;o;){if(o.nodeType===3){if(c=n+o.textContent.length,n<=a&&c>=a)return{node:o,offset:a-n};n=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Qv(o)}}function ey(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?ey(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function ty(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=cc(n.document);a instanceof n.HTMLIFrameElement;){try{var o=typeof a.contentWindow.location.href=="string"}catch{o=!1}if(o)n=a.contentWindow;else break;a=cc(n.document)}return a}function Df(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 CA=qr&&"documentMode"in document&&11>=document.documentMode,si=null,Pf=null,No=null,Lf=!1;function ny(n,a,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Lf||si==null||si!==cc(c)||(c=si,"selectionStart"in c&&Df(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}),No&&To(No,c)||(No=c,c=au(Pf,"onSelect"),0<c.length&&(a=new mc("onSelect","select",null,a,o),n.push({event:a,listeners:c}),a.target=si)))}function hs(n,a){var o={};return o[n.toLowerCase()]=a.toLowerCase(),o["Webkit"+n]="webkit"+a,o["Moz"+n]="moz"+a,o}var ii={animationend:hs("Animation","AnimationEnd"),animationiteration:hs("Animation","AnimationIteration"),animationstart:hs("Animation","AnimationStart"),transitionrun:hs("Transition","TransitionRun"),transitionstart:hs("Transition","TransitionStart"),transitioncancel:hs("Transition","TransitionCancel"),transitionend:hs("Transition","TransitionEnd")},zf={},ry={};qr&&(ry=document.createElement("div").style,"AnimationEvent"in window||(delete ii.animationend.animation,delete ii.animationiteration.animation,delete ii.animationstart.animation),"TransitionEvent"in window||delete ii.transitionend.transition);function ms(n){if(zf[n])return zf[n];if(!ii[n])return n;var a=ii[n],o;for(o in a)if(a.hasOwnProperty(o)&&o in ry)return zf[n]=a[o];return n}var ay=ms("animationend"),sy=ms("animationiteration"),iy=ms("animationstart"),TA=ms("transitionrun"),NA=ms("transitionstart"),AA=ms("transitioncancel"),oy=ms("transitionend"),ly=new Map,If="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(" ");If.push("scrollEnd");function ur(n,a){ly.set(n,a),ds(a,[n])}var vc=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)},Yn=[],oi=0,Uf=0;function yc(){for(var n=oi,a=Uf=oi=0;a<n;){var o=Yn[a];Yn[a++]=null;var c=Yn[a];Yn[a++]=null;var p=Yn[a];Yn[a++]=null;var v=Yn[a];if(Yn[a++]=null,c!==null&&p!==null){var w=c.pending;w===null?p.next=p:(p.next=w.next,w.next=p),c.pending=p}v!==0&&cy(o,p,v)}}function bc(n,a,o,c){Yn[oi++]=n,Yn[oi++]=a,Yn[oi++]=o,Yn[oi++]=c,Uf|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function $f(n,a,o,c){return bc(n,a,o,c),xc(n)}function ps(n,a){return bc(n,null,null,a),xc(n)}function cy(n,a,o){n.lanes|=o;var c=n.alternate;c!==null&&(c.lanes|=o);for(var p=!1,v=n.return;v!==null;)v.childLanes|=o,c=v.alternate,c!==null&&(c.childLanes|=o),v.tag===22&&(n=v.stateNode,n===null||n._visibility&1||(p=!0)),n=v,v=v.return;return n.tag===3?(v=n.stateNode,p&&a!==null&&(p=31-Ot(o),n=v.hiddenUpdates,c=n[p],c===null?n[p]=[a]:c.push(a),a.lane=o|536870912),v):null}function xc(n){if(50<Wo)throw Wo=0,Wh=null,Error(s(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var li={};function RA(n,a,o,c){this.tag=n,this.key=o,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 Ln(n,a,o,c){return new RA(n,a,o,c)}function Bf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Vr(n,a){var o=n.alternate;return o===null?(o=Ln(n.tag,a,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=a,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,a=n.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function uy(n,a){n.flags&=65011714;var o=n.alternate;return o===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=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,a=o.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function wc(n,a,o,c,p,v){var w=0;if(c=n,typeof n=="function")Bf(n)&&(w=1);else if(typeof n=="string")w=DR(n,o,Y.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case Z:return n=Ln(31,o,a,p),n.elementType=Z,n.lanes=v,n;case S:return gs(o.children,p,v,a);case T:w=8,p|=24;break;case C:return n=Ln(12,o,a,p|2),n.elementType=C,n.lanes=v,n;case B:return n=Ln(13,o,a,p),n.elementType=B,n.lanes=v,n;case I:return n=Ln(19,o,a,p),n.elementType=I,n.lanes=v,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case A:w=10;break e;case R:w=9;break e;case D:w=11;break e;case L:w=14;break e;case H:w=16,c=null;break e}w=29,o=Error(s(130,n===null?"null":typeof n,"")),c=null}return a=Ln(w,o,a,p),a.elementType=n,a.type=c,a.lanes=v,a}function gs(n,a,o,c){return n=Ln(7,n,c,a),n.lanes=o,n}function Hf(n,a,o){return n=Ln(6,n,null,a),n.lanes=o,n}function dy(n){var a=Ln(18,null,null,0);return a.stateNode=n,a}function qf(n,a,o){return a=Ln(4,n.children!==null?n.children:[],n.key,a),a.lanes=o,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var fy=new WeakMap;function Wn(n,a){if(typeof n=="object"&&n!==null){var o=fy.get(n);return o!==void 0?o:(a={value:n,source:a,stack:Ve(a)},fy.set(n,a),a)}return{value:n,source:a,stack:Ve(a)}}var ci=[],ui=0,_c=null,Ao=0,Xn=[],Jn=0,Sa=null,_r=1,Sr="";function Gr(n,a){ci[ui++]=Ao,ci[ui++]=_c,_c=n,Ao=a}function hy(n,a,o){Xn[Jn++]=_r,Xn[Jn++]=Sr,Xn[Jn++]=Sa,Sa=n;var c=_r;n=Sr;var p=32-Ot(c)-1;c&=~(1<<p),o+=1;var v=32-Ot(a)+p;if(30<v){var w=p-p%5;v=(c&(1<<w)-1).toString(32),c>>=w,p-=w,_r=1<<32-Ot(a)+p|o<<p|c,Sr=v+n}else _r=1<<v|o<<p|c,Sr=n}function Vf(n){n.return!==null&&(Gr(n,1),hy(n,1,0))}function Gf(n){for(;n===_c;)_c=ci[--ui],ci[ui]=null,Ao=ci[--ui],ci[ui]=null;for(;n===Sa;)Sa=Xn[--Jn],Xn[Jn]=null,Sr=Xn[--Jn],Xn[Jn]=null,_r=Xn[--Jn],Xn[Jn]=null}function my(n,a){Xn[Jn++]=_r,Xn[Jn++]=Sr,Xn[Jn++]=Sa,_r=a.id,Sr=a.overflow,Sa=n}var en=null,wt=null,rt=!1,Ea=null,Qn=!1,Ff=Error(s(519));function Ca(n){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ro(Wn(a,n)),Ff}function py(n){var a=n.stateNode,o=n.type,c=n.memoizedProps;switch(a[Zt]=n,a[_n]=c,o){case"dialog":Qe("cancel",a),Qe("close",a);break;case"iframe":case"object":case"embed":Qe("load",a);break;case"video":case"audio":for(o=0;o<Jo.length;o++)Qe(Jo[o],a);break;case"source":Qe("error",a);break;case"img":case"image":case"link":Qe("error",a),Qe("load",a);break;case"details":Qe("toggle",a);break;case"input":Qe("invalid",a),Av(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Qe("invalid",a);break;case"textarea":Qe("invalid",a),jv(a,c.value,c.defaultValue,c.children)}o=c.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||a.textContent===""+o||c.suppressHydrationWarning===!0||O0(a.textContent,o)?(c.popover!=null&&(Qe("beforetoggle",a),Qe("toggle",a)),c.onScroll!=null&&Qe("scroll",a),c.onScrollEnd!=null&&Qe("scrollend",a),c.onClick!=null&&(a.onclick=Hr),a=!0):a=!1,a||Ca(n,!0)}function gy(n){for(en=n.return;en;)switch(en.tag){case 5:case 31:case 13:Qn=!1;return;case 27:case 3:Qn=!0;return;default:en=en.return}}function di(n){if(n!==en)return!1;if(!rt)return gy(n),rt=!0,!1;var a=n.tag,o;if((o=a!==3&&a!==27)&&((o=a===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||um(n.type,n.memoizedProps)),o=!o),o&&wt&&Ca(n),gy(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));wt=B0(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));wt=B0(n)}else a===27?(a=wt,Ua(n.type)?(n=pm,pm=null,wt=n):wt=a):wt=en?er(n.stateNode.nextSibling):null;return!0}function vs(){wt=en=null,rt=!1}function Kf(){var n=Ea;return n!==null&&(Nn===null?Nn=n:Nn.push.apply(Nn,n),Ea=null),n}function Ro(n){Ea===null?Ea=[n]:Ea.push(n)}var Yf=k(null),ys=null,Fr=null;function Ta(n,a,o){U(Yf,a._currentValue),a._currentValue=o}function Kr(n){n._currentValue=Yf.current,O(Yf)}function Wf(n,a,o){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===o)break;n=n.return}}function Xf(n,a,o,c){var p=n.child;for(p!==null&&(p.return=n);p!==null;){var v=p.dependencies;if(v!==null){var w=p.child;v=v.firstContext;e:for(;v!==null;){var N=v;v=p;for(var M=0;M<a.length;M++)if(N.context===a[M]){v.lanes|=o,N=v.alternate,N!==null&&(N.lanes|=o),Wf(v.return,o,n),c||(w=null);break e}v=N.next}}else if(p.tag===18){if(w=p.return,w===null)throw Error(s(341));w.lanes|=o,v=w.alternate,v!==null&&(v.lanes|=o),Wf(w,o,n),w=null}else w=p.child;if(w!==null)w.return=p;else for(w=p;w!==null;){if(w===n){w=null;break}if(p=w.sibling,p!==null){p.return=w.return,w=p;break}w=w.return}p=w}}function fi(n,a,o,c){n=null;for(var p=a,v=!1;p!==null;){if(!v){if((p.flags&524288)!==0)v=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var w=p.alternate;if(w===null)throw Error(s(387));if(w=w.memoizedProps,w!==null){var N=p.type;Pn(p.pendingProps.value,w.value)||(n!==null?n.push(N):n=[N])}}else if(p===te.current){if(w=p.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(n!==null?n.push(nl):n=[nl])}p=p.return}n!==null&&Xf(a,n,o,c),a.flags|=262144}function Sc(n){for(n=n.firstContext;n!==null;){if(!Pn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function bs(n){ys=n,Fr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function tn(n){return vy(ys,n)}function Ec(n,a){return ys===null&&bs(n),vy(n,a)}function vy(n,a){var o=a._currentValue;if(a={context:a,memoizedValue:o,next:null},Fr===null){if(n===null)throw Error(s(308));Fr=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Fr=Fr.next=a;return o}var jA=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(o,c){n.push(c)}};this.abort=function(){a.aborted=!0,n.forEach(function(o){return o()})}},kA=e.unstable_scheduleCallback,OA=e.unstable_NormalPriority,zt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jf(){return{controller:new jA,data:new Map,refCount:0}}function jo(n){n.refCount--,n.refCount===0&&kA(OA,function(){n.controller.abort()})}var ko=null,Qf=0,hi=0,mi=null;function MA(n,a){if(ko===null){var o=ko=[];Qf=0,hi=tm(),mi={status:"pending",value:void 0,then:function(c){o.push(c)}}}return Qf++,a.then(yy,yy),a}function yy(){if(--Qf===0&&ko!==null){mi!==null&&(mi.status="fulfilled");var n=ko;ko=null,hi=0,mi=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function DA(n,a){var o=[],c={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return n.then(function(){c.status="fulfilled",c.value=a;for(var p=0;p<o.length;p++)(0,o[p])(a)},function(p){for(c.status="rejected",c.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),c}var by=j.S;j.S=function(n,a){n0=Ie(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&MA(n,a),by!==null&&by(n,a)};var xs=k(null);function Zf(){var n=xs.current;return n!==null?n:vt.pooledCache}function Cc(n,a){a===null?U(xs,xs.current):U(xs,a.pool)}function xy(){var n=Zf();return n===null?null:{parent:zt._currentValue,pool:n}}var pi=Error(s(460)),eh=Error(s(474)),Tc=Error(s(542)),Nc={then:function(){}};function wy(n){return n=n.status,n==="fulfilled"||n==="rejected"}function _y(n,a,o){switch(o=n[o],o===void 0?n.push(a):o!==a&&(a.then(Hr,Hr),a=o),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Ey(n),n;default:if(typeof a.status=="string")a.then(Hr,Hr);else{if(n=vt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=a,n.status="pending",n.then(function(c){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=c}},function(c){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Ey(n),n}throw _s=a,pi}}function ws(n){try{var a=n._init;return a(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(_s=o,pi):o}}var _s=null;function Sy(){if(_s===null)throw Error(s(459));var n=_s;return _s=null,n}function Ey(n){if(n===pi||n===Tc)throw Error(s(483))}var gi=null,Oo=0;function Ac(n){var a=Oo;return Oo+=1,gi===null&&(gi=[]),_y(gi,n,a)}function Mo(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function Rc(n,a){throw a.$$typeof===x?Error(s(525)):(n=Object.prototype.toString.call(a),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function Cy(n){function a(z,P){if(n){var q=z.deletions;q===null?(z.deletions=[P],z.flags|=16):q.push(P)}}function o(z,P){if(!n)return null;for(;P!==null;)a(z,P),P=P.sibling;return null}function c(z){for(var P=new Map;z!==null;)z.key!==null?P.set(z.key,z):P.set(z.index,z),z=z.sibling;return P}function p(z,P){return z=Vr(z,P),z.index=0,z.sibling=null,z}function v(z,P,q){return z.index=q,n?(q=z.alternate,q!==null?(q=q.index,q<P?(z.flags|=67108866,P):q):(z.flags|=67108866,P)):(z.flags|=1048576,P)}function w(z){return n&&z.alternate===null&&(z.flags|=67108866),z}function N(z,P,q,ae){return P===null||P.tag!==6?(P=Hf(q,z.mode,ae),P.return=z,P):(P=p(P,q),P.return=z,P)}function M(z,P,q,ae){var ke=q.type;return ke===S?ne(z,P,q.props.children,ae,q.key):P!==null&&(P.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===H&&ws(ke)===P.type)?(P=p(P,q.props),Mo(P,q),P.return=z,P):(P=wc(q.type,q.key,q.props,null,z.mode,ae),Mo(P,q),P.return=z,P)}function V(z,P,q,ae){return P===null||P.tag!==4||P.stateNode.containerInfo!==q.containerInfo||P.stateNode.implementation!==q.implementation?(P=qf(q,z.mode,ae),P.return=z,P):(P=p(P,q.children||[]),P.return=z,P)}function ne(z,P,q,ae,ke){return P===null||P.tag!==7?(P=gs(q,z.mode,ae,ke),P.return=z,P):(P=p(P,q),P.return=z,P)}function ie(z,P,q){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=Hf(""+P,z.mode,q),P.return=z,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case _:return q=wc(P.type,P.key,P.props,null,z.mode,q),Mo(q,P),q.return=z,q;case E:return P=qf(P,z.mode,q),P.return=z,P;case H:return P=ws(P),ie(z,P,q)}if(pe(P)||he(P))return P=gs(P,z.mode,q,null),P.return=z,P;if(typeof P.then=="function")return ie(z,Ac(P),q);if(P.$$typeof===A)return ie(z,Ec(z,P),q);Rc(z,P)}return null}function F(z,P,q,ae){var ke=P!==null?P.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return ke!==null?null:N(z,P,""+q,ae);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return q.key===ke?M(z,P,q,ae):null;case E:return q.key===ke?V(z,P,q,ae):null;case H:return q=ws(q),F(z,P,q,ae)}if(pe(q)||he(q))return ke!==null?null:ne(z,P,q,ae,null);if(typeof q.then=="function")return F(z,P,Ac(q),ae);if(q.$$typeof===A)return F(z,P,Ec(z,q),ae);Rc(z,q)}return null}function X(z,P,q,ae,ke){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return z=z.get(q)||null,N(P,z,""+ae,ke);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:return z=z.get(ae.key===null?q:ae.key)||null,M(P,z,ae,ke);case E:return z=z.get(ae.key===null?q:ae.key)||null,V(P,z,ae,ke);case H:return ae=ws(ae),X(z,P,q,ae,ke)}if(pe(ae)||he(ae))return z=z.get(q)||null,ne(P,z,ae,ke,null);if(typeof ae.then=="function")return X(z,P,q,Ac(ae),ke);if(ae.$$typeof===A)return X(z,P,q,Ec(P,ae),ke);Rc(P,ae)}return null}function _e(z,P,q,ae){for(var ke=null,lt=null,Ce=P,Ge=P=0,tt=null;Ce!==null&&Ge<q.length;Ge++){Ce.index>Ge?(tt=Ce,Ce=null):tt=Ce.sibling;var ct=F(z,Ce,q[Ge],ae);if(ct===null){Ce===null&&(Ce=tt);break}n&&Ce&&ct.alternate===null&&a(z,Ce),P=v(ct,P,Ge),lt===null?ke=ct:lt.sibling=ct,lt=ct,Ce=tt}if(Ge===q.length)return o(z,Ce),rt&&Gr(z,Ge),ke;if(Ce===null){for(;Ge<q.length;Ge++)Ce=ie(z,q[Ge],ae),Ce!==null&&(P=v(Ce,P,Ge),lt===null?ke=Ce:lt.sibling=Ce,lt=Ce);return rt&&Gr(z,Ge),ke}for(Ce=c(Ce);Ge<q.length;Ge++)tt=X(Ce,z,Ge,q[Ge],ae),tt!==null&&(n&&tt.alternate!==null&&Ce.delete(tt.key===null?Ge:tt.key),P=v(tt,P,Ge),lt===null?ke=tt:lt.sibling=tt,lt=tt);return n&&Ce.forEach(function(Va){return a(z,Va)}),rt&&Gr(z,Ge),ke}function De(z,P,q,ae){if(q==null)throw Error(s(151));for(var ke=null,lt=null,Ce=P,Ge=P=0,tt=null,ct=q.next();Ce!==null&&!ct.done;Ge++,ct=q.next()){Ce.index>Ge?(tt=Ce,Ce=null):tt=Ce.sibling;var Va=F(z,Ce,ct.value,ae);if(Va===null){Ce===null&&(Ce=tt);break}n&&Ce&&Va.alternate===null&&a(z,Ce),P=v(Va,P,Ge),lt===null?ke=Va:lt.sibling=Va,lt=Va,Ce=tt}if(ct.done)return o(z,Ce),rt&&Gr(z,Ge),ke;if(Ce===null){for(;!ct.done;Ge++,ct=q.next())ct=ie(z,ct.value,ae),ct!==null&&(P=v(ct,P,Ge),lt===null?ke=ct:lt.sibling=ct,lt=ct);return rt&&Gr(z,Ge),ke}for(Ce=c(Ce);!ct.done;Ge++,ct=q.next())ct=X(Ce,z,Ge,ct.value,ae),ct!==null&&(n&&ct.alternate!==null&&Ce.delete(ct.key===null?Ge:ct.key),P=v(ct,P,Ge),lt===null?ke=ct:lt.sibling=ct,lt=ct);return n&&Ce.forEach(function(GR){return a(z,GR)}),rt&&Gr(z,Ge),ke}function pt(z,P,q,ae){if(typeof q=="object"&&q!==null&&q.type===S&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case _:e:{for(var ke=q.key;P!==null;){if(P.key===ke){if(ke=q.type,ke===S){if(P.tag===7){o(z,P.sibling),ae=p(P,q.props.children),ae.return=z,z=ae;break e}}else if(P.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===H&&ws(ke)===P.type){o(z,P.sibling),ae=p(P,q.props),Mo(ae,q),ae.return=z,z=ae;break e}o(z,P);break}else a(z,P);P=P.sibling}q.type===S?(ae=gs(q.props.children,z.mode,ae,q.key),ae.return=z,z=ae):(ae=wc(q.type,q.key,q.props,null,z.mode,ae),Mo(ae,q),ae.return=z,z=ae)}return w(z);case E:e:{for(ke=q.key;P!==null;){if(P.key===ke)if(P.tag===4&&P.stateNode.containerInfo===q.containerInfo&&P.stateNode.implementation===q.implementation){o(z,P.sibling),ae=p(P,q.children||[]),ae.return=z,z=ae;break e}else{o(z,P);break}else a(z,P);P=P.sibling}ae=qf(q,z.mode,ae),ae.return=z,z=ae}return w(z);case H:return q=ws(q),pt(z,P,q,ae)}if(pe(q))return _e(z,P,q,ae);if(he(q)){if(ke=he(q),typeof ke!="function")throw Error(s(150));return q=ke.call(q),De(z,P,q,ae)}if(typeof q.then=="function")return pt(z,P,Ac(q),ae);if(q.$$typeof===A)return pt(z,P,Ec(z,q),ae);Rc(z,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,P!==null&&P.tag===6?(o(z,P.sibling),ae=p(P,q),ae.return=z,z=ae):(o(z,P),ae=Hf(q,z.mode,ae),ae.return=z,z=ae),w(z)):o(z,P)}return function(z,P,q,ae){try{Oo=0;var ke=pt(z,P,q,ae);return gi=null,ke}catch(Ce){if(Ce===pi||Ce===Tc)throw Ce;var lt=Ln(29,Ce,null,z.mode);return lt.lanes=ae,lt.return=z,lt}finally{}}}var Ss=Cy(!0),Ty=Cy(!1),Na=!1;function th(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nh(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 Aa(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ra(n,a,o){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(ut&2)!==0){var p=c.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),c.pending=a,a=xc(n),cy(n,null,o),a}return bc(n,c,a,o),xc(n)}function Do(n,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,o|=c,a.lanes=o,xn(n,o)}}function rh(n,a){var o=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var p=null,v=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};v===null?p=v=w:v=v.next=w,o=o.next}while(o!==null);v===null?p=v=a:v=v.next=a}else p=v=a;o={baseState:c.baseState,firstBaseUpdate:p,lastBaseUpdate:v,shared:c.shared,callbacks:c.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=a:n.next=a,o.lastBaseUpdate=a}var ah=!1;function Po(){if(ah){var n=mi;if(n!==null)throw n}}function Lo(n,a,o,c){ah=!1;var p=n.updateQueue;Na=!1;var v=p.firstBaseUpdate,w=p.lastBaseUpdate,N=p.shared.pending;if(N!==null){p.shared.pending=null;var M=N,V=M.next;M.next=null,w===null?v=V:w.next=V,w=M;var ne=n.alternate;ne!==null&&(ne=ne.updateQueue,N=ne.lastBaseUpdate,N!==w&&(N===null?ne.firstBaseUpdate=V:N.next=V,ne.lastBaseUpdate=M))}if(v!==null){var ie=p.baseState;w=0,ne=V=M=null,N=v;do{var F=N.lane&-536870913,X=F!==N.lane;if(X?(et&F)===F:(c&F)===F){F!==0&&F===hi&&(ah=!0),ne!==null&&(ne=ne.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var _e=n,De=N;F=a;var pt=o;switch(De.tag){case 1:if(_e=De.payload,typeof _e=="function"){ie=_e.call(pt,ie,F);break e}ie=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=De.payload,F=typeof _e=="function"?_e.call(pt,ie,F):_e,F==null)break e;ie=g({},ie,F);break e;case 2:Na=!0}}F=N.callback,F!==null&&(n.flags|=64,X&&(n.flags|=8192),X=p.callbacks,X===null?p.callbacks=[F]:X.push(F))}else X={lane:F,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ne===null?(V=ne=X,M=ie):ne=ne.next=X,w|=F;if(N=N.next,N===null){if(N=p.shared.pending,N===null)break;X=N,N=X.next,X.next=null,p.lastBaseUpdate=X,p.shared.pending=null}}while(!0);ne===null&&(M=ie),p.baseState=M,p.firstBaseUpdate=V,p.lastBaseUpdate=ne,v===null&&(p.shared.lanes=0),Da|=w,n.lanes=w,n.memoizedState=ie}}function Ny(n,a){if(typeof n!="function")throw Error(s(191,n));n.call(a)}function Ay(n,a){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)Ny(o[n],a)}var vi=k(null),jc=k(0);function Ry(n,a){n=na,U(jc,n),U(vi,a),na=n|a.baseLanes}function sh(){U(jc,na),U(vi,vi.current)}function ih(){na=jc.current,O(vi),O(jc)}var zn=k(null),Zn=null;function ja(n){var a=n.alternate;U(Mt,Mt.current&1),U(zn,n),Zn===null&&(a===null||vi.current!==null||a.memoizedState!==null)&&(Zn=n)}function oh(n){U(Mt,Mt.current),U(zn,n),Zn===null&&(Zn=n)}function jy(n){n.tag===22?(U(Mt,Mt.current),U(zn,n),Zn===null&&(Zn=n)):ka()}function ka(){U(Mt,Mt.current),U(zn,zn.current)}function In(n){O(zn),Zn===n&&(Zn=null),O(Mt)}var Mt=k(0);function kc(n){for(var a=n;a!==null;){if(a.tag===13){var o=a.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||hm(o)||mm(o)))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 Yr=0,Be=null,ht=null,It=null,Oc=!1,yi=!1,Es=!1,Mc=0,zo=0,bi=null,PA=0;function At(){throw Error(s(321))}function lh(n,a){if(a===null)return!1;for(var o=0;o<a.length&&o<n.length;o++)if(!Pn(n[o],a[o]))return!1;return!0}function ch(n,a,o,c,p,v){return Yr=v,Be=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,j.H=n===null||n.memoizedState===null?hb:Eh,Es=!1,v=o(c,p),Es=!1,yi&&(v=Oy(a,o,c,p)),ky(n),v}function ky(n){j.H=$o;var a=ht!==null&&ht.next!==null;if(Yr=0,It=ht=Be=null,Oc=!1,zo=0,bi=null,a)throw Error(s(300));n===null||Ut||(n=n.dependencies,n!==null&&Sc(n)&&(Ut=!0))}function Oy(n,a,o,c){Be=n;var p=0;do{if(yi&&(bi=null),zo=0,yi=!1,25<=p)throw Error(s(301));if(p+=1,It=ht=null,n.updateQueue!=null){var v=n.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}j.H=mb,v=a(o,c)}while(yi);return v}function LA(){var n=j.H,a=n.useState()[0];return a=typeof a.then=="function"?Io(a):a,n=n.useState()[0],(ht!==null?ht.memoizedState:null)!==n&&(Be.flags|=1024),a}function uh(){var n=Mc!==0;return Mc=0,n}function dh(n,a,o){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~o}function fh(n){if(Oc){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Oc=!1}Yr=0,It=ht=Be=null,yi=!1,zo=Mc=0,bi=null}function hn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?Be.memoizedState=It=n:It=It.next=n,It}function Dt(){if(ht===null){var n=Be.alternate;n=n!==null?n.memoizedState:null}else n=ht.next;var a=It===null?Be.memoizedState:It.next;if(a!==null)It=a,ht=n;else{if(n===null)throw Be.alternate===null?Error(s(467)):Error(s(310));ht=n,n={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},It===null?Be.memoizedState=It=n:It=It.next=n}return It}function Dc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Io(n){var a=zo;return zo+=1,bi===null&&(bi=[]),n=_y(bi,n,a),a=Be,(It===null?a.memoizedState:It.next)===null&&(a=a.alternate,j.H=a===null||a.memoizedState===null?hb:Eh),n}function Pc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Io(n);if(n.$$typeof===A)return tn(n)}throw Error(s(438,String(n)))}function hh(n){var a=null,o=Be.updateQueue;if(o!==null&&(a=o.memoCache),a==null){var c=Be.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),o===null&&(o=Dc(),Be.updateQueue=o),o.memoCache=a,o=a.data[a.index],o===void 0)for(o=a.data[a.index]=Array(n),c=0;c<n;c++)o[c]=ue;return a.index++,o}function Wr(n,a){return typeof a=="function"?a(n):a}function Lc(n){var a=Dt();return mh(a,ht,n)}function mh(n,a,o){var c=n.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=o;var p=n.baseQueue,v=c.pending;if(v!==null){if(p!==null){var w=p.next;p.next=v.next,v.next=w}a.baseQueue=p=v,c.pending=null}if(v=n.baseState,p===null)n.memoizedState=v;else{a=p.next;var N=w=null,M=null,V=a,ne=!1;do{var ie=V.lane&-536870913;if(ie!==V.lane?(et&ie)===ie:(Yr&ie)===ie){var F=V.revertLane;if(F===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),ie===hi&&(ne=!0);else if((Yr&F)===F){V=V.next,F===hi&&(ne=!0);continue}else ie={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},M===null?(N=M=ie,w=v):M=M.next=ie,Be.lanes|=F,Da|=F;ie=V.action,Es&&o(v,ie),v=V.hasEagerState?V.eagerState:o(v,ie)}else F={lane:ie,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},M===null?(N=M=F,w=v):M=M.next=F,Be.lanes|=ie,Da|=ie;V=V.next}while(V!==null&&V!==a);if(M===null?w=v:M.next=N,!Pn(v,n.memoizedState)&&(Ut=!0,ne&&(o=mi,o!==null)))throw o;n.memoizedState=v,n.baseState=w,n.baseQueue=M,c.lastRenderedState=v}return p===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function ph(n){var a=Dt(),o=a.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=n;var c=o.dispatch,p=o.pending,v=a.memoizedState;if(p!==null){o.pending=null;var w=p=p.next;do v=n(v,w.action),w=w.next;while(w!==p);Pn(v,a.memoizedState)||(Ut=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),o.lastRenderedState=v}return[v,c]}function My(n,a,o){var c=Be,p=Dt(),v=rt;if(v){if(o===void 0)throw Error(s(407));o=o()}else o=a();var w=!Pn((ht||p).memoizedState,o);if(w&&(p.memoizedState=o,Ut=!0),p=p.queue,yh(Ly.bind(null,c,p,n),[n]),p.getSnapshot!==a||w||It!==null&&It.memoizedState.tag&1){if(c.flags|=2048,xi(9,{destroy:void 0},Py.bind(null,c,p,o,a),null),vt===null)throw Error(s(349));v||(Yr&127)!==0||Dy(c,a,o)}return o}function Dy(n,a,o){n.flags|=16384,n={getSnapshot:a,value:o},a=Be.updateQueue,a===null?(a=Dc(),Be.updateQueue=a,a.stores=[n]):(o=a.stores,o===null?a.stores=[n]:o.push(n))}function Py(n,a,o,c){a.value=o,a.getSnapshot=c,zy(a)&&Iy(n)}function Ly(n,a,o){return o(function(){zy(a)&&Iy(n)})}function zy(n){var a=n.getSnapshot;n=n.value;try{var o=a();return!Pn(n,o)}catch{return!0}}function Iy(n){var a=ps(n,2);a!==null&&An(a,n,2)}function gh(n){var a=hn();if(typeof n=="function"){var o=n;if(n=o(),Es){cn(!0);try{o()}finally{cn(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:n},a}function Uy(n,a,o,c){return n.baseState=o,mh(n,ht,typeof c=="function"?c:Wr)}function zA(n,a,o,c,p){if(Uc(n))throw Error(s(485));if(n=a.action,n!==null){var v={payload:p,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){v.listeners.push(w)}};j.T!==null?o(!0):v.isTransition=!1,c(v),o=a.pending,o===null?(v.next=a.pending=v,$y(a,v)):(v.next=o.next,a.pending=o.next=v)}}function $y(n,a){var o=a.action,c=a.payload,p=n.state;if(a.isTransition){var v=j.T,w={};j.T=w;try{var N=o(p,c),M=j.S;M!==null&&M(w,N),By(n,a,N)}catch(V){vh(n,a,V)}finally{v!==null&&w.types!==null&&(v.types=w.types),j.T=v}}else try{v=o(p,c),By(n,a,v)}catch(V){vh(n,a,V)}}function By(n,a,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(c){Hy(n,a,c)},function(c){return vh(n,a,c)}):Hy(n,a,o)}function Hy(n,a,o){a.status="fulfilled",a.value=o,qy(a),n.state=o,a=n.pending,a!==null&&(o=a.next,o===a?n.pending=null:(o=o.next,a.next=o,$y(n,o)))}function vh(n,a,o){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=o,qy(a),a=a.next;while(a!==c)}n.action=null}function qy(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Vy(n,a){return a}function Gy(n,a){if(rt){var o=vt.formState;if(o!==null){e:{var c=Be;if(rt){if(wt){t:{for(var p=wt,v=Qn;p.nodeType!==8;){if(!v){p=null;break t}if(p=er(p.nextSibling),p===null){p=null;break t}}v=p.data,p=v==="F!"||v==="F"?p:null}if(p){wt=er(p.nextSibling),c=p.data==="F!";break e}}Ca(c)}c=!1}c&&(a=o[0])}}return o=hn(),o.memoizedState=o.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vy,lastRenderedState:a},o.queue=c,o=ub.bind(null,Be,c),c.dispatch=o,c=gh(!1),v=Sh.bind(null,Be,!1,c.queue),c=hn(),p={state:a,dispatch:null,action:n,pending:null},c.queue=p,o=zA.bind(null,Be,p,v,o),p.dispatch=o,c.memoizedState=n,[a,o,!1]}function Fy(n){var a=Dt();return Ky(a,ht,n)}function Ky(n,a,o){if(a=mh(n,a,Vy)[0],n=Lc(Wr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=Io(a)}catch(w){throw w===pi?Tc:w}else c=a;a=Dt();var p=a.queue,v=p.dispatch;return o!==a.memoizedState&&(Be.flags|=2048,xi(9,{destroy:void 0},IA.bind(null,p,o),null)),[c,v,n]}function IA(n,a){n.action=a}function Yy(n){var a=Dt(),o=ht;if(o!==null)return Ky(a,o,n);Dt(),a=a.memoizedState,o=Dt();var c=o.queue.dispatch;return o.memoizedState=n,[a,c,!1]}function xi(n,a,o,c){return n={tag:n,create:o,deps:c,inst:a,next:null},a=Be.updateQueue,a===null&&(a=Dc(),Be.updateQueue=a),o=a.lastEffect,o===null?a.lastEffect=n.next=n:(c=o.next,o.next=n,n.next=c,a.lastEffect=n),n}function Wy(){return Dt().memoizedState}function zc(n,a,o,c){var p=hn();Be.flags|=n,p.memoizedState=xi(1|a,{destroy:void 0},o,c===void 0?null:c)}function Ic(n,a,o,c){var p=Dt();c=c===void 0?null:c;var v=p.memoizedState.inst;ht!==null&&c!==null&&lh(c,ht.memoizedState.deps)?p.memoizedState=xi(a,v,o,c):(Be.flags|=n,p.memoizedState=xi(1|a,v,o,c))}function Xy(n,a){zc(8390656,8,n,a)}function yh(n,a){Ic(2048,8,n,a)}function UA(n){Be.flags|=4;var a=Be.updateQueue;if(a===null)a=Dc(),Be.updateQueue=a,a.events=[n];else{var o=a.events;o===null?a.events=[n]:o.push(n)}}function Jy(n){var a=Dt().memoizedState;return UA({ref:a,nextImpl:n}),function(){if((ut&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function Qy(n,a){return Ic(4,2,n,a)}function Zy(n,a){return Ic(4,4,n,a)}function eb(n,a){if(typeof a=="function"){n=n();var o=a(n);return function(){typeof o=="function"?o():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function tb(n,a,o){o=o!=null?o.concat([n]):null,Ic(4,4,eb.bind(null,a,n),o)}function bh(){}function nb(n,a){var o=Dt();a=a===void 0?null:a;var c=o.memoizedState;return a!==null&&lh(a,c[1])?c[0]:(o.memoizedState=[n,a],n)}function rb(n,a){var o=Dt();a=a===void 0?null:a;var c=o.memoizedState;if(a!==null&&lh(a,c[1]))return c[0];if(c=n(),Es){cn(!0);try{n()}finally{cn(!1)}}return o.memoizedState=[c,a],c}function xh(n,a,o){return o===void 0||(Yr&1073741824)!==0&&(et&261930)===0?n.memoizedState=a:(n.memoizedState=o,n=a0(),Be.lanes|=n,Da|=n,o)}function ab(n,a,o,c){return Pn(o,a)?o:vi.current!==null?(n=xh(n,o,c),Pn(n,a)||(Ut=!0),n):(Yr&42)===0||(Yr&1073741824)!==0&&(et&261930)===0?(Ut=!0,n.memoizedState=o):(n=a0(),Be.lanes|=n,Da|=n,a)}function sb(n,a,o,c,p){var v=K.p;K.p=v!==0&&8>v?v:8;var w=j.T,N={};j.T=N,Sh(n,!1,a,o);try{var M=p(),V=j.S;if(V!==null&&V(N,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var ne=DA(M,c);Uo(n,a,ne,Bn(n))}else Uo(n,a,c,Bn(n))}catch(ie){Uo(n,a,{then:function(){},status:"rejected",reason:ie},Bn())}finally{K.p=v,w!==null&&N.types!==null&&(w.types=N.types),j.T=w}}function $A(){}function wh(n,a,o,c){if(n.tag!==5)throw Error(s(476));var p=ib(n).queue;sb(n,p,a,W,o===null?$A:function(){return ob(n),o(c)})}function ib(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:W},next:null};var o={};return a.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:o},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function ob(n){var a=ib(n);a.next===null&&(a=n.alternate.memoizedState),Uo(n,a.next.queue,{},Bn())}function _h(){return tn(nl)}function lb(){return Dt().memoizedState}function cb(){return Dt().memoizedState}function BA(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var o=Bn();n=Aa(o);var c=Ra(a,n,o);c!==null&&(An(c,a,o),Do(c,a,o)),a={cache:Jf()},n.payload=a;return}a=a.return}}function HA(n,a,o){var c=Bn();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Uc(n)?db(a,o):(o=$f(n,a,o,c),o!==null&&(An(o,n,c),fb(o,a,c)))}function ub(n,a,o){var c=Bn();Uo(n,a,o,c)}function Uo(n,a,o,c){var p={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Uc(n))db(a,p);else{var v=n.alternate;if(n.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var w=a.lastRenderedState,N=v(w,o);if(p.hasEagerState=!0,p.eagerState=N,Pn(N,w))return bc(n,a,p,0),vt===null&&yc(),!1}catch{}finally{}if(o=$f(n,a,p,c),o!==null)return An(o,n,c),fb(o,a,c),!0}return!1}function Sh(n,a,o,c){if(c={lane:2,revertLane:tm(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Uc(n)){if(a)throw Error(s(479))}else a=$f(n,o,c,2),a!==null&&An(a,n,2)}function Uc(n){var a=n.alternate;return n===Be||a!==null&&a===Be}function db(n,a){yi=Oc=!0;var o=n.pending;o===null?a.next=a:(a.next=o.next,o.next=a),n.pending=a}function fb(n,a,o){if((o&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,o|=c,a.lanes=o,xn(n,o)}}var $o={readContext:tn,use:Pc,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};$o.useEffectEvent=At;var hb={readContext:tn,use:Pc,useCallback:function(n,a){return hn().memoizedState=[n,a===void 0?null:a],n},useContext:tn,useEffect:Xy,useImperativeHandle:function(n,a,o){o=o!=null?o.concat([n]):null,zc(4194308,4,eb.bind(null,a,n),o)},useLayoutEffect:function(n,a){return zc(4194308,4,n,a)},useInsertionEffect:function(n,a){zc(4,2,n,a)},useMemo:function(n,a){var o=hn();a=a===void 0?null:a;var c=n();if(Es){cn(!0);try{n()}finally{cn(!1)}}return o.memoizedState=[c,a],c},useReducer:function(n,a,o){var c=hn();if(o!==void 0){var p=o(a);if(Es){cn(!0);try{o(a)}finally{cn(!1)}}}else p=a;return c.memoizedState=c.baseState=p,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:p},c.queue=n,n=n.dispatch=HA.bind(null,Be,n),[c.memoizedState,n]},useRef:function(n){var a=hn();return n={current:n},a.memoizedState=n},useState:function(n){n=gh(n);var a=n.queue,o=ub.bind(null,Be,a);return a.dispatch=o,[n.memoizedState,o]},useDebugValue:bh,useDeferredValue:function(n,a){var o=hn();return xh(o,n,a)},useTransition:function(){var n=gh(!1);return n=sb.bind(null,Be,n.queue,!0,!1),hn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,o){var c=Be,p=hn();if(rt){if(o===void 0)throw Error(s(407));o=o()}else{if(o=a(),vt===null)throw Error(s(349));(et&127)!==0||Dy(c,a,o)}p.memoizedState=o;var v={value:o,getSnapshot:a};return p.queue=v,Xy(Ly.bind(null,c,v,n),[n]),c.flags|=2048,xi(9,{destroy:void 0},Py.bind(null,c,v,o,a),null),o},useId:function(){var n=hn(),a=vt.identifierPrefix;if(rt){var o=Sr,c=_r;o=(c&~(1<<32-Ot(c)-1)).toString(32)+o,a="_"+a+"R_"+o,o=Mc++,0<o&&(a+="H"+o.toString(32)),a+="_"}else o=PA++,a="_"+a+"r_"+o.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:_h,useFormState:Gy,useActionState:Gy,useOptimistic:function(n){var a=hn();a.memoizedState=a.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=o,a=Sh.bind(null,Be,!0,o),o.dispatch=a,[n,a]},useMemoCache:hh,useCacheRefresh:function(){return hn().memoizedState=BA.bind(null,Be)},useEffectEvent:function(n){var a=hn(),o={impl:n};return a.memoizedState=o,function(){if((ut&2)!==0)throw Error(s(440));return o.impl.apply(void 0,arguments)}}},Eh={readContext:tn,use:Pc,useCallback:nb,useContext:tn,useEffect:yh,useImperativeHandle:tb,useInsertionEffect:Qy,useLayoutEffect:Zy,useMemo:rb,useReducer:Lc,useRef:Wy,useState:function(){return Lc(Wr)},useDebugValue:bh,useDeferredValue:function(n,a){var o=Dt();return ab(o,ht.memoizedState,n,a)},useTransition:function(){var n=Lc(Wr)[0],a=Dt().memoizedState;return[typeof n=="boolean"?n:Io(n),a]},useSyncExternalStore:My,useId:lb,useHostTransitionStatus:_h,useFormState:Fy,useActionState:Fy,useOptimistic:function(n,a){var o=Dt();return Uy(o,ht,n,a)},useMemoCache:hh,useCacheRefresh:cb};Eh.useEffectEvent=Jy;var mb={readContext:tn,use:Pc,useCallback:nb,useContext:tn,useEffect:yh,useImperativeHandle:tb,useInsertionEffect:Qy,useLayoutEffect:Zy,useMemo:rb,useReducer:ph,useRef:Wy,useState:function(){return ph(Wr)},useDebugValue:bh,useDeferredValue:function(n,a){var o=Dt();return ht===null?xh(o,n,a):ab(o,ht.memoizedState,n,a)},useTransition:function(){var n=ph(Wr)[0],a=Dt().memoizedState;return[typeof n=="boolean"?n:Io(n),a]},useSyncExternalStore:My,useId:lb,useHostTransitionStatus:_h,useFormState:Yy,useActionState:Yy,useOptimistic:function(n,a){var o=Dt();return ht!==null?Uy(o,ht,n,a):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:hh,useCacheRefresh:cb};mb.useEffectEvent=Jy;function Ch(n,a,o,c){a=n.memoizedState,o=o(c,a),o=o==null?a:g({},a,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var Th={enqueueSetState:function(n,a,o){n=n._reactInternals;var c=Bn(),p=Aa(c);p.payload=a,o!=null&&(p.callback=o),a=Ra(n,p,c),a!==null&&(An(a,n,c),Do(a,n,c))},enqueueReplaceState:function(n,a,o){n=n._reactInternals;var c=Bn(),p=Aa(c);p.tag=1,p.payload=a,o!=null&&(p.callback=o),a=Ra(n,p,c),a!==null&&(An(a,n,c),Do(a,n,c))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var o=Bn(),c=Aa(o);c.tag=2,a!=null&&(c.callback=a),a=Ra(n,c,o),a!==null&&(An(a,n,o),Do(a,n,o))}};function pb(n,a,o,c,p,v,w){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,v,w):a.prototype&&a.prototype.isPureReactComponent?!To(o,c)||!To(p,v):!0}function gb(n,a,o,c){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(o,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(o,c),a.state!==n&&Th.enqueueReplaceState(a,a.state,null)}function Cs(n,a){var o=a;if("ref"in a){o={};for(var c in a)c!=="ref"&&(o[c]=a[c])}if(n=n.defaultProps){o===a&&(o=g({},o));for(var p in n)o[p]===void 0&&(o[p]=n[p])}return o}function vb(n){vc(n)}function yb(n){console.error(n)}function bb(n){vc(n)}function $c(n,a){try{var o=n.onUncaughtError;o(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function xb(n,a,o){try{var c=n.onCaughtError;c(o.value,{componentStack:o.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Nh(n,a,o){return o=Aa(o),o.tag=3,o.payload={element:null},o.callback=function(){$c(n,a)},o}function wb(n){return n=Aa(n),n.tag=3,n}function _b(n,a,o,c){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var v=c.value;n.payload=function(){return p(v)},n.callback=function(){xb(a,o,c)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(n.callback=function(){xb(a,o,c),typeof p!="function"&&(Pa===null?Pa=new Set([this]):Pa.add(this));var N=c.stack;this.componentDidCatch(c.value,{componentStack:N!==null?N:""})})}function qA(n,a,o,c,p){if(o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=o.alternate,a!==null&&fi(a,o,p,!0),o=zn.current,o!==null){switch(o.tag){case 31:case 13:return Zn===null?Qc():o.alternate===null&&Rt===0&&(Rt=3),o.flags&=-257,o.flags|=65536,o.lanes=p,c===Nc?o.flags|=16384:(a=o.updateQueue,a===null?o.updateQueue=new Set([c]):a.add(c),Qh(n,c,p)),!1;case 22:return o.flags|=65536,c===Nc?o.flags|=16384:(a=o.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},o.updateQueue=a):(o=a.retryQueue,o===null?a.retryQueue=new Set([c]):o.add(c)),Qh(n,c,p)),!1}throw Error(s(435,o.tag))}return Qh(n,c,p),Qc(),!1}if(rt)return a=zn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,c!==Ff&&(n=Error(s(422),{cause:c}),Ro(Wn(n,o)))):(c!==Ff&&(a=Error(s(423),{cause:c}),Ro(Wn(a,o))),n=n.current.alternate,n.flags|=65536,p&=-p,n.lanes|=p,c=Wn(c,o),p=Nh(n.stateNode,c,p),rh(n,p),Rt!==4&&(Rt=2)),!1;var v=Error(s(520),{cause:c});if(v=Wn(v,o),Yo===null?Yo=[v]:Yo.push(v),Rt!==4&&(Rt=2),a===null)return!0;c=Wn(c,o),o=a;do{switch(o.tag){case 3:return o.flags|=65536,n=p&-p,o.lanes|=n,n=Nh(o.stateNode,c,n),rh(o,n),!1;case 1:if(a=o.type,v=o.stateNode,(o.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Pa===null||!Pa.has(v))))return o.flags|=65536,p&=-p,o.lanes|=p,p=wb(p),_b(p,n,o,c),rh(o,p),!1}o=o.return}while(o!==null);return!1}var Ah=Error(s(461)),Ut=!1;function nn(n,a,o,c){a.child=n===null?Ty(a,null,o,c):Ss(a,n.child,o,c)}function Sb(n,a,o,c,p){o=o.render;var v=a.ref;if("ref"in c){var w={};for(var N in c)N!=="ref"&&(w[N]=c[N])}else w=c;return bs(a),c=ch(n,a,o,w,v,p),N=uh(),n!==null&&!Ut?(dh(n,a,p),Xr(n,a,p)):(rt&&N&&Vf(a),a.flags|=1,nn(n,a,c,p),a.child)}function Eb(n,a,o,c,p){if(n===null){var v=o.type;return typeof v=="function"&&!Bf(v)&&v.defaultProps===void 0&&o.compare===null?(a.tag=15,a.type=v,Cb(n,a,v,c,p)):(n=wc(o.type,null,c,a,a.mode,p),n.ref=a.ref,n.return=a,a.child=n)}if(v=n.child,!Lh(n,p)){var w=v.memoizedProps;if(o=o.compare,o=o!==null?o:To,o(w,c)&&n.ref===a.ref)return Xr(n,a,p)}return a.flags|=1,n=Vr(v,c),n.ref=a.ref,n.return=a,a.child=n}function Cb(n,a,o,c,p){if(n!==null){var v=n.memoizedProps;if(To(v,c)&&n.ref===a.ref)if(Ut=!1,a.pendingProps=c=v,Lh(n,p))(n.flags&131072)!==0&&(Ut=!0);else return a.lanes=n.lanes,Xr(n,a,p)}return Rh(n,a,o,c,p)}function Tb(n,a,o,c){var p=c.children,v=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(v=v!==null?v.baseLanes|o:o,n!==null){for(c=a.child=n.child,p=0;c!==null;)p=p|c.lanes|c.childLanes,c=c.sibling;c=p&~v}else c=0,a.child=null;return Nb(n,a,v,o,c)}if((o&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Cc(a,v!==null?v.cachePool:null),v!==null?Ry(a,v):sh(),jy(a);else return c=a.lanes=536870912,Nb(n,a,v!==null?v.baseLanes|o:o,o,c)}else v!==null?(Cc(a,v.cachePool),Ry(a,v),ka(),a.memoizedState=null):(n!==null&&Cc(a,null),sh(),ka());return nn(n,a,p,o),a.child}function Bo(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Nb(n,a,o,c,p){var v=Zf();return v=v===null?null:{parent:zt._currentValue,pool:v},a.memoizedState={baseLanes:o,cachePool:v},n!==null&&Cc(a,null),sh(),jy(a),n!==null&&fi(n,a,c,!0),a.childLanes=p,null}function Bc(n,a){return a=qc({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function Ab(n,a,o){return Ss(a,n.child,null,o),n=Bc(a,a.pendingProps),n.flags|=2,In(a),a.memoizedState=null,n}function VA(n,a,o){var c=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(rt){if(c.mode==="hidden")return n=Bc(a,c),a.lanes=536870912,Bo(null,n);if(oh(a),(n=wt)?(n=$0(n,Qn),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Sa!==null?{id:_r,overflow:Sr}:null,retryLane:536870912,hydrationErrors:null},o=dy(n),o.return=a,a.child=o,en=a,wt=null)):n=null,n===null)throw Ca(a);return a.lanes=536870912,null}return Bc(a,c)}var v=n.memoizedState;if(v!==null){var w=v.dehydrated;if(oh(a),p)if(a.flags&256)a.flags&=-257,a=Ab(n,a,o);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(s(558));else if(Ut||fi(n,a,o,!1),p=(o&n.childLanes)!==0,Ut||p){if(c=vt,c!==null&&(w=wn(c,o),w!==0&&w!==v.retryLane))throw v.retryLane=w,ps(n,w),An(c,n,w),Ah;Qc(),a=Ab(n,a,o)}else n=v.treeContext,wt=er(w.nextSibling),en=a,rt=!0,Ea=null,Qn=!1,n!==null&&my(a,n),a=Bc(a,c),a.flags|=4096;return a}return n=Vr(n.child,{mode:c.mode,children:c.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Hc(n,a){var o=a.ref;if(o===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(s(284));(n===null||n.ref!==o)&&(a.flags|=4194816)}}function Rh(n,a,o,c,p){return bs(a),o=ch(n,a,o,c,void 0,p),c=uh(),n!==null&&!Ut?(dh(n,a,p),Xr(n,a,p)):(rt&&c&&Vf(a),a.flags|=1,nn(n,a,o,p),a.child)}function Rb(n,a,o,c,p,v){return bs(a),a.updateQueue=null,o=Oy(a,c,o,p),ky(n),c=uh(),n!==null&&!Ut?(dh(n,a,v),Xr(n,a,v)):(rt&&c&&Vf(a),a.flags|=1,nn(n,a,o,v),a.child)}function jb(n,a,o,c,p){if(bs(a),a.stateNode===null){var v=li,w=o.contextType;typeof w=="object"&&w!==null&&(v=tn(w)),v=new o(c,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Th,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=c,v.state=a.memoizedState,v.refs={},th(a),w=o.contextType,v.context=typeof w=="object"&&w!==null?tn(w):li,v.state=a.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(Ch(a,o,w,c),v.state=a.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(w=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),w!==v.state&&Th.enqueueReplaceState(v,v.state,null),Lo(a,c,v,p),Po(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(n===null){v=a.stateNode;var N=a.memoizedProps,M=Cs(o,N);v.props=M;var V=v.context,ne=o.contextType;w=li,typeof ne=="object"&&ne!==null&&(w=tn(ne));var ie=o.getDerivedStateFromProps;ne=typeof ie=="function"||typeof v.getSnapshotBeforeUpdate=="function",N=a.pendingProps!==N,ne||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(N||V!==w)&&gb(a,v,c,w),Na=!1;var F=a.memoizedState;v.state=F,Lo(a,c,v,p),Po(),V=a.memoizedState,N||F!==V||Na?(typeof ie=="function"&&(Ch(a,o,ie,c),V=a.memoizedState),(M=Na||pb(a,o,M,c,F,V,w))?(ne||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=V),v.props=c,v.state=V,v.context=w,c=M):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{v=a.stateNode,nh(n,a),w=a.memoizedProps,ne=Cs(o,w),v.props=ne,ie=a.pendingProps,F=v.context,V=o.contextType,M=li,typeof V=="object"&&V!==null&&(M=tn(V)),N=o.getDerivedStateFromProps,(V=typeof N=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(w!==ie||F!==M)&&gb(a,v,c,M),Na=!1,F=a.memoizedState,v.state=F,Lo(a,c,v,p),Po();var X=a.memoizedState;w!==ie||F!==X||Na||n!==null&&n.dependencies!==null&&Sc(n.dependencies)?(typeof N=="function"&&(Ch(a,o,N,c),X=a.memoizedState),(ne=Na||pb(a,o,ne,c,F,X,M)||n!==null&&n.dependencies!==null&&Sc(n.dependencies))?(V||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(c,X,M),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(c,X,M)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||w===n.memoizedProps&&F===n.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&F===n.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=X),v.props=c,v.state=X,v.context=M,c=ne):(typeof v.componentDidUpdate!="function"||w===n.memoizedProps&&F===n.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&F===n.memoizedState||(a.flags|=1024),c=!1)}return v=c,Hc(n,a),c=(a.flags&128)!==0,v||c?(v=a.stateNode,o=c&&typeof o.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,n!==null&&c?(a.child=Ss(a,n.child,null,p),a.child=Ss(a,null,o,p)):nn(n,a,o,p),a.memoizedState=v.state,n=a.child):n=Xr(n,a,p),n}function kb(n,a,o,c){return vs(),a.flags|=256,nn(n,a,o,c),a.child}var jh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function kh(n){return{baseLanes:n,cachePool:xy()}}function Oh(n,a,o){return n=n!==null?n.childLanes&~o:0,a&&(n|=$n),n}function Ob(n,a,o){var c=a.pendingProps,p=!1,v=(a.flags&128)!==0,w;if((w=v)||(w=n!==null&&n.memoizedState===null?!1:(Mt.current&2)!==0),w&&(p=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,n===null){if(rt){if(p?ja(a):ka(),(n=wt)?(n=$0(n,Qn),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Sa!==null?{id:_r,overflow:Sr}:null,retryLane:536870912,hydrationErrors:null},o=dy(n),o.return=a,a.child=o,en=a,wt=null)):n=null,n===null)throw Ca(a);return mm(n)?a.lanes=32:a.lanes=536870912,null}var N=c.children;return c=c.fallback,p?(ka(),p=a.mode,N=qc({mode:"hidden",children:N},p),c=gs(c,p,o,null),N.return=a,c.return=a,N.sibling=c,a.child=N,c=a.child,c.memoizedState=kh(o),c.childLanes=Oh(n,w,o),a.memoizedState=jh,Bo(null,c)):(ja(a),Mh(a,N))}var M=n.memoizedState;if(M!==null&&(N=M.dehydrated,N!==null)){if(v)a.flags&256?(ja(a),a.flags&=-257,a=Dh(n,a,o)):a.memoizedState!==null?(ka(),a.child=n.child,a.flags|=128,a=null):(ka(),N=c.fallback,p=a.mode,c=qc({mode:"visible",children:c.children},p),N=gs(N,p,o,null),N.flags|=2,c.return=a,N.return=a,c.sibling=N,a.child=c,Ss(a,n.child,null,o),c=a.child,c.memoizedState=kh(o),c.childLanes=Oh(n,w,o),a.memoizedState=jh,a=Bo(null,c));else if(ja(a),mm(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var V=w.dgst;w=V,c=Error(s(419)),c.stack="",c.digest=w,Ro({value:c,source:null,stack:null}),a=Dh(n,a,o)}else if(Ut||fi(n,a,o,!1),w=(o&n.childLanes)!==0,Ut||w){if(w=vt,w!==null&&(c=wn(w,o),c!==0&&c!==M.retryLane))throw M.retryLane=c,ps(n,c),An(w,n,c),Ah;hm(N)||Qc(),a=Dh(n,a,o)}else hm(N)?(a.flags|=192,a.child=n.child,a=null):(n=M.treeContext,wt=er(N.nextSibling),en=a,rt=!0,Ea=null,Qn=!1,n!==null&&my(a,n),a=Mh(a,c.children),a.flags|=4096);return a}return p?(ka(),N=c.fallback,p=a.mode,M=n.child,V=M.sibling,c=Vr(M,{mode:"hidden",children:c.children}),c.subtreeFlags=M.subtreeFlags&65011712,V!==null?N=Vr(V,N):(N=gs(N,p,o,null),N.flags|=2),N.return=a,c.return=a,c.sibling=N,a.child=c,Bo(null,c),c=a.child,N=n.child.memoizedState,N===null?N=kh(o):(p=N.cachePool,p!==null?(M=zt._currentValue,p=p.parent!==M?{parent:M,pool:M}:p):p=xy(),N={baseLanes:N.baseLanes|o,cachePool:p}),c.memoizedState=N,c.childLanes=Oh(n,w,o),a.memoizedState=jh,Bo(n.child,c)):(ja(a),o=n.child,n=o.sibling,o=Vr(o,{mode:"visible",children:c.children}),o.return=a,o.sibling=null,n!==null&&(w=a.deletions,w===null?(a.deletions=[n],a.flags|=16):w.push(n)),a.child=o,a.memoizedState=null,o)}function Mh(n,a){return a=qc({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function qc(n,a){return n=Ln(22,n,null,a),n.lanes=0,n}function Dh(n,a,o){return Ss(a,n.child,null,o),n=Mh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function Mb(n,a,o){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a),Wf(n.return,a,o)}function Ph(n,a,o,c,p,v){var w=n.memoizedState;w===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:p,treeForkCount:v}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=c,w.tail=o,w.tailMode=p,w.treeForkCount=v)}function Db(n,a,o){var c=a.pendingProps,p=c.revealOrder,v=c.tail;c=c.children;var w=Mt.current,N=(w&2)!==0;if(N?(w=w&1|2,a.flags|=128):w&=1,U(Mt,w),nn(n,a,c,o),c=rt?Ao:0,!N&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Mb(n,o,a);else if(n.tag===19)Mb(n,o,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(p){case"forwards":for(o=a.child,p=null;o!==null;)n=o.alternate,n!==null&&kc(n)===null&&(p=o),o=o.sibling;o=p,o===null?(p=a.child,a.child=null):(p=o.sibling,o.sibling=null),Ph(a,!1,p,o,v,c);break;case"backwards":case"unstable_legacy-backwards":for(o=null,p=a.child,a.child=null;p!==null;){if(n=p.alternate,n!==null&&kc(n)===null){a.child=p;break}n=p.sibling,p.sibling=o,o=p,p=n}Ph(a,!0,o,null,v,c);break;case"together":Ph(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function Xr(n,a,o){if(n!==null&&(a.dependencies=n.dependencies),Da|=a.lanes,(o&a.childLanes)===0)if(n!==null){if(fi(n,a,o,!1),(o&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,o=Vr(n,n.pendingProps),a.child=o,o.return=a;n.sibling!==null;)n=n.sibling,o=o.sibling=Vr(n,n.pendingProps),o.return=a;o.sibling=null}return a.child}function Lh(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&Sc(n)))}function GA(n,a,o){switch(a.tag){case 3:ee(a,a.stateNode.containerInfo),Ta(a,zt,n.memoizedState.cache),vs();break;case 27:case 5:Se(a);break;case 4:ee(a,a.stateNode.containerInfo);break;case 10:Ta(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,oh(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(ja(a),a.flags|=128,null):(o&a.child.childLanes)!==0?Ob(n,a,o):(ja(a),n=Xr(n,a,o),n!==null?n.sibling:null);ja(a);break;case 19:var p=(n.flags&128)!==0;if(c=(o&a.childLanes)!==0,c||(fi(n,a,o,!1),c=(o&a.childLanes)!==0),p){if(c)return Db(n,a,o);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),U(Mt,Mt.current),c)break;return null;case 22:return a.lanes=0,Tb(n,a,o,a.pendingProps);case 24:Ta(a,zt,n.memoizedState.cache)}return Xr(n,a,o)}function Pb(n,a,o){if(n!==null)if(n.memoizedProps!==a.pendingProps)Ut=!0;else{if(!Lh(n,o)&&(a.flags&128)===0)return Ut=!1,GA(n,a,o);Ut=(n.flags&131072)!==0}else Ut=!1,rt&&(a.flags&1048576)!==0&&hy(a,Ao,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(n=ws(a.elementType),a.type=n,typeof n=="function")Bf(n)?(c=Cs(n,c),a.tag=1,a=jb(null,a,n,c,o)):(a.tag=0,a=Rh(null,a,n,c,o));else{if(n!=null){var p=n.$$typeof;if(p===D){a.tag=11,a=Sb(null,a,n,c,o);break e}else if(p===L){a.tag=14,a=Eb(null,a,n,c,o);break e}}throw a=me(n)||n,Error(s(306,a,""))}}return a;case 0:return Rh(n,a,a.type,a.pendingProps,o);case 1:return c=a.type,p=Cs(c,a.pendingProps),jb(n,a,c,p,o);case 3:e:{if(ee(a,a.stateNode.containerInfo),n===null)throw Error(s(387));c=a.pendingProps;var v=a.memoizedState;p=v.element,nh(n,a),Lo(a,c,null,o);var w=a.memoizedState;if(c=w.cache,Ta(a,zt,c),c!==v.cache&&Xf(a,[zt],o,!0),Po(),c=w.element,v.isDehydrated)if(v={element:c,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=kb(n,a,c,o);break e}else if(c!==p){p=Wn(Error(s(424)),a),Ro(p),a=kb(n,a,c,o);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(wt=er(n.firstChild),en=a,rt=!0,Ea=null,Qn=!0,o=Ty(a,null,c,o),a.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(vs(),c===p){a=Xr(n,a,o);break e}nn(n,a,c,o)}a=a.child}return a;case 26:return Hc(n,a),n===null?(o=F0(a.type,null,a.pendingProps,null))?a.memoizedState=o:rt||(o=a.type,n=a.pendingProps,c=su(re.current).createElement(o),c[Zt]=a,c[_n]=n,rn(c,o,n),Wt(c),a.stateNode=c):a.memoizedState=F0(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Se(a),n===null&&rt&&(c=a.stateNode=q0(a.type,a.pendingProps,re.current),en=a,Qn=!0,p=wt,Ua(a.type)?(pm=p,wt=er(c.firstChild)):wt=p),nn(n,a,a.pendingProps.children,o),Hc(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&rt&&((p=c=wt)&&(c=wR(c,a.type,a.pendingProps,Qn),c!==null?(a.stateNode=c,en=a,wt=er(c.firstChild),Qn=!1,p=!0):p=!1),p||Ca(a)),Se(a),p=a.type,v=a.pendingProps,w=n!==null?n.memoizedProps:null,c=v.children,um(p,v)?c=null:w!==null&&um(p,w)&&(a.flags|=32),a.memoizedState!==null&&(p=ch(n,a,LA,null,null,o),nl._currentValue=p),Hc(n,a),nn(n,a,c,o),a.child;case 6:return n===null&&rt&&((n=o=wt)&&(o=_R(o,a.pendingProps,Qn),o!==null?(a.stateNode=o,en=a,wt=null,n=!0):n=!1),n||Ca(a)),null;case 13:return Ob(n,a,o);case 4:return ee(a,a.stateNode.containerInfo),c=a.pendingProps,n===null?a.child=Ss(a,null,c,o):nn(n,a,c,o),a.child;case 11:return Sb(n,a,a.type,a.pendingProps,o);case 7:return nn(n,a,a.pendingProps,o),a.child;case 8:return nn(n,a,a.pendingProps.children,o),a.child;case 12:return nn(n,a,a.pendingProps.children,o),a.child;case 10:return c=a.pendingProps,Ta(a,a.type,c.value),nn(n,a,c.children,o),a.child;case 9:return p=a.type._context,c=a.pendingProps.children,bs(a),p=tn(p),c=c(p),a.flags|=1,nn(n,a,c,o),a.child;case 14:return Eb(n,a,a.type,a.pendingProps,o);case 15:return Cb(n,a,a.type,a.pendingProps,o);case 19:return Db(n,a,o);case 31:return VA(n,a,o);case 22:return Tb(n,a,o,a.pendingProps);case 24:return bs(a),c=tn(zt),n===null?(p=Zf(),p===null&&(p=vt,v=Jf(),p.pooledCache=v,v.refCount++,v!==null&&(p.pooledCacheLanes|=o),p=v),a.memoizedState={parent:c,cache:p},th(a),Ta(a,zt,p)):((n.lanes&o)!==0&&(nh(n,a),Lo(a,null,null,o),Po()),p=n.memoizedState,v=a.memoizedState,p.parent!==c?(p={parent:c,cache:c},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),Ta(a,zt,c)):(c=v.cache,Ta(a,zt,c),c!==p.cache&&Xf(a,[zt],o,!0))),nn(n,a,a.pendingProps.children,o),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function Jr(n){n.flags|=4}function zh(n,a,o,c,p){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(p&335544128)===p)if(n.stateNode.complete)n.flags|=8192;else if(l0())n.flags|=8192;else throw _s=Nc,eh}else n.flags&=-16777217}function Lb(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!J0(a))if(l0())n.flags|=8192;else throw _s=Nc,eh}function Vc(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?un():536870912,n.lanes|=a,Ei|=a)}function Ho(n,a){if(!rt)switch(n.tailMode){case"hidden":a=n.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function _t(n){var a=n.alternate!==null&&n.alternate.child===n.child,o=0,c=0;if(a)for(var p=n.child;p!==null;)o|=p.lanes|p.childLanes,c|=p.subtreeFlags&65011712,c|=p.flags&65011712,p.return=n,p=p.sibling;else for(p=n.child;p!==null;)o|=p.lanes|p.childLanes,c|=p.subtreeFlags,c|=p.flags,p.return=n,p=p.sibling;return n.subtreeFlags|=c,n.childLanes=o,a}function FA(n,a,o){var c=a.pendingProps;switch(Gf(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(a),null;case 1:return _t(a),null;case 3:return o=a.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Kr(zt),se(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(di(a)?Jr(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Kf())),_t(a),null;case 26:var p=a.type,v=a.memoizedState;return n===null?(Jr(a),v!==null?(_t(a),Lb(a,v)):(_t(a),zh(a,p,null,c,o))):v?v!==n.memoizedState?(Jr(a),_t(a),Lb(a,v)):(_t(a),a.flags&=-16777217):(n=n.memoizedProps,n!==c&&Jr(a),_t(a),zh(a,p,n,c,o)),null;case 27:if(Te(a),o=re.current,p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&Jr(a);else{if(!c){if(a.stateNode===null)throw Error(s(166));return _t(a),null}n=Y.current,di(a)?py(a):(n=q0(p,c,o),a.stateNode=n,Jr(a))}return _t(a),null;case 5:if(Te(a),p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&Jr(a);else{if(!c){if(a.stateNode===null)throw Error(s(166));return _t(a),null}if(v=Y.current,di(a))py(a);else{var w=su(re.current);switch(v){case 1:v=w.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:v=w.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":v=w.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":v=w.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":v=w.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?v.multiple=!0:c.size&&(v.size=c.size);break;default:v=typeof c.is=="string"?w.createElement(p,{is:c.is}):w.createElement(p)}}v[Zt]=a,v[_n]=c;e:for(w=a.child;w!==null;){if(w.tag===5||w.tag===6)v.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===a)break e;for(;w.sibling===null;){if(w.return===null||w.return===a)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}a.stateNode=v;e:switch(rn(v,p,c),p){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Jr(a)}}return _t(a),zh(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,o),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&Jr(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(s(166));if(n=re.current,di(a)){if(n=a.stateNode,o=a.memoizedProps,c=null,p=en,p!==null)switch(p.tag){case 27:case 5:c=p.memoizedProps}n[Zt]=a,n=!!(n.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||O0(n.nodeValue,o)),n||Ca(a,!0)}else n=su(n).createTextNode(c),n[Zt]=a,a.stateNode=n}return _t(a),null;case 31:if(o=a.memoizedState,n===null||n.memoizedState!==null){if(c=di(a),o!==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[Zt]=a}else vs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),n=!1}else o=Kf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return a.flags&256?(In(a),a):(In(a),null);if((a.flags&128)!==0)throw Error(s(558))}return _t(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(p=di(a),c!==null&&c.dehydrated!==null){if(n===null){if(!p)throw Error(s(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(s(317));p[Zt]=a}else vs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),p=!1}else p=Kf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(In(a),a):(In(a),null)}return In(a),(a.flags&128)!==0?(a.lanes=o,a):(o=c!==null,n=n!==null&&n.memoizedState!==null,o&&(c=a.child,p=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(p=c.alternate.memoizedState.cachePool.pool),v=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(v=c.memoizedState.cachePool.pool),v!==p&&(c.flags|=2048)),o!==n&&o&&(a.child.flags|=8192),Vc(a,a.updateQueue),_t(a),null);case 4:return se(),n===null&&sm(a.stateNode.containerInfo),_t(a),null;case 10:return Kr(a.type),_t(a),null;case 19:if(O(Mt),c=a.memoizedState,c===null)return _t(a),null;if(p=(a.flags&128)!==0,v=c.rendering,v===null)if(p)Ho(c,!1);else{if(Rt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(v=kc(n),v!==null){for(a.flags|=128,Ho(c,!1),n=v.updateQueue,a.updateQueue=n,Vc(a,n),a.subtreeFlags=0,n=o,o=a.child;o!==null;)uy(o,n),o=o.sibling;return U(Mt,Mt.current&1|2),rt&&Gr(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&Ie()>Wc&&(a.flags|=128,p=!0,Ho(c,!1),a.lanes=4194304)}else{if(!p)if(n=kc(v),n!==null){if(a.flags|=128,p=!0,n=n.updateQueue,a.updateQueue=n,Vc(a,n),Ho(c,!0),c.tail===null&&c.tailMode==="hidden"&&!v.alternate&&!rt)return _t(a),null}else 2*Ie()-c.renderingStartTime>Wc&&o!==536870912&&(a.flags|=128,p=!0,Ho(c,!1),a.lanes=4194304);c.isBackwards?(v.sibling=a.child,a.child=v):(n=c.last,n!==null?n.sibling=v:a.child=v,c.last=v)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=Ie(),n.sibling=null,o=Mt.current,U(Mt,p?o&1|2:o&1),rt&&Gr(a,c.treeForkCount),n):(_t(a),null);case 22:case 23:return In(a),ih(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(o&536870912)!==0&&(a.flags&128)===0&&(_t(a),a.subtreeFlags&6&&(a.flags|=8192)):_t(a),o=a.updateQueue,o!==null&&Vc(a,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==o&&(a.flags|=2048),n!==null&&O(xs),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),Kr(zt),_t(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function KA(n,a){switch(Gf(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Kr(zt),se(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Te(a),null;case 31:if(a.memoizedState!==null){if(In(a),a.alternate===null)throw Error(s(340));vs()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(In(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(s(340));vs()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return O(Mt),null;case 4:return se(),null;case 10:return Kr(a.type),null;case 22:case 23:return In(a),ih(),n!==null&&O(xs),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Kr(zt),null;case 25:return null;default:return null}}function zb(n,a){switch(Gf(a),a.tag){case 3:Kr(zt),se();break;case 26:case 27:case 5:Te(a);break;case 4:se();break;case 31:a.memoizedState!==null&&In(a);break;case 13:In(a);break;case 19:O(Mt);break;case 10:Kr(a.type);break;case 22:case 23:In(a),ih(),n!==null&&O(xs);break;case 24:Kr(zt)}}function qo(n,a){try{var o=a.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var p=c.next;o=p;do{if((o.tag&n)===n){c=void 0;var v=o.create,w=o.inst;c=v(),w.destroy=c}o=o.next}while(o!==p)}}catch(N){ft(a,a.return,N)}}function Oa(n,a,o){try{var c=a.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var v=p.next;c=v;do{if((c.tag&n)===n){var w=c.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,p=a;var M=o,V=N;try{V()}catch(ne){ft(p,M,ne)}}}c=c.next}while(c!==v)}}catch(ne){ft(a,a.return,ne)}}function Ib(n){var a=n.updateQueue;if(a!==null){var o=n.stateNode;try{Ay(a,o)}catch(c){ft(n,n.return,c)}}}function Ub(n,a,o){o.props=Cs(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(c){ft(n,a,c)}}function Vo(n,a){try{var o=n.ref;if(o!==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 o=="function"?n.refCleanup=o(c):o.current=c}}catch(p){ft(n,a,p)}}function Er(n,a){var o=n.ref,c=n.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(p){ft(n,a,p)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){ft(n,a,p)}else o.current=null}function $b(n){var a=n.type,o=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(p){ft(n,n.return,p)}}function Ih(n,a,o){try{var c=n.stateNode;pR(c,n.type,o,a),c[_n]=a}catch(p){ft(n,n.return,p)}}function Bb(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ua(n.type)||n.tag===4}function Uh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Bb(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&&Ua(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 $h(n,a,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,a):(a=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.appendChild(n),o=o._reactRootContainer,o!=null||a.onclick!==null||(a.onclick=Hr));else if(c!==4&&(c===27&&Ua(n.type)&&(o=n.stateNode,a=null),n=n.child,n!==null))for($h(n,a,o),n=n.sibling;n!==null;)$h(n,a,o),n=n.sibling}function Gc(n,a,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?o.insertBefore(n,a):o.appendChild(n);else if(c!==4&&(c===27&&Ua(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(Gc(n,a,o),n=n.sibling;n!==null;)Gc(n,a,o),n=n.sibling}function Hb(n){var a=n.stateNode,o=n.memoizedProps;try{for(var c=n.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);rn(a,c,o),a[Zt]=n,a[_n]=o}catch(v){ft(n,n.return,v)}}var Qr=!1,$t=!1,Bh=!1,qb=typeof WeakSet=="function"?WeakSet:Set,Xt=null;function YA(n,a){if(n=n.containerInfo,lm=fu,n=ty(n),Df(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var p=c.anchorOffset,v=c.focusNode;c=c.focusOffset;try{o.nodeType,v.nodeType}catch{o=null;break e}var w=0,N=-1,M=-1,V=0,ne=0,ie=n,F=null;t:for(;;){for(var X;ie!==o||p!==0&&ie.nodeType!==3||(N=w+p),ie!==v||c!==0&&ie.nodeType!==3||(M=w+c),ie.nodeType===3&&(w+=ie.nodeValue.length),(X=ie.firstChild)!==null;)F=ie,ie=X;for(;;){if(ie===n)break t;if(F===o&&++V===p&&(N=w),F===v&&++ne===c&&(M=w),(X=ie.nextSibling)!==null)break;ie=F,F=ie.parentNode}ie=X}o=N===-1||M===-1?null:{start:N,end:M}}else o=null}o=o||{start:0,end:0}}else o=null;for(cm={focusedElem:n,selectionRange:o},fu=!1,Xt=a;Xt!==null;)if(a=Xt,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Xt=n;else for(;Xt!==null;){switch(a=Xt,v=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(o=0;o<n.length;o++)p=n[o],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&v!==null){n=void 0,o=a,p=v.memoizedProps,v=v.memoizedState,c=o.stateNode;try{var _e=Cs(o.type,p);n=c.getSnapshotBeforeUpdate(_e,v),c.__reactInternalSnapshotBeforeUpdate=n}catch(De){ft(o,o.return,De)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,o=n.nodeType,o===9)fm(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":fm(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,Xt=n;break}Xt=a.return}}function Vb(n,a,o){var c=o.flags;switch(o.tag){case 0:case 11:case 15:ea(n,o),c&4&&qo(5,o);break;case 1:if(ea(n,o),c&4)if(n=o.stateNode,a===null)try{n.componentDidMount()}catch(w){ft(o,o.return,w)}else{var p=Cs(o.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(p,a,n.__reactInternalSnapshotBeforeUpdate)}catch(w){ft(o,o.return,w)}}c&64&&Ib(o),c&512&&Vo(o,o.return);break;case 3:if(ea(n,o),c&64&&(n=o.updateQueue,n!==null)){if(a=null,o.child!==null)switch(o.child.tag){case 27:case 5:a=o.child.stateNode;break;case 1:a=o.child.stateNode}try{Ay(n,a)}catch(w){ft(o,o.return,w)}}break;case 27:a===null&&c&4&&Hb(o);case 26:case 5:ea(n,o),a===null&&c&4&&$b(o),c&512&&Vo(o,o.return);break;case 12:ea(n,o);break;case 31:ea(n,o),c&4&&Kb(n,o);break;case 13:ea(n,o),c&4&&Yb(n,o),c&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=rR.bind(null,o),SR(n,o))));break;case 22:if(c=o.memoizedState!==null||Qr,!c){a=a!==null&&a.memoizedState!==null||$t,p=Qr;var v=$t;Qr=c,($t=a)&&!v?ta(n,o,(o.subtreeFlags&8772)!==0):ea(n,o),Qr=p,$t=v}break;case 30:break;default:ea(n,o)}}function Gb(n){var a=n.alternate;a!==null&&(n.alternate=null,Gb(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&vf(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 St=null,En=!1;function Zr(n,a,o){for(o=o.child;o!==null;)Fb(n,a,o),o=o.sibling}function Fb(n,a,o){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(yn,o)}catch{}switch(o.tag){case 26:$t||Er(o,a),Zr(n,a,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:$t||Er(o,a);var c=St,p=En;Ua(o.type)&&(St=o.stateNode,En=!1),Zr(n,a,o),Zo(o.stateNode),St=c,En=p;break;case 5:$t||Er(o,a);case 6:if(c=St,p=En,St=null,Zr(n,a,o),St=c,En=p,St!==null)if(En)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(o.stateNode)}catch(v){ft(o,a,v)}else try{St.removeChild(o.stateNode)}catch(v){ft(o,a,v)}break;case 18:St!==null&&(En?(n=St,I0(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),Oi(n)):I0(St,o.stateNode));break;case 4:c=St,p=En,St=o.stateNode.containerInfo,En=!0,Zr(n,a,o),St=c,En=p;break;case 0:case 11:case 14:case 15:Oa(2,o,a),$t||Oa(4,o,a),Zr(n,a,o);break;case 1:$t||(Er(o,a),c=o.stateNode,typeof c.componentWillUnmount=="function"&&Ub(o,a,c)),Zr(n,a,o);break;case 21:Zr(n,a,o);break;case 22:$t=(c=$t)||o.memoizedState!==null,Zr(n,a,o),$t=c;break;default:Zr(n,a,o)}}function Kb(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Oi(n)}catch(o){ft(a,a.return,o)}}}function Yb(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Oi(n)}catch(o){ft(a,a.return,o)}}function WA(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new qb),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new qb),a;default:throw Error(s(435,n.tag))}}function Fc(n,a){var o=WA(n);a.forEach(function(c){if(!o.has(c)){o.add(c);var p=aR.bind(null,n,c);c.then(p,p)}})}function Cn(n,a){var o=a.deletions;if(o!==null)for(var c=0;c<o.length;c++){var p=o[c],v=n,w=a,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(Ua(N.type)){St=N.stateNode,En=!1;break e}break;case 5:St=N.stateNode,En=!1;break e;case 3:case 4:St=N.stateNode.containerInfo,En=!0;break e}N=N.return}if(St===null)throw Error(s(160));Fb(v,w,p),St=null,En=!1,v=p.alternate,v!==null&&(v.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Wb(a,n),a=a.sibling}var dr=null;function Wb(n,a){var o=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Cn(a,n),Tn(n),c&4&&(Oa(3,n,n.return),qo(3,n),Oa(5,n,n.return));break;case 1:Cn(a,n),Tn(n),c&512&&($t||o===null||Er(o,o.return)),c&64&&Qr&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?c:o.concat(c))));break;case 26:var p=dr;if(Cn(a,n),Tn(n),c&512&&($t||o===null||Er(o,o.return)),c&4){var v=o!==null?o.memoizedState:null;if(c=n.memoizedState,o===null)if(c===null)if(n.stateNode===null){e:{c=n.type,o=n.memoizedProps,p=p.ownerDocument||p;t:switch(c){case"title":v=p.getElementsByTagName("title")[0],(!v||v[vo]||v[Zt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=p.createElement(c),p.head.insertBefore(v,p.querySelector("head > title"))),rn(v,c,o),v[Zt]=n,Wt(v),c=v;break e;case"link":var w=W0("link","href",p).get(c+(o.href||""));if(w){for(var N=0;N<w.length;N++)if(v=w[N],v.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&v.getAttribute("rel")===(o.rel==null?null:o.rel)&&v.getAttribute("title")===(o.title==null?null:o.title)&&v.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){w.splice(N,1);break t}}v=p.createElement(c),rn(v,c,o),p.head.appendChild(v);break;case"meta":if(w=W0("meta","content",p).get(c+(o.content||""))){for(N=0;N<w.length;N++)if(v=w[N],v.getAttribute("content")===(o.content==null?null:""+o.content)&&v.getAttribute("name")===(o.name==null?null:o.name)&&v.getAttribute("property")===(o.property==null?null:o.property)&&v.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&v.getAttribute("charset")===(o.charSet==null?null:o.charSet)){w.splice(N,1);break t}}v=p.createElement(c),rn(v,c,o),p.head.appendChild(v);break;default:throw Error(s(468,c))}v[Zt]=n,Wt(v),c=v}n.stateNode=c}else X0(p,n.type,n.stateNode);else n.stateNode=Y0(p,c,n.memoizedProps);else v!==c?(v===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):v.count--,c===null?X0(p,n.type,n.stateNode):Y0(p,c,n.memoizedProps)):c===null&&n.stateNode!==null&&Ih(n,n.memoizedProps,o.memoizedProps)}break;case 27:Cn(a,n),Tn(n),c&512&&($t||o===null||Er(o,o.return)),o!==null&&c&4&&Ih(n,n.memoizedProps,o.memoizedProps);break;case 5:if(Cn(a,n),Tn(n),c&512&&($t||o===null||Er(o,o.return)),n.flags&32){p=n.stateNode;try{ti(p,"")}catch(_e){ft(n,n.return,_e)}}c&4&&n.stateNode!=null&&(p=n.memoizedProps,Ih(n,p,o!==null?o.memoizedProps:p)),c&1024&&(Bh=!0);break;case 6:if(Cn(a,n),Tn(n),c&4){if(n.stateNode===null)throw Error(s(162));c=n.memoizedProps,o=n.stateNode;try{o.nodeValue=c}catch(_e){ft(n,n.return,_e)}}break;case 3:if(lu=null,p=dr,dr=iu(a.containerInfo),Cn(a,n),dr=p,Tn(n),c&4&&o!==null&&o.memoizedState.isDehydrated)try{Oi(a.containerInfo)}catch(_e){ft(n,n.return,_e)}Bh&&(Bh=!1,Xb(n));break;case 4:c=dr,dr=iu(n.stateNode.containerInfo),Cn(a,n),Tn(n),dr=c;break;case 12:Cn(a,n),Tn(n);break;case 31:Cn(a,n),Tn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Fc(n,c)));break;case 13:Cn(a,n),Tn(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Yc=Ie()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Fc(n,c)));break;case 22:p=n.memoizedState!==null;var M=o!==null&&o.memoizedState!==null,V=Qr,ne=$t;if(Qr=V||p,$t=ne||M,Cn(a,n),$t=ne,Qr=V,Tn(n),c&8192)e:for(a=n.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(o===null||M||Qr||$t||Ts(n)),o=null,a=n;;){if(a.tag===5||a.tag===26){if(o===null){M=o=a;try{if(v=M.stateNode,p)w=v.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=M.stateNode;var ie=M.memoizedProps.style,F=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;N.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(_e){ft(M,M.return,_e)}}}else if(a.tag===6){if(o===null){M=a;try{M.stateNode.nodeValue=p?"":M.memoizedProps}catch(_e){ft(M,M.return,_e)}}}else if(a.tag===18){if(o===null){M=a;try{var X=M.stateNode;p?U0(X,!0):U0(M.stateNode,!1)}catch(_e){ft(M,M.return,_e)}}}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;o===a&&(o=null),a=a.return}o===a&&(o=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=n.updateQueue,c!==null&&(o=c.retryQueue,o!==null&&(c.retryQueue=null,Fc(n,o))));break;case 19:Cn(a,n),Tn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Fc(n,c)));break;case 30:break;case 21:break;default:Cn(a,n),Tn(n)}}function Tn(n){var a=n.flags;if(a&2){try{for(var o,c=n.return;c!==null;){if(Bb(c)){o=c;break}c=c.return}if(o==null)throw Error(s(160));switch(o.tag){case 27:var p=o.stateNode,v=Uh(n);Gc(n,v,p);break;case 5:var w=o.stateNode;o.flags&32&&(ti(w,""),o.flags&=-33);var N=Uh(n);Gc(n,N,w);break;case 3:case 4:var M=o.stateNode.containerInfo,V=Uh(n);$h(n,V,M);break;default:throw Error(s(161))}}catch(ne){ft(n,n.return,ne)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function Xb(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Xb(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function ea(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Vb(n,a.alternate,a),a=a.sibling}function Ts(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:Oa(4,a,a.return),Ts(a);break;case 1:Er(a,a.return);var o=a.stateNode;typeof o.componentWillUnmount=="function"&&Ub(a,a.return,o),Ts(a);break;case 27:Zo(a.stateNode);case 26:case 5:Er(a,a.return),Ts(a);break;case 22:a.memoizedState===null&&Ts(a);break;case 30:Ts(a);break;default:Ts(a)}n=n.sibling}}function ta(n,a,o){for(o=o&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,p=n,v=a,w=v.flags;switch(v.tag){case 0:case 11:case 15:ta(p,v,o),qo(4,v);break;case 1:if(ta(p,v,o),c=v,p=c.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(V){ft(c,c.return,V)}if(c=v,p=c.updateQueue,p!==null){var N=c.stateNode;try{var M=p.shared.hiddenCallbacks;if(M!==null)for(p.shared.hiddenCallbacks=null,p=0;p<M.length;p++)Ny(M[p],N)}catch(V){ft(c,c.return,V)}}o&&w&64&&Ib(v),Vo(v,v.return);break;case 27:Hb(v);case 26:case 5:ta(p,v,o),o&&c===null&&w&4&&$b(v),Vo(v,v.return);break;case 12:ta(p,v,o);break;case 31:ta(p,v,o),o&&w&4&&Kb(p,v);break;case 13:ta(p,v,o),o&&w&4&&Yb(p,v);break;case 22:v.memoizedState===null&&ta(p,v,o),Vo(v,v.return);break;case 30:break;default:ta(p,v,o)}a=a.sibling}}function Hh(n,a){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&jo(o))}function qh(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&jo(n))}function fr(n,a,o,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Jb(n,a,o,c),a=a.sibling}function Jb(n,a,o,c){var p=a.flags;switch(a.tag){case 0:case 11:case 15:fr(n,a,o,c),p&2048&&qo(9,a);break;case 1:fr(n,a,o,c);break;case 3:fr(n,a,o,c),p&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&jo(n)));break;case 12:if(p&2048){fr(n,a,o,c),n=a.stateNode;try{var v=a.memoizedProps,w=v.id,N=v.onPostCommit;typeof N=="function"&&N(w,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(M){ft(a,a.return,M)}}else fr(n,a,o,c);break;case 31:fr(n,a,o,c);break;case 13:fr(n,a,o,c);break;case 23:break;case 22:v=a.stateNode,w=a.alternate,a.memoizedState!==null?v._visibility&2?fr(n,a,o,c):Go(n,a):v._visibility&2?fr(n,a,o,c):(v._visibility|=2,wi(n,a,o,c,(a.subtreeFlags&10256)!==0||!1)),p&2048&&Hh(w,a);break;case 24:fr(n,a,o,c),p&2048&&qh(a.alternate,a);break;default:fr(n,a,o,c)}}function wi(n,a,o,c,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=n,w=a,N=o,M=c,V=w.flags;switch(w.tag){case 0:case 11:case 15:wi(v,w,N,M,p),qo(8,w);break;case 23:break;case 22:var ne=w.stateNode;w.memoizedState!==null?ne._visibility&2?wi(v,w,N,M,p):Go(v,w):(ne._visibility|=2,wi(v,w,N,M,p)),p&&V&2048&&Hh(w.alternate,w);break;case 24:wi(v,w,N,M,p),p&&V&2048&&qh(w.alternate,w);break;default:wi(v,w,N,M,p)}a=a.sibling}}function Go(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var o=n,c=a,p=c.flags;switch(c.tag){case 22:Go(o,c),p&2048&&Hh(c.alternate,c);break;case 24:Go(o,c),p&2048&&qh(c.alternate,c);break;default:Go(o,c)}a=a.sibling}}var Fo=8192;function _i(n,a,o){if(n.subtreeFlags&Fo)for(n=n.child;n!==null;)Qb(n,a,o),n=n.sibling}function Qb(n,a,o){switch(n.tag){case 26:_i(n,a,o),n.flags&Fo&&n.memoizedState!==null&&PR(o,dr,n.memoizedState,n.memoizedProps);break;case 5:_i(n,a,o);break;case 3:case 4:var c=dr;dr=iu(n.stateNode.containerInfo),_i(n,a,o),dr=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Fo,Fo=16777216,_i(n,a,o),Fo=c):_i(n,a,o));break;default:_i(n,a,o)}}function Zb(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 Ko(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var c=a[o];Xt=c,t0(c,n)}Zb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)e0(n),n=n.sibling}function e0(n){switch(n.tag){case 0:case 11:case 15:Ko(n),n.flags&2048&&Oa(9,n,n.return);break;case 3:Ko(n);break;case 12:Ko(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Kc(n)):Ko(n);break;default:Ko(n)}}function Kc(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var c=a[o];Xt=c,t0(c,n)}Zb(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:Oa(8,a,a.return),Kc(a);break;case 22:o=a.stateNode,o._visibility&2&&(o._visibility&=-3,Kc(a));break;default:Kc(a)}n=n.sibling}}function t0(n,a){for(;Xt!==null;){var o=Xt;switch(o.tag){case 0:case 11:case 15:Oa(8,o,a);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var c=o.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:jo(o.memoizedState.cache)}if(c=o.child,c!==null)c.return=o,Xt=c;else e:for(o=n;Xt!==null;){c=Xt;var p=c.sibling,v=c.return;if(Gb(c),c===o){Xt=null;break e}if(p!==null){p.return=v,Xt=p;break e}Xt=v}}}var XA={getCacheForType:function(n){var a=tn(zt),o=a.data.get(n);return o===void 0&&(o=n(),a.data.set(n,o)),o},cacheSignal:function(){return tn(zt).controller.signal}},JA=typeof WeakMap=="function"?WeakMap:Map,ut=0,vt=null,Je=null,et=0,dt=0,Un=null,Ma=!1,Si=!1,Vh=!1,na=0,Rt=0,Da=0,Ns=0,Gh=0,$n=0,Ei=0,Yo=null,Nn=null,Fh=!1,Yc=0,n0=0,Wc=1/0,Xc=null,Pa=null,Vt=0,La=null,Ci=null,ra=0,Kh=0,Yh=null,r0=null,Wo=0,Wh=null;function Bn(){return(ut&2)!==0&&et!==0?et&-et:j.T!==null?tm():pf()}function a0(){if($n===0)if((et&536870912)===0||rt){var n=at;at<<=1,(at&3932160)===0&&(at=262144),$n=n}else $n=536870912;return n=zn.current,n!==null&&(n.flags|=32),$n}function An(n,a,o){(n===vt&&(dt===2||dt===9)||n.cancelPendingCommit!==null)&&(Ti(n,0),za(n,et,$n,!1)),Ct(n,o),((ut&2)===0||n!==vt)&&(n===vt&&((ut&2)===0&&(Ns|=o),Rt===4&&za(n,et,$n,!1)),Cr(n))}function s0(n,a,o){if((ut&6)!==0)throw Error(s(327));var c=!o&&(a&127)===0&&(a&n.expiredLanes)===0||yt(n,a),p=c?eR(n,a):Jh(n,a,!0),v=c;do{if(p===0){Si&&!c&&za(n,a,0,!1);break}else{if(o=n.current.alternate,v&&!QA(o)){p=Jh(n,a,!1),v=!1;continue}if(p===2){if(v=a,n.errorRecoveryDisabledLanes&v)var w=0;else w=n.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){a=w;e:{var N=n;p=Yo;var M=N.current.memoizedState.isDehydrated;if(M&&(Ti(N,w).flags|=256),w=Jh(N,w,!1),w!==2){if(Vh&&!M){N.errorRecoveryDisabledLanes|=v,Ns|=v,p=4;break e}v=Nn,Nn=p,v!==null&&(Nn===null?Nn=v:Nn.push.apply(Nn,v))}p=w}if(v=!1,p!==2)continue}}if(p===1){Ti(n,0),za(n,a,0,!0);break}e:{switch(c=n,v=p,v){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:za(c,a,$n,!Ma);break e;case 2:Nn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(p=Yc+300-Ie(),10<p)){if(za(c,a,$n,!Ma),Pe(c,0,!0)!==0)break e;ra=a,c.timeoutHandle=L0(i0.bind(null,c,o,Nn,Xc,Fh,a,$n,Ns,Ei,Ma,v,"Throttled",-0,0),p);break e}i0(c,o,Nn,Xc,Fh,a,$n,Ns,Ei,Ma,v,null,-0,0)}}break}while(!0);Cr(n)}function i0(n,a,o,c,p,v,w,N,M,V,ne,ie,F,X){if(n.timeoutHandle=-1,ie=a.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hr},Qb(a,v,ie);var _e=(v&62914560)===v?Yc-Ie():(v&4194048)===v?n0-Ie():0;if(_e=LR(ie,_e),_e!==null){ra=v,n.cancelPendingCommit=_e(m0.bind(null,n,a,v,o,c,p,w,N,M,ne,ie,null,F,X)),za(n,v,w,!V);return}}m0(n,a,v,o,c,p,w,N,M)}function QA(n){for(var a=n;;){var o=a.tag;if((o===0||o===11||o===15)&&a.flags&16384&&(o=a.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var c=0;c<o.length;c++){var p=o[c],v=p.getSnapshot;p=p.value;try{if(!Pn(v(),p))return!1}catch{return!1}}if(o=a.child,a.subtreeFlags&16384&&o!==null)o.return=a,a=o;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 za(n,a,o,c){a&=~Gh,a&=~Ns,n.suspendedLanes|=a,n.pingedLanes&=~a,c&&(n.warmLanes|=a),c=n.expirationTimes;for(var p=a;0<p;){var v=31-Ot(p),w=1<<v;c[v]=-1,p&=~w}o!==0&&us(n,o,a)}function Jc(){return(ut&6)===0?(Xo(0),!1):!0}function Xh(){if(Je!==null){if(dt===0)var n=Je.return;else n=Je,Fr=ys=null,fh(n),gi=null,Oo=0,n=Je;for(;n!==null;)zb(n.alternate,n),n=n.return;Je=null}}function Ti(n,a){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,yR(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),ra=0,Xh(),vt=n,Je=o=Vr(n.current,null),et=a,dt=0,Un=null,Ma=!1,Si=yt(n,a),Vh=!1,Ei=$n=Gh=Ns=Da=Rt=0,Nn=Yo=null,Fh=!1,(a&8)!==0&&(a|=a&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=a;0<c;){var p=31-Ot(c),v=1<<p;a|=n[p],c&=~v}return na=a,yc(),o}function o0(n,a){Be=null,j.H=$o,a===pi||a===Tc?(a=Sy(),dt=3):a===eh?(a=Sy(),dt=4):dt=a===Ah?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Un=a,Je===null&&(Rt=1,$c(n,Wn(a,n.current)))}function l0(){var n=zn.current;return n===null?!0:(et&4194048)===et?Zn===null:(et&62914560)===et||(et&536870912)!==0?n===Zn:!1}function c0(){var n=j.H;return j.H=$o,n===null?$o:n}function u0(){var n=j.A;return j.A=XA,n}function Qc(){Rt=4,Ma||(et&4194048)!==et&&zn.current!==null||(Si=!0),(Da&134217727)===0&&(Ns&134217727)===0||vt===null||za(vt,et,$n,!1)}function Jh(n,a,o){var c=ut;ut|=2;var p=c0(),v=u0();(vt!==n||et!==a)&&(Xc=null,Ti(n,a)),a=!1;var w=Rt;e:do try{if(dt!==0&&Je!==null){var N=Je,M=Un;switch(dt){case 8:Xh(),w=6;break e;case 3:case 2:case 9:case 6:zn.current===null&&(a=!0);var V=dt;if(dt=0,Un=null,Ni(n,N,M,V),o&&Si){w=0;break e}break;default:V=dt,dt=0,Un=null,Ni(n,N,M,V)}}ZA(),w=Rt;break}catch(ne){o0(n,ne)}while(!0);return a&&n.shellSuspendCounter++,Fr=ys=null,ut=c,j.H=p,j.A=v,Je===null&&(vt=null,et=0,yc()),w}function ZA(){for(;Je!==null;)d0(Je)}function eR(n,a){var o=ut;ut|=2;var c=c0(),p=u0();vt!==n||et!==a?(Xc=null,Wc=Ie()+500,Ti(n,a)):Si=yt(n,a);e:do try{if(dt!==0&&Je!==null){a=Je;var v=Un;t:switch(dt){case 1:dt=0,Un=null,Ni(n,a,v,1);break;case 2:case 9:if(wy(v)){dt=0,Un=null,f0(a);break}a=function(){dt!==2&&dt!==9||vt!==n||(dt=7),Cr(n)},v.then(a,a);break e;case 3:dt=7;break e;case 4:dt=5;break e;case 7:wy(v)?(dt=0,Un=null,f0(a)):(dt=0,Un=null,Ni(n,a,v,7));break;case 5:var w=null;switch(Je.tag){case 26:w=Je.memoizedState;case 5:case 27:var N=Je;if(w?J0(w):N.stateNode.complete){dt=0,Un=null;var M=N.sibling;if(M!==null)Je=M;else{var V=N.return;V!==null?(Je=V,Zc(V)):Je=null}break t}}dt=0,Un=null,Ni(n,a,v,5);break;case 6:dt=0,Un=null,Ni(n,a,v,6);break;case 8:Xh(),Rt=6;break e;default:throw Error(s(462))}}tR();break}catch(ne){o0(n,ne)}while(!0);return Fr=ys=null,j.H=c,j.A=p,ut=o,Je!==null?0:(vt=null,et=0,yc(),Rt)}function tR(){for(;Je!==null&&!it();)d0(Je)}function d0(n){var a=Pb(n.alternate,n,na);n.memoizedProps=n.pendingProps,a===null?Zc(n):Je=a}function f0(n){var a=n,o=a.alternate;switch(a.tag){case 15:case 0:a=Rb(o,a,a.pendingProps,a.type,void 0,et);break;case 11:a=Rb(o,a,a.pendingProps,a.type.render,a.ref,et);break;case 5:fh(a);default:zb(o,a),a=Je=uy(a,na),a=Pb(o,a,na)}n.memoizedProps=n.pendingProps,a===null?Zc(n):Je=a}function Ni(n,a,o,c){Fr=ys=null,fh(a),gi=null,Oo=0;var p=a.return;try{if(qA(n,p,a,o,et)){Rt=1,$c(n,Wn(o,n.current)),Je=null;return}}catch(v){if(p!==null)throw Je=p,v;Rt=1,$c(n,Wn(o,n.current)),Je=null;return}a.flags&32768?(rt||c===1?n=!0:Si||(et&536870912)!==0?n=!1:(Ma=n=!0,(c===2||c===9||c===3||c===6)&&(c=zn.current,c!==null&&c.tag===13&&(c.flags|=16384))),h0(a,n)):Zc(a)}function Zc(n){var a=n;do{if((a.flags&32768)!==0){h0(a,Ma);return}n=a.return;var o=FA(a.alternate,a,na);if(o!==null){Je=o;return}if(a=a.sibling,a!==null){Je=a;return}Je=a=n}while(a!==null);Rt===0&&(Rt=5)}function h0(n,a){do{var o=KA(n.alternate,n);if(o!==null){o.flags&=32767,Je=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!a&&(n=n.sibling,n!==null)){Je=n;return}Je=n=o}while(n!==null);Rt=6,Je=null}function m0(n,a,o,c,p,v,w,N,M){n.cancelPendingCommit=null;do eu();while(Vt!==0);if((ut&6)!==0)throw Error(s(327));if(a!==null){if(a===n.current)throw Error(s(177));if(v=a.lanes|a.childLanes,v|=Uf,bn(n,o,v,w,N,M),n===vt&&(Je=vt=null,et=0),Ci=a,La=n,ra=o,Kh=v,Yh=p,r0=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,sR(Lt,function(){return b0(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=j.T,j.T=null,p=K.p,K.p=2,w=ut,ut|=4;try{YA(n,a,o)}finally{ut=w,K.p=p,j.T=c}}Vt=1,p0(),g0(),v0()}}function p0(){if(Vt===1){Vt=0;var n=La,a=Ci,o=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||o){o=j.T,j.T=null;var c=K.p;K.p=2;var p=ut;ut|=4;try{Wb(a,n);var v=cm,w=ty(n.containerInfo),N=v.focusedElem,M=v.selectionRange;if(w!==N&&N&&N.ownerDocument&&ey(N.ownerDocument.documentElement,N)){if(M!==null&&Df(N)){var V=M.start,ne=M.end;if(ne===void 0&&(ne=V),"selectionStart"in N)N.selectionStart=V,N.selectionEnd=Math.min(ne,N.value.length);else{var ie=N.ownerDocument||document,F=ie&&ie.defaultView||window;if(F.getSelection){var X=F.getSelection(),_e=N.textContent.length,De=Math.min(M.start,_e),pt=M.end===void 0?De:Math.min(M.end,_e);!X.extend&&De>pt&&(w=pt,pt=De,De=w);var z=Zv(N,De),P=Zv(N,pt);if(z&&P&&(X.rangeCount!==1||X.anchorNode!==z.node||X.anchorOffset!==z.offset||X.focusNode!==P.node||X.focusOffset!==P.offset)){var q=ie.createRange();q.setStart(z.node,z.offset),X.removeAllRanges(),De>pt?(X.addRange(q),X.extend(P.node,P.offset)):(q.setEnd(P.node,P.offset),X.addRange(q))}}}}for(ie=[],X=N;X=X.parentNode;)X.nodeType===1&&ie.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ie.length;N++){var ae=ie[N];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}fu=!!lm,cm=lm=null}finally{ut=p,K.p=c,j.T=o}}n.current=a,Vt=2}}function g0(){if(Vt===2){Vt=0;var n=La,a=Ci,o=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||o){o=j.T,j.T=null;var c=K.p;K.p=2;var p=ut;ut|=4;try{Vb(n,a.alternate,a)}finally{ut=p,K.p=c,j.T=o}}Vt=3}}function v0(){if(Vt===4||Vt===3){Vt=0,Pt();var n=La,a=Ci,o=ra,c=r0;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Vt=5:(Vt=0,Ci=La=null,y0(n,n.pendingLanes));var p=n.pendingLanes;if(p===0&&(Pa=null),cr(o),a=a.stateNode,kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(yn,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=j.T,p=K.p,K.p=2,j.T=null;try{for(var v=n.onRecoverableError,w=0;w<c.length;w++){var N=c[w];v(N.value,{componentStack:N.stack})}}finally{j.T=a,K.p=p}}(ra&3)!==0&&eu(),Cr(n),p=n.pendingLanes,(o&261930)!==0&&(p&42)!==0?n===Wh?Wo++:(Wo=0,Wh=n):Wo=0,Xo(0)}}function y0(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,jo(a)))}function eu(){return p0(),g0(),v0(),b0()}function b0(){if(Vt!==5)return!1;var n=La,a=Kh;Kh=0;var o=cr(ra),c=j.T,p=K.p;try{K.p=32>o?32:o,j.T=null,o=Yh,Yh=null;var v=La,w=ra;if(Vt=0,Ci=La=null,ra=0,(ut&6)!==0)throw Error(s(331));var N=ut;if(ut|=4,e0(v.current),Jb(v,v.current,w,o),ut=N,Xo(0,!1),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(yn,v)}catch{}return!0}finally{K.p=p,j.T=c,y0(n,a)}}function x0(n,a,o){a=Wn(o,a),a=Nh(n.stateNode,a,2),n=Ra(n,a,2),n!==null&&(Ct(n,2),Cr(n))}function ft(n,a,o){if(n.tag===3)x0(n,n,o);else for(;a!==null;){if(a.tag===3){x0(a,n,o);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Pa===null||!Pa.has(c))){n=Wn(o,n),o=wb(2),c=Ra(a,o,2),c!==null&&(_b(o,c,a,n),Ct(c,2),Cr(c));break}}a=a.return}}function Qh(n,a,o){var c=n.pingCache;if(c===null){c=n.pingCache=new JA;var p=new Set;c.set(a,p)}else p=c.get(a),p===void 0&&(p=new Set,c.set(a,p));p.has(o)||(Vh=!0,p.add(o),n=nR.bind(null,n,a,o),a.then(n,n))}function nR(n,a,o){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,vt===n&&(et&o)===o&&(Rt===4||Rt===3&&(et&62914560)===et&&300>Ie()-Yc?(ut&2)===0&&Ti(n,0):Gh|=o,Ei===et&&(Ei=0)),Cr(n)}function w0(n,a){a===0&&(a=un()),n=ps(n,a),n!==null&&(Ct(n,a),Cr(n))}function rR(n){var a=n.memoizedState,o=0;a!==null&&(o=a.retryLane),w0(n,o)}function aR(n,a){var o=0;switch(n.tag){case 31:case 13:var c=n.stateNode,p=n.memoizedState;p!==null&&(o=p.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),w0(n,o)}function sR(n,a){return Nt(n,a)}var tu=null,Ai=null,Zh=!1,nu=!1,em=!1,Ia=0;function Cr(n){n!==Ai&&n.next===null&&(Ai===null?tu=Ai=n:Ai=Ai.next=n),nu=!0,Zh||(Zh=!0,oR())}function Xo(n,a){if(!em&&nu){em=!0;do for(var o=!1,c=tu;c!==null;){if(n!==0){var p=c.pendingLanes;if(p===0)var v=0;else{var w=c.suspendedLanes,N=c.pingedLanes;v=(1<<31-Ot(42|n)+1)-1,v&=p&~(w&~N),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(o=!0,C0(c,v))}else v=et,v=Pe(c,c===vt?v:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(v&3)===0||yt(c,v)||(o=!0,C0(c,v));c=c.next}while(o);em=!1}}function iR(){_0()}function _0(){nu=Zh=!1;var n=0;Ia!==0&&vR()&&(n=Ia);for(var a=Ie(),o=null,c=tu;c!==null;){var p=c.next,v=S0(c,a);v===0?(c.next=null,o===null?tu=p:o.next=p,p===null&&(Ai=o)):(o=c,(n!==0||(v&3)!==0)&&(nu=!0)),c=p}Vt!==0&&Vt!==5||Xo(n),Ia!==0&&(Ia=0)}function S0(n,a){for(var o=n.suspendedLanes,c=n.pingedLanes,p=n.expirationTimes,v=n.pendingLanes&-62914561;0<v;){var w=31-Ot(v),N=1<<w,M=p[w];M===-1?((N&o)===0||(N&c)!==0)&&(p[w]=Yt(N,a)):M<=a&&(n.expiredLanes|=N),v&=~N}if(a=vt,o=et,o=Pe(n,n===a?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,o===0||n===a&&(dt===2||dt===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&We(c),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||yt(n,o)){if(a=o&-o,a===n.callbackPriority)return a;switch(c!==null&&We(c),cr(o)){case 2:case 8:o=Xe;break;case 32:o=Lt;break;case 268435456:o=Kt;break;default:o=Lt}return c=E0.bind(null,n),o=Nt(o,c),n.callbackPriority=a,n.callbackNode=o,a}return c!==null&&c!==null&&We(c),n.callbackPriority=2,n.callbackNode=null,2}function E0(n,a){if(Vt!==0&&Vt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(eu()&&n.callbackNode!==o)return null;var c=et;return c=Pe(n,n===vt?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(s0(n,c,a),S0(n,Ie()),n.callbackNode!=null&&n.callbackNode===o?E0.bind(null,n):null)}function C0(n,a){if(eu())return null;s0(n,a,!0)}function oR(){bR(function(){(ut&6)!==0?Nt(Oe,iR):_0()})}function tm(){if(Ia===0){var n=hi;n===0&&(n=Me,Me<<=1,(Me&261888)===0&&(Me=256)),Ia=n}return Ia}function T0(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:uc(""+n)}function N0(n,a){var o=a.ownerDocument.createElement("input");return o.name=a.name,o.value=a.value,n.id&&o.setAttribute("form",n.id),a.parentNode.insertBefore(o,a),n=new FormData(n),o.parentNode.removeChild(o),n}function lR(n,a,o,c,p){if(a==="submit"&&o&&o.stateNode===p){var v=T0((p[_n]||null).action),w=c.submitter;w&&(a=(a=w[_n]||null)?T0(a.formAction):w.getAttribute("formAction"),a!==null&&(v=a,w=null));var N=new mc("action","action",null,c,p);n.push({event:N,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Ia!==0){var M=w?N0(p,w):new FormData(p);wh(o,{pending:!0,data:M,method:p.method,action:v},null,M)}}else typeof v=="function"&&(N.preventDefault(),M=w?N0(p,w):new FormData(p),wh(o,{pending:!0,data:M,method:p.method,action:v},v,M))},currentTarget:p}]})}}for(var nm=0;nm<If.length;nm++){var rm=If[nm],cR=rm.toLowerCase(),uR=rm[0].toUpperCase()+rm.slice(1);ur(cR,"on"+uR)}ur(ay,"onAnimationEnd"),ur(sy,"onAnimationIteration"),ur(iy,"onAnimationStart"),ur("dblclick","onDoubleClick"),ur("focusin","onFocus"),ur("focusout","onBlur"),ur(TA,"onTransitionRun"),ur(NA,"onTransitionStart"),ur(AA,"onTransitionCancel"),ur(oy,"onTransitionEnd"),Zs("onMouseEnter",["mouseout","mouseover"]),Zs("onMouseLeave",["mouseout","mouseover"]),Zs("onPointerEnter",["pointerout","pointerover"]),Zs("onPointerLeave",["pointerout","pointerover"]),ds("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ds("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ds("onBeforeInput",["compositionend","keypress","textInput","paste"]),ds("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ds("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ds("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jo="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(" "),dR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Jo));function A0(n,a){a=(a&4)!==0;for(var o=0;o<n.length;o++){var c=n[o],p=c.event;c=c.listeners;e:{var v=void 0;if(a)for(var w=c.length-1;0<=w;w--){var N=c[w],M=N.instance,V=N.currentTarget;if(N=N.listener,M!==v&&p.isPropagationStopped())break e;v=N,p.currentTarget=V;try{v(p)}catch(ne){vc(ne)}p.currentTarget=null,v=M}else for(w=0;w<c.length;w++){if(N=c[w],M=N.instance,V=N.currentTarget,N=N.listener,M!==v&&p.isPropagationStopped())break e;v=N,p.currentTarget=V;try{v(p)}catch(ne){vc(ne)}p.currentTarget=null,v=M}}}}function Qe(n,a){var o=a[gf];o===void 0&&(o=a[gf]=new Set);var c=n+"__bubble";o.has(c)||(R0(a,n,2,!1),o.add(c))}function am(n,a,o){var c=0;a&&(c|=4),R0(o,n,c,a)}var ru="_reactListening"+Math.random().toString(36).slice(2);function sm(n){if(!n[ru]){n[ru]=!0,_v.forEach(function(o){o!=="selectionchange"&&(dR.has(o)||am(o,!1,n),am(o,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[ru]||(a[ru]=!0,am("selectionchange",!1,a))}}function R0(n,a,o,c){switch(ax(a)){case 2:var p=UR;break;case 8:p=$R;break;default:p=xm}o=p.bind(null,a,o,n),p=void 0,!Cf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),c?p!==void 0?n.addEventListener(a,o,{capture:!0,passive:p}):n.addEventListener(a,o,!0):p!==void 0?n.addEventListener(a,o,{passive:p}):n.addEventListener(a,o,!1)}function im(n,a,o,c,p){var v=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var N=c.stateNode.containerInfo;if(N===p)break;if(w===4)for(w=c.return;w!==null;){var M=w.tag;if((M===3||M===4)&&w.stateNode.containerInfo===p)return;w=w.return}for(;N!==null;){if(w=Xs(N),w===null)return;if(M=w.tag,M===5||M===6||M===26||M===27){c=v=w;continue e}N=N.parentNode}}c=c.return}Dv(function(){var V=v,ne=Sf(o),ie=[];e:{var F=ly.get(n);if(F!==void 0){var X=mc,_e=n;switch(n){case"keypress":if(fc(o)===0)break e;case"keydown":case"keyup":X=aA;break;case"focusin":_e="focus",X=Rf;break;case"focusout":_e="blur",X=Rf;break;case"beforeblur":case"afterblur":X=Rf;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=zv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=FN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=oA;break;case ay:case sy:case iy:X=WN;break;case oy:X=cA;break;case"scroll":case"scrollend":X=VN;break;case"wheel":X=dA;break;case"copy":case"cut":case"paste":X=JN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=Uv;break;case"toggle":case"beforetoggle":X=hA}var De=(a&4)!==0,pt=!De&&(n==="scroll"||n==="scrollend"),z=De?F!==null?F+"Capture":null:F;De=[];for(var P=V,q;P!==null;){var ae=P;if(q=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||q===null||z===null||(ae=bo(P,z),ae!=null&&De.push(Qo(P,ae,q))),pt)break;P=P.return}0<De.length&&(F=new X(F,_e,null,o,ne),ie.push({event:F,listeners:De}))}}if((a&7)===0){e:{if(F=n==="mouseover"||n==="pointerover",X=n==="mouseout"||n==="pointerout",F&&o!==_f&&(_e=o.relatedTarget||o.fromElement)&&(Xs(_e)||_e[Ws]))break e;if((X||F)&&(F=ne.window===ne?ne:(F=ne.ownerDocument)?F.defaultView||F.parentWindow:window,X?(_e=o.relatedTarget||o.toElement,X=V,_e=_e?Xs(_e):null,_e!==null&&(pt=l(_e),De=_e.tag,_e!==pt||De!==5&&De!==27&&De!==6)&&(_e=null)):(X=null,_e=V),X!==_e)){if(De=zv,ae="onMouseLeave",z="onMouseEnter",P="mouse",(n==="pointerout"||n==="pointerover")&&(De=Uv,ae="onPointerLeave",z="onPointerEnter",P="pointer"),pt=X==null?F:yo(X),q=_e==null?F:yo(_e),F=new De(ae,P+"leave",X,o,ne),F.target=pt,F.relatedTarget=q,ae=null,Xs(ne)===V&&(De=new De(z,P+"enter",_e,o,ne),De.target=q,De.relatedTarget=pt,ae=De),pt=ae,X&&_e)t:{for(De=fR,z=X,P=_e,q=0,ae=z;ae;ae=De(ae))q++;ae=0;for(var ke=P;ke;ke=De(ke))ae++;for(;0<q-ae;)z=De(z),q--;for(;0<ae-q;)P=De(P),ae--;for(;q--;){if(z===P||P!==null&&z===P.alternate){De=z;break t}z=De(z),P=De(P)}De=null}else De=null;X!==null&&j0(ie,F,X,De,!1),_e!==null&&pt!==null&&j0(ie,pt,_e,De,!0)}}e:{if(F=V?yo(V):window,X=F.nodeName&&F.nodeName.toLowerCase(),X==="select"||X==="input"&&F.type==="file")var lt=Kv;else if(Gv(F))if(Yv)lt=SA;else{lt=wA;var Ce=xA}else X=F.nodeName,!X||X.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?V&&wf(V.elementType)&&(lt=Kv):lt=_A;if(lt&&(lt=lt(n,V))){Fv(ie,lt,o,ne);break e}Ce&&Ce(n,F,V),n==="focusout"&&V&&F.type==="number"&&V.memoizedProps.value!=null&&xf(F,"number",F.value)}switch(Ce=V?yo(V):window,n){case"focusin":(Gv(Ce)||Ce.contentEditable==="true")&&(si=Ce,Pf=V,No=null);break;case"focusout":No=Pf=si=null;break;case"mousedown":Lf=!0;break;case"contextmenu":case"mouseup":case"dragend":Lf=!1,ny(ie,o,ne);break;case"selectionchange":if(CA)break;case"keydown":case"keyup":ny(ie,o,ne)}var Ge;if(kf)e:{switch(n){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else ai?qv(n,o)&&(tt="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(tt="onCompositionStart");tt&&($v&&o.locale!=="ko"&&(ai||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&ai&&(Ge=Pv()):(_a=ne,Tf="value"in _a?_a.value:_a.textContent,ai=!0)),Ce=au(V,tt),0<Ce.length&&(tt=new Iv(tt,n,null,o,ne),ie.push({event:tt,listeners:Ce}),Ge?tt.data=Ge:(Ge=Vv(o),Ge!==null&&(tt.data=Ge)))),(Ge=pA?gA(n,o):vA(n,o))&&(tt=au(V,"onBeforeInput"),0<tt.length&&(Ce=new Iv("onBeforeInput","beforeinput",null,o,ne),ie.push({event:Ce,listeners:tt}),Ce.data=Ge)),lR(ie,n,V,o,ne)}A0(ie,a)})}function Qo(n,a,o){return{instance:n,listener:a,currentTarget:o}}function au(n,a){for(var o=a+"Capture",c=[];n!==null;){var p=n,v=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||v===null||(p=bo(n,o),p!=null&&c.unshift(Qo(n,p,v)),p=bo(n,a),p!=null&&c.push(Qo(n,p,v))),n.tag===3)return c;n=n.return}return[]}function fR(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function j0(n,a,o,c,p){for(var v=a._reactName,w=[];o!==null&&o!==c;){var N=o,M=N.alternate,V=N.stateNode;if(N=N.tag,M!==null&&M===c)break;N!==5&&N!==26&&N!==27||V===null||(M=V,p?(V=bo(o,v),V!=null&&w.unshift(Qo(o,V,M))):p||(V=bo(o,v),V!=null&&w.push(Qo(o,V,M)))),o=o.return}w.length!==0&&n.push({event:a,listeners:w})}var hR=/\r\n?/g,mR=/\u0000|\uFFFD/g;function k0(n){return(typeof n=="string"?n:""+n).replace(hR,`
`).replace(mR,"")}function O0(n,a){return a=k0(a),k0(n)===a}function mt(n,a,o,c,p,v){switch(o){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||ti(n,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&ti(n,""+c);break;case"className":lc(n,"class",c);break;case"tabIndex":lc(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":lc(n,o,c);break;case"style":Ov(n,c,v);break;case"data":if(a!=="object"){lc(n,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||o!=="href")){n.removeAttribute(o);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(o);break}c=uc(""+c),n.setAttribute(o,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(o,"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 v=="function"&&(o==="formAction"?(a!=="input"&&mt(n,a,"name",p.name,p,null),mt(n,a,"formEncType",p.formEncType,p,null),mt(n,a,"formMethod",p.formMethod,p,null),mt(n,a,"formTarget",p.formTarget,p,null)):(mt(n,a,"encType",p.encType,p,null),mt(n,a,"method",p.method,p,null),mt(n,a,"target",p.target,p,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(o);break}c=uc(""+c),n.setAttribute(o,c);break;case"onClick":c!=null&&(n.onclick=Hr);break;case"onScroll":c!=null&&Qe("scroll",n);break;case"onScrollEnd":c!=null&&Qe("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(o=c.__html,o!=null){if(p.children!=null)throw Error(s(60));n.innerHTML=o}}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}o=uc(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);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(o,""+c):n.removeAttribute(o);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(o,""):n.removeAttribute(o);break;case"capture":case"download":c===!0?n.setAttribute(o,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(o,c):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(o,c):n.removeAttribute(o);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(o):n.setAttribute(o,c);break;case"popover":Qe("beforetoggle",n),Qe("toggle",n),oc(n,"popover",c);break;case"xlinkActuate":Br(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Br(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Br(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Br(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Br(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Br(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Br(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Br(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Br(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":oc(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=HN.get(o)||o,oc(n,o,c))}}function om(n,a,o,c,p,v){switch(o){case"style":Ov(n,c,v);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(o=c.__html,o!=null){if(p.children!=null)throw Error(s(60));n.innerHTML=o}}break;case"children":typeof c=="string"?ti(n,c):(typeof c=="number"||typeof c=="bigint")&&ti(n,""+c);break;case"onScroll":c!=null&&Qe("scroll",n);break;case"onScrollEnd":c!=null&&Qe("scrollend",n);break;case"onClick":c!=null&&(n.onclick=Hr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sv.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),a=o.slice(2,p?o.length-7:void 0),v=n[_n]||null,v=v!=null?v[o]:null,typeof v=="function"&&n.removeEventListener(a,v,p),typeof c=="function")){typeof v!="function"&&v!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(a,c,p);break e}o in n?n[o]=c:c===!0?n.setAttribute(o,""):oc(n,o,c)}}}function rn(n,a,o){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",n),Qe("load",n);var c=!1,p=!1,v;for(v in o)if(o.hasOwnProperty(v)){var w=o[v];if(w!=null)switch(v){case"src":c=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:mt(n,a,v,w,o,null)}}p&&mt(n,a,"srcSet",o.srcSet,o,null),c&&mt(n,a,"src",o.src,o,null);return;case"input":Qe("invalid",n);var N=v=w=p=null,M=null,V=null;for(c in o)if(o.hasOwnProperty(c)){var ne=o[c];if(ne!=null)switch(c){case"name":p=ne;break;case"type":w=ne;break;case"checked":M=ne;break;case"defaultChecked":V=ne;break;case"value":v=ne;break;case"defaultValue":N=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,a));break;default:mt(n,a,c,ne,o,null)}}Av(n,v,N,M,V,w,p,!1);return;case"select":Qe("invalid",n),c=w=v=null;for(p in o)if(o.hasOwnProperty(p)&&(N=o[p],N!=null))switch(p){case"value":v=N;break;case"defaultValue":w=N;break;case"multiple":c=N;default:mt(n,a,p,N,o,null)}a=v,o=w,n.multiple=!!c,a!=null?ei(n,!!c,a,!1):o!=null&&ei(n,!!c,o,!0);return;case"textarea":Qe("invalid",n),v=p=c=null;for(w in o)if(o.hasOwnProperty(w)&&(N=o[w],N!=null))switch(w){case"value":c=N;break;case"defaultValue":p=N;break;case"children":v=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(s(91));break;default:mt(n,a,w,N,o,null)}jv(n,c,p,v);return;case"option":for(M in o)if(o.hasOwnProperty(M)&&(c=o[M],c!=null))switch(M){case"selected":n.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:mt(n,a,M,c,o,null)}return;case"dialog":Qe("beforetoggle",n),Qe("toggle",n),Qe("cancel",n),Qe("close",n);break;case"iframe":case"object":Qe("load",n);break;case"video":case"audio":for(c=0;c<Jo.length;c++)Qe(Jo[c],n);break;case"image":Qe("error",n),Qe("load",n);break;case"details":Qe("toggle",n);break;case"embed":case"source":case"link":Qe("error",n),Qe("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(V in o)if(o.hasOwnProperty(V)&&(c=o[V],c!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:mt(n,a,V,c,o,null)}return;default:if(wf(a)){for(ne in o)o.hasOwnProperty(ne)&&(c=o[ne],c!==void 0&&om(n,a,ne,c,o,void 0));return}}for(N in o)o.hasOwnProperty(N)&&(c=o[N],c!=null&&mt(n,a,N,c,o,null))}function pR(n,a,o,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,v=null,w=null,N=null,M=null,V=null,ne=null;for(X in o){var ie=o[X];if(o.hasOwnProperty(X)&&ie!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":M=ie;default:c.hasOwnProperty(X)||mt(n,a,X,null,c,ie)}}for(var F in c){var X=c[F];if(ie=o[F],c.hasOwnProperty(F)&&(X!=null||ie!=null))switch(F){case"type":v=X;break;case"name":p=X;break;case"checked":V=X;break;case"defaultChecked":ne=X;break;case"value":w=X;break;case"defaultValue":N=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,a));break;default:X!==ie&&mt(n,a,F,X,c,ie)}}bf(n,w,N,M,V,ne,v,p);return;case"select":X=w=N=F=null;for(v in o)if(M=o[v],o.hasOwnProperty(v)&&M!=null)switch(v){case"value":break;case"multiple":X=M;default:c.hasOwnProperty(v)||mt(n,a,v,null,c,M)}for(p in c)if(v=c[p],M=o[p],c.hasOwnProperty(p)&&(v!=null||M!=null))switch(p){case"value":F=v;break;case"defaultValue":N=v;break;case"multiple":w=v;default:v!==M&&mt(n,a,p,v,c,M)}a=N,o=w,c=X,F!=null?ei(n,!!o,F,!1):!!c!=!!o&&(a!=null?ei(n,!!o,a,!0):ei(n,!!o,o?[]:"",!1));return;case"textarea":X=F=null;for(N in o)if(p=o[N],o.hasOwnProperty(N)&&p!=null&&!c.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:mt(n,a,N,null,c,p)}for(w in c)if(p=c[w],v=o[w],c.hasOwnProperty(w)&&(p!=null||v!=null))switch(w){case"value":F=p;break;case"defaultValue":X=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(s(91));break;default:p!==v&&mt(n,a,w,p,c,v)}Rv(n,F,X);return;case"option":for(var _e in o)if(F=o[_e],o.hasOwnProperty(_e)&&F!=null&&!c.hasOwnProperty(_e))switch(_e){case"selected":n.selected=!1;break;default:mt(n,a,_e,null,c,F)}for(M in c)if(F=c[M],X=o[M],c.hasOwnProperty(M)&&F!==X&&(F!=null||X!=null))switch(M){case"selected":n.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:mt(n,a,M,F,c,X)}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 De in o)F=o[De],o.hasOwnProperty(De)&&F!=null&&!c.hasOwnProperty(De)&&mt(n,a,De,null,c,F);for(V in c)if(F=c[V],X=o[V],c.hasOwnProperty(V)&&F!==X&&(F!=null||X!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(s(137,a));break;default:mt(n,a,V,F,c,X)}return;default:if(wf(a)){for(var pt in o)F=o[pt],o.hasOwnProperty(pt)&&F!==void 0&&!c.hasOwnProperty(pt)&&om(n,a,pt,void 0,c,F);for(ne in c)F=c[ne],X=o[ne],!c.hasOwnProperty(ne)||F===X||F===void 0&&X===void 0||om(n,a,ne,F,c,X);return}}for(var z in o)F=o[z],o.hasOwnProperty(z)&&F!=null&&!c.hasOwnProperty(z)&&mt(n,a,z,null,c,F);for(ie in c)F=c[ie],X=o[ie],!c.hasOwnProperty(ie)||F===X||F==null&&X==null||mt(n,a,ie,F,c,X)}function M0(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gR(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,o=performance.getEntriesByType("resource"),c=0;c<o.length;c++){var p=o[c],v=p.transferSize,w=p.initiatorType,N=p.duration;if(v&&N&&M0(w)){for(w=0,N=p.responseEnd,c+=1;c<o.length;c++){var M=o[c],V=M.startTime;if(V>N)break;var ne=M.transferSize,ie=M.initiatorType;ne&&M0(ie)&&(M=M.responseEnd,w+=ne*(M<N?1:(N-V)/(M-V)))}if(--c,a+=8*(v+w)/(p.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 lm=null,cm=null;function su(n){return n.nodeType===9?n:n.ownerDocument}function D0(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 P0(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 um(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 dm=null;function vR(){var n=window.event;return n&&n.type==="popstate"?n===dm?!1:(dm=n,!0):(dm=null,!1)}var L0=typeof setTimeout=="function"?setTimeout:void 0,yR=typeof clearTimeout=="function"?clearTimeout:void 0,z0=typeof Promise=="function"?Promise:void 0,bR=typeof queueMicrotask=="function"?queueMicrotask:typeof z0<"u"?function(n){return z0.resolve(null).then(n).catch(xR)}:L0;function xR(n){setTimeout(function(){throw n})}function Ua(n){return n==="head"}function I0(n,a){var o=a,c=0;do{var p=o.nextSibling;if(n.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(c===0){n.removeChild(p),Oi(a);return}c--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")c++;else if(o==="html")Zo(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,Zo(o);for(var v=o.firstChild;v;){var w=v.nextSibling,N=v.nodeName;v[vo]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&v.rel.toLowerCase()==="stylesheet"||o.removeChild(v),v=w}}else o==="body"&&Zo(n.ownerDocument.body);o=p}while(o);Oi(a)}function U0(n,a){var o=n;n=0;do{var c=o.nextSibling;if(o.nodeType===1?a?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(a?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),c&&c.nodeType===8)if(o=c.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=c}while(o)}function fm(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var o=a;switch(a=a.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":fm(o),vf(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function wR(n,a,o,c){for(;n.nodeType===1;){var p=o;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[vo])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(v=n.getAttribute("rel"),v==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(v!==p.rel||n.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||n.getAttribute("title")!==(p.title==null?null:p.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(v=n.getAttribute("src"),(v!==(p.src==null?null:p.src)||n.getAttribute("type")!==(p.type==null?null:p.type)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&v&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var v=p.name==null?null:""+p.name;if(p.type==="hidden"&&n.getAttribute("name")===v)return n}else return n;if(n=er(n.nextSibling),n===null)break}return null}function _R(n,a,o){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=er(n.nextSibling),n===null))return null;return n}function $0(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=er(n.nextSibling),n===null))return null;return n}function hm(n){return n.data==="$?"||n.data==="$~"}function mm(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function SR(n,a){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||o.readyState!=="loading")a();else{var c=function(){a(),o.removeEventListener("DOMContentLoaded",c)};o.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function er(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 pm=null;function B0(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(a===0)return er(n.nextSibling);a--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||a++}n=n.nextSibling}return null}function H0(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(a===0)return n;a--}else o!=="/$"&&o!=="/&"||a++}n=n.previousSibling}return null}function q0(n,a,o){switch(a=su(o),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 Zo(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);vf(n)}var tr=new Map,V0=new Set;function iu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var aa=K.d;K.d={f:ER,r:CR,D:TR,C:NR,L:AR,m:RR,X:kR,S:jR,M:OR};function ER(){var n=aa.f(),a=Jc();return n||a}function CR(n){var a=Js(n);a!==null&&a.tag===5&&a.type==="form"?ob(a):aa.r(n)}var Ri=typeof document>"u"?null:document;function G0(n,a,o){var c=Ri;if(c&&typeof a=="string"&&a){var p=Kn(a);p='link[rel="'+n+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),V0.has(p)||(V0.add(p),n={rel:n,crossOrigin:o,href:a},c.querySelector(p)===null&&(a=c.createElement("link"),rn(a,"link",n),Wt(a),c.head.appendChild(a)))}}function TR(n){aa.D(n),G0("dns-prefetch",n,null)}function NR(n,a){aa.C(n,a),G0("preconnect",n,a)}function AR(n,a,o){aa.L(n,a,o);var c=Ri;if(c&&n&&a){var p='link[rel="preload"][as="'+Kn(a)+'"]';a==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+Kn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+Kn(o.imageSizes)+'"]')):p+='[href="'+Kn(n)+'"]';var v=p;switch(a){case"style":v=ji(n);break;case"script":v=ki(n)}tr.has(v)||(n=g({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:n,as:a},o),tr.set(v,n),c.querySelector(p)!==null||a==="style"&&c.querySelector(el(v))||a==="script"&&c.querySelector(tl(v))||(a=c.createElement("link"),rn(a,"link",n),Wt(a),c.head.appendChild(a)))}}function RR(n,a){aa.m(n,a);var o=Ri;if(o&&n){var c=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+Kn(c)+'"][href="'+Kn(n)+'"]',v=p;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=ki(n)}if(!tr.has(v)&&(n=g({rel:"modulepreload",href:n},a),tr.set(v,n),o.querySelector(p)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(tl(v)))return}c=o.createElement("link"),rn(c,"link",n),Wt(c),o.head.appendChild(c)}}}function jR(n,a,o){aa.S(n,a,o);var c=Ri;if(c&&n){var p=Qs(c).hoistableStyles,v=ji(n);a=a||"default";var w=p.get(v);if(!w){var N={loading:0,preload:null};if(w=c.querySelector(el(v)))N.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":a},o),(o=tr.get(v))&&gm(n,o);var M=w=c.createElement("link");Wt(M),rn(M,"link",n),M._p=new Promise(function(V,ne){M.onload=V,M.onerror=ne}),M.addEventListener("load",function(){N.loading|=1}),M.addEventListener("error",function(){N.loading|=2}),N.loading|=4,ou(w,a,c)}w={type:"stylesheet",instance:w,count:1,state:N},p.set(v,w)}}}function kR(n,a){aa.X(n,a);var o=Ri;if(o&&n){var c=Qs(o).hoistableScripts,p=ki(n),v=c.get(p);v||(v=o.querySelector(tl(p)),v||(n=g({src:n,async:!0},a),(a=tr.get(p))&&vm(n,a),v=o.createElement("script"),Wt(v),rn(v,"link",n),o.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},c.set(p,v))}}function OR(n,a){aa.M(n,a);var o=Ri;if(o&&n){var c=Qs(o).hoistableScripts,p=ki(n),v=c.get(p);v||(v=o.querySelector(tl(p)),v||(n=g({src:n,async:!0,type:"module"},a),(a=tr.get(p))&&vm(n,a),v=o.createElement("script"),Wt(v),rn(v,"link",n),o.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},c.set(p,v))}}function F0(n,a,o,c){var p=(p=re.current)?iu(p):null;if(!p)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(a=ji(o.href),o=Qs(p).hoistableStyles,c=o.get(a),c||(c={type:"style",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=ji(o.href);var v=Qs(p).hoistableStyles,w=v.get(n);if(w||(p=p.ownerDocument||p,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(n,w),(v=p.querySelector(el(n)))&&!v._p&&(w.instance=v,w.state.loading=5),tr.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},tr.set(n,o),v||MR(p,n,o,w.state))),a&&c===null)throw Error(s(528,""));return w}if(a&&c!==null)throw Error(s(529,""));return null;case"script":return a=o.async,o=o.src,typeof o=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ki(o),o=Qs(p).hoistableScripts,c=o.get(a),c||(c={type:"script",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function ji(n){return'href="'+Kn(n)+'"'}function el(n){return'link[rel="stylesheet"]['+n+"]"}function K0(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function MR(n,a,o,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}),rn(a,"link",o),Wt(a),n.head.appendChild(a))}function ki(n){return'[src="'+Kn(n)+'"]'}function tl(n){return"script[async]"+n}function Y0(n,a,o){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+Kn(o.href)+'"]');if(c)return a.instance=c,Wt(c),c;var p=g({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),Wt(c),rn(c,"style",p),ou(c,o.precedence,n),a.instance=c;case"stylesheet":p=ji(o.href);var v=n.querySelector(el(p));if(v)return a.state.loading|=4,a.instance=v,Wt(v),v;c=K0(o),(p=tr.get(p))&&gm(c,p),v=(n.ownerDocument||n).createElement("link"),Wt(v);var w=v;return w._p=new Promise(function(N,M){w.onload=N,w.onerror=M}),rn(v,"link",c),a.state.loading|=4,ou(v,o.precedence,n),a.instance=v;case"script":return v=ki(o.src),(p=n.querySelector(tl(v)))?(a.instance=p,Wt(p),p):(c=o,(p=tr.get(v))&&(c=g({},o),vm(c,p)),n=n.ownerDocument||n,p=n.createElement("script"),Wt(p),rn(p,"link",c),n.head.appendChild(p),a.instance=p);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,ou(c,o.precedence,n));return a.instance}function ou(n,a,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=c.length?c[c.length-1]:null,v=p,w=0;w<c.length;w++){var N=c[w];if(N.dataset.precedence===a)v=N;else if(v!==p)break}v?v.parentNode.insertBefore(n,v.nextSibling):(a=o.nodeType===9?o.head:o,a.insertBefore(n,a.firstChild))}function gm(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function vm(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var lu=null;function W0(n,a,o){if(lu===null){var c=new Map,p=lu=new Map;p.set(o,c)}else p=lu,c=p.get(o),c||(c=new Map,p.set(o,c));if(c.has(n))return c;for(c.set(n,null),o=o.getElementsByTagName(n),p=0;p<o.length;p++){var v=o[p];if(!(v[vo]||v[Zt]||n==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var w=v.getAttribute(a)||"";w=n+w;var N=c.get(w);N?N.push(v):c.set(w,[v])}}return c}function X0(n,a,o){n=n.ownerDocument||n,n.head.insertBefore(o,a==="title"?n.querySelector("head > title"):null)}function DR(n,a,o){if(o===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 J0(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function PR(n,a,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=ji(c.href),v=a.querySelector(el(p));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=cu.bind(n),a.then(n,n)),o.state.loading|=4,o.instance=v,Wt(v);return}v=a.ownerDocument||a,c=K0(c),(p=tr.get(p))&&gm(c,p),v=v.createElement("link"),Wt(v);var w=v;w._p=new Promise(function(N,M){w.onload=N,w.onerror=M}),rn(v,"link",c),o.instance=v}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,a),(a=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=cu.bind(n),a.addEventListener("load",o),a.addEventListener("error",o))}}var ym=0;function LR(n,a){return n.stylesheets&&n.count===0&&du(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var c=setTimeout(function(){if(n.stylesheets&&du(n,n.stylesheets),n.unsuspend){var v=n.unsuspend;n.unsuspend=null,v()}},6e4+a);0<n.imgBytes&&ym===0&&(ym=62500*gR());var p=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&du(n,n.stylesheets),n.unsuspend)){var v=n.unsuspend;n.unsuspend=null,v()}},(n.imgBytes>ym?50:800)+a);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(p)}}:null}function cu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var uu=null;function du(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,uu=new Map,a.forEach(zR,n),uu=null,cu.call(n))}function zR(n,a){if(!(a.state.loading&4)){var o=uu.get(n);if(o)var c=o.get(null);else{o=new Map,uu.set(n,o);for(var p=n.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<p.length;v++){var w=p[v];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),c=w)}c&&o.set(null,c)}p=a.instance,w=p.getAttribute("data-precedence"),v=o.get(w)||c,v===c&&o.set(null,p),o.set(w,p),this.count++,c=cu.bind(this),p.addEventListener("load",c),p.addEventListener("error",c),v?v.parentNode.insertBefore(p,v.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(p,n.firstChild)),a.state.loading|=4}}var nl={$$typeof:A,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function IR(n,a,o,c,p,v,w,N,M){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=xa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xa(0),this.hiddenUpdates=xa(null),this.identifierPrefix=c,this.onUncaughtError=p,this.onCaughtError=v,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Q0(n,a,o,c,p,v,w,N,M,V,ne,ie){return n=new IR(n,a,o,w,M,V,ne,ie,N),a=1,v===!0&&(a|=24),v=Ln(3,null,null,a),n.current=v,v.stateNode=n,a=Jf(),a.refCount++,n.pooledCache=a,a.refCount++,v.memoizedState={element:c,isDehydrated:o,cache:a},th(v),n}function Z0(n){return n?(n=li,n):li}function ex(n,a,o,c,p,v){p=Z0(p),c.context===null?c.context=p:c.pendingContext=p,c=Aa(a),c.payload={element:o},v=v===void 0?null:v,v!==null&&(c.callback=v),o=Ra(n,c,a),o!==null&&(An(o,n,a),Do(o,n,a))}function tx(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<a?o:a}}function bm(n,a){tx(n,a),(n=n.alternate)&&tx(n,a)}function nx(n){if(n.tag===13||n.tag===31){var a=ps(n,67108864);a!==null&&An(a,n,67108864),bm(n,67108864)}}function rx(n){if(n.tag===13||n.tag===31){var a=Bn();a=Ys(a);var o=ps(n,a);o!==null&&An(o,n,a),bm(n,a)}}var fu=!0;function UR(n,a,o,c){var p=j.T;j.T=null;var v=K.p;try{K.p=2,xm(n,a,o,c)}finally{K.p=v,j.T=p}}function $R(n,a,o,c){var p=j.T;j.T=null;var v=K.p;try{K.p=8,xm(n,a,o,c)}finally{K.p=v,j.T=p}}function xm(n,a,o,c){if(fu){var p=wm(c);if(p===null)im(n,a,c,hu,o),sx(n,c);else if(HR(p,n,a,o,c))c.stopPropagation();else if(sx(n,c),a&4&&-1<BR.indexOf(n)){for(;p!==null;){var v=Js(p);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var w=qt(v.pendingLanes);if(w!==0){var N=v;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var M=1<<31-Ot(w);N.entanglements[1]|=M,w&=~M}Cr(v),(ut&6)===0&&(Wc=Ie()+500,Xo(0))}}break;case 31:case 13:N=ps(v,2),N!==null&&An(N,v,2),Jc(),bm(v,2)}if(v=wm(c),v===null&&im(n,a,c,hu,o),v===p)break;p=v}p!==null&&c.stopPropagation()}else im(n,a,c,null,o)}}function wm(n){return n=Sf(n),_m(n)}var hu=null;function _m(n){if(hu=null,n=Xs(n),n!==null){var a=l(n);if(a===null)n=null;else{var o=a.tag;if(o===13){if(n=u(a),n!==null)return n;n=null}else if(o===31){if(n=d(a),n!==null)return n;n=null}else if(o===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return hu=n,null}function ax(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(Q()){case Oe:return 2;case Xe:return 8;case Lt:case ln:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var Sm=!1,$a=null,Ba=null,Ha=null,rl=new Map,al=new Map,qa=[],BR="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 sx(n,a){switch(n){case"focusin":case"focusout":$a=null;break;case"dragenter":case"dragleave":Ba=null;break;case"mouseover":case"mouseout":Ha=null;break;case"pointerover":case"pointerout":rl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":al.delete(a.pointerId)}}function sl(n,a,o,c,p,v){return n===null||n.nativeEvent!==v?(n={blockedOn:a,domEventName:o,eventSystemFlags:c,nativeEvent:v,targetContainers:[p]},a!==null&&(a=Js(a),a!==null&&nx(a)),n):(n.eventSystemFlags|=c,a=n.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),n)}function HR(n,a,o,c,p){switch(a){case"focusin":return $a=sl($a,n,a,o,c,p),!0;case"dragenter":return Ba=sl(Ba,n,a,o,c,p),!0;case"mouseover":return Ha=sl(Ha,n,a,o,c,p),!0;case"pointerover":var v=p.pointerId;return rl.set(v,sl(rl.get(v)||null,n,a,o,c,p)),!0;case"gotpointercapture":return v=p.pointerId,al.set(v,sl(al.get(v)||null,n,a,o,c,p)),!0}return!1}function ix(n){var a=Xs(n.target);if(a!==null){var o=l(a);if(o!==null){if(a=o.tag,a===13){if(a=u(o),a!==null){n.blockedOn=a,xv(n.priority,function(){rx(o)});return}}else if(a===31){if(a=d(o),a!==null){n.blockedOn=a,xv(n.priority,function(){rx(o)});return}}else if(a===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function mu(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var o=wm(n.nativeEvent);if(o===null){o=n.nativeEvent;var c=new o.constructor(o.type,o);_f=c,o.target.dispatchEvent(c),_f=null}else return a=Js(o),a!==null&&nx(a),n.blockedOn=o,!1;a.shift()}return!0}function ox(n,a,o){mu(n)&&o.delete(a)}function qR(){Sm=!1,$a!==null&&mu($a)&&($a=null),Ba!==null&&mu(Ba)&&(Ba=null),Ha!==null&&mu(Ha)&&(Ha=null),rl.forEach(ox),al.forEach(ox)}function pu(n,a){n.blockedOn===a&&(n.blockedOn=null,Sm||(Sm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,qR)))}var gu=null;function lx(n){gu!==n&&(gu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){gu===n&&(gu=null);for(var a=0;a<n.length;a+=3){var o=n[a],c=n[a+1],p=n[a+2];if(typeof c!="function"){if(_m(c||o)===null)continue;break}var v=Js(o);v!==null&&(n.splice(a,3),a-=3,wh(v,{pending:!0,data:p,method:o.method,action:c},c,p))}}))}function Oi(n){function a(M){return pu(M,n)}$a!==null&&pu($a,n),Ba!==null&&pu(Ba,n),Ha!==null&&pu(Ha,n),rl.forEach(a),al.forEach(a);for(var o=0;o<qa.length;o++){var c=qa[o];c.blockedOn===n&&(c.blockedOn=null)}for(;0<qa.length&&(o=qa[0],o.blockedOn===null);)ix(o),o.blockedOn===null&&qa.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(c=0;c<o.length;c+=3){var p=o[c],v=o[c+1],w=p[_n]||null;if(typeof v=="function")w||lx(o);else if(w){var N=null;if(v&&v.hasAttribute("formAction")){if(p=v,w=v[_n]||null)N=w.formAction;else if(_m(p)!==null)continue}else N=w.action;typeof N=="function"?o[c+1]=N:(o.splice(c,3),c-=3),lx(o)}}}function cx(){function n(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(w){return p=w})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),c||setTimeout(o,20)}function o(){if(!c&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,p=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(o,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function Em(n){this._internalRoot=n}vu.prototype.render=Em.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(s(409));var o=a.current,c=Bn();ex(o,c,n,a,null,null)},vu.prototype.unmount=Em.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;ex(n.current,2,null,n,null,null),Jc(),a[Ws]=null}};function vu(n){this._internalRoot=n}vu.prototype.unstable_scheduleHydration=function(n){if(n){var a=pf();n={blockedOn:null,target:n,priority:a};for(var o=0;o<qa.length&&a!==0&&a<qa[o].priority;o++);qa.splice(o,0,n),o===0&&ix(n)}};var ux=t.version;if(ux!=="19.2.6")throw Error(s(527,ux,"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=h(a),n=n!==null?b(n):null,n=n===null?null:n.stateNode,n};var VR={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yu.isDisabled&&yu.supportsFiber)try{yn=yu.inject(VR),kt=yu}catch{}}return ol.createRoot=function(n,a){if(!i(n))throw Error(s(299));var o=!1,c="",p=vb,v=yb,w=bb;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=Q0(n,1,!1,null,null,o,c,null,p,v,w,cx),n[Ws]=a.current,sm(n),new Em(a)},ol.hydrateRoot=function(n,a,o){if(!i(n))throw Error(s(299));var c=!1,p="",v=vb,w=yb,N=bb,M=null;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(v=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(N=o.onRecoverableError),o.formState!==void 0&&(M=o.formState)),a=Q0(n,1,!0,a,o??null,c,p,M,v,w,N,cx),a.context=Z0(null),o=a.current,c=Bn(),c=Ys(c),p=Aa(c),p.callback=null,Ra(o,p,c),o=c,a.current.lanes=o,Ct(a,o),Cr(a),n[Ws]=a.current,sm(n),new vu(a)},ol.version="19.2.6",ol}var xx;function ej(){if(xx)return Nm.exports;xx=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(),Nm.exports=ZR(),Nm.exports}var tj=ej();/**
* 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 wx="popstate";function _x(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function nj(e={}){function t(s,i){var h;let l=(h=i.state)==null?void 0:h.masked,{pathname:u,search:d,hash:f}=l||s.location;return fp("",{pathname:u,search:d,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,i){return typeof i=="string"?i:Cl(i)}return aj(t,r,null,e)}function Tt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Lr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function rj(){return Math.random().toString(36).substring(2,10)}function Sx(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 fp(e,t,r=null,s,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?lo(t):t,state:r,key:t&&t.key||s||rj(),mask:i}}function Cl({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 lo(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 aj(e,t,r,s={}){let{window:i=document.defaultView,v5Compat:l=!1}=s,u=i.history,d="POP",f=null,h=b();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function b(){return(u.state||{idx:null}).idx}function g(){d="POP";let T=b(),C=T==null?null:T-h;h=T,f&&f({action:d,location:S.location,delta:C})}function x(T,C){d="PUSH";let R=_x(T)?T:fp(S.location,T,C);h=b()+1;let A=Sx(R,h),D=S.createHref(R.mask||R);try{u.pushState(A,"",D)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(D)}l&&f&&f({action:d,location:S.location,delta:1})}function _(T,C){d="REPLACE";let R=_x(T)?T:fp(S.location,T,C);h=b();let A=Sx(R,h),D=S.createHref(R.mask||R);u.replaceState(A,"",D),l&&f&&f({action:d,location:S.location,delta:0})}function E(T){return sj(T)}let S={get action(){return d},get location(){return e(i,u)},listen(T){if(f)throw new Error("A history only accepts one active listener");return i.addEventListener(wx,g),f=T,()=>{i.removeEventListener(wx,g),f=null}},createHref(T){return t(i,T)},createURL:E,encodeLocation(T){let C=E(T);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:_,go(T){return u.go(T)}};return S}function sj(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Tt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Cl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function x_(e,t,r="/"){return ij(e,t,r,!1)}function ij(e,t,r,s,i){let l=typeof t=="string"?lo(t):t,u=ua(l.pathname||"/",r);if(u==null)return null;let d=oj(e),f=null,h=bj(u);for(let b=0;f==null&&b<d.length;++b)f=vj(d[b],h,s);return f}function oj(e){let t=w_(e);return lj(t),t}function w_(e,t=[],r=[],s="",i=!1){let l=(u,d,f=i,h)=>{let b={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&f)return;Tt(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=yr([s,b.relativePath]),x=r.concat(b);u.children&&u.children.length>0&&(Tt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),w_(u.children,t,x,g,f)),!(u.path==null&&!u.index)&&t.push({path:g,score:pj(g,u.index),routesMeta:x})};return e.forEach((u,d)=>{var f;if(u.path===""||!((f=u.path)!=null&&f.includes("?")))l(u,d);else for(let h of __(u.path))l(u,d,!0,h)}),t}function __(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,i=r.endsWith("?"),l=r.replace(/\?$/,"");if(s.length===0)return i?[l,""]:[l];let u=__(s.join("/")),d=[];return d.push(...u.map(f=>f===""?l:[l,f].join("/"))),i&&d.push(...u),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function lj(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:gj(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var cj=/^:[\w-]+$/,uj=3,dj=2,fj=1,hj=10,mj=-2,Ex=e=>e==="*";function pj(e,t){let r=e.split("/"),s=r.length;return r.some(Ex)&&(s+=mj),t&&(s+=dj),r.filter(i=>!Ex(i)).reduce((i,l)=>i+(cj.test(l)?uj:l===""?fj:hj),s)}function gj(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function vj(e,t,r=!1){let{routesMeta:s}=e,i={},l="/",u=[];for(let d=0;d<s.length;++d){let f=s[d],h=d===s.length-1,b=l==="/"?t:t.slice(l.length)||"/",g=ad({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},b),x=f.route;if(!g&&h&&r&&!s[s.length-1].route.index&&(g=ad({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},b)),!g)return null;Object.assign(i,g.params),u.push({params:i,pathname:yr([l,g.pathname]),pathnameBase:Sj(yr([l,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(l=yr([l,g.pathnameBase]))}return u}function ad(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=yj(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let l=i[0],u=l.replace(/(.)\/+$/,"$1"),d=i.slice(1);return{params:s.reduce((h,{paramName:b,isOptional:g},x)=>{if(b==="*"){let E=d[x]||"";u=l.slice(0,l.length-E.length).replace(/(.)\/+$/,"$1")}const _=d[x];return g&&!_?h[b]=void 0:h[b]=(_||"").replace(/%2F/g,"/"),h},{}),pathname:l,pathnameBase:u,pattern:e}}function yj(e,t=!1,r=!0){Lr(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=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,h,b)=>{if(s.push({paramName:d,isOptional:f!=null}),f){let g=b.charAt(h+u.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function bj(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Lr(!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 ua(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 xj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function wj(e,t="/"){let{pathname:r,search:s="",hash:i=""}=typeof e=="string"?lo(e):e,l;return r?(r=E_(r),r.startsWith("/")?l=Cx(r.substring(1),"/"):l=Cx(r,t)):l=t,{pathname:l,search:Ej(s),hash:Cj(i)}}function Cx(e,t){let r=sd(t).split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function km(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 _j(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function S_(e){let t=_j(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function ag(e,t,r,s=!1){let i;typeof e=="string"?i=lo(e):(i={...e},Tt(!i.pathname||!i.pathname.includes("?"),km("?","pathname","search",i)),Tt(!i.pathname||!i.pathname.includes("#"),km("#","pathname","hash",i)),Tt(!i.search||!i.search.includes("#"),km("#","search","hash",i)));let l=e===""||i.pathname==="",u=l?"/":i.pathname,d;if(u==null)d=r;else{let g=t.length-1;if(!s&&u.startsWith("..")){let x=u.split("/");for(;x[0]==="..";)x.shift(),g-=1;i.pathname=x.join("/")}d=g>=0?t[g]:"/"}let f=wj(i,d),h=u&&u!=="/"&&u.endsWith("/"),b=(l||u===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(h||b)&&(f.pathname+="/"),f}var E_=e=>e.replace(/\/\/+/g,"/"),yr=e=>E_(e.join("/")),sd=e=>e.replace(/\/+$/,""),Sj=e=>sd(e).replace(/^\/*/,"/"),Ej=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Cj=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Tj=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 Nj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Aj(e){let t=e.map(r=>r.route.path).filter(Boolean);return yr(t)||"/"}var C_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function T_(e,t){let r=e;if(typeof r!="string"||!xj.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,i=!1;if(C_)try{let l=new URL(window.location.href),u=r.startsWith("//")?new URL(l.protocol+r):new URL(r),d=ua(u.pathname,t);u.origin===l.origin&&d!=null?r=d+u.search+u.hash:i=!0}catch{Lr(!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:i,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var N_=["POST","PUT","PATCH","DELETE"];new Set(N_);var Rj=["GET",...N_];new Set(Rj);var co=y.createContext(null);co.displayName="DataRouter";var kd=y.createContext(null);kd.displayName="DataRouterState";var A_=y.createContext(!1);function jj(){return y.useContext(A_)}var R_=y.createContext({isTransitioning:!1});R_.displayName="ViewTransition";var kj=y.createContext(new Map);kj.displayName="Fetchers";var Oj=y.createContext(null);Oj.displayName="Await";var ir=y.createContext(null);ir.displayName="Navigation";var Bl=y.createContext(null);Bl.displayName="Location";var ga=y.createContext({outlet:null,matches:[],isDataRoute:!1});ga.displayName="Route";var sg=y.createContext(null);sg.displayName="RouteError";var j_="REACT_ROUTER_ERROR",Mj="REDIRECT",Dj="ROUTE_ERROR_RESPONSE";function Pj(e){if(e.startsWith(`${j_}:${Mj}:{`))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 Lj(e){if(e.startsWith(`${j_}:${Dj}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Tj(t.status,t.statusText,t.data)}catch{}}function zj(e,{relative:t}={}){Tt(Hl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=y.useContext(ir),{hash:i,pathname:l,search:u}=ql(e,{relative:t}),d=l;return r!=="/"&&(d=l==="/"?r:yr([r,l])),s.createHref({pathname:d,search:u,hash:i})}function Hl(){return y.useContext(Bl)!=null}function va(){return Tt(Hl(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Bl).location}var k_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function O_(e){y.useContext(ir).static||y.useLayoutEffect(e)}function Ij(){let{isDataRoute:e}=y.useContext(ga);return e?Jj():Uj()}function Uj(){Tt(Hl(),"useNavigate() may be used only in the context of a <Router> component.");let e=y.useContext(co),{basename:t,navigator:r}=y.useContext(ir),{matches:s}=y.useContext(ga),{pathname:i}=va(),l=JSON.stringify(S_(s)),u=y.useRef(!1);return O_(()=>{u.current=!0}),y.useCallback((f,h={})=>{if(Lr(u.current,k_),!u.current)return;if(typeof f=="number"){r.go(f);return}let b=ag(f,JSON.parse(l),i,h.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:yr([t,b.pathname])),(h.replace?r.replace:r.push)(b,h.state,h)},[t,r,l,i,e])}y.createContext(null);function ql(e,{relative:t}={}){let{matches:r}=y.useContext(ga),{pathname:s}=va(),i=JSON.stringify(S_(r));return y.useMemo(()=>ag(e,JSON.parse(i),s,t==="path"),[e,i,s,t])}function $j(e,t){return M_(e,t)}function M_(e,t,r){var T;Tt(Hl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=y.useContext(ir),{matches:i}=y.useContext(ga),l=i[i.length-1],u=l?l.params:{},d=l?l.pathname:"/",f=l?l.pathnameBase:"/",h=l&&l.route;{let C=h&&h.path||"";P_(d,!h||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=va(),g;if(t){let C=typeof t=="string"?lo(t):t;Tt(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 x=g.pathname||"/",_=x;if(f!=="/"){let C=f.replace(/^\//,"").split("/");_="/"+x.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})):x_(e,{pathname:_});Lr(h||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Lr(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=Gj(E&&E.map(C=>Object.assign({},C,{params:Object.assign({},u,C.params),pathname:yr([f,s.encodeLocation?s.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:yr([f,s.encodeLocation?s.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),i,r);return t&&S?y.createElement(Bl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},S):S}function Bj(){let e=Xj(),t=Nj(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)",i={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=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:l},"ErrorBoundary")," or"," ",y.createElement("code",{style:l},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),r?y.createElement("pre",{style:i},r):null,u)}var Hj=y.createElement(Bj,null),D_=class extends y.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=Lj(e.digest);r&&(e=r)}let t=e!==void 0?y.createElement(ga.Provider,{value:this.props.routeContext},y.createElement(sg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?y.createElement(qj,{error:e},t):t}};D_.contextType=A_;var Om=new WeakMap;function qj({children:e,error:t}){let{basename:r}=y.useContext(ir);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=Pj(t.digest);if(s){let i=Om.get(t);if(i)throw i;let l=T_(s.location,r);if(C_&&!Om.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 Om.set(t,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function Vj({routeContext:e,match:t,children:r}){let s=y.useContext(co);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(ga.Provider,{value:e},r)}function Gj(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 i=e,l=s==null?void 0:s.errors;if(l!=null){let b=i.findIndex(g=>g.route.id&&(l==null?void 0:l[g.route.id])!==void 0);Tt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),i=i.slice(0,Math.min(i.length,b+1))}let u=!1,d=-1;if(r&&s){u=s.renderFallback;for(let b=0;b<i.length;b++){let g=i[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=b),g.route.id){let{loaderData:x,errors:_}=s,E=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!_||_[g.route.id]===void 0);if(g.route.lazy||E){r.isStatic&&(u=!0),d>=0?i=i.slice(0,d+1):i=[i[0]];break}}}}let f=r==null?void 0:r.onError,h=s&&f?(b,g)=>{var x,_;f(b,{location:s.location,params:((_=(x=s.matches)==null?void 0:x[0])==null?void 0:_.params)??{},pattern:Aj(s.matches),errorInfo:g})}:void 0;return i.reduceRight((b,g,x)=>{let _,E=!1,S=null,T=null;s&&(_=l&&g.route.id?l[g.route.id]:void 0,S=g.route.errorElement||Hj,u&&(d<0&&x===0?(P_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,T=null):d===x&&(E=!0,T=g.route.hydrateFallbackElement||null)));let C=t.concat(i.slice(0,x+1)),R=()=>{let A;return _?A=S:E?A=T:g.route.Component?A=y.createElement(g.route.Component,null):g.route.element?A=g.route.element:A=b,y.createElement(Vj,{match:g,routeContext:{outlet:b,matches:C,isDataRoute:s!=null},children:A})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?y.createElement(D_,{location:s.location,revalidation:s.revalidation,component:S,error:_,children:R(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):R()},null)}function ig(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Fj(e){let t=y.useContext(co);return Tt(t,ig(e)),t}function Kj(e){let t=y.useContext(kd);return Tt(t,ig(e)),t}function Yj(e){let t=y.useContext(ga);return Tt(t,ig(e)),t}function og(e){let t=Yj(e),r=t.matches[t.matches.length-1];return Tt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Wj(){return og("useRouteId")}function Xj(){var s;let e=y.useContext(sg),t=Kj("useRouteError"),r=og("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function Jj(){let{router:e}=Fj("useNavigate"),t=og("useNavigate"),r=y.useRef(!1);return O_(()=>{r.current=!0}),y.useCallback(async(i,l={})=>{Lr(r.current,k_),r.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...l}))},[e,t])}var Tx={};function P_(e,t,r){!t&&!Tx[e]&&(Tx[e]=!0,Lr(!1,r))}y.memo(Qj);function Qj({routes:e,manifest:t,future:r,state:s,isStatic:i,onError:l}){return M_(e,void 0,{manifest:t,state:s,isStatic:i,onError:l})}function L_(e){Tt(!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 Zj({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:i,static:l=!1,useTransitions:u}){Tt(!Hl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=y.useMemo(()=>({basename:d,navigator:i,static:l,useTransitions:u,future:{}}),[d,i,l,u]);typeof r=="string"&&(r=lo(r));let{pathname:h="/",search:b="",hash:g="",state:x=null,key:_="default",mask:E}=r,S=y.useMemo(()=>{let T=ua(h,d);return T==null?null:{location:{pathname:T,search:b,hash:g,state:x,key:_,mask:E},navigationType:s}},[d,h,b,g,x,_,s,E]);return Lr(S!=null,`<Router basename="${d}"> is not able to match the URL "${h}${b}${g}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:y.createElement(ir.Provider,{value:f},y.createElement(Bl.Provider,{children:t,value:S}))}function ek({children:e,location:t}){return $j(hp(e),t)}function hp(e,t=[]){let r=[];return y.Children.forEach(e,(s,i)=>{if(!y.isValidElement(s))return;let l=[...t,i];if(s.type===y.Fragment){r.push.apply(r,hp(s.props.children,l));return}Tt(s.type===L_,`[${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>`),Tt(!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=hp(s.props.children,l)),r.push(u)}),r}var Ku="get",Yu="application/x-www-form-urlencoded";function Od(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function tk(e){return Od(e)&&e.tagName.toLowerCase()==="button"}function nk(e){return Od(e)&&e.tagName.toLowerCase()==="form"}function rk(e){return Od(e)&&e.tagName.toLowerCase()==="input"}function ak(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function sk(e,t){return e.button===0&&(!t||t==="_self")&&!ak(e)}var bu=null;function ik(){if(bu===null)try{new FormData(document.createElement("form"),0),bu=!1}catch{bu=!0}return bu}var ok=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Mm(e){return e!=null&&!ok.has(e)?(Lr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Yu}"`),null):e}function lk(e,t){let r,s,i,l,u;if(nk(e)){let d=e.getAttribute("action");s=d?ua(d,t):null,r=e.getAttribute("method")||Ku,i=Mm(e.getAttribute("enctype"))||Yu,l=new FormData(e)}else if(tk(e)||rk(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?ua(f,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Ku,i=Mm(e.getAttribute("formenctype"))||Mm(d.getAttribute("enctype"))||Yu,l=new FormData(d,e),!ik()){let{name:h,type:b,value:g}=e;if(b==="image"){let x=h?`${h}.`:"";l.append(`${x}x`,"0"),l.append(`${x}y`,"0")}else h&&l.append(h,g)}}else{if(Od(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Ku,s=null,i=Yu,u=e}return l&&i==="text/plain"&&(u=l,l=void 0),{action:s,method:r.toLowerCase(),encType:i,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function lg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function z_(e,t,r,s){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${s}`:i.pathname=`${i.pathname}.${s}`:i.pathname==="/"?i.pathname=`_root.${s}`:t&&ua(i.pathname,t)==="/"?i.pathname=`${sd(t)}/_root.${s}`:i.pathname=`${sd(i.pathname)}.${s}`,i}async function ck(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 uk(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 dk(e,t,r){let s=await Promise.all(e.map(async i=>{let l=t.routes[i.route.id];if(l){let u=await ck(l,r);return u.links?u.links():[]}return[]}));return pk(s.flat(1).filter(uk).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Nx(e,t,r,s,i,l){let u=(f,h)=>r[h]?f.route.id!==r[h].route.id:!0,d=(f,h)=>{var b;return r[h].pathname!==f.pathname||((b=r[h].route.path)==null?void 0:b.endsWith("*"))&&r[h].params["*"]!==f.params["*"]};return l==="assets"?t.filter((f,h)=>u(f,h)||d(f,h)):l==="data"?t.filter((f,h)=>{var g;let b=s.routes[f.route.id];if(!b||!b.hasLoader)return!1;if(u(f,h)||d(f,h))return!0;if(f.route.shouldRevalidate){let x=f.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.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 x=="boolean")return x}return!0}):[]}function fk(e,t,{includeHydrateFallback:r}={}){return hk(e.map(s=>{let i=t.routes[s.route.id];if(!i)return[];let l=[i.module];return i.clientActionModule&&(l=l.concat(i.clientActionModule)),i.clientLoaderModule&&(l=l.concat(i.clientLoaderModule)),r&&i.hydrateFallbackModule&&(l=l.concat(i.hydrateFallbackModule)),i.imports&&(l=l.concat(i.imports)),l}).flat(1))}function hk(e){return[...new Set(e)]}function mk(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function pk(e,t){let r=new Set;return new Set(t),e.reduce((s,i)=>{let l=JSON.stringify(mk(i));return r.has(l)||(r.add(l),s.push({key:l,link:i})),s},[])}function cg(){let e=y.useContext(co);return lg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function gk(){let e=y.useContext(kd);return lg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ug=y.createContext(void 0);ug.displayName="FrameworkContext";function dg(){let e=y.useContext(ug);return lg(e,"You must render this element inside a <HydratedRouter> element"),e}function vk(e,t){let r=y.useContext(ug),[s,i]=y.useState(!1),[l,u]=y.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:h,onMouseLeave:b,onTouchStart:g}=t,x=y.useRef(null);y.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let S=C=>{C.forEach(R=>{u(R.isIntersecting)})},T=new IntersectionObserver(S,{threshold:.5});return x.current&&T.observe(x.current),()=>{T.disconnect()}}},[e]),y.useEffect(()=>{if(s){let S=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(S)}}},[s]);let _=()=>{i(!0)},E=()=>{i(!1),u(!1)};return r?e!=="intent"?[l,x,{}]:[l,x,{onFocus:ll(d,_),onBlur:ll(f,E),onMouseEnter:ll(h,_),onMouseLeave:ll(b,E),onTouchStart:ll(g,_)}]:[!1,x,{}]}function ll(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function yk({page:e,...t}){let r=jj(),{router:s}=cg(),i=y.useMemo(()=>x_(s.routes,e,s.basename),[s.routes,e,s.basename]);return i?r?y.createElement(xk,{page:e,matches:i,...t}):y.createElement(wk,{page:e,matches:i,...t}):null}function bk(e){let{manifest:t,routeModules:r}=dg(),[s,i]=y.useState([]);return y.useEffect(()=>{let l=!1;return dk(e,t,r).then(u=>{l||i(u)}),()=>{l=!0}},[e,t,r]),s}function xk({page:e,matches:t,...r}){let s=va(),{future:i}=dg(),{basename:l}=cg(),u=y.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let d=z_(e,l,i.unstable_trailingSlashAwareDataRequests,"rsc"),f=!1,h=[];for(let b of t)typeof b.route.shouldRevalidate=="function"?f=!0:h.push(b.route.id);return f&&h.length>0&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[l,i.unstable_trailingSlashAwareDataRequests,e,s,t]);return y.createElement(y.Fragment,null,u.map(d=>y.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function wk({page:e,matches:t,...r}){let s=va(),{future:i,manifest:l,routeModules:u}=dg(),{basename:d}=cg(),{loaderData:f,matches:h}=gk(),b=y.useMemo(()=>Nx(e,t,h,l,s,"data"),[e,t,h,l,s]),g=y.useMemo(()=>Nx(e,t,h,l,s,"assets"),[e,t,h,l,s]),x=y.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let S=new Set,T=!1;if(t.forEach(R=>{var D;let A=l.routes[R.route.id];!A||!A.hasLoader||(!b.some(B=>B.route.id===R.route.id)&&R.route.id in f&&((D=u[R.route.id])!=null&&D.shouldRevalidate)||A.hasClientLoader?T=!0:S.add(R.route.id))}),S.size===0)return[];let C=z_(e,d,i.unstable_trailingSlashAwareDataRequests,"data");return T&&S.size>0&&C.searchParams.set("_routes",t.filter(R=>S.has(R.route.id)).map(R=>R.route.id).join(",")),[C.pathname+C.search]},[d,i.unstable_trailingSlashAwareDataRequests,f,s,l,b,t,e,u]),_=y.useMemo(()=>fk(g,l),[g,l]),E=bk(g);return y.createElement(y.Fragment,null,x.map(S=>y.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...r})),_.map(S=>y.createElement("link",{key:S,rel:"modulepreload",href:S,...r})),E.map(({key:S,link:T})=>y.createElement("link",{key:S,nonce:r.nonce,...T,crossOrigin:T.crossOrigin??r.crossOrigin})))}function _k(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Sk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Sk&&(window.__reactRouterVersion="7.15.1")}catch{}function Ek({basename:e,children:t,useTransitions:r,window:s}){let i=y.useRef();i.current==null&&(i.current=nj({window:s,v5Compat:!0}));let l=i.current,[u,d]=y.useState({action:l.action,location:l.location}),f=y.useCallback(h=>{r===!1?d(h):y.startTransition(()=>d(h))},[r]);return y.useLayoutEffect(()=>l.listen(f),[l,f]),y.createElement(Zj,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,useTransitions:r})}var I_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,U_=y.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:i,reloadDocument:l,replace:u,mask:d,state:f,target:h,to:b,preventScrollReset:g,viewTransition:x,defaultShouldRevalidate:_,...E},S){let{basename:T,navigator:C,useTransitions:R}=y.useContext(ir),A=typeof b=="string"&&I_.test(b),D=T_(b,T);b=D.to;let B=zj(b,{relative:i}),I=va(),L=null;if(d){let pe=ag(d,[],I.mask?I.mask.pathname:"/",!0);T!=="/"&&(pe.pathname=pe.pathname==="/"?T:yr([T,pe.pathname])),L=C.createHref(pe)}let[H,Z,ue]=vk(s,E),ce=Ak(b,{replace:u,mask:d,state:f,target:h,preventScrollReset:g,relative:i,viewTransition:x,defaultShouldRevalidate:_,useTransitions:R});function he(pe){t&&t(pe),pe.defaultPrevented||ce(pe)}let de=!(D.isExternal||l),me=y.createElement("a",{...E,...ue,href:(de?L:void 0)||D.absoluteURL||B,onClick:de?he:t,ref:_k(S,Z),target:h,"data-discover":!A&&r==="render"?"true":void 0});return H&&!A?y.createElement(y.Fragment,null,me,y.createElement(yk,{page:B})):me});U_.displayName="Link";var Ck=y.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:i=!1,style:l,to:u,viewTransition:d,children:f,...h},b){let g=ql(u,{relative:h.relative}),x=va(),_=y.useContext(kd),{navigator:E,basename:S}=y.useContext(ir),T=_!=null&&Mk(g)&&d===!0,C=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,R=x.pathname,A=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(R=R.toLowerCase(),A=A?A.toLowerCase():null,C=C.toLowerCase()),A&&S&&(A=ua(A,S)||A);const D=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let B=R===C||!i&&R.startsWith(C)&&R.charAt(D)==="/",I=A!=null&&(A===C||!i&&A.startsWith(C)&&A.charAt(C.length)==="/"),L={isActive:B,isPending:I,isTransitioning:T},H=B?t:void 0,Z;typeof s=="function"?Z=s(L):Z=[s,B?"active":null,I?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let ue=typeof l=="function"?l(L):l;return y.createElement(U_,{...h,"aria-current":H,className:Z,ref:b,style:ue,to:u,viewTransition:d},typeof f=="function"?f(L):f)});Ck.displayName="NavLink";var Tk=y.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:i,state:l,method:u=Ku,action:d,onSubmit:f,relative:h,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:x,..._},E)=>{let{useTransitions:S}=y.useContext(ir),T=kk(),C=Ok(d,{relative:h}),R=u.toLowerCase()==="get"?"get":"post",A=typeof d=="string"&&I_.test(d),D=B=>{if(f&&f(B),B.defaultPrevented)return;B.preventDefault();let I=B.nativeEvent.submitter,L=(I==null?void 0:I.getAttribute("formmethod"))||u,H=()=>T(I||B.currentTarget,{fetcherKey:t,method:L,navigate:r,replace:i,state:l,relative:h,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:x});S&&r!==!1?y.startTransition(()=>H()):H()};return y.createElement("form",{ref:E,method:R,action:C,onSubmit:s?f:D,..._,"data-discover":!A&&e==="render"?"true":void 0})});Tk.displayName="Form";function Nk(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $_(e){let t=y.useContext(co);return Tt(t,Nk(e)),t}function Ak(e,{target:t,replace:r,mask:s,state:i,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:h}={}){let b=Ij(),g=va(),x=ql(e,{relative:u});return y.useCallback(_=>{if(sk(_,t)){_.preventDefault();let E=r!==void 0?r:Cl(g)===Cl(x),S=()=>b(e,{replace:E,mask:s,state:i,preventScrollReset:l,relative:u,viewTransition:d,defaultShouldRevalidate:f});h?y.startTransition(()=>S()):S()}},[g,b,x,r,s,i,t,e,l,u,d,f,h])}var Rk=0,jk=()=>`__${String(++Rk)}__`;function kk(){let{router:e}=$_("useSubmit"),{basename:t}=y.useContext(ir),r=Wj(),s=e.fetch,i=e.navigate;return y.useCallback(async(l,u={})=>{let{action:d,method:f,encType:h,formData:b,body:g}=lk(l,t);if(u.navigate===!1){let x=u.fetcherKey||jk();await s(x,r,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:b,body:g,formMethod:u.method||f,formEncType:u.encType||h,flushSync:u.flushSync})}else await i(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:b,body:g,formMethod:u.method||f,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:r,flushSync:u.flushSync,viewTransition:u.viewTransition})},[s,i,t,r])}function Ok(e,{relative:t}={}){let{basename:r}=y.useContext(ir),s=y.useContext(ga);Tt(s,"useFormAction must be used inside a RouteContext");let[i]=s.matches.slice(-1),l={...ql(e||".",{relative:t})},u=va();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===".")&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(l.pathname=l.pathname==="/"?r:yr([r,l.pathname])),Cl(l)}function Mk(e,{relative:t}={}){let r=y.useContext(R_);Tt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=$_("useViewTransitionState"),i=ql(e,{relative:t});if(!r.isTransitioning)return!1;let l=ua(r.currentLocation.pathname,s)||r.currentLocation.pathname,u=ua(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ad(i.pathname,u)!=null||ad(i.pathname,l)!=null}var Vl=b_();const B_=y_(Vl);var kr=function(){return kr=Object.assign||function(t){for(var r,s=1,i=arguments.length;s<i;s++){r=arguments[s];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[l]=r[l])}return t},kr.apply(this,arguments)};function uo(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 i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r}function Dk(e,t,r,s){function i(l){return l instanceof r?l:new r(function(u){u(l)})}return new(r||(r=Promise))(function(l,u){function d(b){try{h(s.next(b))}catch(g){u(g)}}function f(b){try{h(s.throw(b))}catch(g){u(g)}}function h(b){b.done?l(b.value):i(b.value).then(d,f)}h((s=s.apply(e,t||[])).next())})}function Pk(e,t,r){if(r||arguments.length===2)for(var s=0,i=t.length,l;s<i;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 Lk=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class fg 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 zk extends fg{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Ax extends fg{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Rx extends fg{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var mp;(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"})(mp||(mp={}));class Ik{constructor(t,{headers:r={},customFetch:s,region:i=mp.Any}={}){this.url=t,this.headers=r,this.region=i,this.fetch=Lk(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Dk(this,arguments,void 0,function*(r,s={}){var i;let l,u;try{const{headers:d,method:f,body:h,signal:b,timeout:g}=s;let x={},{region:_}=s;_||(_=this.region);const E=new URL(`${this.url}/${r}`);_&&_!=="any"&&(x["x-region"]=_,E.searchParams.set("forceFunctionRegion",_));let S;h&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&h instanceof Blob||h instanceof ArrayBuffer?(x["Content-Type"]="application/octet-stream",S=h):typeof h=="string"?(x["Content-Type"]="text/plain",S=h):typeof FormData<"u"&&h instanceof FormData?S=h:(x["Content-Type"]="application/json",S=JSON.stringify(h)):h&&typeof h!="string"&&!(typeof Blob<"u"&&h instanceof Blob)&&!(h instanceof ArrayBuffer)&&!(typeof FormData<"u"&&h instanceof FormData)?S=JSON.stringify(h):S=h;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({},x),this.headers),d),body:S,signal:T}).catch(B=>{throw new zk(B)}),R=C.headers.get("x-relay-error");if(R&&R==="true")throw new Ax(C);if(!C.ok)throw new Rx(C);let A=((i=C.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),D;return A==="application/json"?D=yield C.json():A==="application/octet-stream"||A==="application/pdf"?D=yield C.blob():A==="text/event-stream"?D=C:A==="multipart/form-data"?D=yield C.formData():D=yield C.text(),{data:D,error:null,response:C}}catch(d){return{data:null,error:d,response:d instanceof Rx||d instanceof Ax?d.context:void 0}}finally{l&&clearTimeout(l)}})}}const H_=3,jx=e=>Math.min(1e3*2**e,3e4),Uk=[520,503],q_=["GET","HEAD","OPTIONS"];var $k=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 kx(e,t){return new Promise(r=>{if(t!=null&&t.aborted){r();return}const s=setTimeout(()=>{t==null||t.removeEventListener("abort",i),r()},e);function i(){clearTimeout(s),r()}t==null||t.addEventListener("abort",i)})}function Bk(e,t,r,s){return!(!s||r>=H_||!q_.includes(e)||!Uk.includes(t))}var Hk=class{constructor(e){var t,r,s,i,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=(i=e.urlLengthLimit)!==null&&i!==void 0?i: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 h=new Headers(r.headers);u>0&&h.set("X-Retry-Count",String(u));let b;try{b=await s(r.url.toString(),{method:r.method,headers:h,body:JSON.stringify(r.body,(g,x)=>typeof x=="bigint"?x.toString():x),signal:r.signal})}catch(g){if((g==null?void 0:g.name)==="AbortError"||(g==null?void 0:g.code)==="ABORT_ERR"||!q_.includes(r.method))throw g;if(r.retryEnabled&&u<H_){const x=jx(u);u++,await kx(x,r.signal);continue}throw g}if(Bk(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,x=g!==null?Math.max(0,parseInt(g,10)||0)*1e3:jx(u);await b.text(),u++,await kx(x,r.signal);continue}return await r.processResponse(b)}})();return this.shouldThrowOnError||(l=l.catch(u=>{var d;let f="",h="",b="";const g=u==null?void 0:u.cause;if(g){var x,_,E,S;const R=(x=g==null?void 0:g.message)!==null&&x!==void 0?x:"",A=(_=g==null?void 0:g.code)!==null&&_!==void 0?_:"";f=`${(E=u==null?void 0:u.name)!==null&&E!==void 0?E:"FetchError"}: ${u==null?void 0:u.message}`,f+=`
Caused by: ${(S=g==null?void 0:g.name)!==null&&S!==void 0?S:"Error"}: ${R}`,A&&(f+=` (${A})`),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="",h="Request was aborted (timeout or manual cancellation)",C>this.urlLengthLimit&&(h+=`. 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="",h="HTTP headers exceeded server limits (typically 16KB)",C>this.urlLengthLimit&&(h+=`. 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:h,code:b},data:null,count:null,status:0,statusText:""}})),l.then(e,t)}async processResponse(e){var t=this;let r=null,s=null,i=null,l=e.status,u=e.statusText;if(e.ok){var d,f;if(t.method!=="HEAD"){var h;const x=await e.text();x===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((h=t.headers.get("Accept"))===null||h===void 0)&&h.includes("application/vnd.pgrst.plan+text"))?s=x:s=JSON.parse(x))}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&&(i=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,i=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 $k(r)}return{success:r===null,error:r,data:s,count:i,status:l,statusText:u}}returns(){return this}overrideTypes(){return this}},qk=class extends Hk{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:i=s}={}){const l=i?`${i}.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 i=typeof s>"u"?"offset":`${s}.offset`,l=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${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:i=!1,format:l="text"}={}){var u;const d=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,i?"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 Ox=new RegExp("[,()]");var Vi=class extends qk{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"&&Ox.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"&&Ox.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 i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");const l=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${i}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}},Vk=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:i=8e3,retry:l}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=i,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??{},i=r?"HEAD":"GET";let l=!1;const u=(e??"*").split("").map(h=>/\s/.test(h)&&!l?"":(h==='"'&&(l=!l),h)).join(""),{url:d,headers:f}=this.cloneRequestState();return d.searchParams.set("select",u),s&&f.append("Prefer",`count=${s}`),new Vi({method:i,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 i="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,h)=>f.concat(Object.keys(h)),[]);if(d.length>0){const f=[...new Set(d)].map(h=>`"${h}"`);l.searchParams.set("columns",f.join(","))}}return new Vi({method:i,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:i=!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}`),i||f.append("Prefer","missing=default"),Array.isArray(e)){const h=e.reduce((b,g)=>b.concat(Object.keys(g)),[]);if(h.length>0){const b=[...new Set(h)].map(g=>`"${g}"`);d.searchParams.set("columns",b.join(","))}}return new Vi({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:i,headers:l}=this.cloneRequestState();return t&&l.append("Prefer",`count=${t}`),new Vi({method:s,url:i,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:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Vi({method:r,url:s,headers:i,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Tl(e){"@babel/helpers - typeof";return Tl=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},Tl(e)}function Gk(e,t){if(Tl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Tl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fk(e){var t=Gk(e,"string");return Tl(t)=="symbol"?t:t+""}function Kk(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 Mx(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function xu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mx(Object(r),!0).forEach(function(s){Kk(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mx(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var Yk=class V_{constructor(t,{headers:r={},schema:s,fetch:i,timeout:l,urlLengthLimit:u=8e3,retry:d}={}){this.url=t,this.headers=new Headers(r),this.schemaName=s,this.urlLengthLimit=u;const f=i??globalThis.fetch;l!==void 0&&l>0?this.fetch=(h,b)=>{const g=new AbortController,x=setTimeout(()=>g.abort(),l),_=b==null?void 0:b.signal;if(_){if(_.aborted)return clearTimeout(x),f(h,b);const E=()=>{clearTimeout(x),g.abort()};return _.addEventListener("abort",E,{once:!0}),f(h,xu(xu({},b),{},{signal:g.signal})).finally(()=>{clearTimeout(x),_.removeEventListener("abort",E)})}return f(h,xu(xu({},b),{},{signal:g.signal})).finally(()=>clearTimeout(x))}: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 Vk(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 V_(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,r={},{head:s=!1,get:i=!1,count:l}={}){var u;let d;const f=new URL(`${this.url}/rpc/${t}`);let h;const b=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(b)),g=s&&Object.values(r).some(b);g?(d="POST",h=r):s||i?(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",h=r);const x=new Headers(this.headers);return g?x.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&x.set("Prefer",`count=${l}`),new Vi({method:d,url:f,headers:x,schema:this.schemaName,body:h,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Wk{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 i=globalThis.process;if(i){const l=i.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 Xk="2.106.2",Jk=`realtime-js/${Xk}`,Qk="1.0.0",G_="2.0.0",Zk=G_,e2=1e4,t2=100,Ja={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},F_={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},pp={connecting:"connecting",closing:"closing",closed:"closed"};class n2{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 i=(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,i)}_encodeJsonUserBroadcastPush(t){var r,s;const i=(s=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:{},u=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(t,r,s){var i,l;const u=t.topic,d=(i=t.ref)!==null&&i!==void 0?i:"",f=(l=t.join_ref)!==null&&l!==void 0?l:"",h=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(h.length>255)throw new Error(`userEvent length ${h.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const x=this.USER_BROADCAST_PUSH_META_LENGTH+f.length+d.length+u.length+h.length+g.length,_=new ArrayBuffer(this.HEADER_LENGTH+x);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++,h.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(h,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),[i,l,u,d,f]=s;return r({join_ref:i,ref:l,topic:u,event:d,payload:f})}return r({})}_binaryDecode(t){const r=new DataView(t),s=r.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,i)}}_decodeUserBroadcast(t,r,s){const i=r.getUint8(1),l=r.getUint8(2),u=r.getUint8(3),d=r.getUint8(4);let f=this.HEADER_LENGTH+4;const h=s.decode(t.slice(f,f+i));f=f+i;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 x=t.slice(f,t.byteLength),_=d===this.JSON_ENCODING?JSON.parse(s.decode(x)):x,E={type:this.BROADCAST_EVENT,event:b,payload:_};return u>0&&(E.meta=JSON.parse(g)),{join_ref:null,ref:null,topic:h,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 bt;(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"})(bt||(bt={}));const Dx=(e,t,r={})=>{var s;const i=(s=r.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((l,u)=>(l[u]=r2(u,e,t,i),l),{}):{}},r2=(e,t,r,s)=>{const i=t.find(d=>d.name===e),l=i==null?void 0:i.type,u=r[e];return l&&!s.includes(l)?K_(l,u):gp(u)},K_=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return o2(t,r)}switch(e){case bt.bool:return a2(t);case bt.float4:case bt.float8:case bt.int2:case bt.int4:case bt.int8:case bt.numeric:case bt.oid:return s2(t);case bt.json:case bt.jsonb:return i2(t);case bt.timestamp:return l2(t);case bt.abstime:case bt.date:case bt.daterange:case bt.int4range:case bt.int8range:case bt.money:case bt.reltime:case bt.text:case bt.time:case bt.timestamptz:case bt.timetz:case bt.tsrange:case bt.tstzrange:return gp(t);default:return gp(t)}},gp=e=>e,a2=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},s2=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},i2=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},o2=(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=>K_(t,d))}return e},l2=e=>typeof e=="string"?e.replace(" ","T"):e,Y_=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 yl=e=>typeof e=="function"?e:function(){return e},c2=typeof self<"u"?self:null,Gi=typeof window<"u"?window:null,Rr=c2||Gi||globalThis,u2="2.0.0",d2=1e4,f2=1e3,jr={connecting:0,open:1,closing:2,closed:3},Rn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},la={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},vp={longpoll:"longpoll",websocket:"websocket"},h2={complete:4},yp="base64url.bearer.phx.",wu=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})}},W_=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))}},m2=class{constructor(e,t,r){this.state=Rn.closed,this.topic=e,this.params=yl(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new wu(this,la.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new W_(()=>{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=Rn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",s=>{this.state=Rn.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=Rn.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=Rn.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 wu(this,la.leave,yl({}),this.timeout).send(),this.state=Rn.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(la.reply,(s,i)=>{this.trigger(this.replyEventName(i),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=Rn.closed,this.bindings=[]}onClose(e){this.on(la.close,e)}onError(e){return this.on(la.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 wu(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=Rn.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(la.close,"leave")},r=new wu(this,la.leave,yl({}),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=Rn.joining,this.joinPush.resend(e))}trigger(e,t,r,s){let i=this.onMessage(e,t,r,s);if(t&&!i)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(i,r,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Rn.closed}isErrored(){return this.state===Rn.errored}isJoined(){return this.state===Rn.joined}isJoining(){return this.state===Rn.joining}isLeaving(){return this.state===Rn.leaving}},id=class{static request(e,t,r,s,i,l,u){if(Rr.XDomainRequest){let d=new Rr.XDomainRequest;return this.xdomainRequest(d,e,t,s,i,l,u)}else if(Rr.XMLHttpRequest){let d=new Rr.XMLHttpRequest;return this.xhrRequest(d,e,t,r,s,i,l,u)}else{if(Rr.fetch&&Rr.AbortController)return this.fetchRequest(e,t,r,s,i,l,u);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,r,s,i,l,u){let d={method:e,headers:r,body:s},f=null;return i&&(f=new AbortController,setTimeout(()=>f.abort(),i),d.signal=f.signal),Rr.fetch(t,d).then(h=>h.text()).then(h=>this.parseJSON(h)).then(h=>u&&u(h)).catch(h=>{h.name==="AbortError"&&l?l():u&&u(null)}),f}static xdomainRequest(e,t,r,s,i,l,u){return e.timeout=i,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,i,l,u,d){e.open(t,r,!0),e.timeout=l;for(let[f,h]of Object.entries(s))e.setRequestHeader(f,h);return e.onerror=()=>d&&d(null),e.onreadystatechange=()=>{if(e.readyState===h2.complete&&d){let f=this.parseJSON(e.responseText);d(f)}},u&&(e.ontimeout=u),e.send(i),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 i=t?`${t}[${s}]`:s,l=e[s];typeof l=="object"?r.push(this.serialize(l,i)):r.push(encodeURIComponent(i)+"="+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)}`}},p2=e=>{let t="",r=new Uint8Array(e),s=r.byteLength;for(let i=0;i<s;i++)t+=String.fromCharCode(r[i]);return btoa(t)},Mi=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(yp)&&(this.authToken=atob(t[1].slice(yp.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=jr.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+vp.websocket),"$1/"+vp.longpoll)}endpointURL(){return id.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=jr.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===jr.open||this.readyState===jr.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:i}=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:i.forEach(l=>{setTimeout(()=>this.onmessage({data:l}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=jr.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=p2(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 i of this.reqs)i.abort();this.readyState=jr.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,i){let l,u=()=>{this.reqs.delete(l),s()};l=id.request(e,this.endpointURL(),t,r,this.timeout,u,d=>{this.reqs.delete(l),this.isActive()&&i(d)}),this.reqs.add(l)}},g2=class hl{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,i=>{let{onJoin:l,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel.joinRef(),this.state=hl.syncState(this.state,i,l,u),this.pendingDiffs.forEach(f=>{this.state=hl.syncDiff(this.state,f,l,u)}),this.pendingDiffs=[],d()}),this.channel.on(s.diff,i=>{let{onJoin:l,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=hl.syncDiff(this.state,i,l,u),d())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return hl.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,r,s,i){let l=this.clone(t),u={},d={};return this.map(l,(f,h)=>{r[f]||(d[f]=h)}),this.map(r,(f,h)=>{let b=l[f];if(b){let g=h.metas.map(S=>S.phx_ref),x=b.metas.map(S=>S.phx_ref),_=h.metas.filter(S=>x.indexOf(S.phx_ref)<0),E=b.metas.filter(S=>g.indexOf(S.phx_ref)<0);_.length>0&&(u[f]=h,u[f].metas=_),E.length>0&&(d[f]=this.clone(b),d[f].metas=E)}else u[f]=h}),this.syncDiff(l,{joins:u,leaves:d},s,i)}static syncDiff(t,r,s,i){let{joins:l,leaves:u}=this.clone(r);return s||(s=function(){}),i||(i=function(){}),this.map(l,(d,f)=>{let h=t[d];if(t[d]=this.clone(f),h){let b=t[d].metas.map(x=>x.phx_ref),g=h.metas.filter(x=>b.indexOf(x.phx_ref)<0);t[d].metas.unshift(...g)}s(d,h,f)}),this.map(u,(d,f)=>{let h=t[d];if(!h)return;let b=f.metas.map(g=>g.phx_ref);h.metas=h.metas.filter(g=>b.indexOf(g.phx_ref)<0),i(d,h,f),h.metas.length===0&&delete t[d]}),t}static list(t,r){return r||(r=function(s,i){return i}),this.map(t,(s,i)=>r(s,i))}static map(t,r){return Object.getOwnPropertyNames(t).map(s=>r(s,t[s]))}static clone(t){return JSON.parse(JSON.stringify(t))}},_u={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,i,l,u]=JSON.parse(e);return t({join_ref:r,ref:s,topic:i,event:l,payload:u})}},binaryEncode(e){let{join_ref:t,ref:r,event:s,topic:i,payload:l}=e,u=this.META_LENGTH+t.length+r.length+i.length+s.length,d=new ArrayBuffer(this.HEADER_LENGTH+u),f=new DataView(d),h=0;f.setUint8(h++,this.KINDS.push),f.setUint8(h++,t.length),f.setUint8(h++,r.length),f.setUint8(h++,i.length),f.setUint8(h++,s.length),Array.from(t,g=>f.setUint8(h++,g.charCodeAt(0))),Array.from(r,g=>f.setUint8(h++,g.charCodeAt(0))),Array.from(i,g=>f.setUint8(h++,g.charCodeAt(0))),Array.from(s,g=>f.setUint8(h++,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),i=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+i));u=u+i;let h=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:h,payload:b}},decodeReply(e,t,r){let s=t.getUint8(1),i=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 h=r.decode(e.slice(d,d+i));d=d+i;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 x=e.slice(d,e.byteLength),_={status:g,response:x};return{join_ref:f,ref:h,topic:b,event:la.reply,payload:_}},decodeBroadcast(e,t,r){let s=t.getUint8(1),i=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+i));l=l+i;let f=e.slice(l,e.byteLength);return{join_ref:null,ref:null,topic:u,event:d,payload:f}}},v2=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||d2,this.transport=t.transport||Rr.WebSocket||Mi,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Rr&&Rr.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=_u.encode.bind(_u),this.defaultDecoder=_u.decode.bind(_u),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!==Mi?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;Gi&&Gi.addEventListener&&(Gi.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),s=this.connectClock)}),Gi.addEventListener("pageshow",i=>{s===this.connectClock&&(s=null,this.connect())}),Gi.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=i=>t.rejoinAfterMs?t.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>t.reconnectAfterMs?t.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(i,l,u)=>{console.log(`${i}: ${l}`,u)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=yl(t.params||{}),this.endPoint=`${e}/${vp.websocket}`,this.vsn=t.vsn||u2,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new W_(()=>{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 Mi}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=id.appendParams(id.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=yl(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Mi?this.connectWithFallback(Mi,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(i=>{i.ref===t&&(this.off([s]),e(Date.now()-r))});return!0}transportName(e){switch(e){case Mi:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${yp}${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,i,l,u=this.transportName(e),d=f=>{this.log("transport",`falling back to ${u}...`,f),this.off([i,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(),f2,"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===jr.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(la.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case jr.connecting:return"connecting";case jr.open:return"open";case jr.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 m2(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:s,ref:i,join_ref:l}=e;this.log("push",`${t} ${r} (${l}, ${i})`,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:i,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(i.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",`${i.status||""} ${r} ${s} ${l&&"("+l+")"||""}`.trim(),i);for(let d=0;d<this.channels.length;d++){const f=this.channels[d];f.isMember(r,s,i,u)&&f.trigger(s,i,l,u)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,s])=>{try{s(...t)}catch(i){this.log("error",`error in ${e} callback`,i)}})}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 bl{constructor(t,r){const s=b2(r);this.presence=new g2(t.getChannel(),s),this.presence.onJoin((i,l,u)=>{const d=bl.onJoinPayload(i,l,u);t.getChannel().trigger("presence",d)}),this.presence.onLeave((i,l,u)=>{const d=bl.onLeavePayload(i,l,u);t.getChannel().trigger("presence",d)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return bl.transformState(this.presence.state)}static transformState(t){return t=y2(t),Object.getOwnPropertyNames(t).reduce((r,s)=>{const i=t[s];return r[s]=Wu(i),r},{})}static onJoinPayload(t,r,s){const i=Px(r),l=Wu(s);return{event:"join",key:t,currentPresences:i,newPresences:l}}static onLeavePayload(t,r,s){const i=Px(r),l=Wu(s);return{event:"leave",key:t,currentPresences:i,leftPresences:l}}}function Wu(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function y2(e){return JSON.parse(JSON.stringify(e))}function b2(e){return(e==null?void 0:e.events)&&{events:e.events}}function Px(e){return e!=null&&e.metas?Wu(e):[]}var Lx;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Lx||(Lx={}));class x2{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new bl(this.channel.channelAdapter,r)}}function w2(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 _2{constructor(t,r,s){const i=S2(s);this.channel=t.getSocket().channel(r,i),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 i;try{i=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>t2){const l=this.channel.pushBuffer.shift();l.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${l.event}`,l.payload())}return i}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===Ja.joined}isJoined(){return this.state===Ja.joined}isJoining(){return this.state===Ja.joining}isClosed(){return this.state===Ja.closed}isLeaving(){return this.state===Ja.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function S2(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var zx;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(zx||(zx={}));var Xi;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Xi||(Xi={}));var ca;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(ca||(ca={}));class xl{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 i,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 _2(this.socket.socketAdapter,t,this.params),this.presence=new x2(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Y_(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((l=(i=this.params.config)===null||i===void 0?void 0:i.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,i,l;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:f}}=this.params,h=(i=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(_=>_.filter))!==null&&i!==void 0?i:[],b=!!this.bindings[Xi.PRESENCE]&&this.bindings[Xi.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,g={},x={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:b}),postgres_changes:h,private:f};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(_=>{t==null||t(ca.CHANNEL_ERROR,w2(_))}),this._onClose(()=>t==null?void 0:t(ca.CLOSED)),this.updateJoinPayload(Object.assign({config:x},g)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:_})=>{if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){t==null||t(ca.SUBSCRIBED);return}this._updatePostgresBindings(_,t)}).receive("error",_=>{this.state=Ja.errored;const E=Object.values(_).join(", ")||"error";t==null||t(ca.CHANNEL_ERROR,new Error(E,{cause:_}))}).receive("timeout",()=>{t==null||t(ca.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var s;const i=this.bindings.postgres_changes,l=(s=i==null?void 0:i.length)!==null&&s!==void 0?s:0,u=[];for(let d=0;d<l;d++){const f=i[d],{filter:{event:h,schema:b,table:g,filter:x}}=f,_=t&&t[d];if(_&&_.event===h&&xl.isFilterValueEqual(_.schema,b)&&xl.isFilterValueEqual(_.table,g)&&xl.isFilterValueEqual(_.filter,x))u.push(Object.assign(Object.assign({},f),{id:_.id}));else{this.unsubscribe(),this.state=Ja.errored,r==null||r(ca.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=u,this.state!=Ja.errored&&r&&r(ca.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 i=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),l=t===Xi.PRESENCE||t===Xi.POSTGRES_CHANGES;if(i&&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 i;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,(i=s.timeout)!==null&&i!==void 0?i:this.timeout);if(d.status===202)return{success:!0};let f=d.statusText;try{const h=await d.json();f=h.error||h.message||f}catch{}return Promise.reject(new Error(f))}async send(t,r={}){var s,i;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 h=await this._fetchWithTimeout(this.broadcastEndpointURL,f,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);return await((i=h.body)===null||i===void 0?void 0:i.cancel()),h.ok?"ok":"error"}catch(h){return h instanceof Error&&h.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,f;const h=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"),h.receive("ok",()=>l("ok")),h.receive("error",()=>l("error")),h.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 i=new AbortController,l=setTimeout(()=>i.abort(),s),u=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(l),u}_on(t,r,s){const i=t.toLocaleLowerCase(),l=this.channelAdapter.on(t,s),u={type:i,filter:r,callback:s,ref:l};return this.bindings[i]?this.bindings[i].push(u):this.bindings[i]=[u],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,r,s)=>{var i,l,u,d,f,h,b;const g=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(g,s))return!1;const x=(i=this.bindings[g])===null||i===void 0?void 0:i.find(_=>_.ref===t.ref);if(!x)return!0;if(["broadcast","presence","postgres_changes"].includes(g))if("id"in x){const _=x.id,E=(l=x.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 _=(h=(f=x==null?void 0:x.filter)===null||f===void 0?void 0:f.event)===null||h===void 0?void 0:h.toLocaleLowerCase();return _==="*"||_===((b=r==null?void 0:r.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return x.type.toLocaleLowerCase()===g})}_notThisChannelEvent(t,r){const{close:s,error:i,leave:l,join:u}=F_;return r&&[s,i,l,u].includes(t)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,r,s)=>{if(typeof r=="object"&&"ids"in r){const i=r.data,{schema:l,table:u,commit_timestamp:d,type:f,errors:h}=i;return Object.assign(Object.assign({},{schema:l,table:u,commit_timestamp:d,eventType:f,new:{},old:{},errors:h}),this._getPayloadRecords(i))}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=Dx(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=Dx(t.columns,t.old_record)),r}}class E2{constructor(t,r){this.socket=new v2(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,i=1e4){return new Promise(l=>{setTimeout(()=>l("timeout"),i),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()==pp.connecting}isDisconnecting(){return this.socket.connectionState()==pp.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Ix={HEARTBEAT_INTERVAL:25e3},C2=[1e3,2e3,5e3,1e4],T2=1e4;function N2(){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 A2(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return N2()}const R2=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class j2{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 n2,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 i=this._initializeOptions(r);this.socketAdapter=new E2(t,i),this.httpEndpoint=Y_(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 i=await s.unsubscribe();return s.teardown(),i}),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()||pp.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const s=`realtime:${t}`,i=this.getChannels().find(l=>l.topic===s);if(i)return i;{const l=new xl(`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(i){this.log("error","Error fetching access token from callback",i),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(i=>{const l={access_token:r,version:Jk};r&&i.updateJoinPayload(l),i.joinedOnce&&i.channelAdapter.isJoined()&&i.channelAdapter.push(F_.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([R2],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_initializeOptions(t){var r,s,i,l,u,d,f,h,b,g,x,_;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=(i=t==null?void 0:t.timeout)!==null&&i!==void 0?i:e2,E.heartbeatIntervalMs=(l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:Ix.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:Ix.HEARTBEAT_INTERVAL),E.transport=(f=t==null?void 0:t.transport)!==null&&f!==void 0?f:Wk.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=(h=t==null?void 0:t.sessionStorage)!==null&&h!==void 0?h:A2(),E.reconnectAfterMs=(b=t==null?void 0:t.reconnectAfterMs)!==null&&b!==void 0?b:(R=>C2[R-1]||T2);let S,T;const C=(g=t==null?void 0:t.vsn)!==null&&g!==void 0?g:Zk;switch(C){case Qk:S=(R,A)=>A(JSON.stringify(R)),T=(R,A)=>A(JSON.parse(R));break;case G_: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=(x=t==null?void 0:t.encode)!==null&&x!==void 0?x: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 Nl=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 k2(e,t,r){const s=new URL(t,e);if(r)for(const[i,l]of Object.entries(r))l!==void 0&&s.searchParams.set(i,l);return s.toString()}async function O2(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 M2(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:i,body:l,headers:u}){const d=k2(e.baseUrl,s,i),f=await O2(e.auth),h=await t(d,{method:r,headers:{...l?{"Content-Type":"application/json"}:{},...f,...u},body:l?JSON.stringify(l):void 0}),b=await h.text(),g=(h.headers.get("content-type")||"").includes("application/json"),x=g&&b?JSON.parse(b):b;if(!h.ok){const _=g?x:void 0,E=_==null?void 0:_.error;throw new Nl((E==null?void 0:E.message)??`Request failed with status ${h.status}`,{status:h.status,icebergType:E==null?void 0:E.type,icebergCode:E==null?void 0:E.code,details:_})}return{status:h.status,headers:h.headers,data:x}}}}function Su(e){return e.join("")}var D2=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Su(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(s=>({namespace:s}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Su(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Su(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Su(e.namespace)}`}),!0}catch(t){if(t instanceof Nl&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof Nl&&r.status===409)return;throw r}}};function Di(e){return e.join("")}var P2=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/${Di(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/${Di(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/${Di(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/${Di(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/${Di(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/${Di(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof Nl&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof Nl&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},L2=class{constructor(e){var s;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=M2({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(s=e.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new D2(this.client,t),this.tableOps=new P2(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 Al(e){"@babel/helpers - typeof";return Al=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},Al(e)}function z2(e,t){if(Al(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Al(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I2(e){var t=z2(e,"string");return Al(t)=="symbol"?t:t+""}function U2(e,t,r){return(t=I2(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ux(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function Le(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ux(Object(r),!0).forEach(function(s){U2(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ux(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var Md=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 bp=class extends Md{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 Le({},super.toJSON())}},X_=class extends Md{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function od(e,t,r){const s=Le({},e),i=t.toLowerCase();for(const l of Object.keys(s))l.toLowerCase()===i&&delete s[l];return s[i]=r,s}function $2(e){const t={};for(const[r,s]of Object.entries(e))t[r.toLowerCase()]=s;return t}const B2=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),H2=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)},xp=e=>{if(Array.isArray(e))return e.map(r=>xp(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,s])=>{const i=r.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));t[i]=xp(s)}),t},q2=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),$x=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)},V2=async(e,t,r,s)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const i=e;let l=parseInt(String(i.status),10);Number.isFinite(l)||(l=500),i.json().then(u=>{const d=(u==null?void 0:u.statusCode)||(u==null?void 0:u.code)||l+"";t(new bp($x(u),l,d,s))}).catch(()=>{const u=l+"";t(new bp(i.statusText||`HTTP ${l} error`,l,u,s))})}else t(new X_($x(e),e,s))},G2=(e,t,r,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!s)return Le(Le({},i),r);if(H2(s)){var l;const u=(t==null?void 0:t.headers)||{};let d;for(const[f,h]of Object.entries(u))f.toLowerCase()==="content-type"&&(d=h);i.headers=od(u,"Content-Type",(l=d)!==null&&l!==void 0?l:"application/json"),i.body=JSON.stringify(s)}else i.body=s;return t!=null&&t.duplex&&(i.duplex=t.duplex),Le(Le({},i),r)};async function cl(e,t,r,s,i,l,u){return new Promise((d,f)=>{e(r,G2(t,s,i,l)).then(h=>{if(!h.ok)throw h;if(s!=null&&s.noResolveJson)return h;if(u==="vectors"){const b=h.headers.get("content-type");if(h.headers.get("content-length")==="0"||h.status===204)return{};if(!b||!b.includes("application/json"))return{}}return h.json()}).then(h=>d(h)).catch(h=>V2(h,f,s,u))})}function J_(e="storage"){return{get:async(t,r,s,i)=>cl(t,"GET",r,s,i,void 0,e),post:async(t,r,s,i,l)=>cl(t,"POST",r,i,l,s,e),put:async(t,r,s,i,l)=>cl(t,"PUT",r,i,l,s,e),head:async(t,r,s,i)=>cl(t,"HEAD",r,Le(Le({},s),{},{noResolveJson:!0}),i,void 0,e),remove:async(t,r,s,i,l)=>cl(t,"DELETE",r,i,l,s,e)}}const F2=J_("storage"),{get:Rl,post:pr,put:wp,head:K2,remove:hg}=F2,qn=J_("vectors");var fo=class{constructor(e,t={},r,s="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=$2(t),this.fetch=B2(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=od(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 Q_;Q_=Symbol.toStringTag;var Y2=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Q_]="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 Z_;Z_=Symbol.toStringTag;var W2=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Z_]="BlobDownloadBuilder",this.promise=null}asStream(){return new Y2(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 X2={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Bx={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J2=class extends fo{constructor(e,t={},r,s){super(e,t,s,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,s){var i=this;return i.handleOperation(async()=>{let l;const u=Le(Le({},Bx),s);let d=Le(Le({},i.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",i.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",i.encodeMetadata(f))):(l=r,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,f&&(d["x-metadata"]=i.toBase64(i.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[x,_]of Object.entries(s.headers))d=od(d,x,_);const h=i._removeEmptyFolders(t),b=i._getFinalPath(h),g=await(e=="PUT"?wp:pr)(i.fetch,`${i.url}/object/${b}`,l,Le({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}));return{path:h,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 i=this;const l=i._removeEmptyFolders(e),u=i._getFinalPath(l),d=new URL(i.url+`/object/upload/sign/${u}`);return d.searchParams.set("token",t),i.handleOperation(async()=>{let f;const h=Le(Le({},Bx),s);let b=Le(Le({},i.headers),{"x-upsert":String(h.upsert)});const g=h.metadata;if(typeof Blob<"u"&&r instanceof Blob?(f=new FormData,f.append("cacheControl",h.cacheControl),g&&f.append("metadata",i.encodeMetadata(g)),f.append("",r)):typeof FormData<"u"&&r instanceof FormData?(f=r,f.has("cacheControl")||f.append("cacheControl",h.cacheControl),g&&!f.has("metadata")&&f.append("metadata",i.encodeMetadata(g))):(f=r,b["cache-control"]=`max-age=${h.cacheControl}`,b["content-type"]=h.contentType,g&&(b["x-metadata"]=i.toBase64(i.encodeMetadata(g))),(typeof ReadableStream<"u"&&f instanceof ReadableStream||f&&typeof f=="object"&&"pipe"in f&&typeof f.pipe=="function")&&!h.duplex&&(h.duplex="half")),s!=null&&s.headers)for(const[x,_]of Object.entries(s.headers))b=od(b,x,_);return{path:l,fullPath:(await wp(i.fetch,d.toString(),f,Le({headers:b},h!=null&&h.duplex?{duplex:h.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e);const i=Le({},r.headers);t!=null&&t.upsert&&(i["x-upsert"]="true");const l=await pr(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:i}),u=new URL(r.url+l.url),d=u.searchParams.get("token");if(!d)throw new Md("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 pr(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 pr(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 i=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 pr(s.fetch,`${s.url}/object/sign/${i}`,Le({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 i=await pr(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 i.map(d=>Le(Le({},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",i=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(i,t.transform),(t==null?void 0:t.cacheNonce)!=null&&i.set("cacheNonce",String(t.cacheNonce));const l=i.toString(),u=this._getFinalPath(e),d=()=>Rl(this.fetch,`${this.url}/${s}/${u}${l?`?${l}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new W2(d,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>xp(await Rl(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await K2(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(i){if(t.shouldThrowOnError)throw i;if(Dd(i)){var s;const l=i instanceof bp?i.status:i instanceof X_?(s=i.originalError)===null||s===void 0?void 0:s.status:void 0;if(l!==void 0&&[400,404].includes(l))return{data:!1,error:i}}throw i}}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 i=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}`)+(i?`?${i}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await hg(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 i=Le(Le(Le({},X2),t),{},{prefix:e||""});return await pr(s.fetch,`${s.url}/object/list/${s.bucketId}`,i,{headers:s.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const s=Le({},e);return await pr(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 Q2="2.106.2",Gl={"X-Client-Info":`storage-js/${Q2}`};var Z2=class extends fo{constructor(e,t={},r,s){const i=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase."));const l=i.href.replace(/\/$/,""),u=Le(Le({},Gl),t);super(l,u,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await Rl(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Rl(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await pr(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 wp(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 pr(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await hg(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():""}},eO=class extends fo{constructor(e,t={},r){const s=e.replace(/\/$/,""),i=Le(Le({},Gl),t);super(s,i,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await pr(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(),i=s?`${t.url}/bucket?${s}`:`${t.url}/bucket`;return await Rl(t.fetch,i,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await hg(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!q2(e))throw new Md("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 L2({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{get(i,l){const u=i[l];return typeof u!="function"?u:async(...d)=>{try{return{data:await u.apply(i,d),error:null}}catch(f){if(s)throw f;return{data:null,error:f}}}}})}},tO=class extends fo{constructor(e,t={},r){const s=e.replace(/\/$/,""),i=Le(Le({},Gl),{},{"Content-Type":"application/json"},t);super(s,i,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await qn.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await qn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await qn.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await qn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},nO=class extends fo{constructor(e,t={},r){const s=e.replace(/\/$/,""),i=Le(Le({},Gl),{},{"Content-Type":"application/json"},t);super(s,i,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 qn.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await qn.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 qn.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await qn.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 qn.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},rO=class extends fo{constructor(e,t={},r){const s=e.replace(/\/$/,""),i=Le(Le({},Gl),{},{"Content-Type":"application/json"},t);super(s,i,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await qn.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await qn.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await qn.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await qn.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},aO=class extends rO{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new sO(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)}},sO=class extends tO{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,Le(Le({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,Le(Le({},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 iO(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},iO=class extends nO{constructor(e,t,r,s,i){super(e,t,i),this.vectorBucketName=r,this.indexName=s}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,Le(Le({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,Le(Le({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,Le(Le({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,Le(Le({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,Le(Le({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},oO=class extends Z2{constructor(e,t={},r,s){super(e,t,r,s)}from(e){return new J2(this.url,this.headers,e,this.fetch)}get vectors(){return new aO(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new eO(this.url+"/iceberg",this.headers,this.fetch)}};const eS="2.106.2",Fi=30*1e3,_p=3,Dm=_p*Fi,lO="http://localhost:9999",cO="supabase.auth.token",uO={"X-Client-Info":`gotrue-js/${eS}`},Sp="X-Supabase-Api-Version",tS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},dO=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,fO=600*1e3;class no 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 ge(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class hO extends no{constructor(t,r,s){super(t,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function mO(e){return ge(e)&&e.name==="AuthApiError"}class gr extends no{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class ya extends no{constructor(t,r,s,i){super(t,s,i),this.name=r,this.status=s}}class Jt extends ya{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Eu(e){return ge(e)&&e.name==="AuthSessionMissingError"}class Pi extends ya{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Cu extends ya{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Tu extends ya{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 pO(e){return ge(e)&&e.name==="AuthImplicitGrantRedirectError"}class Hx extends ya{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 gO extends ya{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 Ep extends ya{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function Pm(e){return ge(e)&&e.name==="AuthRetryableFetchError"}class qx extends ya{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 Cp extends ya{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const ld="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Vx=`
\r=`.split(""),vO=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Vx.length;t+=1)e[Vx[t].charCodeAt(0)]=-2;for(let t=0;t<ld.length;t+=1)e[ld[t].charCodeAt(0)]=t;return e})();function Gx(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(ld[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(ld[s]),t.queuedBits-=6}}function nS(e,t,r){const s=vO[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 Fx(e){const t=[],r=u=>{t.push(String.fromCodePoint(u))},s={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},l=u=>{xO(u,s,r)};for(let u=0;u<e.length;u+=1)nS(e.charCodeAt(u),i,l);return t.join("")}function yO(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 bO(e,t){for(let r=0;r<e.length;r+=1){let s=e.charCodeAt(r);if(s>55295&&s<=56319){const i=(s-55296)*1024&65535;s=(e.charCodeAt(r+1)-56320&65535|i)+65536,r+=1}yO(s,t)}}function xO(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 Ji(e){const t=[],r={queue:0,queuedBits:0},s=i=>{t.push(i)};for(let i=0;i<e.length;i+=1)nS(e.charCodeAt(i),r,s);return new Uint8Array(t)}function wO(e){const t=[];return bO(e,r=>t.push(r)),new Uint8Array(t)}function Ps(e){const t=[],r={queue:0,queuedBits:0},s=i=>{t.push(i)};return e.forEach(i=>Gx(i,r,s)),Gx(null,r,s),t.join("")}function _O(e){return Math.round(Date.now()/1e3)+e}function SO(){return Symbol("auth-callback")}const sn=()=>typeof window<"u"&&typeof document<"u",As={tested:!1,writable:!1},rS=()=>{if(!sn())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(As.tested)return As.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),As.tested=!0,As.writable=!0}catch{As.tested=!0,As.writable=!1}return As.writable};function EO(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((i,l)=>{t[l]=i})}catch{}return r.searchParams.forEach((s,i)=>{t[i]=s}),t}const aS=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),CO=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Ki=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},Rs=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},an=async(e,t)=>{await e.removeItem(t)};class Pd{constructor(){this.promise=new Pd.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}Pd.promiseConstructor=Promise;function Nu(e){const t=e.split(".");if(t.length!==3)throw new Cp("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!dO.test(t[s]))throw new Cp("JWT not in base64url format");return{header:JSON.parse(Fx(t[0])),payload:JSON.parse(Fx(t[1])),signature:Ji(t[2]),raw:{header:t[0],payload:t[1]}}}async function TO(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function NO(e,t){return new Promise((s,i)=>{(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)){i(u);return}}})()})}function AO(e){return("0"+e.toString(16)).substr(-2)}function RO(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let i="";for(let l=0;l<56;l++)i+=r.charAt(Math.floor(Math.random()*s));return i}return crypto.getRandomValues(t),Array.from(t,AO).join("")}async function jO(e){const r=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(s);return Array.from(i).map(l=>String.fromCharCode(l)).join("")}async function kO(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 jO(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Li(e,t,r=!1){const s=RO();let i=s;r&&(i+="/recovery"),await Ki(e,`${t}-code-verifier`,i);const l=await kO(s);return[l,s===l?"plain":"s256"]}const OO=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function MO(e){const t=e.headers.get(Sp);if(!t||!t.match(OO))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function DO(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 PO(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 LO=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function sa(e){if(!LO.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function hr(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 Lm(){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 zO(e,t){return new Proxy(e,{get:(r,s,i)=>{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,i)}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,i)}})}function Kx(e){return JSON.parse(JSON.stringify(e))}const Ms=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)},IO=[502,503,504,520,521,522,523,524,530];async function Yx(e){var t;if(!CO(e))throw new Ep(Ms(e),0);if(IO.includes(e.status))throw new Ep(Ms(e),e.status);let r;try{r=await e.json()}catch(l){throw new gr(Ms(l),l)}let s;const i=MO(e);if(i&&i.getTime()>=tS["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 qx(Ms(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new Jt}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 qx(Ms(r),e.status,r.weak_password.reasons);throw new hO(Ms(r),e.status||500,s)}const UO=(e,t,r,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),r))};async function Ee(e,t,r,s){var i;const l=Object.assign({},s==null?void 0:s.headers);l[Sp]||(l[Sp]=tS["2024-01-01"].name),s!=null&&s.jwt&&(l.Authorization=`Bearer ${s.jwt}`);const u=(i=s==null?void 0:s.query)!==null&&i!==void 0?i:{};s!=null&&s.redirectTo&&(u.redirect_to=s.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",f=await $O(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 $O(e,t,r,s,i,l){const u=UO(t,s,i,l);let d;try{d=await e(r,Object.assign({},u))}catch(f){throw console.error(f),new Ep(Ms(f),0)}if(d.ok||await Yx(d),s!=null&&s.noResolveJson)return d;try{return await d.json()}catch(f){await Yx(f)}}function rr(e){var t;let r=null;qO(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=_O(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 Wx(e){const t=rr(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 Qa(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function BO(e){return{data:e,error:null}}function HO(e){const{action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:l}=e,u=uo(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:l},f=Object.assign({},u);return{data:{properties:d,user:f},error:null}}function Xx(e){return e}function qO(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const zm=["global","local","others"];class VO{_encodePathSegment(t){if(t==="."||t==="..")throw new no("Invalid path segment");return encodeURIComponent(t)}constructor({url:t="",headers:r={},fetch:s,experimental:i}){this.url=t,this.headers=r,this.fetch=aS(s),this.experimental=i??{},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=zm[0]){if(zm.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${zm.join(", ")}`);try{return await Ee(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ge(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,r={}){try{return await Ee(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Qa})}catch(s){if(ge(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:r}=t,s=uo(t,["options"]),i=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(i.new_email=s==null?void 0:s.newEmail,delete i.newEmail),await Ee(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:HO,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(ge(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await Ee(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Qa})}catch(r){if(ge(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,s,i,l,u,d,f;try{const h={nextPage:null,lastPage:0,total:0},b=await Ee(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=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&l!==void 0?l:""},xform:Xx});if(b.error)throw b.error;const g=await b.json(),x=(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]);h[`${T}Page`]=S}),h.total=parseInt(x)),{data:Object.assign(Object.assign({},g),h),error:null}}catch(h){if(ge(h))return{data:{users:[]},error:h};throw h}}async getUserById(t){sa(t);try{return await Ee(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Qa})}catch(r){if(ge(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){sa(t);try{return await Ee(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Qa})}catch(s){if(ge(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,r=!1){sa(t);try{return await Ee(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Qa})}catch(s){if(ge(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){sa(t.userId);try{const{data:r,error:s}=await Ee(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:r,error:s}}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _deleteFactor(t){sa(t.userId),sa(t.id);try{return{data:await Ee(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,s,i,l,u,d,f;try{const h={nextPage:null,lastPage:0,total:0},b=await Ee(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=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&l!==void 0?l:""},xform:Xx});if(b.error)throw b.error;const g=await b.json(),x=(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]);h[`${T}Page`]=S}),h.total=parseInt(x)),{data:Object.assign(Object.assign({},g),h),error:null}}catch(h){if(ge(h))return{data:{clients:[]},error:h};throw h}}async _createOAuthClient(t){try{return await Ee(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{const r=this._encodePathSegment(t);return await Ee(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{const s=this._encodePathSegment(t);return await Ee(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${s}`,{body:r,headers:this.headers,xform:i=>({data:i,error:null})})}catch(s){if(ge(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{const r=this._encodePathSegment(t);return await Ee(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{const r=this._encodePathSegment(t);return await Ee(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await Ee(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:s=>{var i;return{data:{providers:(i=s==null?void 0:s.providers)!==null&&i!==void 0?i:[]},error:null}}})}catch(r){if(ge(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await Ee(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{const r=this._encodePathSegment(t);return await Ee(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{const s=this._encodePathSegment(t);return await Ee(this.fetch,"PUT",`${this.url}/admin/custom-providers/${s}`,{body:r,headers:this.headers,xform:i=>({data:i,error:null})})}catch(s){if(ge(s))return{data:null,error:s};throw s}}async _deleteCustomProvider(t){try{const r=this._encodePathSegment(t);return await Ee(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){hr(this.experimental),sa(t.userId);try{return await Ee(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){hr(this.experimental),sa(t.userId),sa(t.passkeyId);try{return await Ee(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ge(r))return{data:null,error:r};throw r}}}function Jx(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const Tr={debug:!!(globalThis&&rS()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class sS extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class Qx extends sS{}async function GO(e,t,r){Tr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;let i;t>0&&(i=setTimeout(()=>{s.abort(),Tr.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(i),Tr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,l.name);try{return await r()}finally{Tr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,l.name)}}else{if(t===0)throw Tr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new Qx(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Tr.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(i),await r()}})}catch(l){if(t>0&&clearTimeout(i),l!==null&&typeof l=="object"&&"name"in l&&l.name==="AbortError"&&t>0){if(s.signal.aborted)return Tr.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){Tr.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,u.name);try{return await r()}finally{Tr.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 Tr.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new Qx(`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 iS(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function KO(e){return parseInt(e,16)}function YO(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function WO(e){var t;const{chainId:r,domain:s,expirationTime:i,issuedAt:l=new Date,nonce:u,notBefore:d,requestId:f,resources:h,scheme:b,uri:g,version:x}=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(x!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${x}`);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 _=iS(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: ${x}
Chain ID: ${r}${u?`
Nonce: ${u}`:""}
Issued At: ${l.toISOString()}`;if(i&&(C+=`
Expiration Time: ${i.toISOString()}`),d&&(C+=`
Not Before: ${d.toISOString()}`),f&&(C+=`
Request ID: ${f}`),h){let R=`
Resources:`;for(const A of h){if(!A||typeof A!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${A}`);R+=`
- ${A}`}C+=R}return`${T}
${C}`}class Bt extends Error{constructor({message:t,code:r,cause:s,name:i}){var l;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(l=i??(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 cd extends Bt{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function XO({error:e,options:t}){var r,s,i;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 Bt({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 Bt({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 Bt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((i=l.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Bt({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 Bt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Bt({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 Bt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Bt({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(oS(u)){if(l.rp.id!==u)return new Bt({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Bt({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 Bt({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 Bt({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 Bt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function JO({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 Bt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Bt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(oS(s)){if(r.rpId!==s)return new Bt({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Bt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Bt({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 Bt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class QO{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 Tp=new QO;function Zx(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,i=uo(e,["challenge","user","excludeCredentials"]),l=Ji(t).buffer,u=Object.assign(Object.assign({},r),{id:Ji(r.id).buffer}),d=Object.assign(Object.assign({},i),{challenge:l,user:u});if(s&&s.length>0){d.excludeCredentials=new Array(s.length);for(let f=0;f<s.length;f++){const h=s[f];d.excludeCredentials[f]=Object.assign(Object.assign({},h),{id:Ji(h.id).buffer,type:h.type||"public-key",transports:h.transports})}}return d}function ew(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=uo(e,["challenge","allowCredentials"]),i=Ji(t).buffer,l=Object.assign(Object.assign({},s),{challenge:i});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:Ji(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function tw(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:Ps(new Uint8Array(e.response.attestationObject)),clientDataJSON:Ps(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function nw(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,s=e.getClientExtensionResults(),i=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Ps(new Uint8Array(i.authenticatorData)),clientDataJSON:Ps(new Uint8Array(i.clientDataJSON)),signature:Ps(new Uint8Array(i.signature)),userHandle:i.userHandle?Ps(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function oS(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function ud(){var e,t;return!!(sn()&&"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 lS(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new cd("Browser returned unexpected credential type",t)}:{data:null,error:new cd("Empty credential response",t)}}catch(t){return{data:null,error:XO({error:t,options:e})}}}async function cS(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new cd("Browser returned unexpected credential type",t)}:{data:null,error:new cd("Empty credential response",t)}}catch(t){return{data:null,error:JO({error:t,options:e})}}}const ZO={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},eM={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function dd(...e){const t=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),s={};for(const i of e)if(i)for(const l in i){const u=i[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]=dd(d,u):s[l]=dd(u)}else s[l]=u}return s}function tM(e,t){return dd(ZO,e,t||{})}function nM(e,t){return dd(eM,e,t||{})}class rM{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:i},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 h=i??Tp.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=tM(d.webauthn.credential_options.publicKey,l==null?void 0:l.create),{data:g,error:x}=await lS({publicKey:b,signal:h});return g?{data:{factorId:t,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:g}},error:null}:{data:null,error:x}}case"request":{const b=nM(d.webauthn.credential_options.publicKey,l==null?void 0:l.request),{data:g,error:x}=await cS(Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:b,signal:h}));return g?{data:{factorId:t,challengeId:d.id,webauthn:{type:d.webauthn.type,credential_response:g}},error:null}:{data:null,error:x}}}}catch(d){return ge(d)?{data:null,error:d}:{data:null,error:new gr("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:i}={}},l){if(!r)return{data:null,error:new no("rpId is required for WebAuthn authentication")};try{if(!ud())return{data:null,error:new gr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:s},signal:i},{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 ge(u)?{data:null,error:u}:{data:null,error:new gr("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:i}={}},l){if(!r)return{data:null,error:new no("rpId is required for WebAuthn registration")};try{if(!ud())return{data:null,error:new gr("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(x=>x.factor_type==="webauthn"&&x.friendly_name===t&&x.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:h}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:i},{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:h}}catch(u){return ge(u)?{data:null,error:u}:{data:null,error:new gr("Unexpected error in register",u)}}}}FO();const aM={url:lO,storageKey:cO,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:uO,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function rw(e,t,r){return await r()}const zi={};class jl{get jwks(){var t,r;return(r=(t=zi[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){zi[this.storageKey]=Object.assign(Object.assign({},zi[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=zi[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){zi[this.storageKey]=Object.assign(Object.assign({},zi[this.storageKey]),{cachedAt:t})}constructor(t){var r,s,i,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({},aM),t);if(this.storageKey=u.storageKey,this.instanceID=(r=jl.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,jl.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!u.debug,typeof u.debug=="function"&&(this.logger=u.debug),this.instanceID>0&&sn()){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 VO({url:u.url,headers:u.headers,fetch:u.fetch,experimental:this.experimental}),this.url=u.url,this.headers=u.headers,this.fetch=aS(u.fetch),this.lock=u.lock||rw,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&&sn()&&(!((i=globalThis==null?void 0:globalThis.navigator)===null||i===void 0)&&i.locks)?this.lock=GO:this.lock=rw,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 rM(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:rS()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Jx(this.memoryStorage)),u.userStorage&&(this.userStorage=u.userStorage)):(this.memoryStorage={},this.storage=Jx(this.memoryStorage)),sn()&&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} (${eS}) ${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(sn()&&(r=EO(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),sn()&&this.detectSessionInUrl&&s!=="none"){const{data:i,error:l}=await this._getSessionFromURL(r,s);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),pO(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}=i;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 ge(r)?this._returnResult({error:r}):this._returnResult({error:new gr("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,s,i;try{const l=await Ee(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:(i=t==null?void 0:t.options)===null||i===void 0?void 0:i.captchaToken}},xform:rr}),{data:u,error:d}=l;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const f=u.session,h=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",f)),this._returnResult({data:{user:h,session:f},error:null})}catch(l){if(ge(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(t){var r,s,i;try{let l;if("email"in t){const{email:b,password:g,options:x}=t;let _=null,E=null;this.flowType==="pkce"&&([_,E]=await Li(this.storage,this.storageKey)),l=await Ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:x==null?void 0:x.emailRedirectTo,body:{email:b,password:g,data:(r=x==null?void 0:x.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:x==null?void 0:x.captchaToken},code_challenge:_,code_challenge_method:E},xform:rr})}else if("phone"in t){const{phone:b,password:g,options:x}=t;l=await Ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:b,password:g,data:(s=x==null?void 0:x.data)!==null&&s!==void 0?s:{},channel:(i=x==null?void 0:x.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:x==null?void 0:x.captchaToken}},xform:rr})}else throw new Cu("You must provide either an email or phone number and a password");const{data:u,error:d}=l;if(d||!u)return await an(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const f=u.session,h=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",f)),this._returnResult({data:{user:h,session:f},error:null})}catch(l){if(await an(this.storage,`${this.storageKey}-code-verifier`),ge(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 Ee(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:Wx})}else if("phone"in t){const{phone:l,password:u,options:d}=t;r=await Ee(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:Wx})}else throw new Cu("You must provide either an email or phone number and a password");const{data:s,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!s||!s.session||!s.user){const l=new Pi;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:i})}catch(r){if(ge(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,s,i,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:(i=t.options)===null||i===void 0?void 0:i.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,i,l,u,d,f,h,b,g,x;let _,E;if("message"in t)_=t.message,E=t.signature;else{const{chain:S,wallet:T,statement:C,options:R}=t;let A;if(sn())if(typeof T=="object")A=T;else{const Z=window;if("ethereum"in Z&&typeof Z.ethereum=="object"&&"request"in Z.ethereum&&typeof Z.ethereum.request=="function")A=Z.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof T!="object"||!(R!=null&&R.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");A=T}const D=new URL((r=R==null?void 0:R.url)!==null&&r!==void 0?r:window.location.href),B=await A.request({method:"eth_requestAccounts"}).then(Z=>Z).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!B||B.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const I=iS(B[0]);let L=(s=R==null?void 0:R.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!L){const Z=await A.request({method:"eth_chainId"});L=KO(Z)}const H={domain:D.host,address:I,statement:C,uri:D.href,version:"1",chainId:L,nonce:(i=R==null?void 0:R.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(u=(l=R==null?void 0:R.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=R==null?void 0:R.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(f=R==null?void 0:R.signInWithEthereum)===null||f===void 0?void 0:f.notBefore,requestId:(h=R==null?void 0:R.signInWithEthereum)===null||h===void 0?void 0:h.requestId,resources:(b=R==null?void 0:R.signInWithEthereum)===null||b===void 0?void 0:b.resources};_=WO(H),E=await A.request({method:"personal_sign",params:[YO(_),I]})}try{const{data:S,error:T}=await Ee(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:(x=t.options)===null||x===void 0?void 0:x.captchaToken}}:null),xform:rr});if(T)throw T;if(!S||!S.session||!S.user){const C=new Pi;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(ge(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(t){var r,s,i,l,u,d,f,h,b,g,x,_;let E,S;if("message"in t)E=t.message,S=t.signature;else{const{chain:T,wallet:C,statement:R,options:A}=t;let D;if(sn())if(typeof C=="object")D=C;else{const I=window;if("solana"in I&&typeof I.solana=="object"&&("signIn"in I.solana&&typeof I.solana.signIn=="function"||"signMessage"in I.solana&&typeof I.solana.signMessage=="function"))D=I.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"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=C}const B=new URL((r=A==null?void 0:A.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in D&&D.signIn){const I=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},A==null?void 0:A.signInWithSolana),{version:"1",domain:B.host,uri:B.href}),R?{statement:R}:null));let L;if(Array.isArray(I)&&I[0]&&typeof I[0]=="object")L=I[0];else if(I&&typeof I=="object"&&"signedMessage"in I&&"signature"in I)L=I;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 D)||typeof D.signMessage!="function"||!("publicKey"in D)||typeof D!="object"||!D.publicKey||!("toBase58"in D.publicKey)||typeof D.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${B.host} wants you to sign in with your Solana account:`,D.publicKey.toBase58(),...R?["",R,""]:[""],"Version: 1",`URI: ${B.href}`,`Issued At: ${(i=(s=A==null?void 0:A.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((l=A==null?void 0:A.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${A.signInWithSolana.notBefore}`]:[],...!((u=A==null?void 0:A.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${A.signInWithSolana.expirationTime}`]:[],...!((d=A==null?void 0:A.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${A.signInWithSolana.chainId}`]:[],...!((f=A==null?void 0:A.signInWithSolana)===null||f===void 0)&&f.nonce?[`Nonce: ${A.signInWithSolana.nonce}`]:[],...!((h=A==null?void 0:A.signInWithSolana)===null||h===void 0)&&h.requestId?[`Request ID: ${A.signInWithSolana.requestId}`]:[],...!((g=(b=A==null?void 0:A.signInWithSolana)===null||b===void 0?void 0:b.resources)===null||g===void 0)&&g.length?["Resources",...A.signInWithSolana.resources.map(L=>`- ${L}`)]:[]].join(`
`);const I=await D.signMessage(new TextEncoder().encode(E),"utf8");if(!I||!(I instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=I}}try{const{data:T,error:C}=await Ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:Ps(S)},!((x=t.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(_=t.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:rr});if(C)throw C;if(!T||!T.session||!T.user){const R=new Pi;return this._returnResult({data:{user:null,session:null},error:R})}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(ge(T))return this._returnResult({data:{user:null,session:null},error:T});throw T}}async _exchangeCodeForSession(t){const r=await Rs(this.storage,`${this.storageKey}-code-verifier`),[s,i]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new gO;const{data:l,error:u}=await Ee(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:rr});if(await an(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Pi;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers(i==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l.session)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:i??null}),error:u})}catch(l){if(await an(this.storage,`${this.storageKey}-code-verifier`),ge(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:i,access_token:l,nonce:u}=t,d=await Ee(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:i,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:rr}),{data:f,error:h}=d;if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!f||!f.session||!f.user){const b=new Pi;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:h})}catch(r){if(ge(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,s,i,l,u;try{if("email"in t){const{email:d,options:f}=t;let h=null,b=null;this.flowType==="pkce"&&([h,b]=await Li(this.storage,this.storageKey));const{error:g}=await Ee(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:h,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:h,error:b}=await Ee(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(i=f==null?void 0:f.data)!==null&&i!==void 0?i:{},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:h==null?void 0:h.message_id},error:b})}throw new Cu("You must provide either an email or phone number.")}catch(d){if(await an(this.storage,`${this.storageKey}-code-verifier`),ge(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(t){var r,s;try{let i,l;"options"in t&&(i=(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 Ee(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:l}}),redirectTo:i,xform:rr});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const f=u.session,h=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:h,session:f},error:null})}catch(i){if(ge(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(t){var r,s,i,l,u;try{let d=null,f=null;this.flowType==="pkce"&&([d,f]=await Li(this.storage,this.storageKey));const h=await Ee(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}),!((i=t==null?void 0:t.options)===null||i===void 0)&&i.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:BO});return!((l=h.data)===null||l===void 0)&&l.url&&sn()&&!(!((u=t.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(h.data.url),this._returnResult(h)}catch(d){if(await an(this.storage,`${this.storageKey}-code-verifier`),ge(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 Jt;const{error:i}=await Ee(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(t){if(ge(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:i,options:l}=t,{error:u}=await Ee(this.fetch,"POST",r,{headers:this.headers,body:{email:s,type:i,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:i,options:l}=t,{data:u,error:d}=await Ee(this.fetch,"POST",r,{headers:this.headers,body:{phone:s,type:i,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 Cu("You must provide either an email or phone number and a type")}catch(r){if(ge(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(),i=(async()=>(await s,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}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 i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.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 Rs(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()<Dm:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){const u=await Rs(this.userStorage,this.storageKey+"-user");u!=null&&u.user?t.user=u.user:t.user=Lm()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};t.user=zO(t.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:i,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:i},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 Ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Qa}):await this._useSession(async r=>{var s,i,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 Jt}:await Ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(i=u.session)===null||i===void 0?void 0:i.access_token)!==null&&l!==void 0?l:void 0,xform:Qa})})}catch(r){if(ge(r))return Eu(r)&&(await this._removeSession(),await an(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:i,error:l}=s;if(l)throw l;if(!i.session)throw new Jt;const u=i.session;let d=null,f=null;this.flowType==="pkce"&&t.email!=null&&([d,f]=await Li(this.storage,this.storageKey));const{data:h,error:b}=await Ee(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:Qa});if(b)throw b;return u.user=h.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(s){if(await an(this.storage,`${this.storageKey}-code-verifier`),ge(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 Jt;const r=Date.now()/1e3;let s=r,i=!0,l=null;const{payload:u}=Nu(t.access_token);if(u.exp&&(s=u.exp,i=s<=r),i){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(ge(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 Jt;const{data:i,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(ge(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var s;try{if(!sn())throw new Tu("No browser detected.");if(t.error||t.error_description||t.error_code)throw new Tu(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 Hx("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Tu("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 Hx("No code detected.");const{data:A,error:D}=await this._exchangeCodeForSession(t.code);if(D)throw D;const B=new URL(window.location.href);return B.searchParams.delete("code"),window.history.replaceState(window.history.state,"",B.toString()),{data:{session:A.session,redirectType:(s=A.redirectType)!==null&&s!==void 0?s:null},error:null}}const{provider_token:i,provider_refresh_token:l,access_token:u,refresh_token:d,expires_in:f,expires_at:h,token_type:b}=t;if(!u||!f||!d||!b)throw new Tu("No session defined in URL");const g=Math.round(Date.now()/1e3),x=parseInt(f);let _=g+x;h&&(_=parseInt(h));const E=_-g;E*1e3<=Fi&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${E}s, should have been closer to ${x}s`);const S=_-x;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 R={provider_token:i,provider_refresh_token:l,access_token:u,expires_in:x,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:R,redirectType:t.type},error:null})}catch(i){if(ge(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_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 Rs(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:i,error:l}=r;if(l&&!Eu(l))return this._returnResult({error:l});const u=(s=i.session)===null||s===void 0?void 0:s.access_token;if(u){const{error:d}=await this.admin.signOut(u,t);if(d&&!(mO(d)&&(d.status===404||d.status===401||d.status===403)||Eu(d)))return this._returnResult({error:d})}return t!=="others"&&(await this._removeSession(),await an(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=SO(),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,i;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((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",l),Eu(l)?console.warn(l):console.error(l)}})}async resetPasswordForEmail(t,r={}){let s=null,i=null;this.flowType==="pkce"&&([s,i]=await Li(this.storage,this.storageKey,!0));try{return await Ee(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(l){if(await an(this.storage,`${this.storageKey}-code-verifier`),ge(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(ge(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:i}=await this._useSession(async l=>{var u,d,f,h,b;const{data:g,error:x}=l;if(x)throw x;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 Ee(this.fetch,"GET",_,{headers:this.headers,jwt:(b=(h=g.session)===null||h===void 0?void 0:h.access_token)!==null&&b!==void 0?b:void 0})});if(i)throw i;return sn()&&!(!((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(ge(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:i,data:{session:l}}=r;if(i)throw i;const{options:u,provider:d,token:f,access_token:h,nonce:b}=t,g=await Ee(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:h,nonce:b,link_identity:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:rr}),{data:x,error:_}=g;return _?this._returnResult({data:{user:null,session:null},error:_}):!x||!x.session||!x.user?this._returnResult({data:{user:null,session:null},error:new Pi}):(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("USER_UPDATED",x.session)),this._returnResult({data:x,error:_}))}catch(i){if(await an(this.storage,`${this.storageKey}-code-verifier`),ge(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var s,i;const{data:l,error:u}=r;if(u)throw u;return await Ee(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(i=(s=l.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if(ge(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 NO(async i=>(i>0&&await TO(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await Ee(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:rr})),(i,l)=>{const u=200*Math.pow(2,i);return l&&Pm(l)&&Date.now()+u-s<Fi})}catch(s){if(this._debug(r,"error",s),ge(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),sn()&&!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 i=await Rs(this.storage,this.storageKey);if(i&&this.userStorage){let u=await Rs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:i.user},await Ki(this.userStorage,this.storageKey+"-user",u)),i.user=(t=u==null?void 0:u.user)!==null&&t!==void 0?t:Lm()}else if(i&&!i.user&&!i.user){const u=await Rs(this.storage,this.storageKey+"-user");u&&(u!=null&&u.user)?(i.user=u.user,await an(this.storage,this.storageKey+"-user"),await Ki(this.storage,this.storageKey,i)):i.user=Lm()}if(this._debug(s,"session from storage",i),!this._isValidSession(i)){this._debug(s,"session is not valid"),i!==null&&await this._removeSession();return}const l=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Dm;if(this._debug(s,`session has${l?"":" not"} expired with margin of ${Dm}s`),l){if(this.autoRefreshToken&&i.refresh_token){const{error:u}=await this._callRefreshToken(i.refresh_token);u&&(console.error(u),Pm(u)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",u),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:d}=await this._getUser(i.access_token);!d&&(u!=null&&u.user)?(i.user=u.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):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",i)}catch(i){this._debug(s,"error",i),console.error(i);return}finally{this._debug(s,"end")}}async _callRefreshToken(t){var r,s;if(!t)throw new Jt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new Pd;const{data:l,error:u}=await this._refreshAccessToken(t);if(u)throw u;if(!l.session)throw new Jt;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(i,"error",l),ge(l)){const u={data:null,error:l};return Pm(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(i,"end")}}async _notifyAllSubscribers(t,r,s=!0){const i=`#_notifyAllSubscribers(${t})`;this._debug(i,"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(i,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await an(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 Ki(this.userStorage,this.storageKey+"-user",{user:r.user});const i=Object.assign({},r);delete i.user;const l=Kx(i);await Ki(this.storage,this.storageKey,l)}else{const i=Kx(r);await Ki(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await an(this.storage,this.storageKey),await an(this.storage,this.storageKey+"-code-verifier"),await an(this.storage,this.storageKey+"-user"),this.userStorage&&await an(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&sn()&&(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(),Fi);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 i=Math.floor((s.expires_at*1e3-t)/Fi);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Fi}ms, refresh threshold is ${_p} ticks`),i<=_p&&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 sS)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!sn()||!(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 i=[`provider=${encodeURIComponent(r)}`];if(s!=null&&s.redirectTo&&i.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&i.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[l,u]=await Li(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});i.push(d.toString())}if(s!=null&&s.queryParams){const l=new URLSearchParams(s.queryParams);i.push(l.toString())}return s!=null&&s.skipBrowserRedirect&&i.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${i.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var s;const{data:i,error:l}=r;return l?this._returnResult({data:null,error:l}):await Ee(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token})})}catch(r){if(ge(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var s,i;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:h}=await Ee(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 h?this._returnResult({data:null,error:h}):(t.factorType==="totp"&&f.type==="totp"&&(!((i=f==null?void 0:f.totp)===null||i===void 0)&&i.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(ge(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:i,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"?tw(t.webauthn.credential_response):nw(t.webauthn.credential_response)})}:{code:t.code}),{data:d,error:f}=await Ee(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:u,headers:this.headers,jwt:(s=i==null?void 0:i.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(ge(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:i,error:l}=r;if(l)return this._returnResult({data:null,error:l});const u=await Ee(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=i==null?void 0:i.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:Zx(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:ew(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(ge(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 i={all:[],phone:[],totp:[],webauthn:[]};for(const l of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])i.all.push(l),l.status==="verified"&&i[l.factor_type].push(l);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,s,i,l;if(t)try{const{payload:_}=Nu(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(D=>D.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(S="aal2");const A=_.amr||[];return{data:{currentLevel:E,nextLevel:S,currentAuthenticationMethods:A},error:null}}catch(_){if(ge(_))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}=Nu(u.access_token);let h=null;f.aal&&(h=f.aal);let b=h;((l=(i=u.user.factors)===null||i===void 0?void 0:i.filter(_=>_.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(b="aal2");const x=f.amr||[];return{data:{currentLevel:h,nextLevel:b,currentAuthenticationMethods:x},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;return i?this._returnResult({data:null,error:i}):s?await Ee(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 Jt})})}catch(r){if(ge(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:i},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!i)return this._returnResult({data:null,error:new Jt});const u=await Ee(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&sn()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(s){if(ge(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:i},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!i)return this._returnResult({data:null,error:new Jt});const u=await Ee(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&sn()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(s){if(ge(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 Ee(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Jt})})}catch(t){if(ge(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:i}=r;return i?this._returnResult({data:null,error:i}):s?(await Ee(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 Jt})})}catch(r){if(ge(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 i=Date.now();if(s=this.jwks.keys.find(d=>d.kid===t),s&&this.jwks_cached_at+fO>i)return s;const{data:l,error:u}=await Ee(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=i,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:i,payload:l,signature:u,raw:{header:d,payload:f}}=Nu(s);r!=null&&r.allowExpired||DO(l.exp);const h=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!h){const{error:_}=await this.getUser(s);if(_)throw _;return{data:{claims:l,header:i,signature:u},error:null}}const b=PO(i.alg),g=await crypto.subtle.importKey("jwk",h,b,!0,["verify"]);if(!await crypto.subtle.verify(b,g,u,wO(`${d}.${f}`)))throw new Cp("Invalid JWT signature");return{data:{claims:l,header:i,signature:u},error:null}}catch(s){if(ge(s))return this._returnResult({data:null,error:s});throw s}}async signInWithPasskey(t){var r,s,i;hr(this.experimental);try{if(!ud())return this._returnResult({data:null,error:new gr("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=ew(l.options),f=(i=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&i!==void 0?i:Tp.createNewAbortSignal(),{data:h,error:b}=await cS({publicKey:d,signal:f});if(b||!h)return this._returnResult({data:null,error:b??new gr("WebAuthn ceremony failed",null)});const g=nw(h);return this._verifyPasskeyAuthentication({challengeId:l.challenge_id,credential:g})}catch(l){if(ge(l))return this._returnResult({data:null,error:l});throw l}}async registerPasskey(t){var r,s;hr(this.experimental);try{if(!ud())return this._returnResult({data:null,error:new gr("Browser does not support WebAuthn",null)});const{data:i,error:l}=await this._startPasskeyRegistration();if(l||!i)return this._returnResult({data:null,error:l});const u=Zx(i.options),d=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:Tp.createNewAbortSignal(),{data:f,error:h}=await lS({publicKey:u,signal:d});if(h||!f)return this._returnResult({data:null,error:h??new gr("WebAuthn ceremony failed",null)});const b=tw(f);return this._verifyPasskeyRegistration({challengeId:i.challenge_id,credential:b})}catch(i){if(ge(i))return this._returnResult({data:null,error:i});throw i}}async _startPasskeyRegistration(){hr(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 Jt});const{data:i,error:l}=await Ee(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:i,error:null})})}catch(t){if(ge(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){hr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Jt});const{data:l,error:u}=await Ee(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(ge(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;hr(this.experimental);try{const{data:s,error:i}=await Ee(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 i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})}catch(s){if(ge(s))return this._returnResult({data:null,error:s});throw s}}async _verifyPasskeyAuthentication(t){hr(this.experimental);try{const{data:r,error:s}=await Ee(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:rr});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(ge(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){hr(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 Jt});const{data:i,error:l}=await Ee(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:i,error:null})})}catch(t){if(ge(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){hr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Jt});const{data:l,error:u}=await Ee(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(ge(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){hr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Jt});const{error:l}=await Ee(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(ge(r))return this._returnResult({data:null,error:r});throw r}}}jl.nextInstanceID={};const sM=jl,iM="2.106.2";let ml="";typeof Deno<"u"?ml="deno":typeof document<"u"?ml="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ml="react-native":ml="node";const oM={"X-Client-Info":`supabase-js-${ml}/${iM}`},lM={headers:oM},cM={schema:"public"},uM={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},dM={},fM={enabled:!1,respectSamplingDecision:!0};function hM(e,t,r,s){function i(l){return l instanceof r?l:new r(function(u){u(l)})}return new(r||(r=Promise))(function(l,u){function d(b){try{h(s.next(b))}catch(g){u(g)}}function f(b){try{h(s.throw(b))}catch(g){u(g)}}function h(b){b.done?l(b.value):i(b.value).then(d,f)}h((s=s.apply(e,[])).next())})}let Im=null;const mM="@opentelemetry/api";function pM(){return Im===null&&(Im=import(mM).catch(()=>null)),Im}function gM(){return hM(this,void 0,void 0,function*(){try{const e=yield pM();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 vM(e){if(!e||typeof e!="string")return null;const t=e.split("-");if(t.length!==4)return null;const[r,s,i,l]=t;if(r.length!==2||s.length!==32||i.length!==16||l.length!==2)return null;const u=/^[0-9a-f]+$/i;return!u.test(r)||!u.test(s)||!u.test(i)||!u.test(l)||s==="00000000000000000000000000000000"||i==="0000000000000000"?null:{version:r,traceId:s,parentId:i,traceFlags:l,isSampled:(parseInt(l,16)&1)===1}}function yM(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(bM(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 bM(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 xM(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 kl(e){"@babel/helpers - typeof";return kl=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},kl(e)}function wM(e,t){if(kl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(kl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _M(e){var t=wM(e,"string");return kl(t)=="symbol"?t:t+""}function SM(e,t,r){return(t=_M(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function jt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aw(Object(r),!0).forEach(function(s){SM(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aw(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const EM=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),CM=()=>Headers,TM=(e,t,r,s,i)=>{const l=EM(s),u=CM(),d=(i==null?void 0:i.enabled)===!0,f=(i==null?void 0:i.respectSamplingDecision)!==!1,h=d?xM(t):null;return async(b,g)=>{var x;const _=(x=await r())!==null&&x!==void 0?x: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 ${_}`),h){const S=await NM(b,h,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,jt(jt({},g),{},{headers:E}))}};async function NM(e,t,r){if(!yM(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const s=await gM();if(!s||!s.traceparent)return null;if(r){const i=vM(s.traceparent);if(i&&!i.isSampled)return null}return s}function sw(e){return typeof e=="boolean"?{enabled:e}:e}function AM(e){return e.endsWith("/")?e:e+"/"}function RM(e,t){var r,s,i,l,u,d;const{db:f,auth:h,realtime:b,global:g}=e,{db:x,auth:_,realtime:E,global:S}=t,T=sw(e.tracePropagation),C=sw(t.tracePropagation),R={db:jt(jt({},x),f),auth:jt(jt({},_),h),realtime:jt(jt({},E),b),storage:{},global:jt(jt(jt({},S),g),{},{headers:jt(jt({},(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:(i=(l=T==null?void 0:T.enabled)!==null&&l!==void 0?l:C==null?void 0:C.enabled)!==null&&i!==void 0?i:!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?R.accessToken=e.accessToken:delete R.accessToken,R}function jM(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(AM(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var kM=class extends sM{constructor(e){super(e)}},OM=class{constructor(e,t,r){var s,i;this.supabaseUrl=e,this.supabaseKey=t;const l=jM(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:cM,realtime:dM,auth:jt(jt({},uM),{},{storageKey:u}),global:lM,tracePropagation:fM},f=RM(r??{},d);if(this.settings=f,this.storageKey=(s=f.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=f.global.headers)!==null&&i!==void 0?i:{},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 h;this.auth=this._initSupabaseAuthClient((h=f.auth)!==null&&h!==void 0?h:{},this.headers,f.global.fetch)}this.fetch=TM(t,e,this._getAccessToken.bind(this),f.global.fetch,f.tracePropagation),this.realtime=this._initRealtimeClient(jt({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 Yk(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 oO(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new Ik(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:i,storageKey:l,flowType:u,lock:d,debug:f,throwOnError:h,experimental:b,lockAcquireTimeout:g,skipAutoInitialize:x},_,E){const S={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new kM({url:this.authUrl.href,headers:jt(jt({},S),_),storageKey:l,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:i,flowType:u,lock:d,debug:f,throwOnError:h,experimental:b,fetch:E,lockAcquireTimeout:g,skipAutoInitialize:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(T=>T.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new j2(this.realtimeUrl.href,jt(jt({},e),{},{params:jt(jt({},{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 MM=(e,t,r)=>new OM(e,t,r);function DM(){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}DM()&&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 PM={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"},LM=["VITE_SUPABASE_URL","VITE_SUPABASE_ANON_KEY"],iw=LM.filter(e=>!PM[e]);if(iw.length>0)throw new Error(`Faltan variables de entorno de Supabase. Revisa tu archivo .env.
Variables faltantes: ${iw.join(", ")}`);const ze=MM("https://dbit.digitalcompass.agency","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE",{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}});function uS(e){return String(e??"").trim().toLowerCase()}function ow(e){return!(e!=null&&e.email)||e.is_active!==!0?null:{email:uS(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,canManageTariffCatalog:e.can_manage_tariff_catalog===!0}}async function dS(e){const t=uS(e);if(!t)return null;const r=await ze.from("tablero_cdc_allowed_users").select("email, full_name, role, is_active, can_delete_projects, can_manage_internal_pricing, can_control_pricing_summary, can_manage_tariff_catalog").eq("email",t).eq("is_active",!0).maybeSingle();if(!r.error)return ow(r.data);const s=r.error.message||"";if(!(s.includes("can_manage_tariff_catalog")||s.includes("column")||s.includes("schema cache")))throw r.error;const l=await ze.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(l.error)throw l.error;return ow(l.data)}async function mg(){const{data:e,error:t}=await ze.auth.getUser();if(t||!e.user)throw new Error("No hay una sesión activa de Supabase.");const r=await dS(e.user.email);if(!r)throw new Error("Tu correo no está autorizado para acceder al Tablero CDC.");return r}function zM(){return typeof window>"u"?"/tablero-cdc/":new URL("/tablero-cdc/",window.location.origin).toString()}function IM(e){var i;const t=e.user_metadata||{},r=t.full_name||t.name||t.display_name||((i=e.email)==null?void 0:i.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 fS=y.createContext(null);function UM({children:e}){const[t,r]=y.useState(null),[s,i]=y.useState(null),[l,u]=y.useState(!0),[d,f]=y.useState(null),h=y.useCallback(async C=>{if(!C){r(null),i(null);return}let R=null;try{R=await dS(C.email)}catch(A){console.error("Error al validar acceso al Tablero CDC:",A),await ze.auth.signOut(),r(null),i(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(!R){await ze.auth.signOut(),r(null),i(null),f("Tu correo no está autorizado para acceder al Tablero CDC. Solicita acceso a IT o al equipo CDC.");return}r(IM(C)),i(R),f(null)},[]);y.useEffect(()=>{let C=!0;ze.auth.getSession().then(async({data:A,error:D})=>{var B;if(C){if(D){console.error("Error al recuperar sesión de Supabase:",D),r(null),f("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo.");return}await h(((B=A.session)==null?void 0:B.user)??null)}}).catch(A=>{C&&(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(()=>{C&&u(!1)});const{data:R}=ze.auth.onAuthStateChange((A,D)=>{u(!0),h((D==null?void 0:D.user)??null).finally(()=>{C&&u(!1)})});return()=>{C=!1,R.subscription.unsubscribe()}},[h]);const b=y.useCallback(async()=>{f(null);const{error:C}=await ze.auth.signInWithOAuth({provider:"google",options:{redirectTo:zM(),queryParams:{prompt:"select_account"}}});C&&(console.error("Error al iniciar sesión con Google:",C),f("No se pudo iniciar sesión. Intenta de nuevo."))},[]),g=y.useCallback(async()=>{const{error:C}=await ze.auth.signOut();if(C){console.error("Error al cerrar sesión:",C),f("No se pudo cerrar sesión. Intenta de nuevo.");return}r(null),i(null),f(null)},[]),x=y.useMemo(()=>(s==null?void 0:s.role)==="director_creativo",[s==null?void 0:s.role]),_=y.useMemo(()=>(s==null?void 0:s.canManageInternalPricing)===!0,[s==null?void 0:s.canManageInternalPricing]),E=y.useMemo(()=>(s==null?void 0:s.canDeleteProjects)===!0,[s==null?void 0:s.canDeleteProjects]),S=y.useMemo(()=>(s==null?void 0:s.canControlPricingSummary)===!0,[s==null?void 0:s.canControlPricingSummary]),T=y.useMemo(()=>(s==null?void 0:s.canManageTariffCatalog)===!0,[s==null?void 0:s.canManageTariffCatalog]);return m.jsx(fS.Provider,{value:{user:t,loading:l,error:d,isGerardo:x,canDeleteProjects:E,canManageInternalPricing:_,canControlPricingSummary:S,canManageTariffCatalog:T,loginWithGoogle:b,logout:g},children:e})}function Ld(){const e=y.useContext(fS);if(!e)throw new Error("useAuth debe usarse dentro de <AuthProvider>");return e}function lw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mn(...e){return t=>{let r=!1;const s=e.map(i=>{const l=lw(i,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let i=0;i<s.length;i++){const l=s[i];typeof l=="function"?l():lw(e[i],null)}}}}function Ye(...e){return y.useCallback(mn(...e),e)}var $M=Symbol.for("react.lazy"),fd=rg[" use ".trim().toString()];function BM(e){return typeof e=="object"&&e!==null&&"then"in e}function hS(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===$M&&"_payload"in e&&BM(e._payload)}function zd(e){const t=qM(e),r=y.forwardRef((s,i)=>{let{children:l,...u}=s;hS(l)&&typeof fd=="function"&&(l=fd(l._payload));const d=y.Children.toArray(l),f=d.find(GM);if(f){const h=f.props.children,b=d.map(g=>g===f?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:g);return m.jsx(t,{...u,ref:i,children:y.isValidElement(h)?y.cloneElement(h,void 0,b):null})}return m.jsx(t,{...u,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}var HM=zd("Slot");function qM(e){const t=y.forwardRef((r,s)=>{let{children:i,...l}=r;if(hS(i)&&typeof fd=="function"&&(i=fd(i._payload)),y.isValidElement(i)){const u=KM(i),d=FM(l,i.props);return i.type!==y.Fragment&&(d.ref=s?mn(s,u):u),y.cloneElement(i,d)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var VM=Symbol("radix.slottable");function GM(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===VM}function FM(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const f=l(...d);return i(...d),f}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function KM(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function mS(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=mS(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function pS(){for(var e,t,r=0,s="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=mS(e))&&(s&&(s+=" "),s+=t);return s}const cw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,uw=pS,pg=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return uw(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:l}=t,u=Object.keys(i).map(h=>{const b=r==null?void 0:r[h],g=l==null?void 0:l[h];if(b===null)return null;const x=cw(b)||cw(g);return i[h][x]}),d=r&&Object.entries(r).reduce((h,b)=>{let[g,x]=b;return x===void 0||(h[g]=x),h},{}),f=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((h,b)=>{let{class:g,className:x,..._}=b;return Object.entries(_).every(E=>{let[S,T]=E;return Array.isArray(T)?T.includes({...l,...d}[S]):{...l,...d}[S]===T})?[...h,g,x]:h},[]);return uw(e,u,f,r==null?void 0:r.class,r==null?void 0:r.className)},YM=(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},WM=(e,t)=>({classGroupId:e,validator:t}),gS=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),hd="-",dw=[],XM="arbitrary..",JM=e=>{const t=ZM(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return QM(u);const d=u.split(hd),f=d[0]===""&&d.length>1?1:0;return vS(d,f,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const f=s[u],h=r[u];return f?h?YM(h,f):f:h||dw}return r[u]||dw}}},vS=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],l=r.nextPart.get(i);if(l){const h=vS(e,t+1,l);if(h)return h}const u=r.validators;if(u===null)return;const d=t===0?e.join(hd):e.slice(t).join(hd),f=u.length;for(let h=0;h<f;h++){const b=u[h];if(b.validator(d))return b.classGroupId}},QM=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?XM+s:void 0})(),ZM=e=>{const{theme:t,classGroups:r}=e;return eD(r,t)},eD=(e,t)=>{const r=gS();for(const s in e){const i=e[s];gg(i,r,s,t)}return r},gg=(e,t,r,s)=>{const i=e.length;for(let l=0;l<i;l++){const u=e[l];tD(u,t,r,s)}},tD=(e,t,r,s)=>{if(typeof e=="string"){nD(e,t,r);return}if(typeof e=="function"){rD(e,t,r,s);return}aD(e,t,r,s)},nD=(e,t,r)=>{const s=e===""?t:yS(t,e);s.classGroupId=r},rD=(e,t,r,s)=>{if(sD(e)){gg(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(WM(r,e))},aD=(e,t,r,s)=>{const i=Object.entries(e),l=i.length;for(let u=0;u<l;u++){const[d,f]=i[u];gg(f,yS(t,d),r,s)}},yS=(e,t)=>{let r=e;const s=t.split(hd),i=s.length;for(let l=0;l<i;l++){const u=s[l];let d=r.nextPart.get(u);d||(d=gS(),r.nextPart.set(u,d)),r=d}return r},sD=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,iD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const i=(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 i(l,u),u},set(l,u){l in r?r[l]=u:i(l,u)}}},Np="!",fw=":",oD=[],hw=(e,t,r,s,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:i}),lD=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=i=>{const l=[];let u=0,d=0,f=0,h;const b=i.length;for(let S=0;S<b;S++){const T=i[S];if(u===0&&d===0){if(T===fw){l.push(i.slice(f,S)),f=S+1;continue}if(T==="/"){h=S;continue}}T==="["?u++:T==="]"?u--:T==="("?d++:T===")"&&d--}const g=l.length===0?i:i.slice(f);let x=g,_=!1;g.endsWith(Np)?(x=g.slice(0,-1),_=!0):g.startsWith(Np)&&(x=g.slice(1),_=!0);const E=h&&h>f?h-f:void 0;return hw(l,_,x,E)};if(t){const i=t+fw,l=s;s=u=>u.startsWith(i)?l(u.slice(i.length)):hw(oD,!1,u,void 0,!0)}if(r){const i=s;s=l=>r({className:l,parseClassName:i})}return s},cD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let i=[];for(let l=0;l<r.length;l++){const u=r[l],d=u[0]==="[",f=t.has(u);d||f?(i.length>0&&(i.sort(),s.push(...i),i=[]),s.push(u)):i.push(u)}return i.length>0&&(i.sort(),s.push(...i)),s}},uD=e=>({cache:iD(e.cacheSize),parseClassName:lD(e),sortModifiers:cD(e),postfixLookupClassGroupIds:dD(e),...JM(e)}),dD=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},fD=/\s+/,hD=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:i,sortModifiers:l,postfixLookupClassGroupIds:u}=t,d=[],f=e.trim().split(fD);let h="";for(let b=f.length-1;b>=0;b-=1){const g=f[b],{isExternal:x,modifiers:_,hasImportantModifier:E,baseClassName:S,maybePostfixModifierPosition:T}=r(g);if(x){h=g+(h.length>0?" "+h:h);continue}let C=!!T,R;if(C){const L=S.substring(0,T);R=s(L);const H=R&&u[R]?s(S):void 0;H&&H!==R&&(R=H,C=!1)}else R=s(S);if(!R){if(!C){h=g+(h.length>0?" "+h:h);continue}if(R=s(S),!R){h=g+(h.length>0?" "+h:h);continue}C=!1}const A=_.length===0?"":_.length===1?_[0]:l(_).join(":"),D=E?A+Np:A,B=D+R;if(d.indexOf(B)>-1)continue;d.push(B);const I=i(R,C);for(let L=0;L<I.length;++L){const H=I[L];d.push(D+H)}h=g+(h.length>0?" "+h:h)}return h},mD=(...e)=>{let t=0,r,s,i="";for(;t<e.length;)(r=e[t++])&&(s=bS(r))&&(i&&(i+=" "),i+=s);return i},bS=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=bS(e[s]))&&(r&&(r+=" "),r+=t);return r},pD=(e,...t)=>{let r,s,i,l;const u=f=>{const h=t.reduce((b,g)=>g(b),e());return r=uD(h),s=r.cache.get,i=r.cache.set,l=d,d(f)},d=f=>{const h=s(f);if(h)return h;const b=hD(f,r);return i(f,b),b};return l=u,(...f)=>l(mD(...f))},gD=[],Gt=e=>{const t=r=>r[e]||gD;return t.isThemeGetter=!0,t},xS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,yD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bD=/\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$/,xD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_D=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ga=e=>vD.test(e),Ke=e=>!!e&&!Number.isNaN(Number(e)),Nr=e=>!!e&&Number.isInteger(Number(e)),Um=e=>e.endsWith("%")&&Ke(e.slice(0,-1)),ia=e=>yD.test(e),_S=()=>!0,SD=e=>bD.test(e)&&!xD.test(e),vg=()=>!1,ED=e=>wD.test(e),CD=e=>_D.test(e),TD=e=>!be(e)&&!we(e),ND=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)),AD=e=>is(e,CS,vg),be=e=>xS.test(e),js=e=>is(e,TS,SD),mw=e=>is(e,LD,Ke),RD=e=>is(e,AS,_S),jD=e=>is(e,NS,vg),pw=e=>is(e,SS,vg),kD=e=>is(e,ES,CD),Au=e=>is(e,RS,ED),we=e=>wS.test(e),ul=e=>Gs(e,TS),OD=e=>Gs(e,NS),gw=e=>Gs(e,SS),MD=e=>Gs(e,CS),DD=e=>Gs(e,ES),Ru=e=>Gs(e,RS,!0),PD=e=>Gs(e,AS,!0),is=(e,t,r)=>{const s=xS.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Gs=(e,t,r=!1)=>{const s=wS.exec(e);return s?s[1]?t(s[1]):r:!1},SS=e=>e==="position"||e==="percentage",ES=e=>e==="image"||e==="url",CS=e=>e==="length"||e==="size"||e==="bg-size",TS=e=>e==="length",LD=e=>e==="number",NS=e=>e==="family-name",AS=e=>e==="number"||e==="weight",RS=e=>e==="shadow",zD=()=>{const e=Gt("color"),t=Gt("font"),r=Gt("text"),s=Gt("font-weight"),i=Gt("tracking"),l=Gt("leading"),u=Gt("breakpoint"),d=Gt("container"),f=Gt("spacing"),h=Gt("radius"),b=Gt("shadow"),g=Gt("inset-shadow"),x=Gt("text-shadow"),_=Gt("drop-shadow"),E=Gt("blur"),S=Gt("perspective"),T=Gt("aspect"),C=Gt("ease"),R=Gt("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...D(),we,be],I=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],H=()=>[we,be,f],Z=()=>[Ga,"full","auto",...H()],ue=()=>[Nr,"none","subgrid",we,be],ce=()=>["auto",{span:["full",Nr,we,be]},Nr,we,be],he=()=>[Nr,"auto",we,be],de=()=>["auto","min","max","fr",we,be],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],pe=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...H()],K=()=>[Ga,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],W=()=>[Ga,"screen","full","dvw","lvw","svw","min","max","fit",...H()],J=()=>[Ga,"screen","full","lh","dvh","lvh","svh","min","max","fit",...H()],G=()=>[e,we,be],k=()=>[...D(),gw,pw,{position:[we,be]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",MD,AD,{size:[we,be]}],Y=()=>[Um,ul,js],$=()=>["","none","full",h,we,be],re=()=>["",Ke,ul,js],te=()=>["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"],se=()=>[Ke,Um,gw,pw],Se=()=>["","none",E,we,be],Te=()=>["none",Ke,we,be],Re=()=>["none",Ke,we,be],nt=()=>[Ke,we,be],Ze=()=>[Ga,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ia],breakpoint:[ia],color:[_S],container:[ia],"drop-shadow":[ia],ease:["in","out","in-out"],font:[TD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ia],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ia],shadow:[ia],spacing:["px",Ke],text:[ia],"text-shadow":[ia],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ga,be,we,T]}],container:["container"],"container-type":[{"@container":["","normal","size",we,be]}],"container-named":[ND],columns:[{columns:[Ke,be,we,d]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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:B()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Z()}],"inset-x":[{"inset-x":Z()}],"inset-y":[{"inset-y":Z()}],start:[{"inset-s":Z(),start:Z()}],end:[{"inset-e":Z(),end:Z()}],"inset-bs":[{"inset-bs":Z()}],"inset-be":[{"inset-be":Z()}],top:[{top:Z()}],right:[{right:Z()}],bottom:[{bottom:Z()}],left:[{left:Z()}],visibility:["visible","invisible","collapse"],z:[{z:[Nr,"auto",we,be]}],basis:[{basis:[Ga,"full","auto",d,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,Ga,"auto","initial","none",be]}],grow:[{grow:["",Ke,we,be]}],shrink:[{shrink:["",Ke,we,be]}],order:[{order:[Nr,"first","last","none",we,be]}],"grid-cols":[{"grid-cols":ue()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":he()}],"col-end":[{"col-end":he()}],"grid-rows":[{"grid-rows":ue()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":he()}],"row-end":[{"row-end":he()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...pe(),"normal"]}],"justify-self":[{"justify-self":["auto",...pe()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...pe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...pe(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...pe(),"baseline"]}],"place-self":[{"place-self":["auto",...pe()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pbs:[{pbs:H()}],pbe:[{pbe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...J()]}],"min-block-size":[{"min-block":["auto",...J()]}],"max-block-size":[{"max-block":["none",...J()]}],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,ul,js]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,PD,RD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Um,be]}],"font-family":[{font:[OD,jD,t]}],"font-features":[{"font-features":[be]}],"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:[i,we,be]}],"line-clamp":[{"line-clamp":[Ke,"none",we,mw]}],leading:[{leading:[l,...H()]}],"list-image":[{"list-image":["none",we,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",we,js]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[Ke,"auto",we,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"tab-size":[{tab:[Nr,we,be]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,be]}],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",we,be]}],"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:O()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Nr,we,be],radial:["",we,be],conic:[Nr,we,be]},DD,kD]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-bs":[{"border-bs":G()}],"border-color-be":[{"border-be":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,we,be]}],"outline-w":[{outline:["",Ke,ul,js]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",b,Ru,Au]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",g,Ru,Au]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[Ke,js]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",x,Ru,Au]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[Ke,we,be]}],"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":[Ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[we,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"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":D()}],"mask-image-conic-pos":[{"mask-conic":[Ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,be]}],filter:[{filter:["","none",we,be]}],blur:[{blur:Se()}],brightness:[{brightness:[Ke,we,be]}],contrast:[{contrast:[Ke,we,be]}],"drop-shadow":[{"drop-shadow":["","none",_,Ru,Au]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",Ke,we,be]}],"hue-rotate":[{"hue-rotate":[Ke,we,be]}],invert:[{invert:["",Ke,we,be]}],saturate:[{saturate:[Ke,we,be]}],sepia:[{sepia:["",Ke,we,be]}],"backdrop-filter":[{"backdrop-filter":["","none",we,be]}],"backdrop-blur":[{"backdrop-blur":Se()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,we,be]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,we,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,we,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,we,be]}],"backdrop-invert":[{"backdrop-invert":["",Ke,we,be]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,we,be]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,we,be]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,we,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",we,be]}],ease:[{ease:["linear","initial",C,we,be]}],delay:[{delay:[Ke,we,be]}],animate:[{animate:["none",R,we,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,we,be]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:Te()}],"rotate-x":[{"rotate-x":Te()}],"rotate-y":[{"rotate-y":Te()}],"rotate-z":[{"rotate-z":Te()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:nt()}],"skew-x":[{"skew-x":nt()}],"skew-y":[{"skew-y":nt()}],transform:[{transform:[we,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ze()}],"translate-x":[{"translate-x":Ze()}],"translate-y":[{"translate-y":Ze()}],"translate-z":[{"translate-z":Ze()}],"translate-none":["translate-none"],zoom:[{zoom:[Nr,we,be]}],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"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",we,be]}],"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":G()}],"scrollbar-track-color":[{"scrollbar-track":G()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mbs":[{"scroll-mbs":H()}],"scroll-mbe":[{"scroll-mbe":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pbs":[{"scroll-pbs":H()}],"scroll-pbe":[{"scroll-pbe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",we,be]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[Ke,ul,js,mw]}],stroke:[{stroke:["none",...G()]}],"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"]}},ID=pD(zD);function xe(...e){return ID(pS(e))}const UD=pg("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"}}),Fe=y.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,...i},l)=>{const u=s?HM:"button";return m.jsx(u,{className:xe(UD({variant:t,size:r,className:e})),ref:l,...i})});Fe.displayName="Button";function yg({size:e="sm",className:t}){const r=e==="lg"?"h-auto w-[168px]":"h-auto w-[104px]",s=e==="lg"?"-translate-x-1":"";return m.jsx("div",{className:xe("inline-flex items-center",t),"aria-label":"GLM",children:m.jsx("img",{src:"/tablero-cdc/glm-logo.png",alt:"GLM",className:xe(r,s),loading:"eager",decoding:"async"})})}function $D(){const{loginWithGoogle:e,error:t,loading:r}=Ld();return m.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:m.jsxs("div",{className:"w-full max-w-sm",children:[m.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[m.jsx(yg,{size:"lg"}),m.jsx("h1",{className:"text-2xl font-bold tracking-tight text-[#4F758B] text-center",children:"CDC Project Management"})]}),m.jsxs("div",{className:"bg-card border border-border rounded-2xl p-8 shadow-sm",children:[m.jsxs(Fe,{onClick:e,disabled:r,className:"w-full gap-2.5 h-10 rounded-full font-medium",children:[m.jsxs("svg",{"aria-hidden":"true",className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[m.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"}),m.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"}),m.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"}),m.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&&m.jsx("div",{className:"mt-4 rounded-lg bg-destructive/10 border border-destructive/20 px-4 py-3",children:m.jsx("p",{className:"text-sm text-destructive text-center leading-snug",children:t})})]}),m.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 jS=(...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 BD=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 HD=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 vw=e=>{const t=HD(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 qD={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 VD=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 GD=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:i="",children:l,iconNode:u,...d},f)=>y.createElement("svg",{ref:f,...qD,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:jS("lucide",i),...!l&&!VD(d)&&{"aria-hidden":"true"},...d},[...u.map(([h,b])=>y.createElement(h,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 qe=(e,t)=>{const r=y.forwardRef(({className:s,...i},l)=>y.createElement(GD,{ref:l,iconNode:t,className:jS(`lucide-${BD(vw(e))}`,`lucide-${e}`,s),...i}));return r.displayName=vw(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 FD=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],yw=qe("archive-restore",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 KD=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],kS=qe("badge-dollar-sign",KD);/**
* @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 YD=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],bw=qe("building-2",YD);/**
* @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 WD=[["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"}]],XD=qe("calculator",WD);/**
* @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 JD=[["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"}]],QD=qe("calendar",JD);/**
* @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 ZD=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],da=qe("check",ZD);/**
* @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 eP=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bg=qe("chevron-down",eP);/**
* @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 tP=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],OS=qe("chevron-left",tP);/**
* @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 nP=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xg=qe("chevron-right",nP);/**
* @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 rP=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],aP=qe("chevron-up",rP);/**
* @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 sP=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],MS=qe("chevrons-up-down",sP);/**
* @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 iP=[["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"}]],md=qe("circle-alert",iP);/**
* @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 oP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],lP=qe("circle-check",oP);/**
* @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 cP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],xw=qe("circle-dollar-sign",cP);/**
* @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 uP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],dP=qe("circle",uP);/**
* @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 fP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],hP=qe("clock-3",fP);/**
* @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 mP=[["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"}]],wg=qe("dollar-sign",mP);/**
* @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 pP=[["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"}]],gP=qe("external-link",pP);/**
* @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 vP=[["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"}]],yP=qe("eye-off",vP);/**
* @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 bP=[["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"}]],xP=qe("eye",bP);/**
* @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 wP=[["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"}]],_P=qe("file-check-corner",wP);/**
* @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 SP=[["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"}]],EP=qe("history",SP);/**
* @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 CP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],TP=qe("info",CP);/**
* @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 NP=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],AP=qe("layers",NP);/**
* @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 RP=[["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"}]],jP=qe("layout-grid",RP);/**
* @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 kP=[["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"}]],OP=qe("link-2",kP);/**
* @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 MP=[["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"}]],DP=qe("link",MP);/**
* @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 PP=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ar=qe("loader-circle",PP);/**
* @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 LP=[["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"}]],zP=qe("lock",LP);/**
* @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 IP=[["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"}]],UP=qe("log-out",IP);/**
* @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 $P=[["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"}]],BP=qe("map-pin",$P);/**
* @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 HP=[["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"}]],qP=qe("message-square-plus",HP);/**
* @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 VP=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],GP=qe("pen-line",VP);/**
* @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 FP=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],es=qe("plus",FP);/**
* @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 KP=[["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"}]],DS=qe("refresh-cw",KP);/**
* @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 YP=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ol=qe("search",YP);/**
* @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 WP=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],XP=qe("settings-2",WP);/**
* @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 JP=[["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"}]],QP=qe("sliders-horizontal",JP);/**
* @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 ZP=[["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"}]],ww=qe("tag",ZP);/**
* @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 e5=[["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"}]],PS=qe("trash-2",e5);/**
* @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 t5=[["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"}]],n5=qe("user",t5);/**
* @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 r5=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ml=qe("x",r5),gt=y.forwardRef(({className:e,type:t,...r},s)=>m.jsx("input",{type:t,className:xe("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}));gt.displayName="Input";function ve(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function a5(e,t){const r=y.createContext(t),s=l=>{const{children:u,...d}=l,f=y.useMemo(()=>d,Object.values(d));return m.jsx(r.Provider,{value:f,children:u})};s.displayName=e+"Provider";function i(l){const u=y.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[s,i]}function or(e,t=[]){let r=[];function s(l,u){const d=y.createContext(u),f=r.length;r=[...r,u];const h=g=>{var C;const{scope:x,children:_,...E}=g,S=((C=x==null?void 0:x[e])==null?void 0:C[f])||d,T=y.useMemo(()=>E,Object.values(E));return m.jsx(S.Provider,{value:T,children:_})};h.displayName=l+"Provider";function b(g,x){var S;const _=((S=x==null?void 0:x[e])==null?void 0:S[f])||d,E=y.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[h,b]}const i=()=>{const l=r.map(u=>y.createContext(u));return function(d){const f=(d==null?void 0:d[e])||l;return y.useMemo(()=>({[`__scope${e}`]:{...d,[e]:f}}),[d,f])}};return i.scopeName=e,[s,s5(i,...t)]}function s5(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const u=s.reduce((d,{useScope:f,scopeName:h})=>{const g=f(l)[`__scope${h}`];return{...d,...g}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var Ht=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},i5=rg[" useInsertionEffect ".trim().toString()]||Ht;function fa({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[i,l,u]=o5({defaultProp:t,onChange:r}),d=e!==void 0,f=d?e:i;{const b=y.useRef(e!==void 0);y.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 h=y.useCallback(b=>{var g;if(d){const x=l5(b)?b(e):b;x!==e&&((g=u.current)==null||g.call(u,x))}else l(b)},[d,e,l,u]);return[f,h]}function o5({defaultProp:e,onChange:t}){const[r,s]=y.useState(e),i=y.useRef(r),l=y.useRef(t);return i5(()=>{l.current=t},[t]),y.useEffect(()=>{var u;i.current!==r&&((u=l.current)==null||u.call(l,r),i.current=r)},[r,i]),[r,s,l]}function l5(e){return typeof e=="function"}function c5(e){const t=u5(e),r=y.forwardRef((s,i)=>{const{children:l,...u}=s,d=y.Children.toArray(l),f=d.find(f5);if(f){const h=f.props.children,b=d.map(g=>g===f?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:g);return m.jsx(t,{...u,ref:i,children:y.isValidElement(h)?y.cloneElement(h,void 0,b):null})}return m.jsx(t,{...u,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function u5(e){const t=y.forwardRef((r,s)=>{const{children:i,...l}=r;if(y.isValidElement(i)){const u=m5(i),d=h5(l,i.props);return i.type!==y.Fragment&&(d.ref=s?mn(s,u):u),y.cloneElement(i,d)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var d5=Symbol("radix.slottable");function f5(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===d5}function h5(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const f=l(...d);return i(...d),f}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function m5(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var p5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=p5.reduce((e,t)=>{const r=c5(`Primitive.${t}`),s=y.forwardRef((i,l)=>{const{asChild:u,...d}=i,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function LS(e,t){e&&Vl.flushSync(()=>e.dispatchEvent(t))}function _w(e){const t=g5(e),r=y.forwardRef((s,i)=>{const{children:l,...u}=s,d=y.Children.toArray(l),f=d.find(y5);if(f){const h=f.props.children,b=d.map(g=>g===f?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:g);return m.jsx(t,{...u,ref:i,children:y.isValidElement(h)?y.cloneElement(h,void 0,b):null})}return m.jsx(t,{...u,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function g5(e){const t=y.forwardRef((r,s)=>{const{children:i,...l}=r;if(y.isValidElement(i)){const u=x5(i),d=b5(l,i.props);return i.type!==y.Fragment&&(d.ref=s?mn(s,u):u),y.cloneElement(i,d)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var v5=Symbol("radix.slottable");function y5(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===v5}function b5(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const f=l(...d);return i(...d),f}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function x5(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function _g(e){const t=e+"CollectionProvider",[r,s]=or(t),[i,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:T,children:C}=S,R=fe.useRef(null),A=fe.useRef(new Map).current;return m.jsx(i,{scope:T,itemMap:A,collectionRef:R,children:C})};u.displayName=t;const d=e+"CollectionSlot",f=_w(d),h=fe.forwardRef((S,T)=>{const{scope:C,children:R}=S,A=l(d,C),D=Ye(T,A.collectionRef);return m.jsx(f,{ref:D,children:R})});h.displayName=d;const b=e+"CollectionItemSlot",g="data-radix-collection-item",x=_w(b),_=fe.forwardRef((S,T)=>{const{scope:C,children:R,...A}=S,D=fe.useRef(null),B=Ye(T,D),I=l(b,C);return fe.useEffect(()=>(I.itemMap.set(D,{ref:D,...A}),()=>void I.itemMap.delete(D))),m.jsx(x,{[g]:"",ref:B,children:R})});_.displayName=b;function E(S){const T=l(e+"CollectionConsumer",S);return fe.useCallback(()=>{const R=T.collectionRef.current;if(!R)return[];const A=Array.from(R.querySelectorAll(`[${g}]`));return Array.from(T.itemMap.values()).sort((I,L)=>A.indexOf(I.ref.current)-A.indexOf(L.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:u,Slot:h,ItemSlot:_},E,s]}var w5=y.createContext(void 0);function Fl(e){const t=y.useContext(w5);return e||t||"ltr"}function Qt(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)},[])}function _5(e,t=globalThis==null?void 0:globalThis.document){const r=Qt(e);y.useEffect(()=>{const s=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var S5="DismissableLayer",Ap="dismissableLayer.update",E5="dismissableLayer.pointerDownOutside",C5="dismissableLayer.focusOutside",Sw,zS=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kl=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...f}=e,h=y.useContext(zS),[b,g]=y.useState(null),x=(b==null?void 0:b.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=y.useState({}),E=Ye(t,L=>g(L)),S=Array.from(h.layers),[T]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=S.indexOf(T),R=b?S.indexOf(b):-1,A=h.layersWithOutsidePointerEventsDisabled.size>0,D=R>=C,B=A5(L=>{const H=L.target,Z=[...h.branches].some(ue=>ue.contains(H));!D||Z||(i==null||i(L),u==null||u(L),L.defaultPrevented||d==null||d())},x),I=R5(L=>{const H=L.target;[...h.branches].some(ue=>ue.contains(H))||(l==null||l(L),u==null||u(L),L.defaultPrevented||d==null||d())},x);return _5(L=>{R===h.layers.size-1&&(s==null||s(L),!L.defaultPrevented&&d&&(L.preventDefault(),d()))},x),y.useEffect(()=>{if(b)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Sw=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(b)),h.layers.add(b),Ew(),()=>{r&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=Sw)}},[b,x,r,h]),y.useEffect(()=>()=>{b&&(h.layers.delete(b),h.layersWithOutsidePointerEventsDisabled.delete(b),Ew())},[b,h]),y.useEffect(()=>{const L=()=>_({});return document.addEventListener(Ap,L),()=>document.removeEventListener(Ap,L)},[]),m.jsx(Ne.div,{...f,ref:E,style:{pointerEvents:A?D?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,I.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,B.onPointerDownCapture)})});Kl.displayName=S5;var T5="DismissableLayerBranch",N5=y.forwardRef((e,t)=>{const r=y.useContext(zS),s=y.useRef(null),i=Ye(t,s);return y.useEffect(()=>{const l=s.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),m.jsx(Ne.div,{...e,ref:i})});N5.displayName=T5;function A5(e,t=globalThis==null?void 0:globalThis.document){const r=Qt(e),s=y.useRef(!1),i=y.useRef(()=>{});return y.useEffect(()=>{const l=d=>{if(d.target&&!s.current){let f=function(){IS(E5,r,h,{discrete:!0})};const h={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=f,t.addEventListener("click",i.current,{once:!0})):f()}else t.removeEventListener("click",i.current);s.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function R5(e,t=globalThis==null?void 0:globalThis.document){const r=Qt(e),s=y.useRef(!1);return y.useEffect(()=>{const i=l=>{l.target&&!s.current&&IS(C5,r,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Ew(){const e=new CustomEvent(Ap);document.dispatchEvent(e)}function IS(e,t,r,{discrete:s}){const i=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),s?LS(i,l):i.dispatchEvent(l)}var $m=0;function Id(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Cw()),document.body.insertAdjacentElement("beforeend",e[1]??Cw()),$m++,()=>{$m===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),$m--}},[])}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 Bm="focusScope.autoFocusOnMount",Hm="focusScope.autoFocusOnUnmount",Tw={bubbles:!1,cancelable:!0},j5="FocusScope",Yl=y.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...u}=e,[d,f]=y.useState(null),h=Qt(i),b=Qt(l),g=y.useRef(null),x=Ye(t,S=>f(S)),_=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(s){let S=function(A){if(_.paused||!d)return;const D=A.target;d.contains(D)?g.current=D:Ka(g.current,{select:!0})},T=function(A){if(_.paused||!d)return;const D=A.relatedTarget;D!==null&&(d.contains(D)||Ka(g.current,{select:!0}))},C=function(A){if(document.activeElement===document.body)for(const B of A)B.removedNodes.length>0&&Ka(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",T);const R=new MutationObserver(C);return d&&R.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",T),R.disconnect()}}},[s,d,_.paused]),y.useEffect(()=>{if(d){Aw.add(_);const S=document.activeElement;if(!d.contains(S)){const C=new CustomEvent(Bm,Tw);d.addEventListener(Bm,h),d.dispatchEvent(C),C.defaultPrevented||(k5(L5(US(d)),{select:!0}),document.activeElement===S&&Ka(d))}return()=>{d.removeEventListener(Bm,h),setTimeout(()=>{const C=new CustomEvent(Hm,Tw);d.addEventListener(Hm,b),d.dispatchEvent(C),C.defaultPrevented||Ka(S??document.body,{select:!0}),d.removeEventListener(Hm,b),Aw.remove(_)},0)}}},[d,h,b,_]);const E=y.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 R=S.currentTarget,[A,D]=O5(R);A&&D?!S.shiftKey&&C===D?(S.preventDefault(),r&&Ka(A,{select:!0})):S.shiftKey&&C===A&&(S.preventDefault(),r&&Ka(D,{select:!0})):C===R&&S.preventDefault()}},[r,s,_.paused]);return m.jsx(Ne.div,{tabIndex:-1,...u,ref:x,onKeyDown:E})});Yl.displayName=j5;function k5(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(Ka(s,{select:t}),document.activeElement!==r)return}function O5(e){const t=US(e),r=Nw(t,e),s=Nw(t.reverse(),e);return[r,s]}function US(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Nw(e,t){for(const r of e)if(!M5(r,{upTo:t}))return r}function M5(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 D5(e){return e instanceof HTMLInputElement&&"select"in e}function Ka(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&D5(e)&&t&&e.select()}}var Aw=P5();function P5(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Rw(e,t),e.unshift(t)},remove(t){var r;e=Rw(e,t),(r=e[0])==null||r.resume()}}}function Rw(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function L5(e){return e.filter(t=>t.tagName!=="A")}var z5=rg[" useId ".trim().toString()]||(()=>{}),I5=0;function on(e){const[t,r]=y.useState(z5());return Ht(()=>{r(s=>s??String(I5++))},[e]),t?`radix-${t}`:""}const U5=["top","right","bottom","left"],rs=Math.min,Hn=Math.max,pd=Math.round,ju=Math.floor,Dr=e=>({x:e,y:e}),$5={left:"right",right:"left",bottom:"top",top:"bottom"};function Rp(e,t,r){return Hn(e,rs(t,r))}function ha(e,t){return typeof e=="function"?e(t):e}function ma(e){return e.split("-")[0]}function ho(e){return e.split("-")[1]}function Sg(e){return e==="x"?"y":"x"}function Eg(e){return e==="y"?"height":"width"}function Or(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Cg(e){return Sg(Or(e))}function B5(e,t,r){r===void 0&&(r=!1);const s=ho(e),i=Cg(e),l=Eg(i);let u=i==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=gd(u)),[u,gd(u)]}function H5(e){const t=gd(e);return[jp(e),t,jp(t)]}function jp(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const jw=["left","right"],kw=["right","left"],q5=["top","bottom"],V5=["bottom","top"];function G5(e,t,r){switch(e){case"top":case"bottom":return r?t?kw:jw:t?jw:kw;case"left":case"right":return t?q5:V5;default:return[]}}function F5(e,t,r,s){const i=ho(e);let l=G5(ma(e),r==="start",s);return i&&(l=l.map(u=>u+"-"+i),t&&(l=l.concat(l.map(jp)))),l}function gd(e){const t=ma(e);return $5[t]+e.slice(t.length)}function K5(e){return{top:0,right:0,bottom:0,left:0,...e}}function $S(e){return typeof e!="number"?K5(e):{top:e,right:e,bottom:e,left:e}}function vd(e){const{x:t,y:r,width:s,height:i}=e;return{width:s,height:i,top:r,left:t,right:t+s,bottom:r+i,x:t,y:r}}function Ow(e,t,r){let{reference:s,floating:i}=e;const l=Or(t),u=Cg(t),d=Eg(u),f=ma(t),h=l==="y",b=s.x+s.width/2-i.width/2,g=s.y+s.height/2-i.height/2,x=s[d]/2-i[d]/2;let _;switch(f){case"top":_={x:b,y:s.y-i.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-i.width,y:g};break;default:_={x:s.x,y:s.y}}switch(ho(t)){case"start":_[u]-=x*(r&&h?-1:1);break;case"end":_[u]+=x*(r&&h?-1:1);break}return _}async function Y5(e,t){var r;t===void 0&&(t={});const{x:s,y:i,platform:l,rects:u,elements:d,strategy:f}=e,{boundary:h="clippingAncestors",rootBoundary:b="viewport",elementContext:g="floating",altBoundary:x=!1,padding:_=0}=ha(t,e),E=$S(_),T=d[x?g==="floating"?"reference":"floating":g],C=vd(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:h,rootBoundary:b,strategy:f})),R=g==="floating"?{x:s,y:i,width:u.floating.width,height:u.floating.height}:u.reference,A=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),D=await(l.isElement==null?void 0:l.isElement(A))?await(l.getScale==null?void 0:l.getScale(A))||{x:1,y:1}:{x:1,y:1},B=vd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:R,offsetParent:A,strategy:f}):R);return{top:(C.top-B.top+E.top)/D.y,bottom:(B.bottom-C.bottom+E.bottom)/D.y,left:(C.left-B.left+E.left)/D.x,right:(B.right-C.right+E.right)/D.x}}const W5=50,X5=async(e,t,r)=>{const{placement:s="bottom",strategy:i="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:Y5},f=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:b,y:g}=Ow(h,s,f),x=s,_=0;const E={};for(let S=0;S<l.length;S++){const T=l[S];if(!T)continue;const{name:C,fn:R}=T,{x:A,y:D,data:B,reset:I}=await R({x:b,y:g,initialPlacement:s,placement:x,strategy:i,middlewareData:E,rects:h,platform:d,elements:{reference:e,floating:t}});b=A??b,g=D??g,E[C]={...E[C],...B},I&&_<W5&&(_++,typeof I=="object"&&(I.placement&&(x=I.placement),I.rects&&(h=I.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):I.rects),{x:b,y:g}=Ow(h,x,f)),S=-1)}return{x:b,y:g,placement:x,strategy:i,middlewareData:E}},J5=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:i,rects:l,platform:u,elements:d,middlewareData:f}=t,{element:h,padding:b=0}=ha(e,t)||{};if(h==null)return{};const g=$S(b),x={x:r,y:s},_=Cg(i),E=Eg(_),S=await u.getDimensions(h),T=_==="y",C=T?"top":"left",R=T?"bottom":"right",A=T?"clientHeight":"clientWidth",D=l.reference[E]+l.reference[_]-x[_]-l.floating[E],B=x[_]-l.reference[_],I=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h));let L=I?I[A]:0;(!L||!await(u.isElement==null?void 0:u.isElement(I)))&&(L=d.floating[A]||l.floating[E]);const H=D/2-B/2,Z=L/2-S[E]/2-1,ue=rs(g[C],Z),ce=rs(g[R],Z),he=ue,de=L-S[E]-ce,me=L/2-S[E]/2+H,pe=Rp(he,me,de),j=!f.arrow&&ho(i)!=null&&me!==pe&&l.reference[E]/2-(me<he?ue:ce)-S[E]/2<0,K=j?me<he?me-he:me-de:0;return{[_]:x[_]+K,data:{[_]:pe,centerOffset:me-pe-K,...j&&{alignmentOffset:K}},reset:j}}}),Q5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:i,middlewareData:l,rects:u,initialPlacement:d,platform:f,elements:h}=t,{mainAxis:b=!0,crossAxis:g=!0,fallbackPlacements:x,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:S=!0,...T}=ha(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const C=ma(i),R=Or(d),A=ma(d)===d,D=await(f.isRTL==null?void 0:f.isRTL(h.floating)),B=x||(A||!S?[gd(d)]:H5(d)),I=E!=="none";!x&&I&&B.push(...F5(d,S,E,D));const L=[d,...B],H=await f.detectOverflow(t,T),Z=[];let ue=((s=l.flip)==null?void 0:s.overflows)||[];if(b&&Z.push(H[C]),g){const me=B5(i,u,D);Z.push(H[me[0]],H[me[1]])}if(ue=[...ue,{placement:i,overflows:Z}],!Z.every(me=>me<=0)){var ce,he;const me=(((ce=l.flip)==null?void 0:ce.index)||0)+1,pe=L[me];if(pe&&(!(g==="alignment"?R!==Or(pe):!1)||ue.every(W=>Or(W.placement)===R?W.overflows[0]>0:!0)))return{data:{index:me,overflows:ue},reset:{placement:pe}};let j=(he=ue.filter(K=>K.overflows[0]<=0).sort((K,W)=>K.overflows[1]-W.overflows[1])[0])==null?void 0:he.placement;if(!j)switch(_){case"bestFit":{var de;const K=(de=ue.filter(W=>{if(I){const J=Or(W.placement);return J===R||J==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(J=>J>0).reduce((J,G)=>J+G,0)]).sort((W,J)=>W[1]-J[1])[0])==null?void 0:de[0];K&&(j=K);break}case"initialPlacement":j=d;break}if(i!==j)return{reset:{placement:j}}}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 U5.some(t=>e[t]>=0)}const Z5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:i="referenceHidden",...l}=ha(e,t);switch(i){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{}}}}},BS=new Set(["left","top"]);async function eL(e,t){const{placement:r,platform:s,elements:i}=e,l=await(s.isRTL==null?void 0:s.isRTL(i.floating)),u=ma(r),d=ho(r),f=Or(r)==="y",h=BS.has(u)?-1:1,b=l&&f?-1:1,g=ha(t,e);let{mainAxis:x,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:x*h}:{x:x*h,y:_*b}}const tL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:i,y:l,placement:u,middlewareData:d}=t,f=await eL(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:i+f.x,y:l+f.y,data:{...f,placement:u}}}}},nL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:i,platform:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:f={fn:C=>{let{x:R,y:A}=C;return{x:R,y:A}}},...h}=ha(e,t),b={x:r,y:s},g=await l.detectOverflow(t,h),x=Or(ma(i)),_=Sg(x);let E=b[_],S=b[x];if(u){const C=_==="y"?"top":"left",R=_==="y"?"bottom":"right",A=E+g[C],D=E-g[R];E=Rp(A,E,D)}if(d){const C=x==="y"?"top":"left",R=x==="y"?"bottom":"right",A=S+g[C],D=S-g[R];S=Rp(A,S,D)}const T=f.fn({...t,[_]:E,[x]:S});return{...T,data:{x:T.x-r,y:T.y-s,enabled:{[_]:u,[x]:d}}}}}},rL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:i,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:f=!0,crossAxis:h=!0}=ha(e,t),b={x:r,y:s},g=Or(i),x=Sg(g);let _=b[x],E=b[g];const S=ha(d,t),T=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(f){const A=x==="y"?"height":"width",D=l.reference[x]-l.floating[A]+T.mainAxis,B=l.reference[x]+l.reference[A]-T.mainAxis;_<D?_=D:_>B&&(_=B)}if(h){var C,R;const A=x==="y"?"width":"height",D=BS.has(ma(i)),B=l.reference[g]-l.floating[A]+(D&&((C=u.offset)==null?void 0:C[g])||0)+(D?0:T.crossAxis),I=l.reference[g]+l.reference[A]+(D?0:((R=u.offset)==null?void 0:R[g])||0)-(D?T.crossAxis:0);E<B?E=B:E>I&&(E=I)}return{[x]:_,[g]:E}}}},aL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:i,rects:l,platform:u,elements:d}=t,{apply:f=()=>{},...h}=ha(e,t),b=await u.detectOverflow(t,h),g=ma(i),x=ho(i),_=Or(i)==="y",{width:E,height:S}=l.floating;let T,C;g==="top"||g==="bottom"?(T=g,C=x===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,T=x==="end"?"top":"bottom");const R=S-b.top-b.bottom,A=E-b.left-b.right,D=rs(S-b[T],R),B=rs(E-b[C],A),I=!t.middlewareData.shift;let L=D,H=B;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(H=A),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(L=R),I&&!x){const ue=Hn(b.left,0),ce=Hn(b.right,0),he=Hn(b.top,0),de=Hn(b.bottom,0);_?H=E-2*(ue!==0||ce!==0?ue+ce:Hn(b.left,b.right)):L=S-2*(he!==0||de!==0?he+de:Hn(b.top,b.bottom))}await f({...t,availableWidth:H,availableHeight:L});const Z=await u.getDimensions(d.floating);return E!==Z.width||S!==Z.height?{reset:{rects:!0}}:{}}}};function Ud(){return typeof window<"u"}function mo(e){return HS(e)?(e.nodeName||"").toLowerCase():"#document"}function Vn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function zr(e){var t;return(t=(HS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function HS(e){return Ud()?e instanceof Node||e instanceof Vn(e).Node:!1}function br(e){return Ud()?e instanceof Element||e instanceof Vn(e).Element:!1}function ba(e){return Ud()?e instanceof HTMLElement||e instanceof Vn(e).HTMLElement:!1}function Pw(e){return!Ud()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Vn(e).ShadowRoot}function Wl(e){const{overflow:t,overflowX:r,overflowY:s,display:i}=xr(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&i!=="inline"&&i!=="contents"}function sL(e){return/^(table|td|th)$/.test(mo(e))}function $d(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const iL=/transform|translate|scale|rotate|perspective|filter/,oL=/paint|layout|strict|content/,ks=e=>!!e&&e!=="none";let qm;function Tg(e){const t=br(e)?xr(e):e;return ks(t.transform)||ks(t.translate)||ks(t.scale)||ks(t.rotate)||ks(t.perspective)||!Ng()&&(ks(t.backdropFilter)||ks(t.filter))||iL.test(t.willChange||"")||oL.test(t.contain||"")}function lL(e){let t=as(e);for(;ba(t)&&!ro(t);){if(Tg(t))return t;if($d(t))return null;t=as(t)}return null}function Ng(){return qm==null&&(qm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),qm}function ro(e){return/^(html|body|#document)$/.test(mo(e))}function xr(e){return Vn(e).getComputedStyle(e)}function Bd(e){return br(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function as(e){if(mo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pw(e)&&e.host||zr(e);return Pw(t)?t.host:t}function qS(e){const t=as(e);return ro(t)?e.ownerDocument?e.ownerDocument.body:e.body:ba(t)&&Wl(t)?t:qS(t)}function Dl(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=qS(e),l=i===((s=e.ownerDocument)==null?void 0:s.body),u=Vn(i);if(l){const d=kp(u);return t.concat(u,u.visualViewport||[],Wl(i)?i:[],d&&r?Dl(d):[])}else return t.concat(i,Dl(i,[],r))}function kp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function VS(e){const t=xr(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=ba(e),l=i?e.offsetWidth:r,u=i?e.offsetHeight:s,d=pd(r)!==l||pd(s)!==u;return d&&(r=l,s=u),{width:r,height:s,$:d}}function Ag(e){return br(e)?e:e.contextElement}function Qi(e){const t=Ag(e);if(!ba(t))return Dr(1);const r=t.getBoundingClientRect(),{width:s,height:i,$:l}=VS(t);let u=(l?pd(r.width):r.width)/s,d=(l?pd(r.height):r.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const cL=Dr(0);function GS(e){const t=Vn(e);return!Ng()||!t.visualViewport?cL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uL(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Vn(e)?!1:t}function $s(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),l=Ag(e);let u=Dr(1);t&&(s?br(s)&&(u=Qi(s)):u=Qi(e));const d=uL(l,r,s)?GS(l):Dr(0);let f=(i.left+d.x)/u.x,h=(i.top+d.y)/u.y,b=i.width/u.x,g=i.height/u.y;if(l){const x=Vn(l),_=s&&br(s)?Vn(s):s;let E=x,S=kp(E);for(;S&&s&&_!==E;){const T=Qi(S),C=S.getBoundingClientRect(),R=xr(S),A=C.left+(S.clientLeft+parseFloat(R.paddingLeft))*T.x,D=C.top+(S.clientTop+parseFloat(R.paddingTop))*T.y;f*=T.x,h*=T.y,b*=T.x,g*=T.y,f+=A,h+=D,E=Vn(S),S=kp(E)}}return vd({width:b,height:g,x:f,y:h})}function Hd(e,t){const r=Bd(e).scrollLeft;return t?t.left+r:$s(zr(e)).left+r}function FS(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-Hd(e,r),i=r.top+t.scrollTop;return{x:s,y:i}}function dL(e){let{elements:t,rect:r,offsetParent:s,strategy:i}=e;const l=i==="fixed",u=zr(s),d=t?$d(t.floating):!1;if(s===u||d&&l)return r;let f={scrollLeft:0,scrollTop:0},h=Dr(1);const b=Dr(0),g=ba(s);if((g||!g&&!l)&&((mo(s)!=="body"||Wl(u))&&(f=Bd(s)),g)){const _=$s(s);h=Qi(s),b.x=_.x+s.clientLeft,b.y=_.y+s.clientTop}const x=u&&!g&&!l?FS(u,f):Dr(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-f.scrollLeft*h.x+b.x+x.x,y:r.y*h.y-f.scrollTop*h.y+b.y+x.y}}function fL(e){return Array.from(e.getClientRects())}function hL(e){const t=zr(e),r=Bd(e),s=e.ownerDocument.body,i=Hn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=Hn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-r.scrollLeft+Hd(e);const d=-r.scrollTop;return xr(s).direction==="rtl"&&(u+=Hn(t.clientWidth,s.clientWidth)-i),{width:i,height:l,x:u,y:d}}const Lw=25;function mL(e,t){const r=Vn(e),s=zr(e),i=r.visualViewport;let l=s.clientWidth,u=s.clientHeight,d=0,f=0;if(i){l=i.width,u=i.height;const b=Ng();(!b||b&&t==="fixed")&&(d=i.offsetLeft,f=i.offsetTop)}const h=Hd(s);if(h<=0){const b=s.ownerDocument,g=b.body,x=getComputedStyle(g),_=b.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,E=Math.abs(s.clientWidth-g.clientWidth-_);E<=Lw&&(l-=E)}else h<=Lw&&(l+=h);return{width:l,height:u,x:d,y:f}}function pL(e,t){const r=$s(e,!0,t==="fixed"),s=r.top+e.clientTop,i=r.left+e.clientLeft,l=ba(e)?Qi(e):Dr(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,f=i*l.x,h=s*l.y;return{width:u,height:d,x:f,y:h}}function zw(e,t,r){let s;if(t==="viewport")s=mL(e,r);else if(t==="document")s=hL(zr(e));else if(br(t))s=pL(t,r);else{const i=GS(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return vd(s)}function KS(e,t){const r=as(e);return r===t||!br(r)||ro(r)?!1:xr(r).position==="fixed"||KS(r,t)}function gL(e,t){const r=t.get(e);if(r)return r;let s=Dl(e,[],!1).filter(d=>br(d)&&mo(d)!=="body"),i=null;const l=xr(e).position==="fixed";let u=l?as(e):e;for(;br(u)&&!ro(u);){const d=xr(u),f=Tg(u);!f&&d.position==="fixed"&&(i=null),(l?!f&&!i:!f&&d.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Wl(u)&&!f&&KS(e,u))?s=s.filter(b=>b!==u):i=d,u=as(u)}return t.set(e,s),s}function vL(e){let{element:t,boundary:r,rootBoundary:s,strategy:i}=e;const u=[...r==="clippingAncestors"?$d(t)?[]:gL(t,this._c):[].concat(r),s],d=zw(t,u[0],i);let f=d.top,h=d.right,b=d.bottom,g=d.left;for(let x=1;x<u.length;x++){const _=zw(t,u[x],i);f=Hn(_.top,f),h=rs(_.right,h),b=rs(_.bottom,b),g=Hn(_.left,g)}return{width:h-g,height:b-f,x:g,y:f}}function yL(e){const{width:t,height:r}=VS(e);return{width:t,height:r}}function bL(e,t,r){const s=ba(t),i=zr(t),l=r==="fixed",u=$s(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const f=Dr(0);function h(){f.x=Hd(i)}if(s||!s&&!l)if((mo(t)!=="body"||Wl(i))&&(d=Bd(t)),s){const _=$s(t,!0,l,t);f.x=_.x+t.clientLeft,f.y=_.y+t.clientTop}else i&&h();l&&!s&&i&&h();const b=i&&!s&&!l?FS(i,d):Dr(0),g=u.left+d.scrollLeft-f.x-b.x,x=u.top+d.scrollTop-f.y-b.y;return{x:g,y:x,width:u.width,height:u.height}}function Vm(e){return xr(e).position==="static"}function Iw(e,t){if(!ba(e)||xr(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return zr(e)===r&&(r=r.ownerDocument.body),r}function YS(e,t){const r=Vn(e);if($d(e))return r;if(!ba(e)){let i=as(e);for(;i&&!ro(i);){if(br(i)&&!Vm(i))return i;i=as(i)}return r}let s=Iw(e,t);for(;s&&sL(s)&&Vm(s);)s=Iw(s,t);return s&&ro(s)&&Vm(s)&&!Tg(s)?r:s||lL(e)||r}const xL=async function(e){const t=this.getOffsetParent||YS,r=this.getDimensions,s=await r(e.floating);return{reference:bL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function wL(e){return xr(e).direction==="rtl"}const _L={convertOffsetParentRelativeRectToViewportRelativeRect:dL,getDocumentElement:zr,getClippingRect:vL,getOffsetParent:YS,getElementRects:xL,getClientRects:fL,getDimensions:yL,getScale:Qi,isElement:br,isRTL:wL};function WS(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function SL(e,t){let r=null,s;const i=zr(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 h=e.getBoundingClientRect(),{left:b,top:g,width:x,height:_}=h;if(d||t(),!x||!_)return;const E=ju(g),S=ju(i.clientWidth-(b+x)),T=ju(i.clientHeight-(g+_)),C=ju(b),A={rootMargin:-E+"px "+-S+"px "+-T+"px "+-C+"px",threshold:Hn(0,rs(1,f))||1};let D=!0;function B(I){const L=I[0].intersectionRatio;if(L!==f){if(!D)return u();L?u(!1,L):s=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!WS(h,e.getBoundingClientRect())&&u(),D=!1}try{r=new IntersectionObserver(B,{...A,root:i.ownerDocument})}catch{r=new IntersectionObserver(B,A)}r.observe(e)}return u(!0),l}function EL(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:f=!1}=s,h=Ag(e),b=i||l?[...h?Dl(h):[],...t?Dl(t):[]]:[];b.forEach(C=>{i&&C.addEventListener("scroll",r,{passive:!0}),l&&C.addEventListener("resize",r)});const g=h&&d?SL(h,r):null;let x=-1,_=null;u&&(_=new ResizeObserver(C=>{let[R]=C;R&&R.target===h&&_&&t&&(_.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var A;(A=_)==null||A.observe(t)})),r()}),h&&!f&&_.observe(h),t&&_.observe(t));let E,S=f?$s(e):null;f&&T();function T(){const C=$s(e);S&&!WS(S,C)&&r(),S=C,E=requestAnimationFrame(T)}return r(),()=>{var C;b.forEach(R=>{i&&R.removeEventListener("scroll",r),l&&R.removeEventListener("resize",r)}),g==null||g(),(C=_)==null||C.disconnect(),_=null,f&&cancelAnimationFrame(E)}}const CL=tL,TL=nL,NL=Q5,AL=aL,RL=Z5,Uw=J5,jL=rL,kL=(e,t,r)=>{const s=new Map,i={platform:_L,...r},l={...i.platform,_c:s};return X5(e,t,{...i,platform:l})};var OL=typeof document<"u",ML=function(){},Xu=OL?y.useLayoutEffect:ML;function yd(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,i;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(!yd(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=r;s--!==0;){const l=i[s];if(!(l==="_owner"&&e.$$typeof)&&!yd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function XS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $w(e,t){const r=XS(e);return Math.round(t*r)/r}function Gm(e){const t=y.useRef(e);return Xu(()=>{t.current=e}),t}function DL(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:i,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:f,open:h}=e,[b,g]=y.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[x,_]=y.useState(s);yd(x,s)||_(s);const[E,S]=y.useState(null),[T,C]=y.useState(null),R=y.useCallback(W=>{W!==I.current&&(I.current=W,S(W))},[]),A=y.useCallback(W=>{W!==L.current&&(L.current=W,C(W))},[]),D=l||E,B=u||T,I=y.useRef(null),L=y.useRef(null),H=y.useRef(b),Z=f!=null,ue=Gm(f),ce=Gm(i),he=Gm(h),de=y.useCallback(()=>{if(!I.current||!L.current)return;const W={placement:t,strategy:r,middleware:x};ce.current&&(W.platform=ce.current),kL(I.current,L.current,W).then(J=>{const G={...J,isPositioned:he.current!==!1};me.current&&!yd(H.current,G)&&(H.current=G,Vl.flushSync(()=>{g(G)}))})},[x,t,r,ce,he]);Xu(()=>{h===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,g(W=>({...W,isPositioned:!1})))},[h]);const me=y.useRef(!1);Xu(()=>(me.current=!0,()=>{me.current=!1}),[]),Xu(()=>{if(D&&(I.current=D),B&&(L.current=B),D&&B){if(ue.current)return ue.current(D,B,de);de()}},[D,B,de,ue,Z]);const pe=y.useMemo(()=>({reference:I,floating:L,setReference:R,setFloating:A}),[R,A]),j=y.useMemo(()=>({reference:D,floating:B}),[D,B]),K=y.useMemo(()=>{const W={position:r,left:0,top:0};if(!j.floating)return W;const J=$w(j.floating,b.x),G=$w(j.floating,b.y);return d?{...W,transform:"translate("+J+"px, "+G+"px)",...XS(j.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:J,top:G}},[r,d,j.floating,b.x,b.y]);return y.useMemo(()=>({...b,update:de,refs:pe,elements:j,floatingStyles:K}),[b,de,pe,j,K])}const PL=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:i}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?Uw({element:s.current,padding:i}).fn(r):{}:s?Uw({element:s,padding:i}).fn(r):{}}}},LL=(e,t)=>{const r=CL(e);return{name:r.name,fn:r.fn,options:[e,t]}},zL=(e,t)=>{const r=TL(e);return{name:r.name,fn:r.fn,options:[e,t]}},IL=(e,t)=>({fn:jL(e).fn,options:[e,t]}),UL=(e,t)=>{const r=NL(e);return{name:r.name,fn:r.fn,options:[e,t]}},$L=(e,t)=>{const r=AL(e);return{name:r.name,fn:r.fn,options:[e,t]}},BL=(e,t)=>{const r=RL(e);return{name:r.name,fn:r.fn,options:[e,t]}},HL=(e,t)=>{const r=PL(e);return{name:r.name,fn:r.fn,options:[e,t]}};var qL="Arrow",JS=y.forwardRef((e,t)=>{const{children:r,width:s=10,height:i=5,...l}=e;return m.jsx(Ne.svg,{...l,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});JS.displayName=qL;var VL=JS;function Rg(e){const[t,r]=y.useState(void 0);return Ht(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const l=i[0];let u,d;if("borderBoxSize"in l){const f=l.borderBoxSize,h=Array.isArray(f)?f[0]:f;u=h.inlineSize,d=h.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 jg="Popper",[QS,po]=or(jg),[GL,ZS]=QS(jg),e1=e=>{const{__scopePopper:t,children:r}=e,[s,i]=y.useState(null);return m.jsx(GL,{scope:t,anchor:s,onAnchorChange:i,children:r})};e1.displayName=jg;var t1="PopperAnchor",n1=y.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...i}=e,l=ZS(t1,r),u=y.useRef(null),d=Ye(t,u),f=y.useRef(null);return y.useEffect(()=>{const h=f.current;f.current=(s==null?void 0:s.current)||u.current,h!==f.current&&l.onAnchorChange(f.current)}),s?null:m.jsx(Ne.div,{...i,ref:d})});n1.displayName=t1;var kg="PopperContent",[FL,KL]=QS(kg),r1=y.forwardRef((e,t)=>{var te,ee,se,Se,Te,Re;const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:f=!0,collisionBoundary:h=[],collisionPadding:b=0,sticky:g="partial",hideWhenDetached:x=!1,updatePositionStrategy:_="optimized",onPlaced:E,...S}=e,T=ZS(kg,r),[C,R]=y.useState(null),A=Ye(t,nt=>R(nt)),[D,B]=y.useState(null),I=Rg(D),L=(I==null?void 0:I.width)??0,H=(I==null?void 0:I.height)??0,Z=s+(l!=="center"?"-"+l:""),ue=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},ce=Array.isArray(h)?h:[h],he=ce.length>0,de={padding:ue,boundary:ce.filter(WL),altBoundary:he},{refs:me,floatingStyles:pe,placement:j,isPositioned:K,middlewareData:W}=DL({strategy:"fixed",placement:Z,whileElementsMounted:(...nt)=>EL(...nt,{animationFrame:_==="always"}),elements:{reference:T.anchor},middleware:[LL({mainAxis:i+H,alignmentAxis:u}),f&&zL({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?IL():void 0,...de}),f&&UL({...de}),$L({...de,apply:({elements:nt,rects:Ze,availableWidth:xt,availableHeight:oe})=>{const{width:je,height:Ve}=Ze.reference,$e=nt.floating.style;$e.setProperty("--radix-popper-available-width",`${xt}px`),$e.setProperty("--radix-popper-available-height",`${oe}px`),$e.setProperty("--radix-popper-anchor-width",`${je}px`),$e.setProperty("--radix-popper-anchor-height",`${Ve}px`)}}),D&&HL({element:D,padding:d}),XL({arrowWidth:L,arrowHeight:H}),x&&BL({strategy:"referenceHidden",...de})]}),[J,G]=i1(j),k=Qt(E);Ht(()=>{K&&(k==null||k())},[K,k]);const O=(te=W.arrow)==null?void 0:te.x,U=(ee=W.arrow)==null?void 0:ee.y,Y=((se=W.arrow)==null?void 0:se.centerOffset)!==0,[$,re]=y.useState();return Ht(()=>{C&&re(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:me.setFloating,"data-radix-popper-content-wrapper":"",style:{...pe,transform:K?pe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$,"--radix-popper-transform-origin":[(Se=W.transformOrigin)==null?void 0:Se.x,(Te=W.transformOrigin)==null?void 0:Te.y].join(" "),...((Re=W.hide)==null?void 0:Re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(FL,{scope:r,placedSide:J,onArrowChange:B,arrowX:O,arrowY:U,shouldHideArrow:Y,children:m.jsx(Ne.div,{"data-side":J,"data-align":G,...S,ref:A,style:{...S.style,animation:K?void 0:"none"}})})})});r1.displayName=kg;var a1="PopperArrow",YL={top:"bottom",right:"left",bottom:"top",left:"right"},s1=y.forwardRef(function(t,r){const{__scopePopper:s,...i}=t,l=KL(a1,s),u=YL[l.placedSide];return m.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:m.jsx(VL,{...i,ref:r,style:{...i.style,display:"block"}})})});s1.displayName=a1;function WL(e){return e!==null}var XL=e=>({name:"transformOrigin",options:e,fn(t){var T,C,R;const{placement:r,rects:s,middlewareData:i}=t,u=((T=i.arrow)==null?void 0:T.centerOffset)!==0,d=u?0:e.arrowWidth,f=u?0:e.arrowHeight,[h,b]=i1(r),g={start:"0%",center:"50%",end:"100%"}[b],x=(((C=i.arrow)==null?void 0:C.x)??0)+d/2,_=(((R=i.arrow)==null?void 0:R.y)??0)+f/2;let E="",S="";return h==="bottom"?(E=u?g:`${x}px`,S=`${-f}px`):h==="top"?(E=u?g:`${x}px`,S=`${s.floating.height+f}px`):h==="right"?(E=`${-f}px`,S=u?g:`${_}px`):h==="left"&&(E=`${s.floating.width+f}px`,S=u?g:`${_}px`),{data:{x:E,y:S}}}});function i1(e){const[t,r="center"]=e.split("-");return[t,r]}var Og=e1,qd=n1,Mg=r1,Dg=s1,JL="Portal",Xl=y.forwardRef((e,t)=>{var d;const{container:r,...s}=e,[i,l]=y.useState(!1);Ht(()=>l(!0),[]);const u=r||i&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?B_.createPortal(m.jsx(Ne.div,{...s,ref:t}),u):null});Xl.displayName=JL;function QL(e,t){return y.useReducer((r,s)=>t[r][s]??r,e)}var fn=e=>{const{present:t,children:r}=e,s=ZL(t),i=typeof r=="function"?r({present:s.isPresent}):y.Children.only(r),l=Ye(s.ref,e3(i));return typeof r=="function"||s.isPresent?y.cloneElement(i,{ref:l}):null};fn.displayName="Presence";function ZL(e){const[t,r]=y.useState(),s=y.useRef(null),i=y.useRef(e),l=y.useRef("none"),u=e?"mounted":"unmounted",[d,f]=QL(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const h=ku(s.current);l.current=d==="mounted"?h:"none"},[d]),Ht(()=>{const h=s.current,b=i.current;if(b!==e){const x=l.current,_=ku(h);e?f("MOUNT"):_==="none"||(h==null?void 0:h.display)==="none"?f("UNMOUNT"):f(b&&x!==_?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,f]),Ht(()=>{if(t){let h;const b=t.ownerDocument.defaultView??window,g=_=>{const S=ku(s.current).includes(CSS.escape(_.animationName));if(_.target===t&&S&&(f("ANIMATION_END"),!i.current)){const T=t.style.animationFillMode;t.style.animationFillMode="forwards",h=b.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=T)})}},x=_=>{_.target===t&&(l.current=ku(s.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{b.clearTimeout(h),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:y.useCallback(h=>{s.current=h?getComputedStyle(h):null,r(h)},[])}}function ku(e){return(e==null?void 0:e.animationName)||"none"}function e3(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Fm="rovingFocusGroup.onEntryFocus",t3={bubbles:!1,cancelable:!0},Jl="RovingFocusGroup",[Op,o1,n3]=_g(Jl),[r3,Vd]=or(Jl,[n3]),[a3,s3]=r3(Jl),l1=y.forwardRef((e,t)=>m.jsx(Op.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(Op.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(i3,{...e,ref:t})})}));l1.displayName=Jl;var i3=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:i=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:f,onEntryFocus:h,preventScrollOnEntryFocus:b=!1,...g}=e,x=y.useRef(null),_=Ye(t,x),E=Fl(l),[S,T]=fa({prop:u,defaultProp:d??null,onChange:f,caller:Jl}),[C,R]=y.useState(!1),A=Qt(h),D=o1(r),B=y.useRef(!1),[I,L]=y.useState(0);return y.useEffect(()=>{const H=x.current;if(H)return H.addEventListener(Fm,A),()=>H.removeEventListener(Fm,A)},[A]),m.jsx(a3,{scope:r,orientation:s,dir:E,loop:i,currentTabStopId:S,onItemFocus:y.useCallback(H=>T(H),[T]),onItemShiftTab:y.useCallback(()=>R(!0),[]),onFocusableItemAdd:y.useCallback(()=>L(H=>H+1),[]),onFocusableItemRemove:y.useCallback(()=>L(H=>H-1),[]),children:m.jsx(Ne.div,{tabIndex:C||I===0?-1:0,"data-orientation":s,...g,ref:_,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{B.current=!0}),onFocus:ve(e.onFocus,H=>{const Z=!B.current;if(H.target===H.currentTarget&&Z&&!C){const ue=new CustomEvent(Fm,t3);if(H.currentTarget.dispatchEvent(ue),!ue.defaultPrevented){const ce=D().filter(j=>j.focusable),he=ce.find(j=>j.active),de=ce.find(j=>j.id===S),pe=[he,de,...ce].filter(Boolean).map(j=>j.ref.current);d1(pe,b)}}B.current=!1}),onBlur:ve(e.onBlur,()=>R(!1))})})}),c1="RovingFocusGroupItem",u1=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:i=!1,tabStopId:l,children:u,...d}=e,f=on(),h=l||f,b=s3(c1,r),g=b.currentTabStopId===h,x=o1(r),{onFocusableItemAdd:_,onFocusableItemRemove:E,currentTabStopId:S}=b;return y.useEffect(()=>{if(s)return _(),()=>E()},[s,_,E]),m.jsx(Op.ItemSlot,{scope:r,id:h,focusable:s,active:i,children:m.jsx(Ne.span,{tabIndex:g?0:-1,"data-orientation":b.orientation,...d,ref:t,onMouseDown:ve(e.onMouseDown,T=>{s?b.onItemFocus(h):T.preventDefault()}),onFocus:ve(e.onFocus,()=>b.onItemFocus(h)),onKeyDown:ve(e.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){b.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const C=c3(T,b.orientation,b.dir);if(C!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let A=x().filter(D=>D.focusable).map(D=>D.ref.current);if(C==="last")A.reverse();else if(C==="prev"||C==="next"){C==="prev"&&A.reverse();const D=A.indexOf(T.currentTarget);A=b.loop?u3(A,D+1):A.slice(D+1)}setTimeout(()=>d1(A))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:S!=null}):u})})});u1.displayName=c1;var o3={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function l3(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function c3(e,t,r){const s=l3(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return o3[s]}function d1(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function u3(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var f1=l1,h1=u1;function d3(e){const t=f3(e),r=y.forwardRef((s,i)=>{const{children:l,...u}=s,d=y.Children.toArray(l),f=d.find(m3);if(f){const h=f.props.children,b=d.map(g=>g===f?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:g);return m.jsx(t,{...u,ref:i,children:y.isValidElement(h)?y.cloneElement(h,void 0,b):null})}return m.jsx(t,{...u,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function f3(e){const t=y.forwardRef((r,s)=>{const{children:i,...l}=r;if(y.isValidElement(i)){const u=g3(i),d=p3(l,i.props);return i.type!==y.Fragment&&(d.ref=s?mn(s,u):u),y.cloneElement(i,d)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var h3=Symbol("radix.slottable");function m3(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===h3}function p3(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const f=l(...d);return i(...d),f}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function g3(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var v3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ii=new WeakMap,Ou=new WeakMap,Mu={},Km=0,m1=function(e){return e&&(e.host||m1(e.parentNode))},y3=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=m1(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})},b3=function(e,t,r,s){var i=y3(t,Array.isArray(e)?e:[e]);Mu[r]||(Mu[r]=new WeakMap);var l=Mu[r],u=[],d=new Set,f=new Set(i),h=function(g){!g||d.has(g)||(d.add(g),h(g.parentNode))};i.forEach(h);var b=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(x){if(d.has(x))b(x);else try{var _=x.getAttribute(s),E=_!==null&&_!=="false",S=(Ii.get(x)||0)+1,T=(l.get(x)||0)+1;Ii.set(x,S),l.set(x,T),u.push(x),S===1&&E&&Ou.set(x,!0),T===1&&x.setAttribute(r,"true"),E||x.setAttribute(s,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return b(t),d.clear(),Km++,function(){u.forEach(function(g){var x=Ii.get(g)-1,_=l.get(g)-1;Ii.set(g,x),l.set(g,_),x||(Ou.has(g)||g.removeAttribute(s),Ou.delete(g)),_||g.removeAttribute(r)}),Km--,Km||(Ii=new WeakMap,Ii=new WeakMap,Ou=new WeakMap,Mu={})}},Gd=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=v3(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),b3(s,i,r,"aria-hidden")):function(){return null}},Ju="right-scroll-bar-position",Qu="width-before-scroll-bar",x3="with-scroll-bars-hidden",w3="--removed-body-scroll-bar-size";function Ym(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function _3(e,t){var r=y.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var i=r.value;i!==s&&(r.value=s,r.callback(s,i))}}}})[0];return r.callback=t,r.facade}var S3=typeof window<"u"?y.useLayoutEffect:y.useEffect,Bw=new WeakMap;function E3(e,t){var r=_3(null,function(s){return e.forEach(function(i){return Ym(i,s)})});return S3(function(){var s=Bw.get(r);if(s){var i=new Set(s),l=new Set(e),u=r.current;i.forEach(function(d){l.has(d)||Ym(d,null)}),l.forEach(function(d){i.has(d)||Ym(d,u)})}Bw.set(r,e)},[e]),r}function C3(e){return e}function T3(e,t){t===void 0&&(t=C3);var r=[],s=!1,i={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)},h=function(){return Promise.resolve().then(f)};h(),r={push:function(b){u.push(b),h()},filter:function(b){return u=u.filter(b),r}}}};return i}function N3(e){e===void 0&&(e={});var t=T3(null);return t.options=kr({async:!0,ssr:!1},e),t}var p1=function(e){var t=e.sideCar,r=uo(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 y.createElement(s,kr({},r))};p1.isSideCarExport=!0;function A3(e,t){return e.useMedium(t),p1}var g1=N3(),Wm=function(){},Fd=y.forwardRef(function(e,t){var r=y.useRef(null),s=y.useState({onScrollCapture:Wm,onWheelCapture:Wm,onTouchMoveCapture:Wm}),i=s[0],l=s[1],u=e.forwardProps,d=e.children,f=e.className,h=e.removeScrollBar,b=e.enabled,g=e.shards,x=e.sideCar,_=e.noRelative,E=e.noIsolation,S=e.inert,T=e.allowPinchZoom,C=e.as,R=C===void 0?"div":C,A=e.gapMode,D=uo(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),B=x,I=E3([r,t]),L=kr(kr({},D),i);return y.createElement(y.Fragment,null,b&&y.createElement(B,{sideCar:g1,removeScrollBar:h,shards:g,noRelative:_,noIsolation:E,inert:S,setCallbacks:l,allowPinchZoom:!!T,lockRef:r,gapMode:A}),u?y.cloneElement(y.Children.only(d),kr(kr({},L),{ref:I})):y.createElement(R,kr({},L,{className:f,ref:I}),d))});Fd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Fd.classNames={fullWidth:Qu,zeroRight:Ju};var R3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function j3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=R3();return t&&e.setAttribute("nonce",t),e}function k3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function O3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var M3=function(){var e=0,t=null;return{add:function(r){e==0&&(t=j3())&&(k3(t,r),O3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},D3=function(){var e=M3();return function(t,r){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},v1=function(){var e=D3(),t=function(r){var s=r.styles,i=r.dynamic;return e(s,i),null};return t},P3={left:0,top:0,right:0,gap:0},Xm=function(e){return parseInt(e||"",10)||0},L3=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Xm(r),Xm(s),Xm(i)]},z3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return P3;var t=L3(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])}},I3=v1(),Zi="data-scroll-locked",U3=function(e,t,r,s){var i=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
.`.concat(x3,` {
overflow: hidden `).concat(s,`;
padding-right: `).concat(d,"px ").concat(s,`;
}
body[`).concat(Zi,`] {
overflow: hidden `).concat(s,`;
overscroll-behavior: contain;
`).concat([t&&"position: relative ".concat(s,";"),r==="margin"&&`
padding-left: `.concat(i,`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(Qu,` {
margin-right: `).concat(d,"px ").concat(s,`;
}
.`).concat(Ju," .").concat(Ju,` {
right: 0 `).concat(s,`;
}
.`).concat(Qu," .").concat(Qu,` {
margin-right: 0 `).concat(s,`;
}
body[`).concat(Zi,`] {
`).concat(w3,": ").concat(d,`px;
}
`)},Hw=function(){var e=parseInt(document.body.getAttribute(Zi)||"0",10);return isFinite(e)?e:0},$3=function(){y.useEffect(function(){return document.body.setAttribute(Zi,(Hw()+1).toString()),function(){var e=Hw()-1;e<=0?document.body.removeAttribute(Zi):document.body.setAttribute(Zi,e.toString())}},[])},B3=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;$3();var l=y.useMemo(function(){return z3(i)},[i]);return y.createElement(I3,{styles:U3(l,!t,i,r?"":"!important")})},Mp=!1;if(typeof window<"u")try{var Du=Object.defineProperty({},"passive",{get:function(){return Mp=!0,!0}});window.addEventListener("test",Du,Du),window.removeEventListener("test",Du,Du)}catch{Mp=!1}var Ui=Mp?{passive:!1}:!1,H3=function(e){return e.tagName==="TEXTAREA"},y1=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!H3(e)&&r[t]==="visible")},q3=function(e){return y1(e,"overflowY")},V3=function(e){return y1(e,"overflowX")},qw=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=b1(e,s);if(i){var l=x1(e,s),u=l[1],d=l[2];if(u>d)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},G3=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},F3=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},b1=function(e,t){return e==="v"?q3(t):V3(t)},x1=function(e,t){return e==="v"?G3(t):F3(t)},K3=function(e,t){return e==="h"&&t==="rtl"?-1:1},Y3=function(e,t,r,s,i){var l=K3(e,window.getComputedStyle(t).direction),u=l*s,d=r.target,f=t.contains(d),h=!1,b=u>0,g=0,x=0;do{if(!d)break;var _=x1(e,d),E=_[0],S=_[1],T=_[2],C=S-T-l*E;(E||C)&&b1(e,d)&&(g+=C,x+=E);var R=d.parentNode;d=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!f&&d!==document.body||f&&(t.contains(d)||t===d));return(b&&Math.abs(g)<1||!b&&Math.abs(x)<1)&&(h=!0),h},Pu=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},W3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},X3=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},J3=0,$i=[];function Q3(e){var t=y.useRef([]),r=y.useRef([0,0]),s=y.useRef(),i=y.useState(J3++)[0],l=y.useState(v1)[0],u=y.useRef(e);y.useEffect(function(){u.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=Pk([e.lockRef.current],(e.shards||[]).map(Gw),!0).filter(Boolean);return S.forEach(function(T){return T.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var d=y.useCallback(function(S,T){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var C=Pu(S),R=r.current,A="deltaX"in S?S.deltaX:R[0]-C[0],D="deltaY"in S?S.deltaY:R[1]-C[1],B,I=S.target,L=Math.abs(A)>Math.abs(D)?"h":"v";if("touches"in S&&L==="h"&&I.type==="range")return!1;var H=window.getSelection(),Z=H&&H.anchorNode,ue=Z?Z===I||Z.contains(I):!1;if(ue)return!1;var ce=qw(L,I);if(!ce)return!0;if(ce?B=L:(B=L==="v"?"h":"v",ce=qw(L,I)),!ce)return!1;if(!s.current&&"changedTouches"in S&&(A||D)&&(s.current=B),!B)return!0;var he=s.current||B;return Y3(he,T,S,he==="h"?A:D)},[]),f=y.useCallback(function(S){var T=S;if(!(!$i.length||$i[$i.length-1]!==l)){var C="deltaY"in T?Vw(T):Pu(T),R=t.current.filter(function(B){return B.name===T.type&&(B.target===T.target||T.target===B.shadowParent)&&W3(B.delta,C)})[0];if(R&&R.should){T.cancelable&&T.preventDefault();return}if(!R){var A=(u.current.shards||[]).map(Gw).filter(Boolean).filter(function(B){return B.contains(T.target)}),D=A.length>0?d(T,A[0]):!u.current.noIsolation;D&&T.cancelable&&T.preventDefault()}}},[]),h=y.useCallback(function(S,T,C,R){var A={name:S,delta:T,target:C,should:R,shadowParent:Z3(C)};t.current.push(A),setTimeout(function(){t.current=t.current.filter(function(D){return D!==A})},1)},[]),b=y.useCallback(function(S){r.current=Pu(S),s.current=void 0},[]),g=y.useCallback(function(S){h(S.type,Vw(S),S.target,d(S,e.lockRef.current))},[]),x=y.useCallback(function(S){h(S.type,Pu(S),S.target,d(S,e.lockRef.current))},[]);y.useEffect(function(){return $i.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Ui),document.addEventListener("touchmove",f,Ui),document.addEventListener("touchstart",b,Ui),function(){$i=$i.filter(function(S){return S!==l}),document.removeEventListener("wheel",f,Ui),document.removeEventListener("touchmove",f,Ui),document.removeEventListener("touchstart",b,Ui)}},[]);var _=e.removeScrollBar,E=e.inert;return y.createElement(y.Fragment,null,E?y.createElement(l,{styles:X3(i)}):null,_?y.createElement(B3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Z3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const e4=A3(g1,Q3);var Ql=y.forwardRef(function(e,t){return y.createElement(Fd,kr({},e,{ref:t,sideCar:e4}))});Ql.classNames=Fd.classNames;var Dp=["Enter"," "],t4=["ArrowDown","PageUp","Home"],w1=["ArrowUp","PageDown","End"],n4=[...t4,...w1],r4={ltr:[...Dp,"ArrowRight"],rtl:[...Dp,"ArrowLeft"]},a4={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Zl="Menu",[Pl,s4,i4]=_g(Zl),[Fs,_1]=or(Zl,[i4,po,Vd]),Kd=po(),S1=Vd(),[o4,Ks]=Fs(Zl),[l4,ec]=Fs(Zl),E1=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:i,onOpenChange:l,modal:u=!0}=e,d=Kd(t),[f,h]=y.useState(null),b=y.useRef(!1),g=Qt(l),x=Fl(i);return y.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})}},[]),m.jsx(Og,{...d,children:m.jsx(o4,{scope:t,open:r,onOpenChange:g,content:f,onContentChange:h,children:m.jsx(l4,{scope:t,onClose:y.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:b,dir:x,modal:u,children:s})})})};E1.displayName=Zl;var c4="MenuAnchor",Pg=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,i=Kd(r);return m.jsx(qd,{...i,...s,ref:t})});Pg.displayName=c4;var Lg="MenuPortal",[u4,C1]=Fs(Lg,{forceMount:void 0}),T1=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:i}=e,l=Ks(Lg,t);return m.jsx(u4,{scope:t,forceMount:r,children:m.jsx(fn,{present:r||l.open,children:m.jsx(Xl,{asChild:!0,container:i,children:s})})})};T1.displayName=Lg;var sr="MenuContent",[d4,zg]=Fs(sr),N1=y.forwardRef((e,t)=>{const r=C1(sr,e.__scopeMenu),{forceMount:s=r.forceMount,...i}=e,l=Ks(sr,e.__scopeMenu),u=ec(sr,e.__scopeMenu);return m.jsx(Pl.Provider,{scope:e.__scopeMenu,children:m.jsx(fn,{present:s||l.open,children:m.jsx(Pl.Slot,{scope:e.__scopeMenu,children:u.modal?m.jsx(f4,{...i,ref:t}):m.jsx(h4,{...i,ref:t})})})})}),f4=y.forwardRef((e,t)=>{const r=Ks(sr,e.__scopeMenu),s=y.useRef(null),i=Ye(t,s);return y.useEffect(()=>{const l=s.current;if(l)return Gd(l)},[]),m.jsx(Ig,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ve(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),h4=y.forwardRef((e,t)=>{const r=Ks(sr,e.__scopeMenu);return m.jsx(Ig,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),m4=d3("MenuContent.ScrollLock"),Ig=y.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:f,onEscapeKeyDown:h,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:x,onDismiss:_,disableOutsideScroll:E,...S}=e,T=Ks(sr,r),C=ec(sr,r),R=Kd(r),A=S1(r),D=s4(r),[B,I]=y.useState(null),L=y.useRef(null),H=Ye(t,L,T.onContentChange),Z=y.useRef(0),ue=y.useRef(""),ce=y.useRef(0),he=y.useRef(null),de=y.useRef("right"),me=y.useRef(0),pe=E?Ql:y.Fragment,j=E?{as:m4,allowPinchZoom:!0}:void 0,K=J=>{var te,ee;const G=ue.current+J,k=D().filter(se=>!se.disabled),O=document.activeElement,U=(te=k.find(se=>se.ref.current===O))==null?void 0:te.textValue,Y=k.map(se=>se.textValue),$=T4(Y,G,U),re=(ee=k.find(se=>se.textValue===$))==null?void 0:ee.ref.current;(function se(Se){ue.current=Se,window.clearTimeout(Z.current),Se!==""&&(Z.current=window.setTimeout(()=>se(""),1e3))})(G),re&&setTimeout(()=>re.focus())};y.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Id();const W=y.useCallback(J=>{var k,O;return de.current===((k=he.current)==null?void 0:k.side)&&A4(J,(O=he.current)==null?void 0:O.area)},[]);return m.jsx(d4,{scope:r,searchRef:ue,onItemEnter:y.useCallback(J=>{W(J)&&J.preventDefault()},[W]),onItemLeave:y.useCallback(J=>{var G;W(J)||((G=L.current)==null||G.focus(),I(null))},[W]),onTriggerLeave:y.useCallback(J=>{W(J)&&J.preventDefault()},[W]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:y.useCallback(J=>{he.current=J},[]),children:m.jsx(pe,{...j,children:m.jsx(Yl,{asChild:!0,trapped:i,onMountAutoFocus:ve(l,J=>{var G;J.preventDefault(),(G=L.current)==null||G.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:m.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:x,onDismiss:_,children:m.jsx(f1,{asChild:!0,...A,dir:C.dir,orientation:"vertical",loop:s,currentTabStopId:B,onCurrentTabStopIdChange:I,onEntryFocus:ve(f,J=>{C.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Mg,{role:"menu","aria-orientation":"vertical","data-state":q1(T.open),"data-radix-menu-content":"",dir:C.dir,...R,...S,ref:H,style:{outline:"none",...S.style},onKeyDown:ve(S.onKeyDown,J=>{const k=J.target.closest("[data-radix-menu-content]")===J.currentTarget,O=J.ctrlKey||J.altKey||J.metaKey,U=J.key.length===1;k&&(J.key==="Tab"&&J.preventDefault(),!O&&U&&K(J.key));const Y=L.current;if(J.target!==Y||!n4.includes(J.key))return;J.preventDefault();const re=D().filter(te=>!te.disabled).map(te=>te.ref.current);w1.includes(J.key)&&re.reverse(),E4(re)}),onBlur:ve(e.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(Z.current),ue.current="")}),onPointerMove:ve(e.onPointerMove,Ll(J=>{const G=J.target,k=me.current!==J.clientX;if(J.currentTarget.contains(G)&&k){const O=J.clientX>me.current?"right":"left";de.current=O,me.current=J.clientX}}))})})})})})})});N1.displayName=sr;var p4="MenuGroup",Ug=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return m.jsx(Ne.div,{role:"group",...s,ref:t})});Ug.displayName=p4;var g4="MenuLabel",A1=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return m.jsx(Ne.div,{...s,ref:t})});A1.displayName=g4;var bd="MenuItem",Fw="menu.itemSelect",Yd=y.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...i}=e,l=y.useRef(null),u=ec(bd,e.__scopeMenu),d=zg(bd,e.__scopeMenu),f=Ye(t,l),h=y.useRef(!1),b=()=>{const g=l.current;if(!r&&g){const x=new CustomEvent(Fw,{bubbles:!0,cancelable:!0});g.addEventListener(Fw,_=>s==null?void 0:s(_),{once:!0}),LS(g,x),x.defaultPrevented?h.current=!1:u.onClose()}};return m.jsx(R1,{...i,ref:f,disabled:r,onClick:ve(e.onClick,b),onPointerDown:g=>{var x;(x=e.onPointerDown)==null||x.call(e,g),h.current=!0},onPointerUp:ve(e.onPointerUp,g=>{var x;h.current||(x=g.currentTarget)==null||x.click()}),onKeyDown:ve(e.onKeyDown,g=>{const x=d.searchRef.current!=="";r||x&&g.key===" "||Dp.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});Yd.displayName=bd;var R1=y.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:i,...l}=e,u=zg(bd,r),d=S1(r),f=y.useRef(null),h=Ye(t,f),[b,g]=y.useState(!1),[x,_]=y.useState("");return y.useEffect(()=>{const E=f.current;E&&_((E.textContent??"").trim())},[l.children]),m.jsx(Pl.ItemSlot,{scope:r,disabled:s,textValue:i??x,children:m.jsx(h1,{asChild:!0,...d,focusable:!s,children:m.jsx(Ne.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:h,onPointerMove:ve(e.onPointerMove,Ll(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ve(e.onPointerLeave,Ll(E=>u.onItemLeave(E))),onFocus:ve(e.onFocus,()=>g(!0)),onBlur:ve(e.onBlur,()=>g(!1))})})})}),v4="MenuCheckboxItem",j1=y.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...i}=e;return m.jsx(P1,{scope:e.__scopeMenu,checked:r,children:m.jsx(Yd,{role:"menuitemcheckbox","aria-checked":xd(r)?"mixed":r,...i,ref:t,"data-state":Bg(r),onSelect:ve(i.onSelect,()=>s==null?void 0:s(xd(r)?!0:!r),{checkForDefaultPrevented:!1})})})});j1.displayName=v4;var k1="MenuRadioGroup",[y4,b4]=Fs(k1,{value:void 0,onValueChange:()=>{}}),O1=y.forwardRef((e,t)=>{const{value:r,onValueChange:s,...i}=e,l=Qt(s);return m.jsx(y4,{scope:e.__scopeMenu,value:r,onValueChange:l,children:m.jsx(Ug,{...i,ref:t})})});O1.displayName=k1;var M1="MenuRadioItem",D1=y.forwardRef((e,t)=>{const{value:r,...s}=e,i=b4(M1,e.__scopeMenu),l=r===i.value;return m.jsx(P1,{scope:e.__scopeMenu,checked:l,children:m.jsx(Yd,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":Bg(l),onSelect:ve(s.onSelect,()=>{var u;return(u=i.onValueChange)==null?void 0:u.call(i,r)},{checkForDefaultPrevented:!1})})})});D1.displayName=M1;var $g="MenuItemIndicator",[P1,x4]=Fs($g,{checked:!1}),L1=y.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...i}=e,l=x4($g,r);return m.jsx(fn,{present:s||xd(l.checked)||l.checked===!0,children:m.jsx(Ne.span,{...i,ref:t,"data-state":Bg(l.checked)})})});L1.displayName=$g;var w4="MenuSeparator",z1=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return m.jsx(Ne.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});z1.displayName=w4;var _4="MenuArrow",I1=y.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,i=Kd(r);return m.jsx(Dg,{...i,...s,ref:t})});I1.displayName=_4;var S4="MenuSub",[k6,U1]=Fs(S4),pl="MenuSubTrigger",$1=y.forwardRef((e,t)=>{const r=Ks(pl,e.__scopeMenu),s=ec(pl,e.__scopeMenu),i=U1(pl,e.__scopeMenu),l=zg(pl,e.__scopeMenu),u=y.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:f}=l,h={__scopeMenu:e.__scopeMenu},b=y.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return y.useEffect(()=>b,[b]),y.useEffect(()=>{const g=d.current;return()=>{window.clearTimeout(g),f(null)}},[d,f]),m.jsx(Pg,{asChild:!0,...h,children:m.jsx(R1,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":q1(r.open),...e,ref:mn(t,i.onTriggerChange),onClick:g=>{var x;(x=e.onClick)==null||x.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ve(e.onPointerMove,Ll(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:ve(e.onPointerLeave,Ll(g=>{var _,E;b();const x=(_=r.content)==null?void 0:_.getBoundingClientRect();if(x){const S=(E=r.content)==null?void 0:E.dataset.side,T=S==="right",C=T?-5:5,R=x[T?"left":"right"],A=x[T?"right":"left"];l.onPointerGraceIntentChange({area:[{x:g.clientX+C,y:g.clientY},{x:R,y:x.top},{x:A,y:x.top},{x:A,y:x.bottom},{x:R,y:x.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:ve(e.onKeyDown,g=>{var _;const x=l.searchRef.current!=="";e.disabled||x&&g.key===" "||r4[s.dir].includes(g.key)&&(r.onOpenChange(!0),(_=r.content)==null||_.focus(),g.preventDefault())})})})});$1.displayName=pl;var B1="MenuSubContent",H1=y.forwardRef((e,t)=>{const r=C1(sr,e.__scopeMenu),{forceMount:s=r.forceMount,...i}=e,l=Ks(sr,e.__scopeMenu),u=ec(sr,e.__scopeMenu),d=U1(B1,e.__scopeMenu),f=y.useRef(null),h=Ye(t,f);return m.jsx(Pl.Provider,{scope:e.__scopeMenu,children:m.jsx(fn,{present:s||l.open,children:m.jsx(Pl.Slot,{scope:e.__scopeMenu,children:m.jsx(Ig,{id:d.contentId,"aria-labelledby":d.triggerId,...i,ref:h,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:ve(e.onFocusOutside,b=>{b.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:ve(e.onEscapeKeyDown,b=>{u.onClose(),b.preventDefault()}),onKeyDown:ve(e.onKeyDown,b=>{var _;const g=b.currentTarget.contains(b.target),x=a4[u.dir].includes(b.key);g&&x&&(l.onOpenChange(!1),(_=d.trigger)==null||_.focus(),b.preventDefault())})})})})})});H1.displayName=B1;function q1(e){return e?"open":"closed"}function xd(e){return e==="indeterminate"}function Bg(e){return xd(e)?"indeterminate":e?"checked":"unchecked"}function E4(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function C4(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function T4(e,t,r){const i=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=C4(e,Math.max(l,0));i.length===1&&(u=u.filter(h=>h!==r));const f=u.find(h=>h.toLowerCase().startsWith(i.toLowerCase()));return f!==r?f:void 0}function N4(e,t){const{x:r,y:s}=e;let i=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],f=t[u],h=d.x,b=d.y,g=f.x,x=f.y;b>s!=x>s&&r<(g-h)*(s-b)/(x-b)+h&&(i=!i)}return i}function A4(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return N4(r,t)}function Ll(e){return t=>t.pointerType==="mouse"?e(t):void 0}var R4=E1,j4=Pg,k4=T1,O4=N1,M4=Ug,D4=A1,P4=Yd,L4=j1,z4=O1,I4=D1,U4=L1,$4=z1,B4=I1,H4=$1,q4=H1,Wd="DropdownMenu",[V4]=or(Wd,[_1]),pn=_1(),[G4,V1]=V4(Wd),G1=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:i,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,f=pn(t),h=y.useRef(null),[b,g]=fa({prop:i,defaultProp:l??!1,onChange:u,caller:Wd});return m.jsx(G4,{scope:t,triggerId:on(),triggerRef:h,contentId:on(),open:b,onOpenChange:g,onOpenToggle:y.useCallback(()=>g(x=>!x),[g]),modal:d,children:m.jsx(R4,{...f,open:b,onOpenChange:g,dir:s,modal:d,children:r})})};G1.displayName=Wd;var F1="DropdownMenuTrigger",K1=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...i}=e,l=V1(F1,r),u=pn(r);return m.jsx(j4,{asChild:!0,...u,children:m.jsx(Ne.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,...i,ref:mn(t,l.triggerRef),onPointerDown:ve(e.onPointerDown,d=>{!s&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:ve(e.onKeyDown,d=>{s||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});K1.displayName=F1;var F4="DropdownMenuPortal",Y1=e=>{const{__scopeDropdownMenu:t,...r}=e,s=pn(t);return m.jsx(k4,{...s,...r})};Y1.displayName=F4;var W1="DropdownMenuContent",X1=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=V1(W1,r),l=pn(r),u=y.useRef(!1);return m.jsx(O4,{id:i.contentId,"aria-labelledby":i.triggerId,...l,...s,ref:t,onCloseAutoFocus:ve(e.onCloseAutoFocus,d=>{var f;u.current||(f=i.triggerRef.current)==null||f.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:ve(e.onInteractOutside,d=>{const f=d.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0,b=f.button===2||h;(!i.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)"}})});X1.displayName=W1;var K4="DropdownMenuGroup",Y4=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(M4,{...i,...s,ref:t})});Y4.displayName=K4;var W4="DropdownMenuLabel",J1=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(D4,{...i,...s,ref:t})});J1.displayName=W4;var X4="DropdownMenuItem",Q1=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(P4,{...i,...s,ref:t})});Q1.displayName=X4;var J4="DropdownMenuCheckboxItem",Z1=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(L4,{...i,...s,ref:t})});Z1.displayName=J4;var Q4="DropdownMenuRadioGroup",Z4=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(z4,{...i,...s,ref:t})});Z4.displayName=Q4;var ez="DropdownMenuRadioItem",eE=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(I4,{...i,...s,ref:t})});eE.displayName=ez;var tz="DropdownMenuItemIndicator",tE=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(U4,{...i,...s,ref:t})});tE.displayName=tz;var nz="DropdownMenuSeparator",nE=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx($4,{...i,...s,ref:t})});nE.displayName=nz;var rz="DropdownMenuArrow",az=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(B4,{...i,...s,ref:t})});az.displayName=rz;var sz="DropdownMenuSubTrigger",rE=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(H4,{...i,...s,ref:t})});rE.displayName=sz;var iz="DropdownMenuSubContent",aE=y.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=pn(r);return m.jsx(q4,{...i,...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)"}})});aE.displayName=iz;var oz=G1,lz=K1,cz=Y1,sE=X1,iE=J1,oE=Q1,lE=Z1,cE=eE,uE=tE,dE=nE,fE=rE,hE=aE;const uz=oz,dz=lz,fz=y.forwardRef(({className:e,inset:t,children:r,...s},i)=>m.jsxs(fE,{ref:i,className:xe("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,m.jsx(xg,{className:"ml-auto"})]}));fz.displayName=fE.displayName;const hz=y.forwardRef(({className:e,...t},r)=>m.jsx(hE,{ref:r,className:xe("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}));hz.displayName=hE.displayName;const mE=y.forwardRef(({className:e,sideOffset:t=4,...r},s)=>m.jsx(cz,{children:m.jsx(sE,{ref:s,sideOffset:t,className:xe("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})}));mE.displayName=sE.displayName;const pE=y.forwardRef(({className:e,inset:t,...r},s)=>m.jsx(oE,{ref:s,className:xe("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}));pE.displayName=oE.displayName;const mz=y.forwardRef(({className:e,children:t,checked:r,...s},i)=>m.jsxs(lE,{ref:i,className:xe("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:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(uE,{children:m.jsx(da,{className:"h-4 w-4"})})}),t]}));mz.displayName=lE.displayName;const pz=y.forwardRef(({className:e,children:t,...r},s)=>m.jsxs(cE,{ref:s,className:xe("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:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(uE,{children:m.jsx(dP,{className:"h-2 w-2 fill-current"})})}),t]}));pz.displayName=cE.displayName;const gz=y.forwardRef(({className:e,inset:t,...r},s)=>m.jsx(iE,{ref:s,className:xe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));gz.displayName=iE.displayName;const gE=y.forwardRef(({className:e,...t},r)=>m.jsx(dE,{ref:r,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));gE.displayName=dE.displayName;function vz(e,t=[]){let r=[];function s(l,u){const d=y.createContext(u);d.displayName=l+"Context";const f=r.length;r=[...r,u];const h=g=>{var C;const{scope:x,children:_,...E}=g,S=((C=x==null?void 0:x[e])==null?void 0:C[f])||d,T=y.useMemo(()=>E,Object.values(E));return m.jsx(S.Provider,{value:T,children:_})};h.displayName=l+"Provider";function b(g,x){var S;const _=((S=x==null?void 0:x[e])==null?void 0:S[f])||d,E=y.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[h,b]}const i=()=>{const l=r.map(u=>y.createContext(u));return function(d){const f=(d==null?void 0:d[e])||l;return y.useMemo(()=>({[`__scope${e}`]:{...d,[e]:f}}),[d,f])}};return i.scopeName=e,[s,yz(i,...t)]}function yz(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const u=s.reduce((d,{useScope:f,scopeName:h})=>{const g=f(l)[`__scope${h}`];return{...d,...g}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var bz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hg=bz.reduce((e,t)=>{const r=zd(`Primitive.${t}`),s=y.forwardRef((i,l)=>{const{asChild:u,...d}=i,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Jm={exports:{}},Qm={};/**
* @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 xz(){if(Kw)return Qm;Kw=1;var e=jd();function t(g,x){return g===x&&(g!==0||1/g===1/x)||g!==g&&x!==x}var r=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function d(g,x){var _=x(),E=s({inst:{value:_,getSnapshot:x}}),S=E[0].inst,T=E[1];return l(function(){S.value=_,S.getSnapshot=x,f(S)&&T({inst:S})},[g,_,x]),i(function(){return f(S)&&T({inst:S}),g(function(){f(S)&&T({inst:S})})},[g]),u(_),_}function f(g){var x=g.getSnapshot;g=g.value;try{var _=x();return!r(g,_)}catch{return!0}}function h(g,x){return x()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:d;return Qm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,Qm}var Yw;function wz(){return Yw||(Yw=1,Jm.exports=xz()),Jm.exports}var _z=wz();function Sz(){return _z.useSyncExternalStore(Ez,()=>!0,()=>!1)}function Ez(){return()=>{}}var qg="Avatar",[Cz]=vz(qg),[Tz,vE]=Cz(qg),yE=y.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[i,l]=y.useState("idle");return m.jsx(Tz,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:l,children:m.jsx(Hg.span,{...s,ref:t})})});yE.displayName=qg;var bE="AvatarImage",xE=y.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:i=()=>{},...l}=e,u=vE(bE,r),d=Nz(s,l),f=Qt(h=>{i(h),u.onImageLoadingStatusChange(h)});return Ht(()=>{d!=="idle"&&f(d)},[d,f]),d==="loaded"?m.jsx(Hg.img,{...l,ref:t,src:s}):null});xE.displayName=bE;var wE="AvatarFallback",_E=y.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...i}=e,l=vE(wE,r),[u,d]=y.useState(s===void 0);return y.useEffect(()=>{if(s!==void 0){const f=window.setTimeout(()=>d(!0),s);return()=>window.clearTimeout(f)}},[s]),u&&l.imageLoadingStatus!=="loaded"?m.jsx(Hg.span,{...i,ref:t}):null});_E.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 Nz(e,{referrerPolicy:t,crossOrigin:r}){const s=Sz(),i=y.useRef(null),l=s?(i.current||(i.current=new window.Image),i.current):null,[u,d]=y.useState(()=>Ww(l,e));return Ht(()=>{d(Ww(l,e))},[l,e]),Ht(()=>{const f=g=>()=>{d(g)};if(!l)return;const h=f("loaded"),b=f("error");return l.addEventListener("load",h),l.addEventListener("error",b),t&&(l.referrerPolicy=t),typeof r=="string"&&(l.crossOrigin=r),()=>{l.removeEventListener("load",h),l.removeEventListener("error",b)}},[l,r,t]),u}var SE=yE,EE=xE,CE=_E;const TE=y.forwardRef(({className:e,...t},r)=>m.jsx(SE,{ref:r,className:xe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));TE.displayName=SE.displayName;const NE=y.forwardRef(({className:e,...t},r)=>m.jsx(EE,{ref:r,className:xe("aspect-square h-full w-full",e),...t}));NE.displayName=EE.displayName;const AE=y.forwardRef(({className:e,...t},r)=>m.jsx(CE,{ref:r,className:xe("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));AE.displayName=CE.displayName;const Az=pg("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 Gn({className:e,variant:t,...r}){return m.jsx("div",{className:xe(Az({variant:t}),e),...r})}const Rz=["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(),Vg={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"},RE=Object.keys(Vg).sort(),jz=["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"],kz=["Aprobado","No aprobado","Stand by","Aprobado /no ejecutado","Pre aprobado","On going","Sin respuesta"],Pp=[{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"}],Oz=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];function jE(e){var t;return((t=Pp.find(r=>r.id===e))==null?void 0:t.hex)??Pp[0].hex}function Mz({project:e,onClick:t,showInternalAmount:r=!1}){const s=!!e.status,i=Number(e.monto),l=r&&e.monto!==null&&Number.isFinite(i)&&i>0,u=d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),t())};return m.jsxs("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:u,className:xe("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",s&&"opacity-65 hover:opacity-90"),style:{boxShadow:s?"0 1px 2px oklch(0.5 0.02 280 / 0.04)":"var(--shadow-soft)"},onMouseEnter:d=>{s||(d.currentTarget.style.boxShadow="var(--shadow-hover)")},onMouseLeave:d=>{d.currentTarget.style.boxShadow=s?"0 1px 2px oklch(0.5 0.02 280 / 0.04)":"var(--shadow-soft)"},children:[m.jsx("div",{className:"min-h-14 rounded-t-2xl px-4 py-3",style:{backgroundColor:s?"#9AA0A6":jE(e.color)},children:m.jsx("h3",{className:"text-white font-semibold text-sm leading-snug line-clamp-2 drop-shadow-sm",children:e.nombre||"Sin título"})}),m.jsxs("div",{className:"p-4 space-y-2.5",children:[m.jsx(Lu,{icon:m.jsx(ww,{className:"w-3.5 h-3.5"}),label:"Cliente",value:e.cliente}),m.jsx(Lu,{icon:m.jsx(ww,{className:"w-3.5 h-3.5"}),label:"Marca",value:e.marca}),m.jsx(Lu,{icon:m.jsx(BP,{className:"w-3.5 h-3.5"}),label:"País",value:e.bu}),m.jsx(Lu,{icon:m.jsx(n5,{className:"w-3.5 h-3.5"}),label:"Solicita",value:e.solicitante}),m.jsxs("div",{className:"flex items-center justify-between pt-2 mt-2 border-t border-border/70",children:[m.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[e.propuestaLinks.length>0&&m.jsxs("span",{className:"flex items-center gap-1",title:"Propuestas",children:[m.jsx(OP,{className:"w-3 h-3"})," ",e.propuestaLinks.length]}),e.afLinks.length>0&&m.jsxs("span",{className:"flex items-center gap-1",title:"Artes finales",children:[m.jsx(_P,{className:"w-3 h-3"})," AF·",e.afLinks.length]})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[l&&m.jsx("span",{className:"text-[11px] font-semibold tabular-nums text-foreground",title:"Monto interno cargado",children:Dz(i)}),e.status&&m.jsxs(Gn,{variant:"secondary",className:xe("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"&&m.jsx(lP,{className:"w-2.5 h-2.5 mr-0.5"}),e.status]})]})]})]})]})}function Dz(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:Number.isInteger(e)?0:2,maximumFractionDigits:2})}`}function Lu({icon:e,label:t,value:r}){return m.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[m.jsx("span",{className:"text-muted-foreground mt-0.5 flex-shrink-0",children:e}),m.jsx("span",{className:"text-muted-foreground w-14 flex-shrink-0",children:t}),m.jsx("span",{className:"text-foreground font-medium truncate",children:r||"—"})]})}function Pz(e){const t=Lz(e),r=y.forwardRef((s,i)=>{const{children:l,...u}=s,d=y.Children.toArray(l),f=d.find(Iz);if(f){const h=f.props.children,b=d.map(g=>g===f?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:g);return m.jsx(t,{...u,ref:i,children:y.isValidElement(h)?y.cloneElement(h,void 0,b):null})}return m.jsx(t,{...u,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function Lz(e){const t=y.forwardRef((r,s)=>{const{children:i,...l}=r;if(y.isValidElement(i)){const u=$z(i),d=Uz(l,i.props);return i.type!==y.Fragment&&(d.ref=s?mn(s,u):u),y.cloneElement(i,d)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var zz=Symbol("radix.slottable");function Iz(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===zz}function Uz(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const f=l(...d);return i(...d),f}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function $z(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Xd="Dialog",[kE]=or(Xd),[Bz,wr]=kE(Xd),OE=e=>{const{__scopeDialog:t,children:r,open:s,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,d=y.useRef(null),f=y.useRef(null),[h,b]=fa({prop:s,defaultProp:i??!1,onChange:l,caller:Xd});return m.jsx(Bz,{scope:t,triggerRef:d,contentRef:f,contentId:on(),titleId:on(),descriptionId:on(),open:h,onOpenChange:b,onOpenToggle:y.useCallback(()=>b(g=>!g),[b]),modal:u,children:r})};OE.displayName=Xd;var ME="DialogTrigger",Hz=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=wr(ME,r),l=Ye(t,i.triggerRef);return m.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Kg(i.open),...s,ref:l,onClick:ve(e.onClick,i.onOpenToggle)})});Hz.displayName=ME;var Gg="DialogPortal",[qz,DE]=kE(Gg,{forceMount:void 0}),PE=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:i}=e,l=wr(Gg,t);return m.jsx(qz,{scope:t,forceMount:r,children:y.Children.map(s,u=>m.jsx(fn,{present:r||l.open,children:m.jsx(Xl,{asChild:!0,container:i,children:u})}))})};PE.displayName=Gg;var wd="DialogOverlay",LE=y.forwardRef((e,t)=>{const r=DE(wd,e.__scopeDialog),{forceMount:s=r.forceMount,...i}=e,l=wr(wd,e.__scopeDialog);return l.modal?m.jsx(fn,{present:s||l.open,children:m.jsx(Gz,{...i,ref:t})}):null});LE.displayName=wd;var Vz=Pz("DialogOverlay.RemoveScroll"),Gz=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=wr(wd,r);return m.jsx(Ql,{as:Vz,allowPinchZoom:!0,shards:[i.contentRef],children:m.jsx(Ne.div,{"data-state":Kg(i.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Bs="DialogContent",zE=y.forwardRef((e,t)=>{const r=DE(Bs,e.__scopeDialog),{forceMount:s=r.forceMount,...i}=e,l=wr(Bs,e.__scopeDialog);return m.jsx(fn,{present:s||l.open,children:l.modal?m.jsx(Fz,{...i,ref:t}):m.jsx(Kz,{...i,ref:t})})});zE.displayName=Bs;var Fz=y.forwardRef((e,t)=>{const r=wr(Bs,e.__scopeDialog),s=y.useRef(null),i=Ye(t,r.contentRef,s);return y.useEffect(()=>{const l=s.current;if(l)return Gd(l)},[]),m.jsx(IE,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,l=>l.preventDefault())})}),Kz=y.forwardRef((e,t)=>{const r=wr(Bs,e.__scopeDialog),s=y.useRef(!1),i=y.useRef(!1);return m.jsx(IE,{...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,i.current=!1},onInteractOutside:l=>{var f,h;(f=e.onInteractOutside)==null||f.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;((h=r.triggerRef.current)==null?void 0:h.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),IE=y.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,...u}=e,d=wr(Bs,r),f=y.useRef(null),h=Ye(t,f);return Id(),m.jsxs(m.Fragment,{children:[m.jsx(Yl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:l,children:m.jsx(Kl,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Kg(d.open),...u,ref:h,onDismiss:()=>d.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(Yz,{titleId:d.titleId}),m.jsx(Xz,{contentRef:f,descriptionId:d.descriptionId})]})]})}),Fg="DialogTitle",UE=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=wr(Fg,r);return m.jsx(Ne.h2,{id:i.titleId,...s,ref:t})});UE.displayName=Fg;var $E="DialogDescription",BE=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=wr($E,r);return m.jsx(Ne.p,{id:i.descriptionId,...s,ref:t})});BE.displayName=$E;var HE="DialogClose",qE=y.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=wr(HE,r);return m.jsx(Ne.button,{type:"button",...s,ref:t,onClick:ve(e.onClick,()=>i.onOpenChange(!1))})});qE.displayName=HE;function Kg(e){return e?"open":"closed"}var VE="DialogTitleWarning",[O6,GE]=a5(VE,{contentName:Bs,titleName:Fg,docsSlug:"dialog"}),Yz=({titleId:e})=>{const t=GE(VE),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 y.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Wz="DialogDescriptionWarning",Xz=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${GE(Wz).contentName}}.`;return y.useEffect(()=>{var l;const i=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},FE=OE,KE=PE,Yg=LE,Wg=zE,YE=UE,WE=BE,Jz=qE;const Jd=FE,Qz=KE,XE=y.forwardRef(({className:e,...t},r)=>m.jsx(Yg,{ref:r,className:xe("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}));XE.displayName=Yg.displayName;const tc=y.forwardRef(({className:e,children:t,...r},s)=>m.jsxs(Qz,{children:[m.jsx(XE,{}),m.jsxs(Wg,{ref:s,className:xe("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,m.jsxs(Jz,{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:[m.jsx(Ml,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));tc.displayName=Wg.displayName;const nc=({className:e,...t})=>m.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});nc.displayName="DialogHeader";const Qd=({className:e,...t})=>m.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qd.displayName="DialogFooter";const rc=y.forwardRef(({className:e,...t},r)=>m.jsx(YE,{ref:r,className:xe("text-lg font-semibold leading-none tracking-tight",e),...t}));rc.displayName=YE.displayName;const ac=y.forwardRef(({className:e,...t},r)=>m.jsx(WE,{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));ac.displayName=WE.displayName;var Zz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eI=Zz.reduce((e,t)=>{const r=zd(`Primitive.${t}`),s=y.forwardRef((i,l)=>{const{asChild:u,...d}=i,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),tI="Label",JE=y.forwardRef((e,t)=>m.jsx(eI.label,{...e,ref:t,onMouseDown:r=>{var i;r.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));JE.displayName=tI;var QE=JE;const nI=pg("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),He=y.forwardRef(({className:e,...t},r)=>m.jsx(QE,{ref:r,className:xe(nI(),e),...t}));He.displayName=QE.displayName;const ts=y.forwardRef(({className:e,...t},r)=>m.jsx("textarea",{className:xe("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}));ts.displayName="Textarea";function Xg(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Zd="Checkbox",[rI]=or(Zd),[aI,Jg]=rI(Zd);function sI(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:i,disabled:l,form:u,name:d,onCheckedChange:f,required:h,value:b="on",internal_do_not_use_render:g}=e,[x,_]=fa({prop:r,defaultProp:i??!1,onChange:f,caller:Zd}),[E,S]=y.useState(null),[T,C]=y.useState(null),R=y.useRef(!1),A=E?!!u||!!E.closest("form"):!0,D={checked:x,disabled:l,setChecked:_,control:E,setControl:S,name:d,form:u,value:b,hasConsumerStoppedPropagationRef:R,required:h,defaultChecked:ns(i)?!1:i,isFormControl:A,bubbleInput:T,setBubbleInput:C};return m.jsx(aI,{scope:t,...D,children:iI(g)?g(D):s})}var ZE="CheckboxTrigger",eC=y.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},i)=>{const{control:l,value:u,disabled:d,checked:f,required:h,setControl:b,setChecked:g,hasConsumerStoppedPropagationRef:x,isFormControl:_,bubbleInput:E}=Jg(ZE,e),S=Ye(i,b),T=y.useRef(f);return y.useEffect(()=>{const C=l==null?void 0:l.form;if(C){const R=()=>g(T.current);return C.addEventListener("reset",R),()=>C.removeEventListener("reset",R)}},[l,g]),m.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":ns(f)?"mixed":f,"aria-required":h,"data-state":sC(f),"data-disabled":d?"":void 0,disabled:d,value:u,...s,ref:S,onKeyDown:ve(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:ve(r,C=>{g(R=>ns(R)?!0:!R),E&&_&&(x.current=C.isPropagationStopped(),x.current||C.stopPropagation())})})});eC.displayName=ZE;var Qg=y.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:s,checked:i,defaultChecked:l,required:u,disabled:d,value:f,onCheckedChange:h,form:b,...g}=e;return m.jsx(sI,{__scopeCheckbox:r,checked:i,defaultChecked:l,disabled:d,required:u,onCheckedChange:h,name:s,form:b,value:f,internal_do_not_use_render:({isFormControl:x})=>m.jsxs(m.Fragment,{children:[m.jsx(eC,{...g,ref:t,__scopeCheckbox:r}),x&&m.jsx(aC,{__scopeCheckbox:r})]})})});Qg.displayName=Zd;var tC="CheckboxIndicator",nC=y.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...i}=e,l=Jg(tC,r);return m.jsx(fn,{present:s||ns(l.checked)||l.checked===!0,children:m.jsx(Ne.span,{"data-state":sC(l.checked),"data-disabled":l.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});nC.displayName=tC;var rC="CheckboxBubbleInput",aC=y.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:s,hasConsumerStoppedPropagationRef:i,checked:l,defaultChecked:u,required:d,disabled:f,name:h,value:b,form:g,bubbleInput:x,setBubbleInput:_}=Jg(rC,e),E=Ye(r,_),S=Xg(l),T=Rg(s);y.useEffect(()=>{const R=x;if(!R)return;const A=window.HTMLInputElement.prototype,B=Object.getOwnPropertyDescriptor(A,"checked").set,I=!i.current;if(S!==l&&B){const L=new Event("click",{bubbles:I});R.indeterminate=ns(l),B.call(R,ns(l)?!1:l),R.dispatchEvent(L)}},[x,S,l,i]);const C=y.useRef(ns(l)?!1:l);return m.jsx(Ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??C.current,required:d,disabled:f,name:h,value:b,form:g,...t,tabIndex:-1,ref:E,style:{...t.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});aC.displayName=rC;function iI(e){return typeof e=="function"}function ns(e){return e==="indeterminate"}function sC(e){return ns(e)?"indeterminate":e?"checked":"unchecked"}const iC=y.forwardRef(({className:e,...t},r)=>m.jsx(Qg,{ref:r,className:xe("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:m.jsx(nC,{className:xe("grid place-content-center text-current"),children:m.jsx(da,{className:"h-4 w-4"})})}));iC.displayName=Qg.displayName;function Lp(e,[t,r]){return Math.min(r,Math.max(t,e))}function oI(e){const t=lI(e),r=y.forwardRef((s,i)=>{const{children:l,...u}=s,d=y.Children.toArray(l),f=d.find(uI);if(f){const h=f.props.children,b=d.map(g=>g===f?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:g);return m.jsx(t,{...u,ref:i,children:y.isValidElement(h)?y.cloneElement(h,void 0,b):null})}return m.jsx(t,{...u,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function lI(e){const t=y.forwardRef((r,s)=>{const{children:i,...l}=r;if(y.isValidElement(i)){const u=fI(i),d=dI(l,i.props);return i.type!==y.Fragment&&(d.ref=s?mn(s,u):u),y.cloneElement(i,d)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cI=Symbol("radix.slottable");function uI(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cI}function dI(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const f=l(...d);return i(...d),f}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function fI(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var oC=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"}),hI="VisuallyHidden",mI=y.forwardRef((e,t)=>m.jsx(Ne.span,{...e,ref:t,style:{...oC,...e.style}}));mI.displayName=hI;var pI=[" ","Enter","ArrowUp","ArrowDown"],gI=[" ","Enter"],Hs="Select",[ef,tf,vI]=_g(Hs),[go]=or(Hs,[vI,po]),nf=po(),[yI,os]=go(Hs),[bI,xI]=go(Hs),lC=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:i,onOpenChange:l,value:u,defaultValue:d,onValueChange:f,dir:h,name:b,autoComplete:g,disabled:x,required:_,form:E}=e,S=nf(t),[T,C]=y.useState(null),[R,A]=y.useState(null),[D,B]=y.useState(!1),I=Fl(h),[L,H]=fa({prop:s,defaultProp:i??!1,onChange:l,caller:Hs}),[Z,ue]=fa({prop:u,defaultProp:d,onChange:f,caller:Hs}),ce=y.useRef(null),he=T?E||!!T.closest("form"):!0,[de,me]=y.useState(new Set),pe=Array.from(de).map(j=>j.props.value).join(";");return m.jsx(Og,{...S,children:m.jsxs(yI,{required:_,scope:t,trigger:T,onTriggerChange:C,valueNode:R,onValueNodeChange:A,valueNodeHasChildren:D,onValueNodeHasChildrenChange:B,contentId:on(),value:Z,onValueChange:ue,open:L,onOpenChange:H,dir:I,triggerPointerDownPosRef:ce,disabled:x,children:[m.jsx(ef.Provider,{scope:t,children:m.jsx(bI,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(j=>{me(K=>new Set(K).add(j))},[]),onNativeOptionRemove:y.useCallback(j=>{me(K=>{const W=new Set(K);return W.delete(j),W})},[]),children:r})}),he?m.jsxs(OC,{"aria-hidden":!0,required:_,tabIndex:-1,name:b,autoComplete:g,value:Z,onChange:j=>ue(j.target.value),disabled:x,form:E,children:[Z===void 0?m.jsx("option",{value:""}):null,Array.from(de)]},pe):null]})})};lC.displayName=Hs;var cC="SelectTrigger",uC=y.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...i}=e,l=nf(r),u=os(cC,r),d=u.disabled||s,f=Ye(t,u.onTriggerChange),h=tf(r),b=y.useRef("touch"),[g,x,_]=DC(S=>{const T=h().filter(A=>!A.disabled),C=T.find(A=>A.value===u.value),R=PC(T,S,C);R!==void 0&&u.onValueChange(R.value)}),E=S=>{d||(u.onOpenChange(!0),_()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return m.jsx(qd,{asChild:!0,...l,children:m.jsx(Ne.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":MC(u.value)?"":void 0,...i,ref:f,onClick:ve(i.onClick,S=>{S.currentTarget.focus(),b.current!=="mouse"&&E(S)}),onPointerDown:ve(i.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:ve(i.onKeyDown,S=>{const T=g.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&x(S.key),!(T&&S.key===" ")&&pI.includes(S.key)&&(E(),S.preventDefault())})})})});uC.displayName=cC;var dC="SelectValue",fC=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:i,children:l,placeholder:u="",...d}=e,f=os(dC,r),{onValueNodeHasChildrenChange:h}=f,b=l!==void 0,g=Ye(t,f.onValueNodeChange);return Ht(()=>{h(b)},[h,b]),m.jsx(Ne.span,{...d,ref:g,style:{pointerEvents:"none"},children:MC(f.value)?m.jsx(m.Fragment,{children:u}):l})});fC.displayName=dC;var wI="SelectIcon",hC=y.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...i}=e;return m.jsx(Ne.span,{"aria-hidden":!0,...i,ref:t,children:s||"▼"})});hC.displayName=wI;var _I="SelectPortal",mC=e=>m.jsx(Xl,{asChild:!0,...e});mC.displayName=_I;var qs="SelectContent",pC=y.forwardRef((e,t)=>{const r=os(qs,e.__scopeSelect),[s,i]=y.useState();if(Ht(()=>{i(new DocumentFragment)},[]),!r.open){const l=s;return l?Vl.createPortal(m.jsx(gC,{scope:e.__scopeSelect,children:m.jsx(ef.Slot,{scope:e.__scopeSelect,children:m.jsx("div",{children:e.children})})}),l):null}return m.jsx(vC,{...e,ref:t})});pC.displayName=qs;var mr=10,[gC,ls]=go(qs),SI="SelectContentImpl",EI=oI("SelectContent.RemoveScroll"),vC=y.forwardRef((e,t)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:f,align:h,alignOffset:b,arrowPadding:g,collisionBoundary:x,collisionPadding:_,sticky:E,hideWhenDetached:S,avoidCollisions:T,...C}=e,R=os(qs,r),[A,D]=y.useState(null),[B,I]=y.useState(null),L=Ye(t,te=>D(te)),[H,Z]=y.useState(null),[ue,ce]=y.useState(null),he=tf(r),[de,me]=y.useState(!1),pe=y.useRef(!1);y.useEffect(()=>{if(A)return Gd(A)},[A]),Id();const j=y.useCallback(te=>{const[ee,...se]=he().map(Re=>Re.ref.current),[Se]=se.slice(-1),Te=document.activeElement;for(const Re of te)if(Re===Te||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===ee&&B&&(B.scrollTop=0),Re===Se&&B&&(B.scrollTop=B.scrollHeight),Re==null||Re.focus(),document.activeElement!==Te))return},[he,B]),K=y.useCallback(()=>j([H,A]),[j,H,A]);y.useEffect(()=>{de&&K()},[de,K]);const{onOpenChange:W,triggerPointerDownPosRef:J}=R;y.useEffect(()=>{if(A){let te={x:0,y:0};const ee=Se=>{var Te,Re;te={x:Math.abs(Math.round(Se.pageX)-(((Te=J.current)==null?void 0:Te.x)??0)),y:Math.abs(Math.round(Se.pageY)-(((Re=J.current)==null?void 0:Re.y)??0))}},se=Se=>{te.x<=10&&te.y<=10?Se.preventDefault():A.contains(Se.target)||W(!1),document.removeEventListener("pointermove",ee),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",ee),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ee),document.removeEventListener("pointerup",se,{capture:!0})}}},[A,W,J]),y.useEffect(()=>{const te=()=>W(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[W]);const[G,k]=DC(te=>{const ee=he().filter(Te=>!Te.disabled),se=ee.find(Te=>Te.ref.current===document.activeElement),Se=PC(ee,te,se);Se&&setTimeout(()=>Se.ref.current.focus())}),O=y.useCallback((te,ee,se)=>{const Se=!pe.current&&!se;(R.value!==void 0&&R.value===ee||Se)&&(Z(te),Se&&(pe.current=!0))},[R.value]),U=y.useCallback(()=>A==null?void 0:A.focus(),[A]),Y=y.useCallback((te,ee,se)=>{const Se=!pe.current&&!se;(R.value!==void 0&&R.value===ee||Se)&&ce(te)},[R.value]),$=s==="popper"?zp:yC,re=$===zp?{side:d,sideOffset:f,align:h,alignOffset:b,arrowPadding:g,collisionBoundary:x,collisionPadding:_,sticky:E,hideWhenDetached:S,avoidCollisions:T}:{};return m.jsx(gC,{scope:r,content:A,viewport:B,onViewportChange:I,itemRefCallback:O,selectedItem:H,onItemLeave:U,itemTextRefCallback:Y,focusSelectedItem:K,selectedItemText:ue,position:s,isPositioned:de,searchRef:G,children:m.jsx(Ql,{as:EI,allowPinchZoom:!0,children:m.jsx(Yl,{asChild:!0,trapped:R.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:ve(i,te=>{var ee;(ee=R.trigger)==null||ee.focus({preventScroll:!0}),te.preventDefault()}),children:m.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:m.jsx($,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:te=>te.preventDefault(),...C,...re,onPlaced:()=>me(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:ve(C.onKeyDown,te=>{const ee=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ee&&te.key.length===1&&k(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let Se=he().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes(te.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Te=te.target,Re=Se.indexOf(Te);Se=Se.slice(Re+1)}setTimeout(()=>j(Se)),te.preventDefault()}})})})})})})});vC.displayName=SI;var CI="SelectItemAlignedPosition",yC=y.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...i}=e,l=os(qs,r),u=ls(qs,r),[d,f]=y.useState(null),[h,b]=y.useState(null),g=Ye(t,L=>b(L)),x=tf(r),_=y.useRef(!1),E=y.useRef(!0),{viewport:S,selectedItem:T,selectedItemText:C,focusSelectedItem:R}=u,A=y.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&h&&S&&T&&C){const L=l.trigger.getBoundingClientRect(),H=h.getBoundingClientRect(),Z=l.valueNode.getBoundingClientRect(),ue=C.getBoundingClientRect();if(l.dir!=="rtl"){const Te=ue.left-H.left,Re=Z.left-Te,nt=L.left-Re,Ze=L.width+nt,xt=Math.max(Ze,H.width),oe=window.innerWidth-mr,je=Lp(Re,[mr,Math.max(mr,oe-xt)]);d.style.minWidth=Ze+"px",d.style.left=je+"px"}else{const Te=H.right-ue.right,Re=window.innerWidth-Z.right-Te,nt=window.innerWidth-L.right-Re,Ze=L.width+nt,xt=Math.max(Ze,H.width),oe=window.innerWidth-mr,je=Lp(Re,[mr,Math.max(mr,oe-xt)]);d.style.minWidth=Ze+"px",d.style.right=je+"px"}const ce=x(),he=window.innerHeight-mr*2,de=S.scrollHeight,me=window.getComputedStyle(h),pe=parseInt(me.borderTopWidth,10),j=parseInt(me.paddingTop,10),K=parseInt(me.borderBottomWidth,10),W=parseInt(me.paddingBottom,10),J=pe+j+de+W+K,G=Math.min(T.offsetHeight*5,J),k=window.getComputedStyle(S),O=parseInt(k.paddingTop,10),U=parseInt(k.paddingBottom,10),Y=L.top+L.height/2-mr,$=he-Y,re=T.offsetHeight/2,te=T.offsetTop+re,ee=pe+j+te,se=J-ee;if(ee<=Y){const Te=ce.length>0&&T===ce[ce.length-1].ref.current;d.style.bottom="0px";const Re=h.clientHeight-S.offsetTop-S.offsetHeight,nt=Math.max($,re+(Te?U:0)+Re+K),Ze=ee+nt;d.style.height=Ze+"px"}else{const Te=ce.length>0&&T===ce[0].ref.current;d.style.top="0px";const nt=Math.max(Y,pe+S.offsetTop+(Te?O:0)+re)+se;d.style.height=nt+"px",S.scrollTop=ee-Y+S.offsetTop}d.style.margin=`${mr}px 0`,d.style.minHeight=G+"px",d.style.maxHeight=he+"px",s==null||s(),requestAnimationFrame(()=>_.current=!0)}},[x,l.trigger,l.valueNode,d,h,S,T,C,l.dir,s]);Ht(()=>A(),[A]);const[D,B]=y.useState();Ht(()=>{h&&B(window.getComputedStyle(h).zIndex)},[h]);const I=y.useCallback(L=>{L&&E.current===!0&&(A(),R==null||R(),E.current=!1)},[A,R]);return m.jsx(NI,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:_,onScrollButtonChange:I,children:m.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:D},children:m.jsx(Ne.div,{...i,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});yC.displayName=CI;var TI="SelectPopperPosition",zp=y.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:i=mr,...l}=e,u=nf(r);return m.jsx(Mg,{...u,...l,ref:t,align:s,collisionPadding:i,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)"}})});zp.displayName=TI;var[NI,Zg]=go(qs,{}),Ip="SelectViewport",bC=y.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...i}=e,l=ls(Ip,r),u=Zg(Ip,r),d=Ye(t,l.onViewportChange),f=y.useRef(0);return m.jsxs(m.Fragment,{children:[m.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}),m.jsx(ef.Slot,{scope:r,children:m.jsx(Ne.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ve(i.onScroll,h=>{const b=h.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:x}=u;if(x!=null&&x.current&&g){const _=Math.abs(f.current-b.scrollTop);if(_>0){const E=window.innerHeight-mr*2,S=parseFloat(g.style.minHeight),T=parseFloat(g.style.height),C=Math.max(S,T);if(C<E){const R=C+_,A=Math.min(E,R),D=R-A;g.style.height=A+"px",g.style.bottom==="0px"&&(b.scrollTop=D>0?D:0,g.style.justifyContent="flex-end")}}}f.current=b.scrollTop})})})]})});bC.displayName=Ip;var xC="SelectGroup",[AI,RI]=go(xC),jI=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=on();return m.jsx(AI,{scope:r,id:i,children:m.jsx(Ne.div,{role:"group","aria-labelledby":i,...s,ref:t})})});jI.displayName=xC;var wC="SelectLabel",_C=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=RI(wC,r);return m.jsx(Ne.div,{id:i.id,...s,ref:t})});_C.displayName=wC;var _d="SelectItem",[kI,SC]=go(_d),EC=y.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:i=!1,textValue:l,...u}=e,d=os(_d,r),f=ls(_d,r),h=d.value===s,[b,g]=y.useState(l??""),[x,_]=y.useState(!1),E=Ye(t,R=>{var A;return(A=f.itemRefCallback)==null?void 0:A.call(f,R,s,i)}),S=on(),T=y.useRef("touch"),C=()=>{i||(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 m.jsx(kI,{scope:r,value:s,disabled:i,textId:S,isSelected:h,onItemTextChange:y.useCallback(R=>{g(A=>A||((R==null?void 0:R.textContent)??"").trim())},[]),children:m.jsx(ef.ItemSlot,{scope:r,value:s,disabled:i,textValue:b,children:m.jsx(Ne.div,{role:"option","aria-labelledby":S,"data-highlighted":x?"":void 0,"aria-selected":h&&x,"data-state":h?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:E,onFocus:ve(u.onFocus,()=>_(!0)),onBlur:ve(u.onBlur,()=>_(!1)),onClick:ve(u.onClick,()=>{T.current!=="mouse"&&C()}),onPointerUp:ve(u.onPointerUp,()=>{T.current==="mouse"&&C()}),onPointerDown:ve(u.onPointerDown,R=>{T.current=R.pointerType}),onPointerMove:ve(u.onPointerMove,R=>{var A;T.current=R.pointerType,i?(A=f.onItemLeave)==null||A.call(f):T.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(u.onPointerLeave,R=>{var A;R.currentTarget===document.activeElement&&((A=f.onItemLeave)==null||A.call(f))}),onKeyDown:ve(u.onKeyDown,R=>{var D;((D=f.searchRef)==null?void 0:D.current)!==""&&R.key===" "||(gI.includes(R.key)&&C(),R.key===" "&&R.preventDefault())})})})})});EC.displayName=_d;var gl="SelectItemText",CC=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:i,...l}=e,u=os(gl,r),d=ls(gl,r),f=SC(gl,r),h=xI(gl,r),[b,g]=y.useState(null),x=Ye(t,C=>g(C),f.onItemTextChange,C=>{var R;return(R=d.itemTextRefCallback)==null?void 0:R.call(d,C,f.value,f.disabled)}),_=b==null?void 0:b.textContent,E=y.useMemo(()=>m.jsx("option",{value:f.value,disabled:f.disabled,children:_},f.value),[f.disabled,f.value,_]),{onNativeOptionAdd:S,onNativeOptionRemove:T}=h;return Ht(()=>(S(E),()=>T(E)),[S,T,E]),m.jsxs(m.Fragment,{children:[m.jsx(Ne.span,{id:f.textId,...l,ref:x}),f.isSelected&&u.valueNode&&!u.valueNodeHasChildren?Vl.createPortal(l.children,u.valueNode):null]})});CC.displayName=gl;var TC="SelectItemIndicator",NC=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return SC(TC,r).isSelected?m.jsx(Ne.span,{"aria-hidden":!0,...s,ref:t}):null});NC.displayName=TC;var Up="SelectScrollUpButton",AC=y.forwardRef((e,t)=>{const r=ls(Up,e.__scopeSelect),s=Zg(Up,e.__scopeSelect),[i,l]=y.useState(!1),u=Ye(t,s.onScrollButtonChange);return Ht(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=f.scrollTop>0;l(h)};const f=r.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),i?m.jsx(jC,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=r;d&&f&&(d.scrollTop=d.scrollTop-f.offsetHeight)}}):null});AC.displayName=Up;var $p="SelectScrollDownButton",RC=y.forwardRef((e,t)=>{const r=ls($p,e.__scopeSelect),s=Zg($p,e.__scopeSelect),[i,l]=y.useState(!1),u=Ye(t,s.onScrollButtonChange);return Ht(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=f.scrollHeight-f.clientHeight,b=Math.ceil(f.scrollTop)<h;l(b)};const f=r.viewport;return d(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),i?m.jsx(jC,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:f}=r;d&&f&&(d.scrollTop=d.scrollTop+f.offsetHeight)}}):null});RC.displayName=$p;var jC=y.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...i}=e,l=ls("SelectScrollButton",r),u=y.useRef(null),d=tf(r),f=y.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return y.useEffect(()=>()=>f(),[f]),Ht(()=>{var b;const h=d().find(g=>g.ref.current===document.activeElement);(b=h==null?void 0:h.ref.current)==null||b.scrollIntoView({block:"nearest"})},[d]),m.jsx(Ne.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ve(i.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(s,50))}),onPointerMove:ve(i.onPointerMove,()=>{var h;(h=l.onItemLeave)==null||h.call(l),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:ve(i.onPointerLeave,()=>{f()})})}),OI="SelectSeparator",kC=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return m.jsx(Ne.div,{"aria-hidden":!0,...s,ref:t})});kC.displayName=OI;var Bp="SelectArrow",MI=y.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=nf(r),l=os(Bp,r),u=ls(Bp,r);return l.open&&u.position==="popper"?m.jsx(Dg,{...i,...s,ref:t}):null});MI.displayName=Bp;var DI="SelectBubbleInput",OC=y.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const i=y.useRef(null),l=Ye(s,i),u=Xg(t);return y.useEffect(()=>{const d=i.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]),m.jsx(Ne.select,{...r,style:{...oC,...r.style},ref:l,defaultValue:t})});OC.displayName=DI;function MC(e){return e===""||e===void 0}function DC(e){const t=Qt(e),r=y.useRef(""),s=y.useRef(0),i=y.useCallback(u=>{const d=r.current+u;t(d),(function f(h){r.current=h,window.clearTimeout(s.current),h!==""&&(s.current=window.setTimeout(()=>f(""),1e3))})(d)},[t]),l=y.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,i,l]}function PC(e,t,r){const i=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=PI(e,Math.max(l,0));i.length===1&&(u=u.filter(h=>h!==r));const f=u.find(h=>h.textValue.toLowerCase().startsWith(i.toLowerCase()));return f!==r?f:void 0}function PI(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var LI=lC,LC=uC,zI=fC,II=hC,UI=mC,zC=pC,$I=bC,IC=_C,UC=EC,BI=CC,HI=NC,$C=AC,BC=RC,HC=kC;const qI=LI,VI=zI,qC=y.forwardRef(({className:e,children:t,...r},s)=>m.jsxs(LC,{ref:s,className:xe("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,m.jsx(II,{asChild:!0,children:m.jsx(bg,{className:"h-4 w-4 opacity-50"})})]}));qC.displayName=LC.displayName;const VC=y.forwardRef(({className:e,...t},r)=>m.jsx($C,{ref:r,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(aP,{className:"h-4 w-4"})}));VC.displayName=$C.displayName;const GC=y.forwardRef(({className:e,...t},r)=>m.jsx(BC,{ref:r,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(bg,{className:"h-4 w-4"})}));GC.displayName=BC.displayName;const FC=y.forwardRef(({className:e,children:t,position:r="popper",...s},i)=>m.jsx(UI,{children:m.jsxs(zC,{ref:i,className:xe("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:[m.jsx(VC,{}),m.jsx($I,{className:xe("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),m.jsx(GC,{})]})}));FC.displayName=zC.displayName;const GI=y.forwardRef(({className:e,...t},r)=>m.jsx(IC,{ref:r,className:xe("px-2 py-1.5 text-sm font-semibold",e),...t}));GI.displayName=IC.displayName;const Hp=y.forwardRef(({className:e,children:t,...r},s)=>m.jsxs(UC,{ref:s,className:xe("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:[m.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(HI,{children:m.jsx(da,{className:"h-4 w-4"})})}),m.jsx(BI,{children:t})]}));Hp.displayName=UC.displayName;const FI=y.forwardRef(({className:e,...t},r)=>m.jsx(HC,{ref:r,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));FI.displayName=HC.displayName;var KI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YI=KI.reduce((e,t)=>{const r=zd(`Primitive.${t}`),s=y.forwardRef((i,l)=>{const{asChild:u,...d}=i,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(f,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),WI="Separator",Xw="horizontal",XI=["horizontal","vertical"],KC=y.forwardRef((e,t)=>{const{decorative:r,orientation:s=Xw,...i}=e,l=JI(s)?s:Xw,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return m.jsx(YI.div,{"data-orientation":l,...d,...i,ref:t})});KC.displayName=WI;function JI(e){return XI.includes(e)}var YC=KC;const Ls=y.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},i)=>m.jsx(YC,{ref:i,decorative:r,orientation:t,className:xe("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Ls.displayName=YC.displayName;function QI({value:e,onChange:t}){return m.jsx("div",{className:"flex flex-wrap gap-2",children:Pp.map(r=>m.jsx("button",{type:"button",onClick:()=>t(r.id),title:r.name,className:xe("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&&m.jsx(da,{className:"w-4 h-4 text-white drop-shadow"})},r.id))})}function Jw({label:e,prefix:t,links:r,onChange:s,readOnly:i,emptyText:l}){const[u,d]=y.useState(""),f=()=>{const g=u.trim();g&&(s([...r,g]),d(""))},h=(g,x)=>s(r.map((_,E)=>E===g?x:_)),b=g=>s(r.filter((x,_)=>_!==g));return m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("span",{className:"text-sm font-medium text-foreground",children:[e," ",t&&m.jsxs("span",{className:"text-xs text-muted-foreground font-normal",children:["(",t,")"]})]}),m.jsx("span",{className:"text-xs text-muted-foreground",children:r.length})]}),r.length===0&&m.jsx("p",{className:"text-xs text-muted-foreground italic px-1",children:l??"Sin links aún"}),m.jsx("div",{className:"space-y-1.5",children:r.map((g,x)=>m.jsxs("div",{className:"group flex items-center gap-1.5",children:[m.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??"·",x+1]}),i?m.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:[m.jsx(DP,{className:"w-3.5 h-3.5 flex-shrink-0"}),m.jsx("span",{className:"truncate",children:g}),m.jsx(gP,{className:"w-3 h-3 flex-shrink-0 opacity-60"})]}):m.jsxs(m.Fragment,{children:[m.jsx(gt,{value:g,onChange:_=>h(x,_.target.value),placeholder:"https://…",className:"h-9 text-sm"}),m.jsx(Fe,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>b(x),children:m.jsx(Ml,{className:"w-4 h-4"})})]})]},x))}),!i&&m.jsxs("div",{className:"flex gap-1.5 pt-1",children:[m.jsx(gt,{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"}),m.jsxs(Fe,{type:"button",variant:"outline",size:"sm",onClick:f,className:"h-9",children:[m.jsx(es,{className:"w-4 h-4 mr-1"})," Añadir"]})]})]})}var Qw=1,ZI=.9,eU=.8,tU=.17,Zm=.1,ep=.999,nU=.9999,rU=.99,aU=/[\\\/_+.#"@\[\(\{&]/,sU=/[\\\/_+.#"@\[\(\{&]/g,iU=/[\s-]/,WC=/[\s-]/g;function qp(e,t,r,s,i,l,u){if(l===t.length)return i===e.length?Qw:rU;var d=`${i},${l}`;if(u[d]!==void 0)return u[d];for(var f=s.charAt(l),h=r.indexOf(f,i),b=0,g,x,_,E;h>=0;)g=qp(e,t,r,s,h+1,l+1,u),g>b&&(h===i?g*=Qw:aU.test(e.charAt(h-1))?(g*=eU,_=e.slice(i,h-1).match(sU),_&&i>0&&(g*=Math.pow(ep,_.length))):iU.test(e.charAt(h-1))?(g*=ZI,E=e.slice(i,h-1).match(WC),E&&i>0&&(g*=Math.pow(ep,E.length))):(g*=tU,i>0&&(g*=Math.pow(ep,h-i))),e.charAt(h)!==t.charAt(l)&&(g*=nU)),(g<Zm&&r.charAt(h-1)===s.charAt(l+1)||s.charAt(l+1)===s.charAt(l)&&r.charAt(h-1)!==s.charAt(l))&&(x=qp(e,t,r,s,h+1,l+2,u),x*Zm>g&&(g=x*Zm)),g>b&&(b=g),h=r.indexOf(f,h+1);return u[d]=b,b}function Zw(e){return e.toLowerCase().replace(WC," ")}function oU(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,qp(e,t,Zw(e),Zw(t),0,0,{})}var dl='[cmdk-group=""]',tp='[cmdk-group-items=""]',lU='[cmdk-group-heading=""]',XC='[cmdk-item=""]',e_=`${XC}:not([aria-disabled="true"])`,Vp="cmdk-item-select",Yi="data-value",cU=(e,t,r)=>oU(e,t,r),JC=y.createContext(void 0),sc=()=>y.useContext(JC),QC=y.createContext(void 0),ev=()=>y.useContext(QC),ZC=y.createContext(void 0),eT=y.forwardRef((e,t)=>{let r=Wi(()=>{var O,U;return{search:"",value:(U=(O=e.value)!=null?O:e.defaultValue)!=null?U:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=Wi(()=>new Set),i=Wi(()=>new Map),l=Wi(()=>new Map),u=Wi(()=>new Set),d=tT(e),{label:f,children:h,value:b,onValueChange:g,filter:x,shouldFilter:_,loop:E,disablePointerSelection:S=!1,vimBindings:T=!0,...C}=e,R=on(),A=on(),D=on(),B=y.useRef(null),I=xU();Vs(()=>{if(b!==void 0){let O=b.trim();r.current.value=O,L.emit()}},[b]),Vs(()=>{I(6,de)},[]);let L=y.useMemo(()=>({subscribe:O=>(u.current.add(O),()=>u.current.delete(O)),snapshot:()=>r.current,setState:(O,U,Y)=>{var $,re,te,ee;if(!Object.is(r.current[O],U)){if(r.current[O]=U,O==="search")he(),ue(),I(1,ce);else if(O==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(D);se?se.focus():($=document.getElementById(R))==null||$.focus()}if(I(7,()=>{var se;r.current.selectedItemId=(se=me())==null?void 0:se.id,L.emit()}),Y||I(5,de),((re=d.current)==null?void 0:re.value)!==void 0){let se=U??"";(ee=(te=d.current).onValueChange)==null||ee.call(te,se);return}}L.emit()}},emit:()=>{u.current.forEach(O=>O())}}),[]),H=y.useMemo(()=>({value:(O,U,Y)=>{var $;U!==(($=l.current.get(O))==null?void 0:$.value)&&(l.current.set(O,{value:U,keywords:Y}),r.current.filtered.items.set(O,Z(U,Y)),I(2,()=>{ue(),L.emit()}))},item:(O,U)=>(s.current.add(O),U&&(i.current.has(U)?i.current.get(U).add(O):i.current.set(U,new Set([O]))),I(3,()=>{he(),ue(),r.current.value||ce(),L.emit()}),()=>{l.current.delete(O),s.current.delete(O),r.current.filtered.items.delete(O);let Y=me();I(4,()=>{he(),(Y==null?void 0:Y.getAttribute("id"))===O&&ce(),L.emit()})}),group:O=>(i.current.has(O)||i.current.set(O,new Set),()=>{l.current.delete(O),i.current.delete(O)}),filter:()=>d.current.shouldFilter,label:f||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:R,inputId:D,labelId:A,listInnerRef:B}),[]);function Z(O,U){var Y,$;let re=($=(Y=d.current)==null?void 0:Y.filter)!=null?$:cU;return O?re(O,r.current.search,U):0}function ue(){if(!r.current.search||d.current.shouldFilter===!1)return;let O=r.current.filtered.items,U=[];r.current.filtered.groups.forEach($=>{let re=i.current.get($),te=0;re.forEach(ee=>{let se=O.get(ee);te=Math.max(se,te)}),U.push([$,te])});let Y=B.current;pe().sort(($,re)=>{var te,ee;let se=$.getAttribute("id"),Se=re.getAttribute("id");return((te=O.get(Se))!=null?te:0)-((ee=O.get(se))!=null?ee:0)}).forEach($=>{let re=$.closest(tp);re?re.appendChild($.parentElement===re?$:$.closest(`${tp} > *`)):Y.appendChild($.parentElement===Y?$:$.closest(`${tp} > *`))}),U.sort(($,re)=>re[1]-$[1]).forEach($=>{var re;let te=(re=B.current)==null?void 0:re.querySelector(`${dl}[${Yi}="${encodeURIComponent($[0])}"]`);te==null||te.parentElement.appendChild(te)})}function ce(){let O=pe().find(Y=>Y.getAttribute("aria-disabled")!=="true"),U=O==null?void 0:O.getAttribute(Yi);L.setState("value",U||void 0)}function he(){var O,U,Y,$;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=s.current.size;return}r.current.filtered.groups=new Set;let re=0;for(let te of s.current){let ee=(U=(O=l.current.get(te))==null?void 0:O.value)!=null?U:"",se=($=(Y=l.current.get(te))==null?void 0:Y.keywords)!=null?$:[],Se=Z(ee,se);r.current.filtered.items.set(te,Se),Se>0&&re++}for(let[te,ee]of i.current)for(let se of ee)if(r.current.filtered.items.get(se)>0){r.current.filtered.groups.add(te);break}r.current.filtered.count=re}function de(){var O,U,Y;let $=me();$&&(((O=$.parentElement)==null?void 0:O.firstChild)===$&&((Y=(U=$.closest(dl))==null?void 0:U.querySelector(lU))==null||Y.scrollIntoView({block:"nearest"})),$.scrollIntoView({block:"nearest"}))}function me(){var O;return(O=B.current)==null?void 0:O.querySelector(`${XC}[aria-selected="true"]`)}function pe(){var O;return Array.from(((O=B.current)==null?void 0:O.querySelectorAll(e_))||[])}function j(O){let U=pe()[O];U&&L.setState("value",U.getAttribute(Yi))}function K(O){var U;let Y=me(),$=pe(),re=$.findIndex(ee=>ee===Y),te=$[re+O];(U=d.current)!=null&&U.loop&&(te=re+O<0?$[$.length-1]:re+O===$.length?$[0]:$[re+O]),te&&L.setState("value",te.getAttribute(Yi))}function W(O){let U=me(),Y=U==null?void 0:U.closest(dl),$;for(;Y&&!$;)Y=O>0?yU(Y,dl):bU(Y,dl),$=Y==null?void 0:Y.querySelector(e_);$?L.setState("value",$.getAttribute(Yi)):K(O)}let J=()=>j(pe().length-1),G=O=>{O.preventDefault(),O.metaKey?J():O.altKey?W(1):K(1)},k=O=>{O.preventDefault(),O.metaKey?j(0):O.altKey?W(-1):K(-1)};return y.createElement(Ne.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:O=>{var U;(U=C.onKeyDown)==null||U.call(C,O);let Y=O.nativeEvent.isComposing||O.keyCode===229;if(!(O.defaultPrevented||Y))switch(O.key){case"n":case"j":{T&&O.ctrlKey&&G(O);break}case"ArrowDown":{G(O);break}case"p":case"k":{T&&O.ctrlKey&&k(O);break}case"ArrowUp":{k(O);break}case"Home":{O.preventDefault(),j(0);break}case"End":{O.preventDefault(),J();break}case"Enter":{O.preventDefault();let $=me();if($){let re=new Event(Vp);$.dispatchEvent(re)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:H.inputId,id:H.labelId,style:_U},f),rf(e,O=>y.createElement(QC.Provider,{value:L},y.createElement(JC.Provider,{value:H},O))))}),uU=y.forwardRef((e,t)=>{var r,s;let i=on(),l=y.useRef(null),u=y.useContext(ZC),d=sc(),f=tT(e),h=(s=(r=f.current)==null?void 0:r.forceMount)!=null?s:u==null?void 0:u.forceMount;Vs(()=>{if(!h)return d.item(i,u==null?void 0:u.id)},[h]);let b=nT(i,l,[e.value,e.children,l],e.keywords),g=ev(),x=ss(I=>I.value&&I.value===b.current),_=ss(I=>h||d.filter()===!1?!0:I.search?I.filtered.items.get(i)>0:!0);y.useEffect(()=>{let I=l.current;if(!(!I||e.disabled))return I.addEventListener(Vp,E),()=>I.removeEventListener(Vp,E)},[_,e.onSelect,e.disabled]);function E(){var I,L;S(),(L=(I=f.current).onSelect)==null||L.call(I,b.current)}function S(){g.setState("value",b.current,!0)}if(!_)return null;let{disabled:T,value:C,onSelect:R,forceMount:A,keywords:D,...B}=e;return y.createElement(Ne.div,{ref:mn(l,t),...B,id:i,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!x,"data-disabled":!!T,"data-selected":!!x,onPointerMove:T||d.getDisablePointerSelection()?void 0:S,onClick:T?void 0:E},e.children)}),dU=y.forwardRef((e,t)=>{let{heading:r,children:s,forceMount:i,...l}=e,u=on(),d=y.useRef(null),f=y.useRef(null),h=on(),b=sc(),g=ss(_=>i||b.filter()===!1?!0:_.search?_.filtered.groups.has(u):!0);Vs(()=>b.group(u),[]),nT(u,d,[e.value,e.heading,f]);let x=y.useMemo(()=>({id:u,forceMount:i}),[i]);return y.createElement(Ne.div,{ref:mn(d,t),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&y.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:h},r),rf(e,_=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?h:void 0},y.createElement(ZC.Provider,{value:x},_))))}),fU=y.forwardRef((e,t)=>{let{alwaysRender:r,...s}=e,i=y.useRef(null),l=ss(u=>!u.search);return!r&&!l?null:y.createElement(Ne.div,{ref:mn(i,t),...s,"cmdk-separator":"",role:"separator"})}),hU=y.forwardRef((e,t)=>{let{onValueChange:r,...s}=e,i=e.value!=null,l=ev(),u=ss(h=>h.search),d=ss(h=>h.selectedItemId),f=sc();return y.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),y.createElement(Ne.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:i?e.value:u,onChange:h=>{i||l.setState("search",h.target.value),r==null||r(h.target.value)}})}),mU=y.forwardRef((e,t)=>{let{children:r,label:s="Suggestions",...i}=e,l=y.useRef(null),u=y.useRef(null),d=ss(h=>h.selectedItemId),f=sc();return y.useEffect(()=>{if(u.current&&l.current){let h=u.current,b=l.current,g,x=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let _=h.offsetHeight;b.style.setProperty("--cmdk-list-height",_.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(g),x.unobserve(h)}}},[]),y.createElement(Ne.div,{ref:mn(l,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":s,id:f.listId},rf(e,h=>y.createElement("div",{ref:mn(u,f.listInnerRef),"cmdk-list-sizer":""},h)))}),pU=y.forwardRef((e,t)=>{let{open:r,onOpenChange:s,overlayClassName:i,contentClassName:l,container:u,...d}=e;return y.createElement(FE,{open:r,onOpenChange:s},y.createElement(KE,{container:u},y.createElement(Yg,{"cmdk-overlay":"",className:i}),y.createElement(Wg,{"aria-label":e.label,"cmdk-dialog":"",className:l},y.createElement(eT,{ref:t,...d}))))}),gU=y.forwardRef((e,t)=>ss(r=>r.filtered.count===0)?y.createElement(Ne.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),vU=y.forwardRef((e,t)=>{let{progress:r,children:s,label:i="Loading...",...l}=e;return y.createElement(Ne.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},rf(e,u=>y.createElement("div",{"aria-hidden":!0},u)))}),Dn=Object.assign(eT,{List:mU,Item:uU,Input:hU,Group:dU,Separator:fU,Dialog:pU,Empty:gU,Loading:vU});function yU(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function bU(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function tT(e){let t=y.useRef(e);return Vs(()=>{t.current=e}),t}var Vs=typeof window>"u"?y.useEffect:y.useLayoutEffect;function Wi(e){let t=y.useRef();return t.current===void 0&&(t.current=e()),t}function ss(e){let t=ev(),r=()=>e(t.snapshot());return y.useSyncExternalStore(t.subscribe,r,r)}function nT(e,t,r,s=[]){let i=y.useRef(),l=sc();return Vs(()=>{var u;let d=(()=>{var h;for(let b of r){if(typeof b=="string")return b.trim();if(typeof b=="object"&&"current"in b)return b.current?(h=b.current.textContent)==null?void 0:h.trim():i.current}})(),f=s.map(h=>h.trim());l.value(e,d,f),(u=t.current)==null||u.setAttribute(Yi,d),i.current=d}),i}var xU=()=>{let[e,t]=y.useState(),r=Wi(()=>new Map);return Vs(()=>{r.current.forEach(s=>s()),r.current=new Map},[e]),(s,i)=>{r.current.set(s,i),t({})}};function wU(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function rf({asChild:e,children:t},r){return e&&y.isValidElement(t)?y.cloneElement(wU(t),{ref:t.ref},r(t.props.children)):r(t)}var _U={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const tv=y.forwardRef(({className:e,...t},r)=>m.jsx(Dn,{ref:r,className:xe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));tv.displayName=Dn.displayName;const nv=y.forwardRef(({className:e,...t},r)=>m.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[m.jsx(Ol,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),m.jsx(Dn.Input,{ref:r,className:xe("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})]}));nv.displayName=Dn.Input.displayName;const rv=y.forwardRef(({className:e,...t},r)=>m.jsx(Dn.List,{ref:r,className:xe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));rv.displayName=Dn.List.displayName;const av=y.forwardRef((e,t)=>m.jsx(Dn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));av.displayName=Dn.Empty.displayName;const sv=y.forwardRef(({className:e,...t},r)=>m.jsx(Dn.Group,{ref:r,className:xe("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}));sv.displayName=Dn.Group.displayName;const rT=y.forwardRef(({className:e,...t},r)=>m.jsx(Dn.Separator,{ref:r,className:xe("-mx-1 h-px bg-border",e),...t}));rT.displayName=Dn.Separator.displayName;const Sd=y.forwardRef(({className:e,...t},r)=>m.jsx(Dn.Item,{ref:r,className:xe("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}));Sd.displayName=Dn.Item.displayName;function SU(e){const t=EU(e),r=y.forwardRef((s,i)=>{const{children:l,...u}=s,d=y.Children.toArray(l),f=d.find(TU);if(f){const h=f.props.children,b=d.map(g=>g===f?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:g);return m.jsx(t,{...u,ref:i,children:y.isValidElement(h)?y.cloneElement(h,void 0,b):null})}return m.jsx(t,{...u,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function EU(e){const t=y.forwardRef((r,s)=>{const{children:i,...l}=r;if(y.isValidElement(i)){const u=AU(i),d=NU(l,i.props);return i.type!==y.Fragment&&(d.ref=s?mn(s,u):u),y.cloneElement(i,d)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var CU=Symbol("radix.slottable");function TU(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===CU}function NU(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const f=l(...d);return i(...d),f}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function AU(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var af="Popover",[aT]=or(af,[po]),ic=po(),[RU,cs]=aT(af),sT=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:i,onOpenChange:l,modal:u=!1}=e,d=ic(t),f=y.useRef(null),[h,b]=y.useState(!1),[g,x]=fa({prop:s,defaultProp:i??!1,onChange:l,caller:af});return m.jsx(Og,{...d,children:m.jsx(RU,{scope:t,contentId:on(),triggerRef:f,open:g,onOpenChange:x,onOpenToggle:y.useCallback(()=>x(_=>!_),[x]),hasCustomAnchor:h,onCustomAnchorAdd:y.useCallback(()=>b(!0),[]),onCustomAnchorRemove:y.useCallback(()=>b(!1),[]),modal:u,children:r})})};sT.displayName=af;var iT="PopoverAnchor",jU=y.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=cs(iT,r),l=ic(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=i;return y.useEffect(()=>(u(),()=>d()),[u,d]),m.jsx(qd,{...l,...s,ref:t})});jU.displayName=iT;var oT="PopoverTrigger",lT=y.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=cs(oT,r),l=ic(r),u=Ye(t,i.triggerRef),d=m.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":hT(i.open),...s,ref:u,onClick:ve(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?d:m.jsx(qd,{asChild:!0,...l,children:d})});lT.displayName=oT;var iv="PopoverPortal",[kU,OU]=aT(iv,{forceMount:void 0}),cT=e=>{const{__scopePopover:t,forceMount:r,children:s,container:i}=e,l=cs(iv,t);return m.jsx(kU,{scope:t,forceMount:r,children:m.jsx(fn,{present:r||l.open,children:m.jsx(Xl,{asChild:!0,container:i,children:s})})})};cT.displayName=iv;var ao="PopoverContent",uT=y.forwardRef((e,t)=>{const r=OU(ao,e.__scopePopover),{forceMount:s=r.forceMount,...i}=e,l=cs(ao,e.__scopePopover);return m.jsx(fn,{present:s||l.open,children:l.modal?m.jsx(DU,{...i,ref:t}):m.jsx(PU,{...i,ref:t})})});uT.displayName=ao;var MU=SU("PopoverContent.RemoveScroll"),DU=y.forwardRef((e,t)=>{const r=cs(ao,e.__scopePopover),s=y.useRef(null),i=Ye(t,s),l=y.useRef(!1);return y.useEffect(()=>{const u=s.current;if(u)return Gd(u)},[]),m.jsx(Ql,{as:MU,allowPinchZoom:!0,children:m.jsx(dT,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,u=>{var d;u.preventDefault(),l.current||(d=r.triggerRef.current)==null||d.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,h=d.button===2||f;l.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:ve(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),PU=y.forwardRef((e,t)=>{const r=cs(ao,e.__scopePopover),s=y.useRef(!1),i=y.useRef(!1);return m.jsx(dT,{...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,i.current=!1},onInteractOutside:l=>{var f,h;(f=e.onInteractOutside)==null||f.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;((h=r.triggerRef.current)==null?void 0:h.contains(u))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),dT=y.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:b,...g}=e,x=cs(ao,r),_=ic(r);return Id(),m.jsx(Yl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:l,children:m.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:b,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:m.jsx(Mg,{"data-state":hT(x.open),role:"dialog",id:x.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)"}})})})}),fT="PopoverClose",LU=y.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=cs(fT,r);return m.jsx(Ne.button,{type:"button",...s,ref:t,onClick:ve(e.onClick,()=>i.onOpenChange(!1))})});LU.displayName=fT;var zU="PopoverArrow",IU=y.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=ic(r);return m.jsx(Dg,{...i,...s,ref:t})});IU.displayName=zU;function hT(e){return e?"open":"closed"}var UU=sT,$U=lT,BU=cT,mT=uT;const pT=UU,gT=$U,ov=y.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},i)=>m.jsx(BU,{children:m.jsx(mT,{ref:i,align:t,sideOffset:r,className:xe("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})}));ov.displayName=mT.displayName;const HU=new RegExp("[\\u0000-\\u001F\\u007F-\\u009F\\u00AD\\u061C\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u206F\\uFEFF]","g");function vT(e){return String(e||"").replace(HU,"").replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function Ae(e){return vT(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function Ft(e){const t=vT(e),r=Ae(t);return["republica dominicana","rep dominicana","rep dom","rep dom lizbeth","dominicana"].includes(r)?"Republica Dominicana":t}function st(e){const t=new Map;for(const r of e){const s=Ft(r);if(!s)continue;const i=Ae(s);i&&(t.has(i)||t.set(i,s))}return Array.from(t.values())}function t_(e,t){const r=st(e),s=Ft(t);if(!s)return r;const i=Ae(s);return r.some(u=>Ae(u)===i)?r:[s,...r]}function qU(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function Mr({value:e,options:t,onValueChange:r,placeholder:s="Seleccionar…",searchPlaceholder:i="Buscar…",emptyText:l="No hay resultados.",disabled:u=!1,clearLabel:d}){const[f,h]=y.useState(!1),b=y.useMemo(()=>{const x=new Map;for(const _ of st(t)){const E=Ft(_),S=Ae(E);!S||x.has(S)||x.set(S,E)}return Array.from(x.values())},[t]),g=y.useMemo(()=>{const x=Ae(e);return b.find(_=>Ae(_)===x)??e},[b,e]);return m.jsxs(pT,{open:f,onOpenChange:h,children:[m.jsx(gT,{asChild:!0,children:m.jsxs(Fe,{type:"button",variant:"outline",role:"combobox","aria-expanded":f,disabled:u,className:xe("h-10 w-full justify-between rounded-md border-border bg-background px-3 font-normal hover:bg-background",!g&&"text-muted-foreground"),children:[m.jsx("span",{className:"truncate",children:g||s}),m.jsx(MS,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(ov,{align:"start",className:"w-[min(92vw,560px)] min-w-[var(--radix-popover-trigger-width)] p-0",children:m.jsxs(tv,{children:[m.jsx(nv,{placeholder:i}),m.jsxs(rv,{className:"overscroll-contain",onWheel:qU,children:[m.jsx(av,{children:l}),m.jsxs(sv,{children:[d&&m.jsxs(m.Fragment,{children:[m.jsxs(Sd,{value:`__clear_${d}`,onSelect:()=>{r(""),h(!1)},children:[m.jsx(da,{className:xe("mr-2 h-4 w-4",e?"opacity-0":"opacity-100")}),m.jsx("span",{className:"whitespace-normal break-words font-medium",children:d})]},"__clear__"),b.length>0&&m.jsx(rT,{className:"my-1"})]}),b.map(x=>m.jsxs(Sd,{value:`${Ae(x)} ${x}`,onSelect:()=>{r(x),h(!1)},children:[m.jsx(da,{className:xe("mr-2 h-4 w-4",Ae(e)===Ae(x)?"opacity-100":"opacity-0")}),m.jsx("span",{className:"whitespace-normal break-words leading-snug",children:x})]},Ae(x)))]})]})]})})]})}function VU(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function n_(e){return st(e.map(t=>Ft(t)).filter(Boolean))}function Gp({values:e,options:t,onValuesChange:r,placeholder:s="Seleccionar…",searchPlaceholder:i="Buscar…",emptyText:l="No hay resultados.",disabled:u=!1,summaryLabel:d="opciones seleccionadas"}){const[f,h]=y.useState(!1),b=y.useMemo(()=>n_(e),[e]),g=y.useMemo(()=>new Set(b.map(C=>Ae(C))),[b]),x=y.useMemo(()=>st([...t,...b].map(C=>Ft(C))),[t,b]),_=y.useMemo(()=>b.length===0?"":b.length<=2?b.join(", "):`${b.length} ${d}`,[b,d]),E=C=>{r(n_(C))},S=C=>{const R=Ft(C),A=Ae(R);if(g.has(A)){E(b.filter(D=>Ae(D)!==A));return}E([...b,R])},T=C=>{const R=Ae(C);E(b.filter(A=>Ae(A)!==R))};return m.jsxs("div",{className:"space-y-2",children:[m.jsxs(pT,{open:f,onOpenChange:h,children:[m.jsx(gT,{asChild:!0,children:m.jsxs(Fe,{type:"button",variant:"outline",role:"combobox","aria-expanded":f,disabled:u,className:xe("min-h-10 w-full justify-between rounded-md border-border bg-background px-3 font-normal hover:bg-background",!_&&"text-muted-foreground"),children:[m.jsx("span",{className:"truncate text-left",children:_||s}),m.jsx(MS,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(ov,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:m.jsxs(tv,{children:[m.jsx(nv,{placeholder:i}),m.jsxs(rv,{className:"overscroll-contain",onWheel:VU,children:[m.jsx(av,{children:l}),m.jsx(sv,{children:x.map(C=>{const R=g.has(Ae(C));return m.jsxs(Sd,{value:C,onSelect:()=>S(C),children:[m.jsx(da,{className:xe("mr-2 h-4 w-4",R?"opacity-100":"opacity-0")}),m.jsx("span",{className:"truncate",children:C})]},C)})})]})]})})]}),b.length>0&&m.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map(C=>m.jsxs(Gn,{variant:"secondary",className:"gap-1 rounded-full px-2 py-0.5",children:[m.jsx("span",{className:"max-w-[190px] truncate",children:C}),m.jsx("button",{type:"button",onClick:()=>T(C),className:"rounded-full text-muted-foreground transition-colors hover:text-foreground","aria-label":`Quitar ${C}`,children:m.jsx(Ml,{className:"h-3 w-3"})})]},C))})]})}const GU="design_final_art",FU="adaptation_final_art",kn="reference",KU="wmc",YU="wmc_fixed",WU="fixed";function ye(e,t,r,s,i,l){return{id:e,label:t,reference:r,min:s,max:i,hint:l}}function jn({designHour:e="35 - 50",adaptationHour:t="30",design:r,adaptation:s}){const i=[{id:GU,label:"Diseño + Entregable Arte Final",shortLabel:"Diseño + AF",hourReference:e,levels:r}];return s!=null&&s.length&&i.push({id:FU,label:"Adaptación Arte Final",shortLabel:"Adaptación AF",hourReference:t,levels:s}),i}function nr({id:e,service:t,amount:r,description:s,equivalent:i,observations:l}){const u=[s,i?`Equivalencia CDC: ${i}.`:"",l].filter(Boolean).join(" ");return{id:e,section:KU,category:"Walmart Connect",service:t,notes:u,workTypes:[{id:YU,label:"Tarifa fija WMC",shortLabel:"WMC",hourReference:"35 - 80",levels:[ye(WU,"Precio fijo",`${r} USD`,r,r,l)]}]}}const wl=[{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:jn({design:[ye("basic","Básico","50 - 80",50,80),ye("intermediate","Intermedio","100 - 150",100,150),ye("advanced","Avanzado","150 - 300",150,300)],adaptation:[ye("basic","Básico","30 - 50",30,50),ye("intermediate","Intermedio","60 - 80",60,80),ye("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:jn({design:[ye("basic","Básico","320 - 500",320,500),ye("intermediate","Intermedio","500 - 700",500,700),ye("advanced","Avanzado","800 - 1000",800,1e3)],adaptation:[ye("basic","Básico","200 - 350",200,350),ye("intermediate","Intermedio","350 - 550",350,550),ye("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:jn({design:[ye("basic","6m² aprox","250 - 350",250,350),ye("intermediate","Más 10m²","400 - 650",400,650),ye("advanced","Más de 20m²","700 - 1100",700,1100)],adaptation:[ye("basic","6m² aprox","100 - 150",100,150),ye("intermediate","Más 10m²","200 - 300",200,300),ye("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:jn({design:[ye("basic","Básico","300 - 400",300,400),ye("intermediate","Intermedio","450 - 650",450,650),ye("advanced","Avanzado","700 - 1000",700,1e3)],adaptation:[ye("basic","Básico","200 - 300",200,300),ye("intermediate","Intermedio","300 - 400",300,400),ye("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:jn({design:[ye("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[ye("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:jn({design:[ye("project","Precio único","1500 - 3000",1500,3e3)],adaptation:[ye("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:jn({design:[ye("project","Precio único","700 - 1000",700,1e3)],adaptation:[ye("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:jn({design:[ye("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[ye("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:jn({design:[ye("basic","Básico","200 - 400",200,400),ye("intermediate","Intermedio","400 - 600",400,600),ye("advanced","Avanzado","600 - 800",600,800)],adaptation:[ye("basic","Básico","50 - 100",50,100),ye("intermediate","Intermedio","100 - 150",100,150),ye("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:jn({design:[ye("basic","Básico","30 - 60",30,60),ye("intermediate","Intermedio","60 - 90",60,90),ye("advanced","Avanzado","90 - 120",90,120)],adaptation:[ye("basic","Básico","15 - 30",15,30),ye("intermediate","Intermedio","30 - 60",30,60),ye("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:kn,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[ye("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:kn,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[ye("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:kn,label:"Diseño web",shortLabel:"Web",hourReference:"36 - 50",levels:[ye("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:jn({design:[ye("basic","Básico","20 - 40",20,40),ye("intermediate","Intermedio","50 - 100",50,100),ye("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:jn({designHour:"35 - 50",design:[ye("basic","Básico","100 - 250",100,250),ye("intermediate","Intermedio","250 - 500",250,500),ye("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:jn({designHour:"1 - 25",design:[ye("basic","Básico","100",100,100),ye("intermediate","Intermedio","100 - 200",100,200),ye("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:jn({designHour:"1 - 50",design:[ye("basic","Básico","100",100,100),ye("intermediate","Intermedio","100 - 150",100,150),ye("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:kn,label:"Referencia manual",shortLabel:"Manual",levels:[ye("base","Diseño base","20 base",20,20),ye("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:kn,label:"Tarifa fija",shortLabel:"Fija",levels:[ye("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:kn,label:"Tarifa fija",shortLabel:"Fija",levels:[ye("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:kn,label:"Tarifa fija",shortLabel:"Fija",levels:[ye("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:kn,label:"Tarifa fija",shortLabel:"Fija",levels:[ye("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:kn,label:"Tarifa fija",shortLabel:"Fija",levels:[ye("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:kn,label:"Tarifa fija",shortLabel:"Fija",levels:[ye("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:kn,label:"Tarifa fija o por hora",shortLabel:"Referencia",levels:[ye("project","Por proyecto","1500 - 3000",1500,3e3),ye("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:kn,label:"Por hora",shortLabel:"Hora",levels:[ye("hour","Por hora","50 - 150 por hora",50,150)]}]},nr({id:"wmc-uniformes",service:"Uniformes",amount:80,description:"Uniforme completo para personal de impulso en piso (playera/top, jogger, falda, chaleco), con 4 variantes de diseño exploradas.",equivalent:"Materiales de PDV estándar y otros materiales básicos > Uniformes",observations:"Incluye diseño en alta resolución y 3 rondas de cambios."}),nr({id:"wmc-uniformes-supervisor",service:"Uniformes Supervisor",amount:100,description:"Uniforme para supervisor de piso (polo, chumpa/track jacket, camisa formal), con 3 variantes de diseño exploradas.",equivalent:"Materiales de PDV estándar y otros materiales básicos > Uniformes",observations:"Incluye diseño en alta resolución y 3 rondas de cambios."}),nr({id:"wmc-glorificador-mano",service:"Glorificador de mano",amount:150,description:"Exhibidor portátil pequeño para presentar el producto: bandeja iluminada, aro LED, estuche o base acrílica.",equivalent:"Stands, Muebles y Exhibidores > Estándar (Displays básicos)",observations:"Incluye diseño 3D, troqueles y 3 rondas de cambios."}),nr({id:"wmc-carritos-intervenidos",service:"Carritos intervenidos",amount:200,description:"Vinil o calcomanía de marca aplicada a la canasta y al mango del carrito de compras.",equivalent:"Materiales de PDV estándar y otros materiales básicos (análogo a Backings/Rompetráficos)",observations:"Pieza análoga a material gráfico estándar aplicado sobre una superficie existente."}),nr({id:"wmc-dummies-exhibicion",service:"Dummies de exhibición",amount:200,description:"Réplica escultórica a gran escala de pasta y cepillo dental como punto focal decorativo o táctil.",equivalent:"Proyectos especiales > Diseño de muebles / proyectos con planos y troqueles desde cero",observations:"Requiere diseño estructural y visualización 3D; no es solo arte de impresión."}),nr({id:"wmc-photobooth",service:"Photobooth",amount:200,description:"Estructura tipo arco con iluminación LED y espacio fotográfico de marca para activaciones.",equivalent:"Proyectos especiales > Diseño de Stands Creativos para ferias o eventos",observations:"Estructura autoportante con iluminación, ambientación y 4 rondas de cambios."}),nr({id:"wmc-play-station",service:"Play Station",amount:200,description:"Kiosco interactivo con pantalla táctil y mecánica de juego.",equivalent:"Proyectos especiales > Diseño de muebles / proyectos especiales",observations:"Incluye diseño de mueble e interfaz gráfica; el desarrollo funcional del juego se cotiza aparte."}),nr({id:"wmc-isla-wm",service:"Isla WM",amount:150,description:"Mueble isla completo multinivel con iluminación, gráficos y espacio de exhibición de la línea completa de producto.",equivalent:"Proyectos especiales > Diseño de Stands Creativos para ferias o eventos",observations:"Mayor escala y complejidad estructural dentro del set de piezas."}),nr({id:"wmc-exhibicion-especial",service:"Exhibición Especial",amount:250,description:"Propuesta de muebles de exhibición.",equivalent:"Proyectos especiales > Diseño de muebles con planos y troqueles desde cero",observations:"Costo de referencia por concepto; las variantes adicionales se cobran como adicionales."}),nr({id:"wmc-punta-gondola",service:"Punta de góndola",amount:250,description:"Cabecera de góndola personalizada con iluminación, gráficos y espacio para producto.",equivalent:"Proyectos especiales > Diseño de muebles con planos y troqueles desde cero",observations:"Costo de referencia por concepto; las variantes adicionales se cobran como adicionales."}),nr({id:"wmc-estacion-prueba-producto",service:"Estación para prueba de producto",amount:200,description:"Carrito móvil con lavamanos funcional, grifo y desagüe para pruebas de producto en piso.",equivalent:"Proyectos especiales > Diseño de Stands Creativos para ferias o eventos",observations:"La complejidad funcional puede requerir una cotización especial fuera del tarifario estándar."}),nr({id:"wmc-arco-entrada",service:"Arco de entrada",amount:200,description:"Estructura de entrada de tienda a gran formato con iluminación, efecto de niebla y gráficos de marca.",equivalent:"Proyectos especiales > Diseño de Stands Creativos para ferias o eventos",observations:"La instalación en sitio se cotiza aparte."})];function Fp(e){return e?e.reference:""}function zu(e){return e&&typeof e.min=="number"&&typeof e.max=="number"?String((e.min===e.max,e.min)):""}const so="tablero_cdc_tariff_catalog",Kp="Referencia",yT="Precio único";let Wa={rows:Yp(wl),catalog:wl,source:"fallback",loading:!1,error:null},eo=!1,Zu=[],np=0;function rp(){Zu.forEach(e=>e())}function r_(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 _l(e){return String(e||"").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function lv(e,t,r){return[e,t,r].map(_l).filter(Boolean).join("__")}function bT(e){const t=String(e.section||"grafico").trim().toLowerCase()||"grafico",r=String(e.category||"").trim(),s=String(e.service||"").trim(),i=String(e.catalog_item_id||_l(`${t}-${r}-${s}`)).trim(),l=String(e.work_type_label||Kp).trim(),u=String(e.level_label||yT).trim(),d=String(e.work_type_id||_l(l)||kn).trim(),f=String(e.level_id||_l(u)||"project").trim();return{id:String(e.id||lv(i,d,f)).trim(),catalog_item_id:i,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:r_(e.reference_min),reference_max:r_(e.reference_max),level_hint:String(e.level_hint||"").trim(),sort_order:Number(e.sort_order||0),is_active:e.is_active!==!1,managed_by:String(e.managed_by||"sheet").trim()||"sheet",created_at:typeof e.created_at=="string"?e.created_at:null,updated_at:typeof e.updated_at=="string"?e.updated_at:null}}function XU(e){const t=new Map,r=new Map,s=e.filter(i=>i.is_active).sort((i,l)=>i.sort_order-l.sort_order||i.category.localeCompare(l.category));for(const i of s){const l=i.catalog_item_id||_l(`${i.section}-${i.category}-${i.service}`);let u=t.get(l);u||(u={id:l,section:i.section,category:i.category,service:i.service,notes:i.notes,workTypes:[]},t.set(l,u),r.set(l,new Map));const d=i.work_type_id||kn,f=r.get(l);let h=f.get(d);h||(h={id:d,label:i.work_type_label||Kp,shortLabel:i.work_type_short_label||i.work_type_label||Kp,hourReference:i.hour_reference||void 0,levels:[]},f.set(d,h),u.workTypes.push(h));const b={id:i.level_id||"project",label:i.level_label||yT,reference:i.reference||"",min:i.reference_min??void 0,max:i.reference_max??void 0,hint:i.level_hint||void 0};h.levels.some(g=>g.id===b.id)||h.levels.push(b)}return Array.from(t.values())}function Yp(e){const t=[];return e.forEach((r,s)=>{r.workTypes.forEach((i,l)=>{i.levels.forEach((u,d)=>{t.push({id:lv(r.id,i.id,u.id),catalog_item_id:r.id,section:r.section,category:r.category,service:r.service,notes:r.notes||"",work_type_id:i.id,work_type_label:i.label,work_type_short_label:i.shortLabel,hour_reference:i.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,managed_by:"system"})})})}),t}function xT(e){return lv(e.catalog_item_id,e.work_type_id,e.level_id)}function JU(e){const t=e instanceof Error?e.message:String(e||"");return t.includes(so)||t.includes("Could not find the table")||t.includes("relation")||t.includes("does not exist")}async function Ed(e=!1){if(eo&&!e)return Wa;const t=np+=1;Wa={...Wa,loading:!0,error:null},rp();try{const r=await ze.from(so).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, managed_by, created_at, updated_at").order("sort_order",{ascending:!0}).order("category",{ascending:!0});let s=r.data,i=r.error;if(i&&String(i.message||"").includes("managed_by")){const b=await ze.from(so).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});s=b.data,i=b.error}if(i)throw i;const l=(s||[]).map(b=>bT(b)),u=Yp(wl),d=new Map;u.forEach(b=>d.set(b.id,b)),l.forEach(b=>d.set(b.id,b));const f=Array.from(d.values()).sort((b,g)=>b.sort_order-g.sort_order||b.category.localeCompare(g.category)),h=XU(f);t===np&&(Wa={rows:f,catalog:h,source:l.length?"supabase":"fallback",loading:!1,error:l.length?null:"La tabla del tarifario está vacía. Se está usando el tarifario base de la app como respaldo."},eo=!0,rp())}catch(r){const s=r instanceof Error?r.message:String(r||""),i=JU(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===np&&(Wa={rows:Yp(wl),catalog:wl,source:"fallback",loading:!1,error:i},eo=!0,rp())}return Wa}async function QU(e,t){const r=bT(e),s=r.id||xT(r);if(t!=null&&t.catalog_item_id&&(t.category!==r.category||t.service!==r.service||t.notes!==r.notes)){const{error:u}=await ze.from(so).update({category:r.category,service:r.service,notes:r.notes,managed_by:"app"}).eq("catalog_item_id",t.catalog_item_id);if(u)throw u}const{error:i}=await ze.from(so).upsert({id:s,catalog_item_id:r.catalog_item_id,section:r.section,category:r.category,service:r.service,notes:r.notes,work_type_id:r.work_type_id,work_type_label:r.work_type_label,work_type_short_label:r.work_type_short_label,hour_reference:r.hour_reference,level_id:r.level_id,level_label:r.level_label,reference:r.reference,reference_min:r.reference_min,reference_max:r.reference_max,level_hint:r.level_hint,sort_order:r.sort_order,is_active:r.is_active,managed_by:"app"},{onConflict:"id"});if(i)throw i;return eo=!1,Ed(!0)}async function ZU(e,t){const{error:r}=await ze.from(so).update({is_active:t,managed_by:"app"}).eq("id",e.id);if(r)throw r;eo=!1,await Ed(!0)}function wT(){const[,e]=y.useState(0);return y.useEffect(()=>{const t=()=>e(r=>r+1);return Zu.push(t),!eo&&!Wa.loading&&Ed(),()=>{Zu=Zu.filter(r=>r!==t)}},[]),{...Wa,refresh:Ed}}const sf="tablero_cdc_tariff_sections",Wp=[{id:"grafico",name:"Tarifario Gráfico CDC",scope:"general",clientName:"",pricingMode:"guided",allowManual:!0,description:"Diseño gráfico, artes finales, adaptaciones y materiales de punto de venta.",sortOrder:10,isActive:!0},{id:"estrategia",name:"Estrategia y Creatividad",scope:"general",clientName:"",pricingMode:"guided",allowManual:!0,description:"Servicios de estrategia, conceptualización y creatividad.",sortOrder:20,isActive:!0},{id:"wmc",name:"Tarifario Walmart Connect",scope:"client",clientName:"Walmart Connect WMC",pricingMode:"fixed_multi",allowManual:!0,description:"Piezas de precio fijo que aparecen únicamente para Walmart Connect WMC.",sortOrder:100,isActive:!0}];let Xa={sections:Wp,loading:!1,error:null,source:"fallback"},to=!1,ed=[],ap=0;function sp(){ed.forEach(e=>e())}function Ya(e){return String(e||"").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,70)}function _T(e,t,r=""){const s=Ya(e==="client"&&r||t)||"seccion",i=Date.now().toString(36).slice(-5);return`${e==="client"?"cliente":"general"}-${s}-${i}`}function e$(e){const t=e.scope==="client"?"client":"general",r=e.pricing_mode==="fixed_multi"?"fixed_multi":"guided";return{id:String(e.id||"").trim(),name:String(e.name||"Sección sin nombre").trim(),scope:t,clientName:String(e.client_name||"").trim(),pricingMode:r,allowManual:e.allow_manual!==!1,description:String(e.description||"").trim(),sortOrder:Number(e.sort_order||0),isActive:e.is_active!==!1,createdAt:e.created_at||null,updatedAt:e.updated_at||null}}function t$(e){const t=e instanceof Error?e.message:String(e||"");return t.includes(sf)||t.includes("Could not find the table")||t.includes("does not exist")||t.includes("relation")}async function Cd(e=!1){if(to&&!e)return Xa;const t=ap+=1;Xa={...Xa,loading:!0,error:null},sp();try{const{data:r,error:s}=await ze.from(sf).select("id, name, scope, client_name, pricing_mode, allow_manual, description, sort_order, is_active, created_at, updated_at").order("sort_order",{ascending:!0}).order("name",{ascending:!0});if(s)throw s;const i=(r||[]).map(e$),l=new Map(Wp.map(d=>[d.id,d]));i.forEach(d=>l.set(d.id,d));const u=Array.from(l.values()).sort((d,f)=>d.sortOrder-f.sortOrder||d.name.localeCompare(f.name));t===ap&&(Xa={sections:u,loading:!1,error:i.length?null:"La tabla de secciones está vacía. Se muestran las secciones base como respaldo.",source:i.length?"supabase":"fallback"},to=!0,sp())}catch(r){const s=r instanceof Error?r.message:String(r||"");t===ap&&(Xa={sections:Wp,loading:!1,error:t$(r)?"Falta ejecutar el SQL del módulo de tarifario. Se muestran las secciones base como respaldo.":s||"No se pudieron cargar las secciones del tarifario.",source:"fallback"},to=!0,sp())}return Xa}async function n$(e){const t=e.name.trim(),r=e.scope==="client"?e.clientName.trim():"";if(!t)throw new Error("Escribe el nombre de la sección.");if(e.scope==="client"&&!r)throw new Error("Selecciona el cliente del tarifario especial.");const{error:s}=await ze.from(sf).upsert({id:e.id,name:t,scope:e.scope,client_name:r,pricing_mode:e.scope==="client"?"fixed_multi":"guided",allow_manual:e.allowManual,description:e.description.trim(),sort_order:Number(e.sortOrder||0),is_active:e.isActive},{onConflict:"id"});if(s)throw s;return to=!1,Cd(!0)}async function r$(e,t){const{error:r}=await ze.from(sf).update({is_active:t}).eq("id",e.id);if(r)throw r;return to=!1,Cd(!0)}function ST(){const[,e]=y.useState(0);return y.useEffect(()=>{const t=()=>e(r=>r+1);return ed.push(t),!to&&!Xa.loading&&Cd(),()=>{ed=ed.filter(r=>r!==t)}},[]),{...Xa,refresh:Cd}}function Iu(e){const t=Number(e.replace(/,/g,"").trim());return Number.isFinite(t)?t:0}function fl(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function a$(e){return(e==null?void 0:e.workTypes[0])||null}function a_(e){return(e==null?void 0:e.levels[0])||null}function ip(e){return e.trim()}function ET(e){const t=e.workTypes[0]||null,r=(t==null?void 0:t.levels[0])||null;return{workType:t,level:r}}function td(e){const{level:t}=ET(e),r=Number((t==null?void 0:t.min)??(t==null?void 0:t.max)??0);return Number.isFinite(r)?r:0}function CT(e,t){return t.id==="wmc"&&e.source==="tariff"&&(Ae(e.workType)===Ae("Tarifa fija WMC")||Ae(e.category)===Ae("Walmart Connect"))}function op(e,t){return e.source!=="tariff"?!1:e.tariffSectionId?e.tariffSectionId===t.id:CT(e,t)}function s$(e,t){const{workType:r,level:s}=ET(e),i=td(e);return!r||!s||i<=0?null:{source:"tariff",category:t.name,serviceName:e.service,workType:`Tarifa fija · ${t.name}`,complexityLevel:"Precio fijo",referenceLabel:Fp(s),referenceMin:i,referenceMax:i,amount:i,description:e.notes||"",tariffSectionId:t.id,tariffCatalogId:e.id}}function i$({client:e,items:t,onChange:r,loading:s,error:i}){const[l,u]=y.useState("grafico"),[d,f]=y.useState(""),[h,b]=y.useState(""),[g,x]=y.useState(""),[_,E]=y.useState(""),[S,T]=y.useState(""),[C,R]=y.useState(""),[A,D]=y.useState(""),[B,I]=y.useState(""),{catalog:L,loading:H,error:Z}=wT(),{sections:ue,loading:ce,error:he}=ST(),de=y.useMemo(()=>ue.filter(oe=>oe.isActive&&oe.scope==="general"&&oe.pricingMode==="guided"),[ue]),me=y.useMemo(()=>{const oe=Ae(e);return oe?ue.filter(je=>je.isActive&&je.scope==="client"&&je.pricingMode==="fixed_multi"&&Ae(je.clientName)===oe):[]},[e,ue]),pe=me.length>0,j=de.find(oe=>oe.id===l)||de[0]||null;y.useEffect(()=>{!j&&de.length?u(de[0].id):j&&j.id!==l&&u(j.id)},[j,de,l]);const K=y.useMemo(()=>L.filter(oe=>oe.section===(j==null?void 0:j.id)).map(oe=>`${oe.category} · ${oe.service}`),[j==null?void 0:j.id,L]),W=y.useMemo(()=>L.find(oe=>oe.section===(j==null?void 0:j.id)&&`${oe.category} · ${oe.service}`===d)||null,[j==null?void 0:j.id,d,L]),J=y.useMemo(()=>W&&W.workTypes.find(oe=>oe.id===h)||null,[W,h]),G=y.useMemo(()=>J&&J.levels.find(oe=>oe.id===g)||null,[J,g]),k=t.reduce((oe,je)=>oe+Number(je.amount||0),0),O=()=>{f(""),b(""),x(""),E(""),T("")},U=oe=>{var Ve;const je=de.find($e=>$e.name===oe);u((je==null?void 0:je.id)||((Ve=de[0])==null?void 0:Ve.id)||""),O()},Y=oe=>{f(oe);const je=L.find(Nt=>Nt.section===(j==null?void 0:j.id)&&`${Nt.category} · ${Nt.service}`===oe),Ve=a$(je),$e=a_(Ve);b((Ve==null?void 0:Ve.id)||""),x(($e==null?void 0:$e.id)||""),E(zu($e)),T("")},$=oe=>{if(!W)return;const je=W.workTypes.find($e=>$e.label===oe),Ve=a_(je);b((je==null?void 0:je.id)||""),x((Ve==null?void 0:Ve.id)||""),E(zu(Ve))},re=oe=>{if(!J)return;const je=J.levels.find(Ve=>Ve.label===oe);x((je==null?void 0:je.id)||""),E(zu(je))},te=()=>{if(!W||!J||!G||!j)return;const oe=Iu(_);oe<=0||(r([...t,{source:"tariff",category:W.category,serviceName:W.service,workType:J.label,complexityLevel:G.label,referenceLabel:Fp(G),referenceMin:G.min??null,referenceMax:G.max??null,amount:oe,description:ip(S),tariffSectionId:j.id,tariffCatalogId:W.id}]),T(""),E(zu(G)))},ee=(oe,je)=>{const Ve=L.filter(Ie=>Ie.section===oe.id&&td(Ie)>0),$e=t.filter(Ie=>op(Ie,oe)),Nt=new Map($e.map(Ie=>[Ae(Ie.serviceName),Ie])),We=new Map(Ve.map(Ie=>[Ae(Ie.service),Ie])),it=je.map(Ie=>{const Q=Ae(Ie);return Nt.get(Q)||(We.get(Q)?s$(We.get(Q),oe):null)}).filter(Ie=>!!Ie),Pt=t.filter(Ie=>!op(Ie,oe));r([...Pt,...it])},se=me[0]||null,Se=!pe||me.some(oe=>oe.allowManual),Te=()=>{const oe=Iu(B),je=(se==null?void 0:se.name)||"Otros",Ve=ip(C)||(se?`Propuesta general ${se.clientName}`:"Otros / costo manual");oe<=0||(r([...t,{source:"manual",category:je,serviceName:Ve,workType:"Manual",complexityLevel:"",referenceLabel:"Monto manual",referenceMin:null,referenceMax:null,amount:oe,description:ip(A),tariffSectionId:se==null?void 0:se.id}]),R(""),D(""),I(""))},Re=oe=>{r(t.filter((je,Ve)=>Ve!==oe))},nt=(J==null?void 0:J.label)||"",Ze=(G==null?void 0:G.label)||"",xt=i||Z||he;return m.jsxs("div",{className:"md:col-span-2 rounded-2xl border border-border bg-muted/20 p-4",children:[m.jsxs("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[m.jsxs("div",{className:"flex items-start gap-2.5",children:[m.jsx("span",{className:"mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:m.jsx(XD,{className:"h-4 w-4"})}),m.jsxs("div",{children:[m.jsx("h3",{className:"text-sm font-semibold",children:"Tarifario / Estimación interna"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:pe?`Este cliente tiene ${me.length===1?"un tarifario especial":"tarifarios especiales"}. Selecciona piezas o agrega un costo manual.`:"Agrega costos del tarifario general o montos manuales. El total se guarda como Interno Cargado."})]})]}),m.jsxs("div",{className:"rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-sm font-semibold text-primary",children:["Total: ",fl(k)]})]}),xt&&m.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:[m.jsx(TP,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0"}),m.jsx("span",{children:xt})]}),(s||H||ce)&&m.jsx("div",{className:"mb-3 rounded-xl border border-border bg-card px-3 py-2 text-xs text-muted-foreground",children:s?"Cargando costos guardados…":"Cargando tarifario…"}),m.jsxs("div",{className:"space-y-4",children:[pe?me.map(oe=>{const je=L.filter(We=>We.section===oe.id&&td(We)>0),Ve=t.filter(We=>op(We,oe)),$e=Ve.map(We=>We.serviceName),Nt=Ve.reduce((We,it)=>We+Number(it.amount||0),0);return m.jsxs("div",{className:"space-y-4 rounded-xl border border-primary/20 bg-card p-4",children:[m.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium",children:oe.name}),m.jsx("p",{className:"text-xs text-muted-foreground",children:oe.description||"Selecciona una o varias piezas. Cada pieza se carga una sola vez con su monto fijo."})]}),m.jsx(Gn,{className:"w-fit",children:oe.clientName})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Piezas a cotizar"}),m.jsx(Gp,{values:$e,options:je.map(We=>We.service),onValuesChange:We=>ee(oe,We),placeholder:"Seleccionar una o varias piezas…",searchPlaceholder:"Buscar pieza…",emptyText:"No se encontró esa pieza en este tarifario.",disabled:H||je.length===0,summaryLabel:"piezas seleccionadas"})]}),m.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-muted/30 p-3",children:[m.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[m.jsx("p",{className:"text-xs font-medium text-foreground",children:"Piezas y montos fijos"}),m.jsxs("p",{className:"text-xs font-semibold text-primary",children:["Subtotal: ",fl(Nt)]})]}),je.length===0?m.jsx("p",{className:"text-xs text-muted-foreground",children:"Este tarifario todavía no tiene piezas activas. Agrégalas desde el módulo Tarifario."}):m.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:je.map(We=>{const it=$e.some(Pt=>Ae(Pt)===Ae(We.service));return m.jsxs("div",{className:xe("flex items-center justify-between gap-3 rounded-lg border px-2.5 py-2 text-xs",it?"border-primary/30 bg-primary/10 text-foreground":"border-border bg-card text-muted-foreground"),children:[m.jsx("span",{className:"min-w-0 truncate",children:We.service}),m.jsx("span",{className:"flex-shrink-0 font-semibold text-foreground",children:fl(td(We))})]},We.id)})})]})]},oe.id)}):m.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium",children:"Agregar desde tarifario general"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Referencia flexible. El usuario autorizado decide el monto final."})]}),m.jsx(Gn,{variant:"secondary",children:"Tarifario"})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Sección"}),m.jsx(Mr,{value:(j==null?void 0:j.name)||"",options:de.map(oe=>oe.name),onValueChange:U,placeholder:"Seleccionar sección…",searchPlaceholder:"Buscar sección…",emptyText:"No hay secciones generales activas."})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Ítem a cobrar"}),m.jsx(Mr,{value:d,options:K,onValueChange:Y,placeholder:"Seleccionar ítem…",searchPlaceholder:"Buscar ítem…",emptyText:"No se encontró ese ítem.",disabled:!j})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Tipo de trabajo"}),m.jsx(Mr,{value:nt,options:(W==null?void 0:W.workTypes.map(oe=>oe.label))||[],onValueChange:$,placeholder:"Seleccionar tipo…",searchPlaceholder:"Buscar tipo…",disabled:!W})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Nivel / referencia"}),m.jsx(Mr,{value:Ze,options:(J==null?void 0:J.levels.map(oe=>oe.label))||[],onValueChange:re,placeholder:"Seleccionar nivel…",searchPlaceholder:"Buscar nivel…",disabled:!J})]})]}),W&&J&&G&&m.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground",children:[m.jsxs("p",{children:[m.jsx("span",{className:"font-medium text-foreground",children:"Referencia:"})," ",Fp(G)," USD",J.hourReference?` · Hora hombre ref.: ${J.hourReference}`:""]}),W.notes&&m.jsx("p",{className:"mt-1",children:W.notes}),G.hint&&m.jsx("p",{className:"mt-1",children:G.hint})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[220px_minmax(0,1fr)]",children:[m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Monto final"}),m.jsx(gt,{type:"number",min:"0",step:"0.01",value:_,onChange:oe=>E(oe.target.value),placeholder:"0.00",disabled:!G})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Observación"}),m.jsx(ts,{value:S,onChange:oe=>T(oe.target.value),placeholder:"Ej: más rondas de cambios, piezas adicionales, complejidad especial…",disabled:!G,rows:5,className:"min-h-[132px] resize-y"})]})]}),m.jsx("div",{className:"flex justify-end",children:m.jsxs(Fe,{type:"button",onClick:te,disabled:!W||!J||!G||Iu(_)<=0,className:"gap-1.5 rounded-full",children:[m.jsx(es,{className:"h-4 w-4"}),"Agregar tarifa"]})})]}),Se&&m.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium",children:se?`Agregar propuesta o costo manual para ${se.clientName}`:"Agregar costo manual"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:se?"Para propuestas generales, proyectos por concepto o casos no contemplados por pieza.":"Para otros, adicionales o casos fuera del tarifario."})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[minmax(0,1fr)_220px]",children:[m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Nombre"}),m.jsx(gt,{value:C,onChange:oe=>R(oe.target.value),placeholder:se?`Ej: Propuesta general ${se.clientName}`:"Ej: Piezas adicionales"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Monto"}),m.jsx(gt,{type:"number",min:"0",step:"0.01",value:B,onChange:oe=>I(oe.target.value),placeholder:"0.00"})]})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Descripción"}),m.jsx(ts,{value:A,onChange:oe=>D(oe.target.value),placeholder:se?"Ej: Compendio cotizado por proyecto, no por piezas.":"Ej: Cliente pidió piezas adicionales fuera del paquete.",rows:4,className:"min-h-[110px] resize-y"})]}),m.jsx("div",{className:"flex justify-end",children:m.jsxs(Fe,{type:"button",variant:"outline",onClick:Te,disabled:Iu(B)<=0,className:"w-full gap-1.5 rounded-full sm:w-auto sm:min-w-[240px]",children:[m.jsx(es,{className:"h-4 w-4"}),"Agregar costo manual"]})})]})]}),m.jsx(Ls,{className:"my-4"}),m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("p",{className:"text-sm font-medium",children:"Costos agregados"}),m.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.length," línea(s)"]})]}),t.length===0?m.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. Usa el tarifario disponible o agrega un monto manual."}):m.jsxs("div",{className:"space-y-2",children:[t.map((oe,je)=>{const Ve=ue.find(We=>We.id===oe.tariffSectionId&&We.scope==="client"),$e=!Ve&&me.find(We=>CT(oe,We)),Nt=Ve||$e;return m.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:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.jsx(Gn,{variant:oe.source==="manual"?"outline":"secondary",children:oe.source==="manual"?"Manual":Nt?Nt.clientName:"Tarifario"}),m.jsx("p",{className:"text-sm font-medium",children:oe.serviceName})]}),m.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[oe.category&&m.jsx("span",{children:oe.category}),oe.workType&&m.jsx("span",{children:oe.workType}),oe.complexityLevel&&m.jsx("span",{children:oe.complexityLevel}),oe.referenceLabel&&m.jsxs("span",{children:["Ref.: ",oe.referenceLabel]})]}),oe.description&&m.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:oe.description})]}),m.jsxs("div",{className:"flex items-center justify-between gap-3 sm:flex-col sm:items-end",children:[m.jsx("p",{className:"text-sm font-semibold text-foreground",children:fl(Number(oe.amount||0))}),m.jsxs(Fe,{type:"button",variant:"ghost",size:"sm",onClick:()=>Re(je),className:xe("h-8 rounded-full px-2 text-muted-foreground hover:text-destructive"),children:[m.jsx(PS,{className:"mr-1 h-3.5 w-3.5"}),"Quitar"]})]})]},`${oe.source}-${oe.serviceName}-${je}`)}),m.jsxs("div",{className:"flex items-center justify-end gap-2 rounded-xl bg-primary/10 px-3 py-2 text-primary",children:[m.jsx(wg,{className:"h-4 w-4"}),m.jsxs("span",{className:"text-sm font-semibold",children:["Total interno estimado: ",fl(k)]})]})]})]})]})}const Ds={clientes:Rz,marcas:jz,bus:RE,buCm:Vg,status:[...kz]};let nd=[],Xp=Ds,zl=!1,TT=!1,cv=null,Sl=null,zs=null,Uu=0;function Jp(){nd.forEach(e=>e())}function Os(e){return st(e)}function o$(e){const t=new Map(RE.map(r=>[Ae(r),r]));return st(e).map(r=>t.get(Ae(r))||null).filter(r=>!!r)}function l$(e){return String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function c$(e){const t=l$(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 u$(e){return Ft(String(e.label||e.value||""))}function d$(e){const t=[],r=[],s=[],i=[],l={...Vg};for(const u of e){if(u.is_active===!1)continue;const d=c$(u.category),f=u$(u),h=Ft(String(u.value||""));if(!(!f&&!h)&&(d==="client"&&t.push(f||h),d==="brand"&&r.push(f||h),d==="country"&&s.push(f||h),d==="status"&&i.push(f||h),d==="country_manager"&&h)){const b=f||h;b&&b!==h&&(l[h]=b)}}return{clientes:t.length?Os(t):Os(Ds.clientes),marcas:r.length?Os(r):Os(Ds.marcas),bus:s.length?o$([...Ds.bus,...s]):Os(Ds.bus),buCm:l,status:i.length?Os(i):Os(Ds.status)}}function f$(e){cv=e,Jp()}async function Qp(){zl=!0,f$(null),Jp();try{const{data:e,error:t}=await ze.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;Xp=d$(e||[]),TT=!0}catch(e){console.error("Error cargando listas desde Supabase:",e),cv=e instanceof Error?e.message:"No se pudieron cargar los desplegables desde Supabase.",Xp=Ds}finally{zl=!1,Jp()}}function h$(){zs&&clearTimeout(zs),zs=setTimeout(()=>{zs=null,zl||Qp()},350)}function m$(){Sl||(Sl=ze.channel("tablero-cdc-app-lists").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_lists"},()=>h$()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a tablero_cdc_app_lists:",e)}))}function p$(){zs&&(clearTimeout(zs),zs=null),Sl&&(ze.removeChannel(Sl),Sl=null)}function uv(){const[,e]=y.useState(0);return y.useEffect(()=>{const t=()=>e(r=>r+1);return nd.push(t),Uu+=1,m$(),!TT&&!zl&&Qp(),()=>{nd=nd.filter(r=>r!==t),Uu=Math.max(0,Uu-1),Uu===0&&p$()}},[]),{lists:Xp,loading:zl,error:cv,refresh:Qp}}const g$={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"},v$=[[/(^|[_\-\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 io(e){return Ft(String(e??""))}function s_(e,t,r=[]){const s=io(t);if(!s)return;const i=r.find(l=>Ae(l)===Ae(s));e.push(i||s)}function NT(e,t,r){const s=io(t),i=Ae(s);i&&r.forEach(l=>{const u=Ae(l);u&&(i===u||i.includes(u))&&e.push(l)})}function of(e,t=[]){const r=io(e);if(!r)return[];const s=[];return NT(s,r,t),r.split(/[,;|/]+/).map(i=>io(i)).filter(Boolean).forEach(i=>s_(s,i,t)),s.length===0&&s_(s,r,t),st(s)}function Zp(e,t=[]){const r=io(e);if(!r)return[];const s=[];return NT(s,r,t),r.split(/[,;|/]+/).map(i=>io(i)).filter(Boolean).forEach(i=>{const l=g$[Ae(i)],u=t.find(d=>Ae(d)===Ae(i));l?s.push(l):u&&s.push(u)}),v$.forEach(([i,l])=>{i.test(r)&&s.push(l)}),st(s)}function AT(e,t=[]){const r=[...Zp(e.bu,t),...Zp(e.nombre,t)],s=Ae(e.cliente),i=Ae(e.nombre);return(s.includes("walmartconnect")||s.includes("wmc")||i.includes("wmc"))&&r.push("WMC"),st(r)}function RT(e,t=[]){return of(e.marca,t)}function jT(e,t=[]){return of(e.cliente,t)}function kT(e,t=[]){return of(e.cm,t)}function $u(e,t){const r=Ae(t);return r?e.some(s=>{const i=Ae(s);return i===r||i.includes(r)||r.includes(i)}):!0}function OT(e,t,r={}){if(t.country){const s=AT(e,r.countries||[]);if(!$u(s,t.country))return!1}if(t.brand){const s=RT(e,r.brands||[]);if(!$u(s,t.brand))return!1}if(t.client){const s=jT(e,r.clients||[]);if(!$u(s,t.client))return!1}if(t.cm){const s=kT(e,r.cms||[]);if(!$u(s,t.cm))return!1}return!0}function y$(e,t=[]){return st(e.flatMap(r=>Zp(r,t)))}function lp(e,t=[]){return st(e.flatMap(r=>of(r,t)))}function MT(e,t={}){return{countries:st(e.flatMap(r=>AT(r,t.countries||[]))),brands:st(e.flatMap(r=>RT(r,t.brands||[]))),clients:st(e.flatMap(r=>jT(r,t.clients||[]))),cms:st(e.flatMap(r=>kT(r,t.cms||[])))}}function DT(e){return!!(e.country||e.brand||e.client||e.cm)}const PT="blue",lf="Activo",oa={tab:"todos",search:"",page:1,pageSize:24,country:"",brand:"",client:"",cm:""};let rd=[],pa=[],Td=0,LT={countries:[],brands:[],clients:[],cms:[]},Il=!1,zT=!1,dv=null,El=null,Is=null,Bu=0,Mn={...oa},Pr=0,Hu=0;function Ul(){rd.forEach(e=>e())}function Nd(e,t=""){return typeof e=="string"?e:t}function b$(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function x$(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 w$(e,t){return Nd(e.legacy_month,"")||Nd(e.mes,"")||t.toLocaleString("es-DO",{month:"long"})}function _$(e,t){return x$(e.legacy_year,b$(e.anio,t.getFullYear()))}function S$(e){return!e||e===lf?"":e}function E$(e){return e&&e.trim()?e:lf}function IT(e){return{tab:(e==null?void 0:e.tab)??Mn.tab??oa.tab,search:String((e==null?void 0:e.search)??Mn.search??oa.search).trim(),page:Math.max(1,Math.floor(Number((e==null?void 0:e.page)??Mn.page??oa.page))),pageSize:Math.max(1,Math.min(100,Math.floor(Number((e==null?void 0:e.pageSize)??Mn.pageSize??oa.pageSize)))),country:String((e==null?void 0:e.country)??Mn.country??oa.country).trim(),brand:String((e==null?void 0:e.brand)??Mn.brand??oa.brand).trim(),client:String((e==null?void 0:e.client)??Mn.client??oa.client).trim(),cm:String((e==null?void 0:e.cm)??Mn.cm??oa.cm).trim()}}function cf(e){const t=e.extra_data||{},r=e.project_links||[],s=r.filter(d=>d.link_type==="proposal").map(d=>d.url||"").filter(Boolean),i=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:Nd(t.color,PT),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:i,status:S$(e.status),monto:e.internal_amount==null?null:Number(e.internal_amount),mes:w$(t,u),anio:_$(t,u),createdAt:Number.isFinite(l)?l:Date.now(),extraData:t}}function C$(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 i_(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),i=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(i)?i:null,amount:Number.isFinite(r)?r:0,description:e.description||"",tariffSectionId:e.tariff_section_id||"",tariffCatalogId:e.tariff_catalog_id||"",createdAt:Number.isFinite(t)?t:Date.now()}}function UT(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 o_(e){return e&&e.trim()?e:lf}function qu(e,t,r){return`${e} ${e===1?t:r}`}function l_(e){return Array.isArray(e)?e.map(t=>String(t||"").trim()).filter(Boolean).join(" | "):String(e??"").trim()}function Fa(e,t,r,s,i){const l=l_(r),u=l_(s);if(l!==u){if(i!=null&&i.privateValue){e.push(`${t} actualizado.`);return}e.push(`${t}: ${l||"—"}${u||"—"}`)}}function T$(e,t,r){const s=[];return Fa(s,"Nombre",e.nombre,t.nombre),Fa(s,"Cliente",e.cliente,t.cliente),Fa(s,"Marca",e.marca,t.marca),Fa(s,"País/BU",e.bu,t.bu),Fa(s,"CM",e.cm,t.cm),Fa(s,"Solicitado por",e.solicitante,t.solicitante),Fa(s,"Estatus",o_(e.status),o_(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: ${qu(e.propuestaLinks.length,"link","links")}${qu(t.propuestaLinks.length,"link","links")}.`),e.afLinks.join("|")!==t.afLinks.join("|")&&s.push(`Links de artes finales: ${qu(e.afLinks.length,"link","links")}${qu(t.afLinks.length,"link","links")}.`),r&&Number(e.monto??0)!==Number(t.monto??0)&&Fa(s,"Monto interno",e.monto,t.monto,{privateValue:!0}),s}async function fv(){const{data:e,error:t}=await ze.auth.getUser();if(t||!e.user)throw new Error("No hay una sesión activa de Supabase.");return e.user}async function $T(){return(await fv()).id}async function N$(){return(await mg()).role==="director_creativo"}async function BT(){return(await mg()).canManageInternalPricing}async function A$(){return(await mg()).canDeleteProjects}function HT(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:E$(e.status),internal_amount:e.monto??null,brief_link:e.briefLink,extra_data:{...t,color:e.color??Nd(t.color,PT),mes:e.mes,anio:e.anio}}}function R$(e,t){const r=t.propuestaLinks.map(i=>i.trim()).filter(Boolean).map((i,l)=>({project_id:e,link_type:"proposal",url:i,label:`Propuesta ${l+1}`})),s=t.afLinks.map(i=>i.trim()).filter(Boolean).map((i,l)=>({project_id:e,link_type:"final_art",url:i,label:`AF ${l+1}`}));return[...r,...s]}function qT(e){pa=e,Ul()}function Za(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 j$(e){return{countries:Za(e.map(t=>t.bu)),brands:Za(e.map(t=>t.marca)),clients:Za(e.map(t=>t.cliente)),cms:Za(e.map(t=>t.cm))}}function vr(e){dv=e,Ul()}function VT(e){pa.some(r=>r.id===e.id)&&qT(pa.map(r=>r.id===e.id?e:r))}function k$(e){pa.some(t=>t.id===e)&&(qT(pa.filter(t=>t.id!==e)),Td=Math.max(0,Td-1),Ul())}function O$(){return"https://agenteit.digitalcompass.agency/webhook/tablero-cdc-sync-proyecto".trim()||""}async function uf(e,t){const r=O$();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,i=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(i)}}function c_(){Is&&clearTimeout(Is),Is=setTimeout(()=>{Is=null,!Il&&Pr===0&&Us(Mn)},350)}function M$(){El||(El=ze.channel("tablero-cdc-projects").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_projects"},()=>c_()).on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_project_links"},()=>c_()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a proyectos:",e)}))}function D$(){Is&&(clearTimeout(Is),Is=null),El&&(ze.removeChannel(El),El=null)}async function GT(e,t){const r=R$(e,t);try{const{error:l}=await ze.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(!$$(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 ze.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw s;if(r.length===0)return;const{error:i}=await ze.from("tablero_cdc_project_links").insert(r);if(i)throw i}function FT(e){const t=String((e==null?void 0:e.message)||"");return t.includes("tariff_section_id")||t.includes("tariff_catalog_id")||t.includes("schema cache")}async function KT(e,t){if(!Array.isArray(t))return;const{error:r}=await ze.from("tablero_cdc_project_pricing_items").delete().eq("project_id",e);if(r)throw r;const s=t.map((d,f)=>({item:d,index:f})).filter(({item:d})=>Number.isFinite(Number(d.amount))&&Number(d.amount)>0).map(({item:d,index:f})=>({project_id:e,source:d.source,category:d.category||"",service_name:d.serviceName||"Costo manual",work_type:d.workType||"",complexity_level:d.complexityLevel||"",reference_label:d.referenceLabel||"",reference_min:d.referenceMin??null,reference_max:d.referenceMax??null,amount:Number(d.amount),description:d.description||"",tariff_section_id:d.tariffSectionId||null,tariff_catalog_id:d.tariffCatalogId||null,sort_order:f}));if(s.length===0)return;const i=await ze.from("tablero_cdc_project_pricing_items").insert(s);if(!i.error)return;if(!FT(i.error))throw i.error;const l=s.map(({tariff_section_id:d,tariff_catalog_id:f,...h})=>h),u=await ze.from("tablero_cdc_project_pricing_items").insert(l);if(u.error)throw u.error}async function P$(e){const r=await ze.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, tariff_section_id, tariff_catalog_id, created_at").eq("project_id",e).order("sort_order",{ascending:!0}).order("created_at",{ascending:!0});if(!r.error)return(r.data||[]).map(i_);if(!FT(r.error))throw r.error;const s=await ze.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(s.error)throw s.error;return(s.data||[]).map(i_)}async function u_(e,t=20,r=0){const s=Math.max(1,Math.min(50,Math.floor(t))),i=Math.max(0,Math.floor(r)),{data:l,error:u}=await ze.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(i,i+s-1);if(u)throw u;return(l||[]).map(C$)}function L$(e,t,r,s){const i=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`[${i}] ${l}:
${e}`}async function z$(e,t,r,s,i,l){const{data:u,error:d}=await ze.from("tablero_cdc_projects").select("description").eq("id",e).single();if(d)throw d;const f=String((u==null?void 0:u.description)||"").trim(),h=L$(t,r,s,l),b=f?`${f}
${h}`:h,{error:g}=await ze.from("tablero_cdc_projects").update({description:b,updated_by:i}).eq("id",e);if(g)throw g;const x=pa.find(_=>_.id===e);return x&&VT({...x,comentarios:b}),b}async function I$(e,t){const r=t.trim();if(!r)throw new Error("Escribe una nota antes de agregarla al historial.");const s=await fv(),i=UT(s),l=s.email||"",u=new Date,{error:d}=await ze.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:i});if(d)throw d;const f=await z$(e,r,i,l,s.id,u),h=await uf(e,"update");return{comments:f,...h}}async function YT(e,t,r,s="",i=!1){try{const l=await fv(),u=UT(l),{error:d}=await ze.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),i)throw l instanceof Error?l:new Error("No se pudo registrar la actividad del proyecto.")}}function WT(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 hv(e){return e instanceof Error?e.message:e&&typeof e=="object"&&"message"in e?String(e.message||""):String(e||"")}function U$(e){const t=hv(e);return t.includes("tablero_cdc_get_projects_paginated")||t.includes("Could not find the function")}function $$(e){const t=hv(e);return t.includes("tablero_cdc_replace_project_links")||t.includes("Could not find the function")}function B$(e){const t=hv(e);return t.includes("tablero_cdc_get_pricing_summary")||t.includes("Could not find the function")}function vl(e){return e.replace(/[%_]/g,"\\$&").replace(/,/g," ")}function mv(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",lf));const s=t.search.trim();if(s){const l=`%${vl(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 XT(e,t){let r=mv(e,t);if(t.country){const s=`%${vl(t.country)}%`;r=r.or(`country.ilike.${s}`)}if(t.brand){const s=`%${vl(t.brand)}%`;r=r.or(`brand.ilike.${s}`)}if(t.client){const s=`%${vl(t.client)}%`;r=r.or(`client.ilike.${s}`)}if(t.cm){const s=`%${vl(t.cm)}%`;r=r.or(`country_manager.ilike.${s}`)}return r}async function H$(e,t){const r=(e.page-1)*e.pageSize,s=r+e.pageSize-1;let i=ze.from("tablero_cdc_projects").select(WT(t),{count:"exact"}).order("created_at",{ascending:!1});i=XT(i,e);const{data:l,error:u,count:d}=await i.range(r,s);if(u)throw u;const f=(l||[]).map(h=>cf(h));return{projects:f,totalProjects:d??0,filterOptions:j$(f)}}async function q$(e,t){let s=0,i=null;const l=[];for(;i===null||s<i;){let b=ze.from("tablero_cdc_projects").select(WT(t),{count:"exact"}).order("created_at",{ascending:!1});b=mv(b,e);const{data:g,error:x,count:_}=await b.range(s,s+1e3-1);if(x)throw x;i===null&&(i=_??(g||[]).length);const E=(g||[]).map(S=>cf(S));if(l.push(...E),E.length<1e3)break;s+=1e3}const u=MT(l),d=l.filter(b=>OT(b,e,u)),f=(e.page-1)*e.pageSize,h=f+e.pageSize;return{projects:d.slice(f,h),totalProjects:d.length,filterOptions:u}}async function V$(e){var l,u,d,f;const{data:t,error:r}=await ze.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||{},i=Array.isArray(s.projects)?s.projects:[];return{totalProjects:Number(s.total_count||0),projects:i.map(h=>cf(h)),filterOptions:{countries:Za((l=s.filter_options)==null?void 0:l.countries),brands:Za((u=s.filter_options)==null?void 0:u.brands),clients:Za((d=s.filter_options)==null?void 0:d.clients),cms:Za((f=s.filter_options)==null?void 0:f.cms)}}}async function Us(e){const t=IT(e),r=Hu+=1;Mn=t,Il=!0,vr(null),Ul();try{const s=await BT();let i;if(DT(t)||s)i=await q$(t,s);else try{i=await V$(t)}catch(l){if(!U$(l))throw l;console.warn("RPC tablero_cdc_get_projects_paginated no existe todavía. Usando consulta directa como respaldo temporal.",l),i=await H$(t,s)}if(r!==Hu)return;Td=i.totalProjects,pa=i.projects,LT=i.filterOptions,zT=!0}catch(s){if(r!==Hu)return;console.error("Error cargando proyectos desde Supabase:",s),dv=s instanceof Error?s.message:"No se pudieron cargar los proyectos desde Supabase."}finally{r===Hu&&(Il=!1,Ul())}}async function G$(e){vr(null),Pr+=1;try{const t=await $T(),r={...HT(e),created_by:t,updated_by:t},{data:s,error:i}=await ze.from("tablero_cdc_projects").insert(r).select("id").single();if(i)throw vr(i.message),i;await GT(s.id,e),await KT(s.id,e.pricingItems),await YT(s.id,"created","Proyecto creado",`${e.nombre||"Proyecto sin título"} quedó registrado en el tablero.`);const l=await uf(s.id,"create");return await Us(Mn),{projectId:s.id,...l}}finally{Pr=Math.max(0,Pr-1)}}async function F$(e,t){vr(null),Pr+=1;try{const r=await $T(),s=await N$(),i=await BT(),l=pa.find(x=>x.id===e);if(!l){const x="No se encontró el proyecto en la página actual. Recarga el tablero antes de guardar para evitar sobrescribir datos.";throw vr(x),new Error(x)}const u={...l,...t},d=HT(u),f=s?{...d,updated_by:r}:i?{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:h}=await ze.from("tablero_cdc_projects").update(f).eq("id",e);if(h)throw vr(h.message),h;VT(u),await GT(e,u),i&&await KT(e,t.pricingItems);const b=T$(l,u,i);b.length>0&&await YT(e,"updated","Proyecto actualizado",b.slice(0,8).join(`
`));const g=await uf(e,"update");return await Us(Mn),{projectId:e,...g}}finally{Pr=Math.max(0,Pr-1)}}async function K$(e){vr(null),Pr+=1;try{if(!await A$()){const l="No tienes permiso para eliminar proyectos.";throw vr(l),new Error(l)}const r=await uf(e,"delete");if(r.sheetSyncStatus!=="synced"){const l=r.sheetSyncMessage||"No se pudo eliminar el proyecto del Google Sheet.";throw vr(l),new Error(l)}const{error:s}=await ze.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw vr(s.message),s;const{error:i}=await ze.from("tablero_cdc_projects").delete().eq("id",e);if(i)throw vr(i.message),i;k$(e),await Us(Mn)}finally{Pr=Math.max(0,Pr-1)}}async function Y$(e){const{data:t,error:r}=await ze.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||{},i=Number(s.total_amount||0),l=Number(s.project_count||0);return{totalAmount:Number.isFinite(i)?i:0,projectCount:Number.isFinite(l)?l:0,loadedAt:Date.now()}}async function W$(e){let r=0,s=null,i=0;for(;s===null||r<s;){let l=ze.from("tablero_cdc_projects").select("id, internal_amount",{count:"exact"}).order("created_at",{ascending:!1});l=XT(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 h=u||[];if(h.forEach(b=>{const g=Number(b.internal_amount??0);Number.isFinite(g)&&g>0&&(i+=g)}),h.length<1e3)break;r+=1e3}return{totalAmount:i,projectCount:s??0,loadedAt:Date.now()}}async function X$(e){let r=0,s=null;const i=[];for(;s===null||r<s;){let f=ze.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=mv(f,e);const{data:h,error:b,count:g}=await f.range(r,r+1e3-1);if(b)throw b;s===null&&(s=g??(h||[]).length);const x=(h||[]).map(_=>cf(_));if(i.push(...x),x.length<1e3)break;r+=1e3}const l=MT(i),u=i.filter(f=>OT(f,e,l));return{totalAmount:u.reduce((f,h)=>{const b=Number(h.monto??0);return Number.isFinite(b)&&b>0?f+b:f},0),projectCount:u.length,loadedAt:Date.now()}}async function d_(e){const t=IT({...e,page:1,pageSize:1e3});if(DT(t))return X$(t);try{return await Y$(t)}catch(r){if(!B$(r))throw r;return console.warn("RPC tablero_cdc_get_pricing_summary no existe todavía. Usando suma directa como respaldo temporal.",r),W$(t)}}function J$(e,t){const[r,s]=y.useState({totalAmount:0,projectCount:0,loadedAt:null}),[i,l]=y.useState(!1),[u,d]=y.useState(null),f=e.tab,h=e.search,b=e.country,g=e.brand,x=e.client,_=e.cm;return y.useEffect(()=>{if(!t){s({totalAmount:0,projectCount:0,loadedAt:null}),d(null),l(!1);return}let E=!1;return l(!0),d(null),d_({tab:f,search:h,country:b,brand:g,client:x,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,h,b,g,x,_]),{summary:r,loading:i,error:u,refresh:()=>d_(e).then(E=>(s(E),E))}}function JT(e){const[,t]=y.useState(0),r=e==null?void 0:e.tab,s=e==null?void 0:e.search,i=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,h=e==null?void 0:e.cm;return y.useEffect(()=>{const b=()=>t(g=>g+1);return rd.push(b),Bu+=1,M$(),()=>{rd=rd.filter(g=>g!==b),Bu=Math.max(0,Bu-1),Bu===0&&D$()}},[]),y.useEffect(()=>{if(r&&i&&l){Us({tab:r,search:s??"",page:i,pageSize:l,country:u??"",brand:d??"",client:f??"",cm:h??""});return}!zT&&!Il&&Us()},[r,s,i,l,u,d,f,h]),{projects:pa,totalProjects:Td,filterOptions:LT,loading:Il,error:dv,refresh:()=>Us(e??Mn),add:G$,update:F$,remove:K$}}function Q$(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 Z$=e=>{switch(e){case"success":return nB;case"info":return aB;case"warning":return rB;case"error":return sB;default:return null}},eB=Array(12).fill(0),tB=({visible:e,className:t})=>fe.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},fe.createElement("div",{className:"sonner-spinner"},eB.map((r,s)=>fe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),nB=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.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"})),rB=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},fe.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"})),aB=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.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"})),sB=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.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"})),iB=fe.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"},fe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),fe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),oB=()=>{const[e,t]=fe.useState(document.hidden);return fe.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let eg=1;class lB{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,...i}=t,l=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:eg++,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,...i,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 i=Promise.resolve(t instanceof Function?t():t);let l=s!==void 0,u;const d=i.then(async h=>{if(u=["resolve",h],fe.isValidElement(h))l=!1,this.create({id:s,type:"default",message:h});else if(uB(h)&&!h.ok){l=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,x=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,E=typeof g=="object"&&!fe.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:x,...E})}else if(h instanceof Error){l=!1;const g=typeof r.error=="function"?await r.error(h):r.error,x=typeof r.description=="function"?await r.description(h):r.description,E=typeof g=="object"&&!fe.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:x,...E})}else if(r.success!==void 0){l=!1;const g=typeof r.success=="function"?await r.success(h):r.success,x=typeof r.description=="function"?await r.description(h):r.description,E=typeof g=="object"&&!fe.isValidElement(g)?g:{message:g};this.create({id:s,type:"success",description:x,...E})}}).catch(async h=>{if(u=["reject",h],r.error!==void 0){l=!1;const b=typeof r.error=="function"?await r.error(h):r.error,g=typeof r.description=="function"?await r.description(h):r.description,_=typeof b=="object"&&!fe.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((h,b)=>d.then(()=>u[0]==="reject"?b(u[1]):h(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)||eg++;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 On=new lB,cB=(e,t)=>{const r=(t==null?void 0:t.id)||eg++;return On.addToast({title:e,...t,id:r}),r},uB=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",dB=cB,fB=()=>On.toasts,hB=()=>On.getActiveToasts(),Et=Object.assign(dB,{success:On.success,info:On.info,warning:On.warning,error:On.error,custom:On.custom,message:On.message,promise:On.promise,dismiss:On.dismiss,loading:On.loading},{getHistory:fB,getToasts:hB});Q$("[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 Vu(e){return e.label!==void 0}const mB=3,pB="24px",gB="16px",f_=4e3,vB=356,yB=14,bB=45,xB=200;function Ar(...e){return e.filter(Boolean).join(" ")}function wB(e){const[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}const _B=e=>{var t,r,s,i,l,u,d,f,h;const{invert:b,toast:g,unstyled:x,interacting:_,setHeights:E,visibleToasts:S,heights:T,index:C,toasts:R,expanded:A,removeToast:D,defaultRichColors:B,closeButton:I,style:L,cancelButtonStyle:H,actionButtonStyle:Z,className:ue="",descriptionClassName:ce="",duration:he,position:de,gap:me,expandByDefault:pe,classNames:j,icons:K,closeButtonAriaLabel:W="Close toast"}=e,[J,G]=fe.useState(null),[k,O]=fe.useState(null),[U,Y]=fe.useState(!1),[$,re]=fe.useState(!1),[te,ee]=fe.useState(!1),[se,Se]=fe.useState(!1),[Te,Re]=fe.useState(!1),[nt,Ze]=fe.useState(0),[xt,oe]=fe.useState(0),je=fe.useRef(g.duration||he||f_),Ve=fe.useRef(null),$e=fe.useRef(null),Nt=C===0,We=C+1<=S,it=g.type,Pt=g.dismissible!==!1,Ie=g.className||"",Q=g.descriptionClassName||"",Oe=fe.useMemo(()=>T.findIndex(Pe=>Pe.toastId===g.id)||0,[T,g.id]),Xe=fe.useMemo(()=>{var Pe;return(Pe=g.closeButton)!=null?Pe:I},[g.closeButton,I]),Lt=fe.useMemo(()=>g.duration||he||f_,[g.duration,he]),ln=fe.useRef(0),Kt=fe.useRef(0),gn=fe.useRef(0),vn=fe.useRef(null),[yn,kt]=de.split("-"),cn=fe.useMemo(()=>T.reduce((Pe,yt,Yt)=>Yt>=Oe?Pe:Pe+yt.height,0),[T,Oe]),Ot=oB(),Ur=g.invert||b,$r=it==="loading";Kt.current=fe.useMemo(()=>Oe*me+cn,[Oe,cn]),fe.useEffect(()=>{je.current=Lt},[Lt]),fe.useEffect(()=>{Y(!0)},[]),fe.useEffect(()=>{const Pe=$e.current;if(Pe){const yt=Pe.getBoundingClientRect().height;return oe(yt),E(Yt=>[{toastId:g.id,height:yt,position:g.position},...Yt]),()=>E(Yt=>Yt.filter(un=>un.toastId!==g.id))}},[E,g.id]),fe.useLayoutEffect(()=>{if(!U)return;const Pe=$e.current,yt=Pe.style.height;Pe.style.height="auto";const Yt=Pe.getBoundingClientRect().height;Pe.style.height=yt,oe(Yt),E(un=>un.find(Ct=>Ct.toastId===g.id)?un.map(Ct=>Ct.toastId===g.id?{...Ct,height:Yt}:Ct):[{toastId:g.id,height:Yt,position:g.position},...un])},[U,g.title,g.description,E,g.id,g.jsx,g.action,g.cancel]);const le=fe.useCallback(()=>{re(!0),Ze(Kt.current),E(Pe=>Pe.filter(yt=>yt.toastId!==g.id)),setTimeout(()=>{D(g)},xB)},[g,D,E,Kt]);fe.useEffect(()=>{if(g.promise&&it==="loading"||g.duration===1/0||g.type==="loading")return;let Pe;return A||_||Ot?(()=>{if(gn.current<ln.current){const un=new Date().getTime()-ln.current;je.current=je.current-un}gn.current=new Date().getTime()})():(()=>{je.current!==1/0&&(ln.current=new Date().getTime(),Pe=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),le()},je.current))})(),()=>clearTimeout(Pe)},[A,_,g,it,Ot,le]),fe.useEffect(()=>{g.delete&&(le(),g.onDismiss==null||g.onDismiss.call(g,g))},[le,g.delete]);function Me(){var Pe;if(K!=null&&K.loading){var yt;return fe.createElement("div",{className:Ar(j==null?void 0:j.loader,g==null||(yt=g.classNames)==null?void 0:yt.loader,"sonner-loader"),"data-visible":it==="loading"},K.loading)}return fe.createElement(tB,{className:Ar(j==null?void 0:j.loader,g==null||(Pe=g.classNames)==null?void 0:Pe.loader),visible:it==="loading"})}const at=g.icon||(K==null?void 0:K[it])||Z$(it);var ot,qt;return fe.createElement("li",{tabIndex:0,ref:$e,className:Ar(ue,Ie,j==null?void 0:j.toast,g==null||(t=g.classNames)==null?void 0:t.toast,j==null?void 0:j.default,j==null?void 0:j[it],g==null||(r=g.classNames)==null?void 0:r[it]),"data-sonner-toast":"","data-rich-colors":(ot=g.richColors)!=null?ot:B,"data-styled":!(g.jsx||g.unstyled||x),"data-mounted":U,"data-promise":!!g.promise,"data-swiped":Te,"data-removed":$,"data-visible":We,"data-y-position":yn,"data-x-position":kt,"data-index":C,"data-front":Nt,"data-swiping":te,"data-dismissible":Pt,"data-type":it,"data-invert":Ur,"data-swipe-out":se,"data-swipe-direction":k,"data-expanded":!!(A||pe&&U),"data-testid":g.testId,style:{"--index":C,"--toasts-before":C,"--z-index":R.length-C,"--offset":`${$?nt:Kt.current}px`,"--initial-height":pe?"auto":`${xt}px`,...L,...g.style},onDragEnd:()=>{ee(!1),G(null),vn.current=null},onPointerDown:Pe=>{Pe.button!==2&&($r||!Pt||(Ve.current=new Date,Ze(Kt.current),Pe.target.setPointerCapture(Pe.pointerId),Pe.target.tagName!=="BUTTON"&&(ee(!0),vn.current={x:Pe.clientX,y:Pe.clientY})))},onPointerUp:()=>{var Pe,yt,Yt;if(se||!Pt)return;vn.current=null;const un=Number(((Pe=$e.current)==null?void 0:Pe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),xa=Number(((yt=$e.current)==null?void 0:yt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ct=new Date().getTime()-((Yt=Ve.current)==null?void 0:Yt.getTime()),bn=J==="x"?un:xa,us=Math.abs(bn)/Ct;if(Math.abs(bn)>=bB||us>.11){Ze(Kt.current),g.onDismiss==null||g.onDismiss.call(g,g),O(J==="x"?un>0?"right":"left":xa>0?"down":"up"),le(),Se(!0);return}else{var xn,wn;(xn=$e.current)==null||xn.style.setProperty("--swipe-amount-x","0px"),(wn=$e.current)==null||wn.style.setProperty("--swipe-amount-y","0px")}Re(!1),ee(!1),G(null)},onPointerMove:Pe=>{var yt,Yt,un;if(!vn.current||!Pt||((yt=window.getSelection())==null?void 0:yt.toString().length)>0)return;const Ct=Pe.clientY-vn.current.y,bn=Pe.clientX-vn.current.x;var us;const xn=(us=e.swipeDirections)!=null?us:wB(de);!J&&(Math.abs(bn)>1||Math.abs(Ct)>1)&&G(Math.abs(bn)>Math.abs(Ct)?"x":"y");let wn={x:0,y:0};const Ys=cr=>1/(1.5+Math.abs(cr)/20);if(J==="y"){if(xn.includes("top")||xn.includes("bottom"))if(xn.includes("top")&&Ct<0||xn.includes("bottom")&&Ct>0)wn.y=Ct;else{const cr=Ct*Ys(Ct);wn.y=Math.abs(cr)<Math.abs(Ct)?cr:Ct}}else if(J==="x"&&(xn.includes("left")||xn.includes("right")))if(xn.includes("left")&&bn<0||xn.includes("right")&&bn>0)wn.x=bn;else{const cr=bn*Ys(bn);wn.x=Math.abs(cr)<Math.abs(bn)?cr:bn}(Math.abs(wn.x)>0||Math.abs(wn.y)>0)&&Re(!0),(Yt=$e.current)==null||Yt.style.setProperty("--swipe-amount-x",`${wn.x}px`),(un=$e.current)==null||un.style.setProperty("--swipe-amount-y",`${wn.y}px`)}},Xe&&!g.jsx&&it!=="loading"?fe.createElement("button",{"aria-label":W,"data-disabled":$r,"data-close-button":!0,onClick:$r||!Pt?()=>{}:()=>{le(),g.onDismiss==null||g.onDismiss.call(g,g)},className:Ar(j==null?void 0:j.closeButton,g==null||(s=g.classNames)==null?void 0:s.closeButton)},(qt=K==null?void 0:K.close)!=null?qt:iB):null,(it||g.icon||g.promise)&&g.icon!==null&&((K==null?void 0:K[it])!==null||g.icon)?fe.createElement("div",{"data-icon":"",className:Ar(j==null?void 0:j.icon,g==null||(i=g.classNames)==null?void 0:i.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||Me():null,g.type!=="loading"?at:null):null,fe.createElement("div",{"data-content":"",className:Ar(j==null?void 0:j.content,g==null||(l=g.classNames)==null?void 0:l.content)},fe.createElement("div",{"data-title":"",className:Ar(j==null?void 0:j.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?fe.createElement("div",{"data-description":"",className:Ar(ce,Q,j==null?void 0:j.description,g==null||(d=g.classNames)==null?void 0:d.description)},typeof g.description=="function"?g.description():g.description):null),fe.isValidElement(g.cancel)?g.cancel:g.cancel&&Vu(g.cancel)?fe.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||H,onClick:Pe=>{Vu(g.cancel)&&Pt&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,Pe),le())},className:Ar(j==null?void 0:j.cancelButton,g==null||(f=g.classNames)==null?void 0:f.cancelButton)},g.cancel.label):null,fe.isValidElement(g.action)?g.action:g.action&&Vu(g.action)?fe.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||Z,onClick:Pe=>{Vu(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,Pe),!Pe.defaultPrevented&&le())},className:Ar(j==null?void 0:j.actionButton,g==null||(h=g.classNames)==null?void 0:h.actionButton)},g.action.label):null)};function h_(){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 SB(e,t){const r={};return[e,t].forEach((s,i)=>{const l=i===1,u=l?"--mobile-offset":"--offset",d=l?gB:pB;function f(h){["top","right","bottom","left"].forEach(b=>{r[`${u}-${b}`]=typeof h=="number"?`${h}px`:h})}typeof s=="number"||typeof s=="string"?f(s):typeof s=="object"?["top","right","bottom","left"].forEach(h=>{s[h]===void 0?r[`${u}-${h}`]=d:r[`${u}-${h}`]=typeof s[h]=="number"?`${s[h]}px`:s[h]}):f(d)}),r}const EB=fe.forwardRef(function(t,r){const{id:s,invert:i,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:f,className:h,offset:b,mobileOffset:g,theme:x="light",richColors:_,duration:E,style:S,visibleToasts:T=mB,toastOptions:C,dir:R=h_(),gap:A=yB,icons:D,containerAriaLabel:B="Notifications"}=t,[I,L]=fe.useState([]),H=fe.useMemo(()=>s?I.filter(U=>U.toasterId===s):I.filter(U=>!U.toasterId),[I,s]),Z=fe.useMemo(()=>Array.from(new Set([l].concat(H.filter(U=>U.position).map(U=>U.position)))),[H,l]),[ue,ce]=fe.useState([]),[he,de]=fe.useState(!1),[me,pe]=fe.useState(!1),[j,K]=fe.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=fe.useRef(null),J=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),G=fe.useRef(null),k=fe.useRef(!1),O=fe.useCallback(U=>{L(Y=>{var $;return($=Y.find(re=>re.id===U.id))!=null&&$.delete||On.dismiss(U.id),Y.filter(({id:re})=>re!==U.id)})},[]);return fe.useEffect(()=>On.subscribe(U=>{if(U.dismiss){requestAnimationFrame(()=>{L(Y=>Y.map($=>$.id===U.id?{...$,delete:!0}:$))});return}setTimeout(()=>{B_.flushSync(()=>{L(Y=>{const $=Y.findIndex(re=>re.id===U.id);return $!==-1?[...Y.slice(0,$),{...Y[$],...U},...Y.slice($+1)]:[U,...Y]})})})}),[I]),fe.useEffect(()=>{if(x!=="system"){K(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:Y})=>{K(Y?"dark":"light")})}catch{U.addListener(({matches:$})=>{try{K($?"dark":"light")}catch(re){console.error(re)}})}},[x]),fe.useEffect(()=>{I.length<=1&&de(!1)},[I]),fe.useEffect(()=>{const U=Y=>{var $;if(u.every(ee=>Y[ee]||Y.code===ee)){var te;de(!0),(te=W.current)==null||te.focus()}Y.code==="Escape"&&(document.activeElement===W.current||($=W.current)!=null&&$.contains(document.activeElement))&&de(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[u]),fe.useEffect(()=>{if(W.current)return()=>{G.current&&(G.current.focus({preventScroll:!0}),G.current=null,k.current=!1)}},[W.current]),fe.createElement("section",{ref:r,"aria-label":`${B} ${J}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Z.map((U,Y)=>{var $;const[re,te]=U.split("-");return H.length?fe.createElement("ol",{key:U,dir:R==="auto"?h_():R,tabIndex:-1,ref:W,className:h,"data-sonner-toaster":!0,"data-sonner-theme":j,"data-y-position":re,"data-x-position":te,style:{"--front-toast-height":`${(($=ue[0])==null?void 0:$.height)||0}px`,"--width":`${vB}px`,"--gap":`${A}px`,...S,...SB(b,g)},onBlur:ee=>{k.current&&!ee.currentTarget.contains(ee.relatedTarget)&&(k.current=!1,G.current&&(G.current.focus({preventScroll:!0}),G.current=null))},onFocus:ee=>{ee.target instanceof HTMLElement&&ee.target.dataset.dismissible==="false"||k.current||(k.current=!0,G.current=ee.relatedTarget)},onMouseEnter:()=>de(!0),onMouseMove:()=>de(!0),onMouseLeave:()=>{me||de(!1)},onDragEnd:()=>de(!1),onPointerDown:ee=>{ee.target instanceof HTMLElement&&ee.target.dataset.dismissible==="false"||pe(!0)},onPointerUp:()=>pe(!1)},H.filter(ee=>!ee.position&&Y===0||ee.position===U).map((ee,se)=>{var Se,Te;return fe.createElement(_B,{key:ee.id,icons:D,index:se,toast:ee,defaultRichColors:_,duration:(Se=C==null?void 0:C.duration)!=null?Se:E,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:i,visibleToasts:T,closeButton:(Te=C==null?void 0:C.closeButton)!=null?Te:f,interacting:me,position:U,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:O,toasts:H.filter(Re=>Re.position==ee.position),heights:ue.filter(Re=>Re.position==ee.position),setHeights:ce,expandByDefault:d,gap:A,expanded:he,swipeDirections:t.swipeDirections})})):null}))}),CB="Walmart Connect WMC",TB=new Set(["wmc"]),Bi=15;function NB(e){return new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function AB(e){return e.split(`
`).map(t=>t.trim()).filter(Boolean)}function QT(e){return e.reduce((t,r)=>t+Number(r.amount||0),0)}function RB(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,tariffSectionId:t.tariffSectionId,tariffCatalogId:t.tariffCatalogId}))}function jB(e,t){if(!t.length||e==null)return!1;const r=Number(e);if(!Number.isFinite(r)||r<=0)return!1;const s=QT(t);return Math.abs(r-s)>.01}function kB(e,t=[]){const r=Ft(e);if(!r)return[];const s=new Map(st(t).map(f=>[Ae(f),f])),i=s.get(Ae(r));if(i)return[i];const l=r.split(/[,;]/).map(f=>Ft(f)).filter(Boolean);if(l.length<=1)return st([i||r]);const u=[];let d=0;for(;d<l.length;){let f="",h=d+1;for(let b=l.length;b>d;b-=1){const g=l.slice(d,b).join(", "),x=s.get(Ae(g));if(x){f=x,h=b;break}}u.push(f||l[d]),d=h}return st(u)}function OB(e){return st(e.map(t=>Ft(t)).filter(Boolean)).join(", ")}function MB(e,t=[]){const r=Ft(e);if(!r)return[];const s=new Map(st(t).map(u=>[Ae(u),u])),i=s.get(Ae(r));if(i)return[i];const l=r.split(/[,;]/).map(u=>Ft(u)).filter(Boolean);return l.length<=1?st([i||r]):st(l.map(u=>s.get(Ae(u))||u))}function DB(e){return st(e.map(t=>Ft(t)).filter(Boolean)).join(", ")}function Gu(e){return Ae(e)===Ae(CB)}const m_=()=>{const e=new Date;return{nombre:"",color:"blue",cliente:"",bu:"",cm:"",marca:"",solicitante:"",comentarios:"",briefLink:"",propuestaLinks:[],afLinks:[],status:"",monto:null,mes:Oz[e.getMonth()],anio:e.getFullYear()}};function PB({open:e,onOpenChange:t,project:r,onDelete:s,deleting:i=!1}){const{add:l,update:u}=JT(),{lists:d,loading:f,error:h,refresh:b}=uv(),{isGerardo:g,canDeleteProjects:x,canManageInternalPricing:_}=Ld(),E=!!r,[S,T]=y.useState(m_()),[C,R]=y.useState([]),[A,D]=y.useState(!1),[B,I]=y.useState(""),[L,H]=y.useState(null),[Z,ue]=y.useState(null),[ce,he]=y.useState([]),[de,me]=y.useState(!1),[pe,j]=y.useState(null),[K,W]=y.useState(""),[J,G]=y.useState(!1),[k,O]=y.useState(!1),[U,Y]=y.useState(!1),[$,re]=y.useState([]),[te,ee]=y.useState(!1),[se,Se]=y.useState(null),[Te,Re]=y.useState(!1),nt=y.useRef(!1),Ze=kB(S.marca,d.marcas),xt=MB(S.bu,d.bus),oe=st(t_(d.clientes,S.cliente)),je=st([...d.marcas,...Ze]),Ve=st([...d.bus,...xt]),$e=st(t_(d.status,S.status)),Nt=Ve.filter(le=>{const Me=Ae(le);return!TB.has(Me)&&Me.includes(Ae(B))}),We=QT($);y.useEffect(()=>{if(ue(null),H(null),r){const{id:le,createdAt:Me,...at}=r,ot=Ft(at.bu);T({...at,bu:ot}),R(ot?[ot]:[]),I(""),he([]),G(!1),j(null),W(""),re([]),Se(null),Re(!1)}else e&&(T(m_()),R([]),I(""),he([]),G(!1),j(null),W(""),re([]),Se(null),Re(!1))},[r,e]);const it=y.useCallback(async()=>{if(r!=null&&r.id)try{me(!0),j(null);const le=await u_(r.id,Bi+1);he(le.slice(0,Bi)),G(le.length>Bi)}catch(le){console.warn("No se pudo cargar el historial del proyecto:",le),j("No se pudo cargar el historial. Revisa que el SQL de actividad esté ejecutado en Supabase."),he([]),G(!1)}finally{me(!1)}},[r==null?void 0:r.id]),Pt=y.useCallback(async()=>{if(!(!(r!=null&&r.id)||k||!J))try{O(!0),j(null);const le=await u_(r.id,Bi+1,ce.length);he(Me=>[...Me,...le.slice(0,Bi)]),G(le.length>Bi)}catch(le){console.warn("No se pudo cargar más historial del proyecto:",le),j("No se pudo cargar más actividad. Inténtalo nuevamente.")}finally{O(!1)}},[J,ce.length,k,r==null?void 0:r.id]);y.useEffect(()=>{!e||!(r!=null&&r.id)||it()},[e,r==null?void 0:r.id,it]),y.useEffect(()=>{if(!e||!(r!=null&&r.id)||!_)return;let le=!1;return(async()=>{try{ee(!0),Se(null);const at=await P$(r.id),ot=RB(at);le||(Re(jB(r.monto,ot)),re(ot))}catch(at){console.warn("No se pudo cargar el tarifario del proyecto:",at),le||(re([]),Se("No se pudieron cargar los costos guardados. Revisa que el SQL del tarifario esté ejecutado en Supabase."))}finally{le||ee(!1)}})(),()=>{le=!0}},[_,e,r==null?void 0:r.id,r==null?void 0:r.monto]);const Ie=(le,Me)=>T(at=>({...at,[le]:Me}));y.useEffect(()=>{if(!_||!$.length||Te)return;const le=Number(We.toFixed(2));T(Me=>Me.monto===le?Me:{...Me,monto:le})},[_,Te,$.length,We]);const Q=le=>{const Me=d.buCm[le];if(Me)return Me;const at=Ae(le),ot=Object.entries(d.buCm).find(([qt])=>Ae(qt)===at);return(ot==null?void 0:ot[1])??""},Oe=le=>{const Me=st(le.map(ot=>Ft(ot)).filter(Boolean)),at=st(Me.map(Q).filter(Boolean));T(ot=>({...ot,bu:DB(Me),cm:at.join(", ")}))},Xe=le=>{const Me=Ft(le);T(at=>({...at,cliente:Me,...Gu(Me)&&!E?{bu:"",cm:""}:at.cliente&&Gu(at.cliente)?{bu:"",cm:""}:{}})),Gu(Me)||(R([]),I(""))},Lt=!E&&Gu(S.cliente),ln=Lt?C:xt,Kt=!E&&ln.length>1,gn=(le,Me)=>{const at=Ft(le);R(ot=>Me?st([...ot,at]):ot.filter(qt=>Ae(qt)!==Ae(at)))},vn=C.map(le=>({country:le,manager:Q(le)})),yn=xt.map(le=>({country:le,manager:Q(le)})),kt=S.nombre.trim()&&S.cliente&&S.marca&&S.solicitante.trim()&&(Lt?C.length>0:xt.length>0),cn=le=>{if(le.sheetSyncStatus==="synced"){Et.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó y se sincronizó con el Google Sheet."});return}if(le.sheetSyncStatus==="skipped"){Et.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó. La sincronización con Google Sheet no está configurada."});return}Et.warning("Proyecto guardado con aviso",{description:le.sheetSyncMessage})},Ot=async()=>{if(!(!(r!=null&&r.id)||!K.trim()||U))try{Y(!0);const le=await I$(r.id,K);Ie("comentarios",le.comments),W(""),await it(),le.sheetSyncStatus==="synced"?Et.success("Comentario agregado al historial",{description:"También se actualizó la columna Comentarios del Google Sheet."}):le.sheetSyncStatus==="skipped"?Et.success("Comentario agregado al historial",{description:"Se guardó como comentario interno. La sincronización con Sheet no está configurada."}):Et.warning("Comentario agregado con aviso",{description:le.sheetSyncMessage})}catch(le){console.error("Error agregando comentario al historial:",le);const Me=le instanceof Error?le.message:"No se pudo agregar el comentario al historial.";Et.error("No se pudo agregar el comentario",{description:Me})}finally{Y(!1)}},Ur=async()=>{if(!kt||A||nt.current)return;nt.current=!0;const le=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(D(!0),ue(null),H("Guardando y sincronizando con Google Sheet…"),Kt){const Me=ln,at=[];for(const[qt,Pe]of Me.entries()){H(`Guardando país ${qt+1} de ${Me.length}: ${Pe}`);const yt={...le,bu:Pe,cm:Q(Pe),id:crypto.randomUUID(),createdAt:Date.now()+qt};at.push(await l({...yt,pricingItems:_?$:void 0}))}const ot=at.filter(qt=>qt.sheetSyncStatus!=="synced");ot.length===0?Et.success("Proyectos multipaís creados",{description:`Se crearon ${Me.length} proyectos y ${Me.length} filas en Google Sheet. El Interno Cargado se aplicó por país.`}):Et.warning("Proyectos multipaís creados con aviso",{description:`${ot.length} de ${Me.length} sincronizaciones con Google Sheet requieren revisión.`})}else{const Me=E&&r?await u(r.id,{...le,pricingItems:_?$:void 0}):await l({...le,id:crypto.randomUUID(),createdAt:Date.now(),pricingItems:_?$:void 0});cn(Me)}t(!1)}catch(Me){console.error("Error guardando proyecto:",Me);const at=Me instanceof Error?Me.message:"No se pudo guardar el proyecto. Revisa los permisos o intenta de nuevo.";ue(at),Et.error("No se pudo guardar el proyecto",{description:at})}finally{nt.current=!1,D(!1),H(null)}},$r=!!S.status;return m.jsx(Jd,{open:e,onOpenChange:le=>{A||nt.current||t(le)},children:m.jsxs(tc,{className:"max-w-3xl max-h-[92vh] overflow-y-auto p-0 gap-0",children:[m.jsx("div",{className:"h-2.5 w-full rounded-t-lg",style:{backgroundColor:jE(S.color)}}),m.jsxs("div",{className:"px-7 pt-6 pb-7",children:[m.jsx(nc,{className:"space-y-3",children:m.jsx("div",{className:"flex items-start justify-between gap-4",children:m.jsxs("div",{className:"flex-1",children:[m.jsx(rc,{className:"text-2xl tracking-tight",children:E?S.nombre||"Sin título":"Nuevo proyecto"}),m.jsxs(ac,{className:"mt-1 flex items-center gap-2 text-xs",children:[m.jsx(QD,{className:"w-3.5 h-3.5"}),S.mes," · ",S.anio,$r&&m.jsx(Gn,{variant:"secondary",className:"ml-2",children:"Cerrado"})]})]})})}),m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mt-6",children:[m.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[m.jsxs(He,{children:["Nombre del proyecto ",m.jsx("span",{className:"text-destructive",children:"*"})]}),m.jsx(gt,{value:S.nombre,onChange:le=>Ie("nombre",le.target.value),placeholder:"Ej: Promoción Día de las Madres",className:"h-10"})]}),m.jsxs("div",{className:"md:col-span-2 space-y-2",children:[m.jsx(He,{children:"Etiqueta de color"}),m.jsx(QI,{value:S.color,onChange:le=>Ie("color",le)})]}),m.jsx(Ls,{className:"md:col-span-2 my-1"}),(f||h)&&m.jsxs("div",{className:xe("md:col-span-2 flex items-center justify-between gap-3 rounded-xl border px-3 py-2 text-xs",h?"border-amber-300/50 bg-amber-50 text-amber-900":"border-border bg-muted/30 text-muted-foreground"),children:[m.jsx("span",{className:"flex items-center gap-2",children:f?m.jsxs(m.Fragment,{children:[m.jsx(ar,{className:"h-3.5 w-3.5 animate-spin"}),"Cargando listas…"]}):m.jsxs(m.Fragment,{children:[m.jsx(md,{className:"h-3.5 w-3.5"}),"No se pudieron cargar las listas. Se usaron opciones locales."]})}),h&&m.jsx("button",{type:"button",onClick:()=>void b(),className:"font-medium text-amber-950 underline-offset-4 hover:underline",children:"Reintentar"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs(He,{children:["Cliente ",m.jsx("span",{className:"text-destructive",children:"*"})]}),m.jsx(Mr,{value:S.cliente,options:oe,onValueChange:Xe,placeholder:"Seleccionar…",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente."})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs(He,{children:["Marca ",m.jsx("span",{className:"text-destructive",children:"*"})]}),m.jsx(Gp,{values:Ze,options:je,onValuesChange:le=>Ie("marca",OB(le)),placeholder:"Seleccionar una o varias marcas…",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",summaryLabel:"marcas seleccionadas"})]}),Lt?m.jsxs("div",{className:"md:col-span-2 space-y-2 rounded-xl border border-primary/20 bg-primary/5 p-3",children:[m.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[m.jsxs(He,{children:["BU Solicita (Países) ",m.jsx("span",{className:"text-destructive",children:"*"})]}),m.jsxs("span",{className:"text-xs font-medium text-primary",children:[C.length," seleccionado(s)"]})]}),m.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."}),m.jsxs("div",{className:"relative",children:[m.jsx(Ol,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),m.jsx(gt,{value:B,onChange:le=>I(le.target.value),placeholder:"Buscar país…",className:"h-9 pl-9 bg-card"})]}),m.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:Nt.map(le=>{const Me=C.some(ot=>Ae(ot)===Ae(le)),at=Q(le);return m.jsxs("label",{className:xe("flex cursor-pointer items-start gap-2 rounded-lg border bg-card px-3 py-2 text-sm transition-colors",Me?"border-primary/50 bg-primary/10":"border-border hover:bg-muted/40"),children:[m.jsx(iC,{checked:Me,onCheckedChange:ot=>gn(le,ot===!0),className:"mt-0.5"}),m.jsxs("span",{className:"leading-tight",children:[m.jsx("span",{className:"block font-medium",children:le}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["CM: ",at||"—"]})]})]},le)})})]}):m.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[m.jsxs(He,{children:["BU Solicita (Países) ",m.jsx("span",{className:"text-destructive",children:"*"})]}),m.jsx(Gp,{values:xt,options:Ve,onValuesChange:Oe,placeholder:"Seleccionar uno o varios países…",searchPlaceholder:"Buscar país…",emptyText:"No se encontró ese país.",summaryLabel:"países seleccionados"}),m.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."})]}),m.jsxs("div",{className:xe("space-y-1.5",Lt&&"md:col-span-2"),children:[m.jsxs(He,{className:"flex items-center gap-1.5",children:["Country Manager ",m.jsx("span",{className:"text-xs text-muted-foreground",children:"(automático)"})]}),Lt?m.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:vn.length===0?m.jsx("span",{className:"text-muted-foreground",children:"Selecciona uno o más países."}):m.jsx("div",{className:"flex flex-wrap gap-1.5",children:vn.map(({country:le,manager:Me})=>m.jsxs(Gn,{variant:"secondary",className:"font-normal",children:[le,": ",Me||"—"]},le))})}):m.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:yn.length===0?m.jsx("span",{className:"text-muted-foreground",children:"Selecciona uno o más países."}):m.jsx("div",{className:"flex flex-wrap gap-1.5",children:yn.map(({country:le,manager:Me})=>m.jsxs(Gn,{variant:"secondary",className:"font-normal",children:[le,": ",Me||"—"]},le))})})]}),Kt&&_&&m.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."}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs(He,{children:["Solicitado por ",m.jsx("span",{className:"text-destructive",children:"*"})]}),m.jsx(gt,{value:S.solicitante,onChange:le=>Ie("solicitante",le.target.value),placeholder:"Nombre de quien solicita",className:"h-10"})]}),m.jsx(LB,{isEdit:E,items:ce,loading:de,error:pe,note:K,hasMore:J,loadingMore:k,addingNote:U,onNoteChange:W,onAddNote:Ot,onRefresh:it,onLoadMore:Pt}),m.jsx(Ls,{className:"md:col-span-2 my-1"}),m.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[m.jsxs(He,{children:["Link del Brief"," ",m.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(carpeta de Fulgencio)"})]}),m.jsx(gt,{value:S.briefLink,onChange:le=>Ie("briefLink",le.target.value),placeholder:"https://drive.google.com/…",className:"h-10"})]}),m.jsx("div",{className:"md:col-span-2",children:m.jsx(Jw,{label:"Links de Propuestas",links:S.propuestaLinks,onChange:le=>Ie("propuestaLinks",le),emptyText:"Aún no hay propuestas. Pega tantos links como necesites."})}),m.jsx("div",{className:"md:col-span-2",children:m.jsx(Jw,{label:"Links de Artes Finales",prefix:"AF",links:S.afLinks,onChange:le=>Ie("afLinks",le),emptyText:"Aún no hay artes finales."})}),m.jsx(Ls,{className:"md:col-span-2 my-1"}),_&&m.jsx(i$,{client:S.cliente,items:$,onChange:re,loading:te,error:se}),m.jsx(Ls,{className:"md:col-span-2 my-1"}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs(He,{className:"flex items-center gap-1.5 pl-1",children:["Estatus",!g&&m.jsx(zP,{className:"w-3 h-3 text-muted-foreground"})]}),g?m.jsxs(qI,{value:S.status||"_none",onValueChange:le=>Ie("status",le==="_none"?"":le),children:[m.jsx(qC,{className:"h-10",children:m.jsx(VI,{placeholder:"Sin estatus"})}),m.jsxs(FC,{children:[m.jsx(Hp,{value:"_none",children:"Sin estatus"}),$e.map(le=>m.jsx(Hp,{value:le,children:le},le))]})]}):m.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&&m.jsx("p",{className:"pl-1 text-[11px] text-muted-foreground",children:"Solo el Director Creativo puede cambiar el estatus."})]}),_&&m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs(He,{className:"flex items-center gap-1.5 pl-1",children:["Interno Cargado ",m.jsx(wg,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),m.jsx(gt,{type:"number",value:S.monto??"",onChange:le=>{Re(!0),Ie("monto",le.target.value===""?null:Number(le.target.value))},placeholder:"0.00",className:"h-10"}),m.jsxs("p",{className:"pl-1 text-[11px] text-muted-foreground",children:["Privado · solo usuarios internos autorizados.",Te&&$.length>0?" Monto ajustado manualmente; se respetará al guardar.":$.length>0?" El total del tarifario se refleja aquí y puedes ajustarlo.":""]})]})]}),(Z||L)&&m.jsxs("div",{className:xe("mt-5 flex items-start gap-2 rounded-xl border px-3 py-2 text-sm",Z?"border-destructive/30 bg-destructive/5 text-destructive":"border-primary/20 bg-primary/5 text-primary"),children:[Z?m.jsx(md,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}):m.jsx(ar,{className:"mt-0.5 h-4 w-4 flex-shrink-0 animate-spin"}),m.jsx("span",{children:Z||L})]})]}),m.jsx(Qd,{className:"px-7 py-4 border-t bg-muted/30 rounded-b-lg sm:justify-between",children:m.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[m.jsx("div",{children:E&&r&&x&&s&&m.jsxs(Fe,{type:"button",variant:"destructive",onClick:()=>s(r),disabled:A||i,className:"gap-1.5 rounded-full",children:[i?m.jsx(ar,{className:"h-4 w-4 animate-spin"}):m.jsx(PS,{className:"h-4 w-4"}),i?"Eliminando…":"Eliminar proyecto"]})}),m.jsxs("div",{className:"flex justify-end gap-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>{A||nt.current||t(!1)},disabled:A||i,children:"Cancelar"}),m.jsxs(Fe,{onClick:Ur,disabled:!kt||A||i,children:[A&&m.jsx(ar,{className:"mr-1.5 h-4 w-4 animate-spin"}),A?"Guardando…":E?"Guardar cambios":Kt?"Crear proyectos":"Crear proyecto"]})]})]})})]})})}function LB({isEdit:e,items:t,loading:r,error:s,note:i,hasMore:l,loadingMore:u,addingNote:d,onNoteChange:f,onAddNote:h,onRefresh:b,onLoadMore:g}){return m.jsxs("div",{className:"md:col-span-2 rounded-2xl border border-border bg-muted/20 p-4",children:[m.jsxs("div",{className:"mb-3 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[m.jsxs("div",{className:"flex items-start gap-2.5",children:[m.jsx("span",{className:"mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:m.jsx(EP,{className:"h-4 w-4"})}),m.jsxs("div",{children:[m.jsx("h3",{className:"text-sm font-semibold",children:"Actividad del proyecto"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Comentarios y movimientos recientes con fecha."})]})]}),e&&m.jsxs(Fe,{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?m.jsx(ar,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):null,"Actualizar"]})]}),e?m.jsxs("div",{className:"space-y-3",children:[m.jsxs("div",{className:"rounded-xl border border-border bg-card p-3",children:[m.jsx(He,{className:"text-xs font-medium",children:"Agregar comentario o solicitud adicional"}),m.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[m.jsx(ts,{value:i,onChange:x=>f(x.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"}),m.jsxs(Fe,{type:"button",onClick:()=>void h(),disabled:!i.trim()||d,className:"gap-1.5 rounded-full sm:self-end",children:[d?m.jsx(ar,{className:"h-4 w-4 animate-spin"}):m.jsx(qP,{className:"h-4 w-4"}),"Agregar"]})]})]}),s&&m.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:[m.jsx(md,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0"}),m.jsx("span",{children:s})]}),r&&t.length===0?m.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:[m.jsx(ar,{className:"h-4 w-4 animate-spin"}),"Cargando actividad…"]}):t.length===0?m.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í."}):m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 px-0.5 text-[11px] text-muted-foreground",children:[m.jsx("span",{children:"Mostrando los movimientos más recientes."}),m.jsxs("span",{children:[t.length," visibles"]})]}),m.jsx("div",{className:"max-h-[440px] space-y-2 overflow-y-auto pr-1",children:t.map(x=>{const _=AB(x.description);return m.jsxs("div",{className:"rounded-xl border border-border bg-card px-3 py-3 shadow-sm",children:[m.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium",children:x.title}),m.jsxs("p",{className:"text-xs text-muted-foreground",children:[x.actorName,x.actorEmail?` · ${x.actorEmail}`:""]})]}),m.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[m.jsx(hP,{className:"h-3.5 w-3.5"}),NB(x.createdAt)]})]}),_.length>0&&m.jsx("div",{className:"mt-2 space-y-1 text-sm text-muted-foreground",children:_.map(E=>m.jsx("p",{children:E},E))})]},x.id)})}),l&&m.jsx("div",{className:"flex justify-center pt-1",children:m.jsxs(Fe,{type:"button",variant:"outline",size:"sm",onClick:()=>void g(),disabled:u,className:"rounded-full",children:[u?m.jsx(ar,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,u?"Cargando…":"Cargar más"]})})]})]}):m.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 ZT="pricing_summary_public";function eN(e){var t;return!!((t=e==null?void 0:e.value)!=null&&t.enabled)}async function zB(){const{data:e,error:t}=await ze.from("tablero_cdc_app_settings").select("key, value").eq("key",ZT).maybeSingle();if(t)throw t;return eN(e)}async function IB(e){const{error:t}=await ze.rpc("tablero_cdc_set_pricing_summary_public",{p_enabled:e});if(t)throw t}function UB(e=!0){const[t,r]=y.useState(!1),[s,i]=y.useState(e),[l,u]=y.useState(!1),[d,f]=y.useState(null),h=y.useCallback(async()=>{if(!e)return!1;i(!0),f(null);try{const g=await zB();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{i(!1)}},[e]),b=y.useCallback(async g=>{u(!0),f(null);try{return await IB(g),r(g),g}catch(x){throw console.error("No se pudo actualizar la visibilidad del total tarifado:",x),f(x instanceof Error?x.message:"No se pudo actualizar la visibilidad del total tarifado."),x}finally{u(!1)}},[]);return y.useEffect(()=>{h()},[h]),y.useEffect(()=>{if(!e)return;const g=ze.channel("tablero-cdc-pricing-summary-visibility").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_settings",filter:`key=eq.${ZT}`},x=>{const _=x.new||x.old;r(eN(_))}).subscribe();return()=>{ze.removeChannel(g)}},[e]),{isPublic:t,loading:s,saving:l,error:d,refresh:h,setPublicVisibility:b}}function $B(e,t){return y.useReducer((r,s)=>t[r][s]??r,e)}var pv="ScrollArea",[tN]=or(pv),[BB,lr]=tN(pv),nN=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:s="hover",dir:i,scrollHideDelay:l=600,...u}=e,[d,f]=y.useState(null),[h,b]=y.useState(null),[g,x]=y.useState(null),[_,E]=y.useState(null),[S,T]=y.useState(null),[C,R]=y.useState(0),[A,D]=y.useState(0),[B,I]=y.useState(!1),[L,H]=y.useState(!1),Z=Ye(t,ce=>f(ce)),ue=Fl(i);return m.jsx(BB,{scope:r,type:s,dir:ue,scrollHideDelay:l,scrollArea:d,viewport:h,onViewportChange:b,content:g,onContentChange:x,scrollbarX:_,onScrollbarXChange:E,scrollbarXEnabled:B,onScrollbarXEnabledChange:I,scrollbarY:S,onScrollbarYChange:T,scrollbarYEnabled:L,onScrollbarYEnabledChange:H,onCornerWidthChange:R,onCornerHeightChange:D,children:m.jsx(Ne.div,{dir:ue,...u,ref:Z,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":A+"px",...e.style}})})});nN.displayName=pv;var rN="ScrollAreaViewport",aN=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:s,nonce:i,...l}=e,u=lr(rN,r),d=y.useRef(null),f=Ye(t,d,u.onViewportChange);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),m.jsx(Ne.div,{"data-radix-scroll-area-viewport":"",...l,ref:f,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...e.style},children:m.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});aN.displayName=rN;var Ir="ScrollAreaScrollbar",gv=y.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=lr(Ir,e.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:u}=i,d=e.orientation==="horizontal";return y.useEffect(()=>(d?l(!0):u(!0),()=>{d?l(!1):u(!1)}),[d,l,u]),i.type==="hover"?m.jsx(HB,{...s,ref:t,forceMount:r}):i.type==="scroll"?m.jsx(qB,{...s,ref:t,forceMount:r}):i.type==="auto"?m.jsx(sN,{...s,ref:t,forceMount:r}):i.type==="always"?m.jsx(vv,{...s,ref:t}):null});gv.displayName=Ir;var HB=y.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=lr(Ir,e.__scopeScrollArea),[l,u]=y.useState(!1);return y.useEffect(()=>{const d=i.scrollArea;let f=0;if(d){const h=()=>{window.clearTimeout(f),u(!0)},b=()=>{f=window.setTimeout(()=>u(!1),i.scrollHideDelay)};return d.addEventListener("pointerenter",h),d.addEventListener("pointerleave",b),()=>{window.clearTimeout(f),d.removeEventListener("pointerenter",h),d.removeEventListener("pointerleave",b)}}},[i.scrollArea,i.scrollHideDelay]),m.jsx(fn,{present:r||l,children:m.jsx(sN,{"data-state":l?"visible":"hidden",...s,ref:t})})}),qB=y.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=lr(Ir,e.__scopeScrollArea),l=e.orientation==="horizontal",u=ff(()=>f("SCROLL_END"),100),[d,f]=$B("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(d==="idle"){const h=window.setTimeout(()=>f("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(h)}},[d,i.scrollHideDelay,f]),y.useEffect(()=>{const h=i.viewport,b=l?"scrollLeft":"scrollTop";if(h){let g=h[b];const x=()=>{const _=h[b];g!==_&&(f("SCROLL"),u()),g=_};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[i.viewport,l,f,u]),m.jsx(fn,{present:r||d!=="hidden",children:m.jsx(vv,{"data-state":d==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:ve(e.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:ve(e.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),sN=y.forwardRef((e,t)=>{const r=lr(Ir,e.__scopeScrollArea),{forceMount:s,...i}=e,[l,u]=y.useState(!1),d=e.orientation==="horizontal",f=ff(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,b=r.viewport.offsetHeight<r.viewport.scrollHeight;u(d?h:b)}},10);return oo(r.viewport,f),oo(r.content,f),m.jsx(fn,{present:s||l,children:m.jsx(vv,{"data-state":l?"visible":"hidden",...i,ref:t})})}),vv=y.forwardRef((e,t)=>{const{orientation:r="vertical",...s}=e,i=lr(Ir,e.__scopeScrollArea),l=y.useRef(null),u=y.useRef(0),[d,f]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=uN(d.viewport,d.content),b={...s,sizes:d,onSizesChange:f,hasThumb:h>0&&h<1,onThumbChange:x=>l.current=x,onThumbPointerUp:()=>u.current=0,onThumbPointerDown:x=>u.current=x};function g(x,_){return WB(x,u.current,d,_)}return r==="horizontal"?m.jsx(VB,{...b,ref:t,onThumbPositionChange:()=>{if(i.viewport&&l.current){const x=i.viewport.scrollLeft,_=p_(x,d,i.dir);l.current.style.transform=`translate3d(${_}px, 0, 0)`}},onWheelScroll:x=>{i.viewport&&(i.viewport.scrollLeft=x)},onDragScroll:x=>{i.viewport&&(i.viewport.scrollLeft=g(x,i.dir))}}):r==="vertical"?m.jsx(GB,{...b,ref:t,onThumbPositionChange:()=>{if(i.viewport&&l.current){const x=i.viewport.scrollTop,_=p_(x,d);l.current.style.transform=`translate3d(0, ${_}px, 0)`}},onWheelScroll:x=>{i.viewport&&(i.viewport.scrollTop=x)},onDragScroll:x=>{i.viewport&&(i.viewport.scrollTop=g(x))}}):null}),VB=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:s,...i}=e,l=lr(Ir,e.__scopeScrollArea),[u,d]=y.useState(),f=y.useRef(null),h=Ye(t,f,l.onScrollbarXChange);return y.useEffect(()=>{f.current&&d(getComputedStyle(f.current))},[f]),m.jsx(oN,{"data-orientation":"horizontal",...i,ref:h,sizes:r,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":df(r)+"px",...e.style},onThumbPointerDown:b=>e.onThumbPointerDown(b.x),onDragScroll:b=>e.onDragScroll(b.x),onWheelScroll:(b,g)=>{if(l.viewport){const x=l.viewport.scrollLeft+b.deltaX;e.onWheelScroll(x),fN(x,g)&&b.preventDefault()}},onResize:()=>{f.current&&l.viewport&&u&&s({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:Rd(u.paddingLeft),paddingEnd:Rd(u.paddingRight)}})}})}),GB=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:s,...i}=e,l=lr(Ir,e.__scopeScrollArea),[u,d]=y.useState(),f=y.useRef(null),h=Ye(t,f,l.onScrollbarYChange);return y.useEffect(()=>{f.current&&d(getComputedStyle(f.current))},[f]),m.jsx(oN,{"data-orientation":"vertical",...i,ref:h,sizes:r,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":df(r)+"px",...e.style},onThumbPointerDown:b=>e.onThumbPointerDown(b.y),onDragScroll:b=>e.onDragScroll(b.y),onWheelScroll:(b,g)=>{if(l.viewport){const x=l.viewport.scrollTop+b.deltaY;e.onWheelScroll(x),fN(x,g)&&b.preventDefault()}},onResize:()=>{f.current&&l.viewport&&u&&s({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:Rd(u.paddingTop),paddingEnd:Rd(u.paddingBottom)}})}})}),[FB,iN]=tN(Ir),oN=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:s,hasThumb:i,onThumbChange:l,onThumbPointerUp:u,onThumbPointerDown:d,onThumbPositionChange:f,onDragScroll:h,onWheelScroll:b,onResize:g,...x}=e,_=lr(Ir,r),[E,S]=y.useState(null),T=Ye(t,Z=>S(Z)),C=y.useRef(null),R=y.useRef(""),A=_.viewport,D=s.content-s.viewport,B=Qt(b),I=Qt(f),L=ff(g,10);function H(Z){if(C.current){const ue=Z.clientX-C.current.left,ce=Z.clientY-C.current.top;h({x:ue,y:ce})}}return y.useEffect(()=>{const Z=ue=>{const ce=ue.target;(E==null?void 0:E.contains(ce))&&B(ue,D)};return document.addEventListener("wheel",Z,{passive:!1}),()=>document.removeEventListener("wheel",Z,{passive:!1})},[A,E,D,B]),y.useEffect(I,[s,I]),oo(E,L),oo(_.content,L),m.jsx(FB,{scope:r,scrollbar:E,hasThumb:i,onThumbChange:Qt(l),onThumbPointerUp:Qt(u),onThumbPositionChange:I,onThumbPointerDown:Qt(d),children:m.jsx(Ne.div,{...x,ref:T,style:{position:"absolute",...x.style},onPointerDown:ve(e.onPointerDown,Z=>{Z.button===0&&(Z.target.setPointerCapture(Z.pointerId),C.current=E.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",_.viewport&&(_.viewport.style.scrollBehavior="auto"),H(Z))}),onPointerMove:ve(e.onPointerMove,H),onPointerUp:ve(e.onPointerUp,Z=>{const ue=Z.target;ue.hasPointerCapture(Z.pointerId)&&ue.releasePointerCapture(Z.pointerId),document.body.style.webkitUserSelect=R.current,_.viewport&&(_.viewport.style.scrollBehavior=""),C.current=null})})})}),Ad="ScrollAreaThumb",lN=y.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=iN(Ad,e.__scopeScrollArea);return m.jsx(fn,{present:r||i.hasThumb,children:m.jsx(KB,{ref:t,...s})})}),KB=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:s,...i}=e,l=lr(Ad,r),u=iN(Ad,r),{onThumbPositionChange:d}=u,f=Ye(t,g=>u.onThumbChange(g)),h=y.useRef(void 0),b=ff(()=>{h.current&&(h.current(),h.current=void 0)},100);return y.useEffect(()=>{const g=l.viewport;if(g){const x=()=>{if(b(),!h.current){const _=XB(g,d);h.current=_,d()}};return d(),g.addEventListener("scroll",x),()=>g.removeEventListener("scroll",x)}},[l.viewport,b,d]),m.jsx(Ne.div,{"data-state":u.hasThumb?"visible":"hidden",...i,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:ve(e.onPointerDownCapture,g=>{const _=g.target.getBoundingClientRect(),E=g.clientX-_.left,S=g.clientY-_.top;u.onThumbPointerDown({x:E,y:S})}),onPointerUp:ve(e.onPointerUp,u.onThumbPointerUp)})});lN.displayName=Ad;var yv="ScrollAreaCorner",cN=y.forwardRef((e,t)=>{const r=lr(yv,e.__scopeScrollArea),s=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&s?m.jsx(YB,{...e,ref:t}):null});cN.displayName=yv;var YB=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,...s}=e,i=lr(yv,r),[l,u]=y.useState(0),[d,f]=y.useState(0),h=!!(l&&d);return oo(i.scrollbarX,()=>{var g;const b=((g=i.scrollbarX)==null?void 0:g.offsetHeight)||0;i.onCornerHeightChange(b),f(b)}),oo(i.scrollbarY,()=>{var g;const b=((g=i.scrollbarY)==null?void 0:g.offsetWidth)||0;i.onCornerWidthChange(b),u(b)}),h?m.jsx(Ne.div,{...s,ref:t,style:{width:l,height:d,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Rd(e){return e?parseInt(e,10):0}function uN(e,t){const r=e/t;return isNaN(r)?0:r}function df(e){const t=uN(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-r)*t;return Math.max(s,18)}function WB(e,t,r,s="ltr"){const i=df(r),l=i/2,u=t||l,d=i-u,f=r.scrollbar.paddingStart+u,h=r.scrollbar.size-r.scrollbar.paddingEnd-d,b=r.content-r.viewport,g=s==="ltr"?[0,b]:[b*-1,0];return dN([f,h],g)(e)}function p_(e,t,r="ltr"){const s=df(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-i,u=t.content-t.viewport,d=l-s,f=r==="ltr"?[0,u]:[u*-1,0],h=Lp(e,f);return dN([0,u],[0,d])(h)}function dN(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(r-e[0])}}function fN(e,t){return e>0&&e<t}var XB=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},s=0;return(function i(){const l={left:e.scrollLeft,top:e.scrollTop},u=r.left!==l.left,d=r.top!==l.top;(u||d)&&t(),r=l,s=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(s)};function ff(e,t){const r=Qt(e),s=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(s.current),[]),y.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(r,t)},[r,t])}function oo(e,t){const r=Qt(t);Ht(()=>{let s=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(s),i.unobserve(e)}}},[e,r])}var hN=nN,JB=aN,QB=cN;const tg=y.forwardRef(({className:e,children:t,...r},s)=>m.jsxs(hN,{ref:s,className:xe("relative overflow-hidden",e),...r,children:[m.jsx(JB,{className:"h-full w-full rounded-[inherit]",children:t}),m.jsx(mN,{}),m.jsx(QB,{})]}));tg.displayName=hN.displayName;const mN=y.forwardRef(({className:e,orientation:t="vertical",...r},s)=>m.jsx(gv,{ref:s,orientation:t,className:xe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:m.jsx(lN,{className:"relative flex-1 rounded-full bg-border"})}));mN.displayName=gv.displayName;var hf="Switch",[ZB]=or(hf),[e6,t6]=ZB(hf),pN=y.forwardRef((e,t)=>{const{__scopeSwitch:r,name:s,checked:i,defaultChecked:l,required:u,disabled:d,value:f="on",onCheckedChange:h,form:b,...g}=e,[x,_]=y.useState(null),E=Ye(t,A=>_(A)),S=y.useRef(!1),T=x?b||!!x.closest("form"):!0,[C,R]=fa({prop:i,defaultProp:l??!1,onChange:h,caller:hf});return m.jsxs(e6,{scope:r,checked:C,disabled:d,children:[m.jsx(Ne.button,{type:"button",role:"switch","aria-checked":C,"aria-required":u,"data-state":bN(C),"data-disabled":d?"":void 0,disabled:d,value:f,...g,ref:E,onClick:ve(e.onClick,A=>{R(D=>!D),T&&(S.current=A.isPropagationStopped(),S.current||A.stopPropagation())})}),T&&m.jsx(yN,{control:x,bubbles:!S.current,name:s,value:f,checked:C,required:u,disabled:d,form:b,style:{transform:"translateX(-100%)"}})]})});pN.displayName=hf;var gN="SwitchThumb",vN=y.forwardRef((e,t)=>{const{__scopeSwitch:r,...s}=e,i=t6(gN,r);return m.jsx(Ne.span,{"data-state":bN(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})});vN.displayName=gN;var n6="SwitchBubbleInput",yN=y.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:s=!0,...i},l)=>{const u=y.useRef(null),d=Ye(u,l),f=Xg(r),h=Rg(t);return y.useEffect(()=>{const b=u.current;if(!b)return;const g=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(g,"checked").set;if(f!==r&&_){const E=new Event("click",{bubbles:s});_.call(b,r),b.dispatchEvent(E)}},[f,r,s]),m.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:d,style:{...i.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});yN.displayName=n6;function bN(e){return e?"checked":"unchecked"}var xN=pN,r6=vN;const $l=y.forwardRef(({className:e,...t},r)=>m.jsx(xN,{className:xe("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:m.jsx(r6,{className:xe("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));$l.displayName=xN.displayName;var mf="Tabs",[a6]=or(mf,[Vd]),wN=Vd(),[s6,bv]=a6(mf),_N=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,onValueChange:i,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:f="automatic",...h}=e,b=Fl(d),[g,x]=fa({prop:s,onChange:i,defaultProp:l??"",caller:mf});return m.jsx(s6,{scope:r,baseId:on(),value:g,onValueChange:x,orientation:u,dir:b,activationMode:f,children:m.jsx(Ne.div,{dir:b,"data-orientation":u,...h,ref:t})})});_N.displayName=mf;var SN="TabsList",EN=y.forwardRef((e,t)=>{const{__scopeTabs:r,loop:s=!0,...i}=e,l=bv(SN,r),u=wN(r);return m.jsx(f1,{asChild:!0,...u,orientation:l.orientation,dir:l.dir,loop:s,children:m.jsx(Ne.div,{role:"tablist","aria-orientation":l.orientation,...i,ref:t})})});EN.displayName=SN;var CN="TabsTrigger",TN=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,disabled:i=!1,...l}=e,u=bv(CN,r),d=wN(r),f=RN(u.baseId,s),h=jN(u.baseId,s),b=s===u.value;return m.jsx(h1,{asChild:!0,...d,focusable:!i,active:b,children:m.jsx(Ne.button,{type:"button",role:"tab","aria-selected":b,"aria-controls":h,"data-state":b?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:f,...l,ref:t,onMouseDown:ve(e.onMouseDown,g=>{!i&&g.button===0&&g.ctrlKey===!1?u.onValueChange(s):g.preventDefault()}),onKeyDown:ve(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&u.onValueChange(s)}),onFocus:ve(e.onFocus,()=>{const g=u.activationMode!=="manual";!b&&!i&&g&&u.onValueChange(s)})})})});TN.displayName=CN;var NN="TabsContent",AN=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,forceMount:i,children:l,...u}=e,d=bv(NN,r),f=RN(d.baseId,s),h=jN(d.baseId,s),b=s===d.value,g=y.useRef(b);return y.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),m.jsx(fn,{present:i||b,children:({present:x})=>m.jsx(Ne.div,{"data-state":b?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":f,hidden:!x,id:h,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:x&&l})})});AN.displayName=NN;function RN(e,t){return`${e}-trigger-${t}`}function jN(e,t){return`${e}-content-${t}`}var i6=_N,kN=EN,ON=TN,MN=AN;const o6=i6,DN=y.forwardRef(({className:e,...t},r)=>m.jsx(kN,{ref:r,className:xe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));DN.displayName=kN.displayName;const ng=y.forwardRef(({className:e,...t},r)=>m.jsx(ON,{ref:r,className:xe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background cursor-pointer transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));ng.displayName=ON.displayName;const l6=y.forwardRef(({className:e,...t},r)=>m.jsx(MN,{ref:r,className:xe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));l6.displayName=MN.displayName;const Hi=6,Fu=10;function cp(e){return e==null||!Number.isFinite(Number(e))?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(Number(e))}function up(e){const t=Number(String(e||"").replace(/,/g,"").trim());return Number.isFinite(t)?t:null}function c6(e,t){return e==null&&t==null?"":e!=null&&t!=null&&e!==t?`${e} - ${t}`:String(e??t??"")}function u6(e,t){const r=t.reduce((i,l)=>Math.max(i,l.sortOrder),0),s=e==="client"?"Tarifario especial":"Nueva sección";return{id:_T(e,s),name:s,scope:e,clientName:"",pricingMode:e==="client"?"fixed_multi":"guided",allowManual:!0,description:"",sortOrder:r+10,isActive:!0}}function d6(e){return{id:e.id,name:e.name,scope:e.scope,clientName:e.clientName,pricingMode:e.pricingMode,allowManual:e.allowManual,description:e.description,sortOrder:e.sortOrder,isActive:e.isActive}}function f6(e,t){const s=t.filter(l=>l.section===e.id).reduce((l,u)=>Math.max(l,u.sort_order),0),i=e.scope==="client";return{id:"",catalog_item_id:"",section:e.id,category:i?e.name:"",service:"",notes:"",work_type_id:i?"special_fixed":"",work_type_label:i?"Tarifa fija":"",work_type_short_label:i?"Fijo":"",hour_reference:"",level_id:i?"fixed":"",level_label:i?"Precio fijo":"",reference:"",reference_min:null,reference_max:null,level_hint:"",sort_order:s+1,is_active:!0,managed_by:"app"}}function h6(e){return{id:e.id,catalog_item_id:e.catalog_item_id,section:e.section,category:e.category,service:e.service,notes:e.notes,work_type_id:e.work_type_id,work_type_label:e.work_type_label,work_type_short_label:e.work_type_short_label,hour_reference:e.hour_reference,level_id:e.level_id,level_label:e.level_label,reference:e.reference,reference_min:e.reference_min,reference_max:e.reference_max,level_hint:e.level_hint,sort_order:e.sort_order,is_active:e.is_active,managed_by:"app"}}function m6({open:e,onOpenChange:t}){const{lists:r}=uv(),{sections:s,loading:i,error:l,refresh:u}=ST(),{rows:d,loading:f,error:h,refresh:b}=wT(),[g,x]=y.useState("general"),[_,E]=y.useState(""),[S,T]=y.useState(""),[C,R]=y.useState(!1),[A,D]=y.useState(!1),[B,I]=y.useState(null),[L,H]=y.useState(null),[Z,ue]=y.useState(!1),[ce,he]=y.useState(null),[de,me]=y.useState(null),[pe,j]=y.useState(!1),[K,W]=y.useState(!1),[J,G]=y.useState(null),[k,O]=y.useState(1),[U,Y]=y.useState(1),$=y.useMemo(()=>s.filter(Q=>Q.scope===g).sort((Q,Oe)=>Q.isActive!==Oe.isActive?Q.isActive?-1:1:Q.sortOrder-Oe.sortOrder||Q.name.localeCompare(Oe.name)),[g,s]),re=Math.max(1,Math.ceil($.length/Hi)),te=y.useMemo(()=>{const Q=(k-1)*Hi;return $.slice(Q,Q+Hi)},[$,k]),ee=s.find(Q=>Q.id===_)||$[0]||null;y.useEffect(()=>{var Q;if(!ee&&$.length){E($[0].id);return}ee&&ee.scope!==g&&E(((Q=$[0])==null?void 0:Q.id)||"")},[g,$,ee]),y.useEffect(()=>{e&&Promise.all([u(),b()])},[e,b,u]),y.useEffect(()=>{O(1)},[g]),y.useEffect(()=>{O(Q=>Math.min(Q,re))},[re]),y.useEffect(()=>{if(!_)return;const Q=$.findIndex(Xe=>Xe.id===_);if(Q<0)return;const Oe=Math.floor(Q/Hi)+1;O(Oe)},[$,_]);const se=y.useMemo(()=>{if(!ee)return[];const Q=S.trim().toLowerCase();return d.filter(Oe=>Oe.section===ee.id).filter(Oe=>C||Oe.is_active).filter(Oe=>Q?[Oe.category,Oe.service,Oe.work_type_label,Oe.level_label,Oe.notes].join(" ").toLowerCase().includes(Q):!0).sort((Oe,Xe)=>Oe.sort_order-Xe.sort_order||Oe.service.localeCompare(Xe.service))},[d,S,ee,C]),Se=Math.max(1,Math.ceil(se.length/Fu)),Te=y.useMemo(()=>{const Q=(U-1)*Fu;return se.slice(Q,Q+Fu)},[se,U]);y.useEffect(()=>{Y(1)},[S,ee==null?void 0:ee.id,C]),y.useEffect(()=>{Y(Q=>Math.min(Q,Se))},[Se]);const Re=d.filter(Q=>Q.is_active).length,nt=s.filter(Q=>Q.scope==="client"&&Q.isActive).length,Ze=Q=>{const Oe=Math.min(Math.max(Q,1),re);O(Oe);const Xe=$[(Oe-1)*Hi];Xe&&E(Xe.id)},xt=Q=>{H(null),I(u6(Q,s)),D(!0)},oe=Q=>{H(Q),I(d6(Q)),D(!0)},je=async()=>{if(!B)return;const Q=B.name.trim(),Oe=B.scope==="client"?B.clientName.trim():"";if(!Q){Et.error("Escribe el nombre de la sección.");return}if(B.scope==="client"&&!Oe){Et.error("Selecciona el cliente del tarifario especial.");return}j(!0);try{const Xe={...B,id:(L==null?void 0:L.id)||_T(B.scope,Q,B.clientName),name:Q,clientName:Oe,pricingMode:B.scope==="client"?"fixed_multi":"guided"};await n$(Xe),x(Xe.scope),E(Xe.id),D(!1),Et.success(L?"Sección actualizada.":"Sección creada.")}catch(Xe){console.error("Error guardando sección del tarifario:",Xe),Et.error(Xe instanceof Error?Xe.message:"No se pudo guardar la sección.")}finally{j(!1)}},Ve=async Q=>{G(Q.id);try{await r$(Q,!Q.isActive),Et.success(Q.isActive?"Sección desactivada.":"Sección reactivada.")}catch(Oe){console.error("Error cambiando estado de sección:",Oe),Et.error("No se pudo cambiar el estado de la sección.")}finally{G(null)}},$e=()=>{ee&&(me(null),he(f6(ee,d)),ue(!0))},Nt=Q=>{me(Q),he(h6(Q)),ue(!0)},We=async()=>{if(!ce||!ee)return;const Q=ee.scope==="client",Oe=ce.service.trim(),Xe=Q?ee.name:ce.category.trim(),Lt=ce.notes.trim();if(!Oe){Et.error(Q?"Escribe el nombre de la pieza.":"Escribe el servicio o ítem.");return}if(!Q&&!Xe){Et.error("Escribe la categoría.");return}const ln=ce.reference_min==null?null:Number(ce.reference_min),Kt=ce.reference_max==null?null:Number(ce.reference_max);if(Q&&(!Number.isFinite(ln)||Number(ln)<=0)){Et.error("El monto fijo debe ser mayor que cero.");return}if(ln!=null&&Kt!=null&&ln>Kt){Et.error("El monto mínimo no puede ser mayor que el máximo.");return}W(!0);try{const gn=Q?null:d.find(le=>le.section===ee.id&&Ya(le.category)===Ya(Xe)&&Ya(le.service)===Ya(Oe)),vn=(de==null?void 0:de.catalog_item_id)||(gn==null?void 0:gn.catalog_item_id)||Ya(`${ee.id}-${Xe}-${Oe}`),yn=Q?"Tarifa fija":ce.work_type_label.trim()||"Referencia",kt=Q?"Precio fijo":ce.level_label.trim()||"Precio único",cn=(de==null?void 0:de.work_type_id)||Ya(yn)||"reference",Ot=(de==null?void 0:de.level_id)||Ya(kt)||"project",Ur=Q?Number(ln):null,$r={...ce,id:(de==null?void 0:de.id)||xT({catalog_item_id:vn,work_type_id:cn,level_id:Ot}),catalog_item_id:vn,section:ee.id,category:Xe,service:Oe,notes:Lt,work_type_id:cn,work_type_label:yn,work_type_short_label:Q?"Fijo":ce.work_type_short_label.trim()||yn,hour_reference:Q?"":ce.hour_reference.trim(),level_id:Ot,level_label:kt,reference:Q?`${Ur} USD`:ce.reference.trim()||c6(ln,Kt),reference_min:Q?Ur:ln,reference_max:Q?Ur:Kt,level_hint:Q?"Monto fijo por pieza.":ce.level_hint.trim(),sort_order:Number(ce.sort_order||0),is_active:ce.is_active,managed_by:"app"};await QU($r,de),ue(!1),Et.success(de?"Tarifa actualizada.":"Tarifa agregada.")}catch(gn){console.error("Error guardando tarifa:",gn),Et.error(gn instanceof Error?gn.message:"No se pudo guardar la tarifa.")}finally{W(!1)}},it=async Q=>{G(Q.id);try{await ZU(Q,!Q.is_active),Et.success(Q.is_active?"Tarifa desactivada.":"Tarifa reactivada.")}catch(Oe){console.error("Error cambiando estado de tarifa:",Oe),Et.error("No se pudo cambiar el estado de la tarifa.")}finally{G(null)}},Pt=i||f,Ie=l||h;return m.jsxs(m.Fragment,{children:[m.jsx(Jd,{open:e,onOpenChange:t,children:m.jsx(tc,{className:"h-[90vh] max-h-[900px] w-[96vw] max-w-[1280px] overflow-hidden p-0",children:m.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[m.jsxs("div",{className:"border-b border-border px-6 py-5 pr-14",children:[m.jsx(nc,{children:m.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[m.jsxs("div",{children:[m.jsxs(rc,{className:"flex items-center gap-2 text-xl",children:[m.jsx(kS,{className:"h-5 w-5 text-primary"}),"Administración del tarifario"]}),m.jsx(ac,{className:"mt-1 max-w-3xl",children:"Crea secciones generales, administra tarifas por cliente y edita los ítems que ya utiliza el equipo al cotizar proyectos."})]}),m.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>void Promise.all([u(),b()]),disabled:Pt,children:[m.jsx(DS,{className:xe("h-3.5 w-3.5",Pt&&"animate-spin")}),"Actualizar"]}),m.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>xt("client"),children:[m.jsx(bw,{className:"h-3.5 w-3.5"}),"Tarifario por cliente"]}),m.jsxs(Fe,{type:"button",size:"sm",className:"gap-1.5",onClick:()=>xt("general"),children:[m.jsx(es,{className:"h-3.5 w-3.5"}),"Sección general"]})]})]})}),m.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:grid-cols-3",children:[m.jsx(dp,{icon:m.jsx(AP,{className:"h-4 w-4"}),label:"Secciones activas",value:s.filter(Q=>Q.isActive).length}),m.jsx(dp,{icon:m.jsx(bw,{className:"h-4 w-4"}),label:"Tarifarios por cliente",value:nt}),m.jsx(dp,{icon:m.jsx(xw,{className:"h-4 w-4"}),label:"Tarifas activas",value:Re})]})]}),Ie&&m.jsx("div",{className:"border-b border-amber-200 bg-amber-50 px-6 py-2 text-xs text-amber-900",children:Ie}),m.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-[310px_minmax(0,1fr)]",children:[m.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border bg-muted/20 lg:border-b-0 lg:border-r",children:[m.jsxs("div",{className:"space-y-3 p-4",children:[m.jsx(o6,{value:g,onValueChange:Q=>x(Q),children:m.jsxs(DN,{className:"grid w-full grid-cols-2",children:[m.jsx(ng,{value:"general",children:"Generales"}),m.jsx(ng,{value:"client",children:"Por cliente"})]})}),m.jsx("p",{className:"text-xs text-muted-foreground",children:g==="general"?"Estas secciones aparecen para los clientes que no tienen un tarifario especial.":"Cada tarifario aparece únicamente al seleccionar el cliente asociado."})]}),m.jsx(tg,{className:"min-h-[220px] flex-1 px-3 pb-3",children:m.jsxs("div",{className:"space-y-2 pr-2",children:[te.map(Q=>{const Oe=Q.id===(ee==null?void 0:ee.id),Xe=d.filter(Lt=>Lt.section===Q.id&&Lt.is_active).length;return m.jsxs("button",{type:"button",onClick:()=>E(Q.id),className:xe("w-full rounded-xl border px-3 py-3 text-left transition-colors",Oe?"border-primary/40 bg-primary/10":"border-border bg-card hover:bg-muted/50",!Q.isActive&&"opacity-60"),children:[m.jsxs("div",{className:"flex items-start justify-between gap-2",children:[m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:"truncate text-sm font-semibold",children:Q.name}),Q.scope==="client"&&m.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:Q.clientName})]}),m.jsx(Gn,{variant:Q.isActive?"secondary":"outline",children:Q.isActive?"Activa":"Inactiva"})]}),m.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:[Xe," tarifa(s) activa(s)"]})]},Q.id)}),$.length===0&&m.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card px-3 py-5 text-center text-sm text-muted-foreground",children:"No hay secciones de este tipo."})]})}),m.jsx(g_,{currentPage:k,totalPages:re,totalItems:$.length,pageSize:Hi,itemLabel:"secciones",onPageChange:Ze,compact:!0})]}),m.jsx("section",{className:"min-h-0",children:ee?m.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[m.jsx("div",{className:"border-b border-border px-5 py-4",children:m.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.jsx("h3",{className:"text-lg font-semibold",children:ee.name}),m.jsx(Gn,{variant:ee.scope==="client"?"default":"secondary",children:ee.scope==="client"?"Por cliente":"General"}),!ee.isActive&&m.jsx(Gn,{variant:"outline",children:"Inactiva"})]}),ee.scope==="client"&&m.jsxs("p",{className:"mt-1 text-sm text-primary",children:["Se muestra al seleccionar: ",ee.clientName]}),m.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:ee.description||"Sin descripción."})]}),m.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>oe(ee),children:[m.jsx(XP,{className:"h-3.5 w-3.5"}),"Editar sección"]}),m.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>void Ve(ee),disabled:J===ee.id,children:[ee.isActive?m.jsx(yw,{className:"h-3.5 w-3.5 rotate-180"}):m.jsx(yw,{className:"h-3.5 w-3.5"}),ee.isActive?"Desactivar":"Reactivar"]}),m.jsxs(Fe,{type:"button",size:"sm",className:"gap-1.5",onClick:$e,children:[m.jsx(es,{className:"h-3.5 w-3.5"}),ee.scope==="client"?"Nueva pieza":"Nueva tarifa"]})]})]})}),m.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border px-5 py-3",children:[m.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[m.jsx(Ol,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),m.jsx(gt,{value:S,onChange:Q=>T(Q.target.value),className:"pl-9",placeholder:"Buscar servicio, categoría o nivel…"})]}),m.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[m.jsx($l,{checked:C,onCheckedChange:R}),"Mostrar inactivas"]})]}),m.jsx(tg,{className:"min-h-0 flex-1",children:m.jsx("div",{className:"space-y-3 p-5",children:Pt&&se.length===0?m.jsxs("div",{className:"flex items-center justify-center gap-2 py-12 text-sm text-muted-foreground",children:[m.jsx(ar,{className:"h-4 w-4 animate-spin"})," Cargando tarifario…"]}):se.length===0?m.jsxs("div",{className:"rounded-2xl border border-dashed border-border bg-muted/20 px-5 py-10 text-center",children:[m.jsx(xw,{className:"mx-auto h-8 w-8 text-muted-foreground"}),m.jsx("p",{className:"mt-3 text-sm font-medium",children:"No hay tarifas para mostrar"}),m.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Agrega la primera tarifa de esta sección o activa “Mostrar inactivas”."}),m.jsxs(Fe,{className:"mt-4 gap-1.5",size:"sm",onClick:$e,children:[m.jsx(es,{className:"h-3.5 w-3.5"})," Agregar tarifa"]})]}):Te.map(Q=>m.jsx(p6,{row:Q,section:ee,busy:J===Q.id,onEdit:()=>Nt(Q),onToggle:()=>void it(Q)},Q.id))})}),m.jsx(g_,{currentPage:U,totalPages:Se,totalItems:se.length,pageSize:Fu,itemLabel:"tarifas",onPageChange:Y})]}):m.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Selecciona o crea una sección para comenzar."})})]})]})})}),m.jsx(g6,{open:A,onOpenChange:D,draft:B,onDraftChange:I,clients:r.clientes,editing:!!L,saving:pe,onSave:()=>void je()}),m.jsx(v6,{open:Z,onOpenChange:ue,section:ee,draft:ce,onDraftChange:he,editing:!!de,saving:K,onSave:()=>void We()})]})}function g_({currentPage:e,totalPages:t,totalItems:r,pageSize:s,itemLabel:i,onPageChange:l,compact:u=!1}){const d=r===0?0:(e-1)*s+1,f=Math.min(e*s,r);return m.jsxs("div",{className:xe("flex items-center justify-between gap-3 border-t border-border bg-background/95 px-4 py-2.5",u&&"px-3"),children:[m.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[d,"",f," de ",r," ",i]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[!u&&m.jsxs("span",{className:"mr-1 text-[11px] text-muted-foreground",children:["Página ",e," de ",t]}),m.jsx(Fe,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7","aria-label":"Página anterior",onClick:()=>l(e-1),disabled:e<=1,children:m.jsx(OS,{className:"h-3.5 w-3.5"})}),u&&m.jsxs("span",{className:"min-w-[42px] text-center text-[11px] text-muted-foreground",children:[e,"/",t]}),m.jsx(Fe,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7","aria-label":"Página siguiente",onClick:()=>l(e+1),disabled:e>=t,children:m.jsx(xg,{className:"h-3.5 w-3.5"})})]})]})}function dp({icon:e,label:t,value:r}){return m.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-border bg-muted/20 px-3 py-2.5",children:[m.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10 text-primary",children:e}),m.jsxs("div",{children:[m.jsx("p",{className:"text-lg font-semibold leading-none",children:r}),m.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:t})]})]})}function p6({row:e,section:t,busy:r,onEdit:s,onToggle:i}){const l=t.scope==="client",u=l?cp(e.reference_min??e.reference_max):e.reference||(e.reference_min!=null||e.reference_max!=null?`${cp(e.reference_min)} ${cp(e.reference_max)}`:"Sin monto de referencia");return m.jsx("div",{className:xe("rounded-2xl border border-border bg-card px-4 py-3 shadow-sm",!e.is_active&&"opacity-60"),children:m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.jsx("p",{className:"font-medium",children:e.service}),m.jsx(Gn,{variant:e.is_active?"secondary":"outline",children:e.is_active?"Activa":"Inactiva"}),e.managed_by==="app"&&m.jsx(Gn,{variant:"outline",children:"Gestionada en app"})]}),!l&&m.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:e.category}),m.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[!l&&m.jsx("span",{children:e.work_type_label}),!l&&m.jsx("span",{children:e.level_label}),m.jsx("span",{className:"font-semibold text-foreground",children:u}),m.jsxs("span",{children:["Orden: ",e.sort_order]})]}),e.notes&&m.jsx("p",{className:"mt-2 line-clamp-2 text-xs text-muted-foreground",children:e.notes})]}),m.jsxs("div",{className:"flex gap-2",children:[m.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:s,children:[m.jsx(GP,{className:"h-3.5 w-3.5"})," Editar"]}),m.jsx(Fe,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:r,children:r?m.jsx(ar,{className:"h-3.5 w-3.5 animate-spin"}):e.is_active?"Desactivar":"Reactivar"})]})]})})}function g6({open:e,onOpenChange:t,draft:r,onDraftChange:s,clients:i,editing:l,saving:u,onSave:d}){if(!r)return null;const f=r.scope==="client";return m.jsx(Jd,{open:e,onOpenChange:t,children:m.jsxs(tc,{className:"max-w-2xl",children:[m.jsxs(nc,{children:[m.jsx(rc,{children:l?"Editar sección":f?"Nuevo tarifario por cliente":"Nueva sección general"}),m.jsx(ac,{children:f?"El tarifario aparecerá automáticamente cuando se seleccione el cliente indicado.":"La sección aparecerá junto a las demás secciones del tarifario general."})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-4 py-2 sm:grid-cols-2",children:[m.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[m.jsx(He,{children:"Nombre de la sección"}),m.jsx(gt,{value:r.name,onChange:h=>s({...r,name:h.target.value}),placeholder:f?"Ej: Tarifario PepsiCo":"Ej: Producción audiovisual"})]}),f&&m.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[m.jsx(He,{children:"Cliente asociado"}),m.jsx(Mr,{value:r.clientName,options:i,onValueChange:h=>s({...r,clientName:h}),placeholder:"Seleccionar cliente…",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente en las listas de la app."}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"El nombre debe coincidir con el cliente disponible en el formulario de proyectos."})]}),m.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[m.jsx(He,{children:"Descripción para el usuario"}),m.jsx(ts,{value:r.description,onChange:h=>s({...r,description:h.target.value}),placeholder:"Explica brevemente qué incluye esta sección.",rows:3})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Orden"}),m.jsx(gt,{type:"number",min:"0",value:r.sortOrder,onChange:h=>s({...r,sortOrder:Number(h.target.value||0)})})]}),m.jsxs("div",{className:"flex flex-col justify-end gap-3 rounded-xl border border-border bg-muted/20 px-3 py-2.5",children:[m.jsxs("label",{className:"flex items-center justify-between gap-3 text-sm",children:[m.jsx("span",{children:"Sección activa"}),m.jsx($l,{checked:r.isActive,onCheckedChange:h=>s({...r,isActive:h})})]}),f&&m.jsxs("label",{className:"flex items-center justify-between gap-3 text-sm",children:[m.jsx("span",{children:"Permitir costo manual"}),m.jsx($l,{checked:r.allowManual,onCheckedChange:h=>s({...r,allowManual:h})})]})]})]}),m.jsxs(Qd,{children:[m.jsx(Fe,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),m.jsxs(Fe,{type:"button",className:"gap-1.5",onClick:d,disabled:u,children:[u?m.jsx(ar,{className:"h-4 w-4 animate-spin"}):m.jsx(da,{className:"h-4 w-4"}),"Guardar sección"]})]})]})})}function v6({open:e,onOpenChange:t,section:r,draft:s,onDraftChange:i,editing:l,saving:u,onSave:d}){if(!s||!r)return null;const f=r.scope==="client";return m.jsx(Jd,{open:e,onOpenChange:t,children:m.jsxs(tc,{className:"max-h-[88vh] max-w-3xl overflow-y-auto",children:[m.jsxs(nc,{children:[m.jsx(rc,{children:l?f?"Editar pieza":"Editar tarifa":f?"Nueva pieza de precio fijo":"Nueva tarifa"}),m.jsxs(ac,{children:["Sección: ",r.name]})]}),f?m.jsxs("div",{className:"grid grid-cols-1 gap-4 py-2 sm:grid-cols-[minmax(0,1fr)_200px]",children:[m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Nombre de la pieza"}),m.jsx(gt,{value:s.service,onChange:h=>i({...s,service:h.target.value}),placeholder:"Ej: Photobooth"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Monto fijo (USD)"}),m.jsx(gt,{type:"number",min:"0",step:"0.01",value:s.reference_min??"",onChange:h=>i({...s,reference_min:up(h.target.value)}),placeholder:"0.00"})]}),m.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[m.jsx(He,{children:"Descripción / incluye"}),m.jsx(ts,{value:s.notes,onChange:h=>i({...s,notes:h.target.value}),placeholder:"Describe qué incluye esta pieza y cualquier observación importante.",rows:4})]})]}):m.jsxs("div",{className:"grid grid-cols-1 gap-4 py-2 sm:grid-cols-2",children:[m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Categoría"}),m.jsx(gt,{value:s.category,onChange:h=>i({...s,category:h.target.value}),placeholder:"Ej: Materiales de PDV"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Servicio / ítem"}),m.jsx(gt,{value:s.service,onChange:h=>i({...s,service:h.target.value}),placeholder:"Ej: Diseño de roll up"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Tipo de trabajo"}),m.jsx(gt,{value:s.work_type_label,onChange:h=>i({...s,work_type_label:h.target.value}),placeholder:"Ej: Diseño + Arte Final"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Etiqueta corta"}),m.jsx(gt,{value:s.work_type_short_label,onChange:h=>i({...s,work_type_short_label:h.target.value}),placeholder:"Ej: Diseño"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Nivel / referencia"}),m.jsx(gt,{value:s.level_label,onChange:h=>i({...s,level_label:h.target.value}),placeholder:"Ej: Básico"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Hora hombre ref."}),m.jsx(gt,{value:s.hour_reference,onChange:h=>i({...s,hour_reference:h.target.value}),placeholder:"Ej: 35 - 50"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Monto mínimo"}),m.jsx(gt,{type:"number",min:"0",step:"0.01",value:s.reference_min??"",onChange:h=>i({...s,reference_min:up(h.target.value)}),placeholder:"0.00"})]}),m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Monto máximo"}),m.jsx(gt,{type:"number",min:"0",step:"0.01",value:s.reference_max??"",onChange:h=>i({...s,reference_max:up(h.target.value)}),placeholder:"0.00"})]}),m.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[m.jsx(He,{children:"Referencia visible"}),m.jsx(gt,{value:s.reference,onChange:h=>i({...s,reference:h.target.value}),placeholder:"Ej: 100 - 150 USD (se genera automáticamente si se deja vacío)"})]}),m.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[m.jsx(He,{children:"Observaciones / incluye"}),m.jsx(ts,{value:s.notes,onChange:h=>i({...s,notes:h.target.value}),placeholder:"Describe qué incluye el servicio.",rows:3})]}),m.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[m.jsx(He,{children:"Nota del nivel"}),m.jsx(ts,{value:s.level_hint,onChange:h=>i({...s,level_hint:h.target.value}),placeholder:"Ej: Puede superar el rango si la complejidad lo requiere.",rows:2})]})]}),m.jsx(Ls,{}),m.jsxs("div",{className:"grid grid-cols-1 gap-4 py-2 sm:grid-cols-2",children:[m.jsxs("div",{className:"space-y-1.5",children:[m.jsx(He,{children:"Orden"}),m.jsx(gt,{type:"number",min:"0",value:s.sort_order,onChange:h=>i({...s,sort_order:Number(h.target.value||0)})})]}),m.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-muted/20 px-3 py-2.5 text-sm",children:[m.jsx("span",{children:"Tarifa activa"}),m.jsx($l,{checked:s.is_active,onCheckedChange:h=>i({...s,is_active:h})})]})]}),m.jsxs(Qd,{children:[m.jsx(Fe,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),m.jsxs(Fe,{type:"button",className:"gap-1.5",onClick:d,disabled:u,children:[u?m.jsx(ar,{className:"h-4 w-4 animate-spin"}):m.jsx(da,{className:"h-4 w-4"}),"Guardar tarifa"]})]})]})})}const qi=24,v_={country:"",brand:"",client:"",cm:""};function y6(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 b6(){const[e,t]=y.useState(!1),[r,s]=y.useState(null),[i,l]=y.useState(""),[u,d]=y.useState("todos"),[f,h]=y.useState(v_),[b,g]=y.useState({todos:1,abiertos:1,cerrados:1}),[x,_]=y.useState(null),[E,S]=y.useState(!1),T=b[u],{lists:C}=uv(),{projects:R,totalProjects:A,filterOptions:D,loading:B,error:I,refresh:L,remove:H}=JT({tab:u,search:i,page:T,pageSize:qi,country:f.country,brand:f.brand,client:f.client,cm:f.cm}),{user:Z,isGerardo:ue,canManageInternalPricing:ce,canControlPricingSummary:he,canManageTariffCatalog:de,logout:me}=Ld(),pe={tab:u,search:i,page:1,pageSize:qi,country:f.country,brand:f.brand,client:f.client,cm:f.cm},{isPublic:j,loading:K,saving:W,error:J,setPublicVisibility:G}=UB(!!Z),k=he||j,{summary:O,loading:U,error:Y}=J$(pe,k),$=Object.values(C.buCm),re=st([...C.bus,...y$(D.countries,C.bus),f.country]),te=st([...C.marcas,...lp(D.brands,C.marcas),f.brand]),ee=st([...C.clientes,...lp(D.clients,C.clientes),f.client]),se=st([...$,...lp(D.cms,$),f.cm]),Se=Object.values(f).filter(Boolean).length,Te=Math.max(1,Math.ceil(A/qi)),Re=Math.min(T,Te),nt=(Re-1)*qi,Ze=A===0?0:nt+1,xt=Math.min(nt+qi,A);y.useEffect(()=>{g(Q=>({...Q,[u]:1}))},[i,u,f.country,f.brand,f.client,f.cm]),y.useEffect(()=>{T>Te&&g(Q=>({...Q,[u]:Te}))},[T,u,Te]);const oe=Q=>{const Oe=Math.min(Math.max(Q,1),Te);Oe!==T&&(g(Xe=>({...Xe,[u]:Oe})),window.scrollTo({top:0,behavior:"smooth"}))},je=(Q,Oe)=>{h(Xe=>({...Xe,[Q]:Oe}))},Ve=()=>{h(v_)},$e=()=>{s(null),t(!0)},Nt=Q=>{s(Q),t(!0)},We=async Q=>{if(window.confirm(`¿Seguro que deseas eliminar el proyecto "${Q.nombre||"Sin título"}"?
Esta acción eliminará el proyecto del tablero y del Google Sheet.`)){_(Q.id);try{await H(Q.id),(r==null?void 0:r.id)===Q.id&&(t(!1),s(null))}catch(Xe){console.error("Error eliminando proyecto:",Xe);const Lt=Xe instanceof Error?Xe.message:"No se pudo eliminar el proyecto. Revisa n8n, Supabase o permisos.";window.alert(Lt)}finally{_(null)}}},it=(Z==null?void 0:Z.displayName)??(Z==null?void 0:Z.email)??"Usuario",Pt=ue?"Jefe CDC":"Usuario CDC",Ie=y6(Z==null?void 0:Z.displayName,Z==null?void 0:Z.email);return m.jsxs("div",{className:"min-h-screen bg-background",children:[m.jsx("header",{className:"sticky top-0 z-30 bg-background/85 backdrop-blur-md border-b border-border",children:m.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-3.5 flex items-center gap-4",children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx(yg,{size:"sm"}),m.jsx("div",{className:"h-7 w-px bg-border"}),m.jsx("h1",{className:"text-[15px] font-semibold tracking-tight text-[#4F758B]",children:"CDC Project Management"})]}),m.jsxs("div",{className:"flex-1 max-w-md ml-4 relative hidden md:block",children:[m.jsx(Ol,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),m.jsx(gt,{value:i,onChange:Q=>l(Q.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"})]}),m.jsx("div",{className:"flex-1 md:flex-none"}),m.jsxs(uz,{children:[m.jsx(dz,{asChild:!0,children:m.jsxs(Fe,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2.5",children:[m.jsxs(TE,{className:"w-7 h-7",children:[(Z==null?void 0:Z.photoURL)&&m.jsx(NE,{src:Z.photoURL,alt:it,referrerPolicy:"no-referrer"}),m.jsx(AE,{className:ue?"bg-primary text-primary-foreground text-xs":"bg-accent text-accent-foreground text-xs",children:Ie})]}),m.jsxs("div",{className:"text-left leading-tight hidden sm:block",children:[m.jsx("div",{className:"text-xs font-medium",children:it}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:Pt})]}),m.jsx(bg,{className:"w-3.5 h-3.5 text-muted-foreground"})]})}),m.jsxs(mE,{align:"end",className:"w-52",children:[m.jsxs("div",{className:"px-3 py-2",children:[m.jsx("p",{className:"text-xs font-medium truncate",children:it}),m.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:Z==null?void 0:Z.email})]}),m.jsx(gE,{}),m.jsxs(pE,{onClick:me,className:"gap-2 text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer",children:[m.jsx(UP,{className:"w-3.5 h-3.5"}),"Cerrar sesión"]})]})]}),de&&m.jsxs(Fe,{type:"button",variant:"outline",onClick:()=>S(!0),className:"gap-1.5 h-9 rounded-full px-4 shadow-sm",children:[m.jsx(kS,{className:"w-4 h-4"})," Tarifario"]}),m.jsxs(Fe,{onClick:$e,className:"gap-1.5 h-9 rounded-full px-4 shadow-sm",children:[m.jsx(es,{className:"w-4 h-4"})," Nuevo"]})]})}),m.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 pt-6 pb-3 space-y-3",children:[m.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[m.jsx("div",{children:m.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:"Proyectos"})}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsx("div",{className:"inline-flex bg-muted/60 rounded-full p-1 text-xs",children:[["todos","Todos"],["abiertos","Activos"],["cerrados","Cerrados"]].map(([Q,Oe])=>m.jsx("button",{onClick:()=>d(Q),className:`px-3.5 py-1.5 rounded-full transition-colors font-medium ${u===Q?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:Oe},Q))})})]}),m.jsxs("div",{className:"relative md:hidden",children:[m.jsx(Ol,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),m.jsx(gt,{value:i,onChange:Q=>l(Q.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"})]}),m.jsx(_6,{filters:f,activeCount:Se,countryOptions:re,brandOptions:te,clientOptions:ee,cmOptions:se,onFilterChange:je,onClear:Ve}),k&&m.jsx(w6,{totalAmount:O.totalAmount,projectCount:O.projectCount,loading:U||K,error:Y||J,hasFilters:u!=="todos"||i.trim().length>0||Se>0,canControlVisibility:he,isPublic:j,visibilitySaving:W,onToggleVisibility:()=>G(!j).catch(()=>{})})]}),m.jsxs("main",{className:"max-w-[1400px] mx-auto px-6 pb-16",children:[I&&m.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:[m.jsxs("span",{className:"flex items-start gap-2",children:[m.jsx(md,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),m.jsxs("span",{children:[m.jsx("span",{className:"font-medium",children:"No se pudieron cargar los proyectos."})," ",I]})]}),m.jsxs(Fe,{variant:"outline",size:"sm",onClick:()=>void L(),className:"gap-1.5",children:[m.jsx(DS,{className:"h-3.5 w-3.5"})," Reintentar"]})]}),B&&R.length===0?m.jsx(C6,{}):R.length===0?m.jsx(T6,{onNew:$e,hasProjects:A>0||u!=="todos"||i.trim().length>0||Se>0,filter:u,query:i,activeAdvancedFilterCount:Se}):m.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:R.map(Q=>m.jsx(Mz,{project:Q,onClick:()=>Nt(Q),showInternalAmount:ce},Q.id))}),A>qi&&m.jsx(S6,{currentPage:Re,totalPages:Te,visibleStart:Ze,visibleEnd:xt,totalItems:A,onPageChange:oe})]}),m.jsx(PB,{open:e,onOpenChange:t,project:r,onDelete:We,deleting:!!r&&x===r.id}),de&&m.jsx(m6,{open:E,onOpenChange:S})]})}function x6(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function w6({totalAmount:e,projectCount:t,loading:r,error:s,hasFilters:i,canControlVisibility:l,isPublic:u,visibilitySaving:d,onToggleVisibility:f}){return m.jsx("div",{className:"rounded-2xl border border-primary/15 bg-primary/5 px-4 py-3 shadow-sm",children:m.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[m.jsxs("div",{className:"flex items-start gap-3",children:[m.jsx("span",{className:"mt-0.5 flex h-9 w-9 items-center justify-center rounded-xl bg-primary/10 text-primary",children:m.jsx(wg,{className:"h-4 w-4"})}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:i?"Total tarifado filtrado":"Total tarifado global"}),m.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"})]}),m.jsx("p",{className:"mt-0.5 text-2xl font-semibold tracking-tight text-foreground",children:r?"Calculando…":x6(e)}),m.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.`})]})]}),m.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center lg:justify-end",children:[m.jsx("div",{className:"rounded-full border border-primary/20 bg-card px-3 py-1 text-xs font-medium text-primary",children:i?"Según filtros activos":"Sin filtros aplicados"}),l&&m.jsxs(Fe,{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?m.jsx(yP,{className:"h-3.5 w-3.5"}):m.jsx(xP,{className:"h-3.5 w-3.5"}),d?"Actualizando…":u?"Ocultar a todos":"Mostrar a todos"]})]})]})})}function _6({filters:e,activeCount:t,countryOptions:r,brandOptions:s,clientOptions:i,cmOptions:l,onFilterChange:u,onClear:d}){return m.jsx("div",{className:"rounded-2xl border border-border bg-card/70 px-3.5 py-3 shadow-sm",children:m.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 lg:w-auto lg:min-w-[120px] lg:justify-start",children:[m.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[m.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:m.jsx(QP,{className:"h-4 w-4"})}),m.jsx("span",{children:"Filtros"}),t>0&&m.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary",children:t})]}),t>0&&m.jsxs(Fe,{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:[m.jsx(Ml,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]}),m.jsxs("div",{className:"grid flex-1 grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[m.jsx(Mr,{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"}),m.jsx(Mr,{value:e.brand,options:s,onValueChange:f=>u("brand",f),placeholder:"Marca: Todas",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",clearLabel:"Todas"}),m.jsx(Mr,{value:e.client,options:i,onValueChange:f=>u("client",f),placeholder:"Cliente: Todos",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente.",clearLabel:"Todos"}),m.jsx(Mr,{value:e.cm,options:l,onValueChange:f=>u("cm",f),placeholder:"CM: Todos",searchPlaceholder:"Buscar CM…",emptyText:"No se encontró ese CM.",clearLabel:"Todos"})]}),m.jsxs(Fe,{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:[m.jsx(Ml,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]})})}function S6({currentPage:e,totalPages:t,visibleStart:r,visibleEnd:s,totalItems:i,onPageChange:l}){const u=E6(e,t);return m.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:[m.jsxs("p",{className:"text-xs text-muted-foreground",children:[m.jsxs("span",{className:"font-medium text-foreground",children:[r,"-",s]})," ","de ",m.jsx("span",{className:"font-medium text-foreground",children:i})," proyectos"]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsxs(Fe,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-full px-2.5",onClick:()=>l(e-1),disabled:e===1,children:[m.jsx(OS,{className:"h-4 w-4"}),m.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),m.jsx("div",{className:"flex items-center gap-1",children:u.map((d,f)=>d==="ellipsis"?m.jsx("span",{className:"flex h-8 w-8 items-center justify-center text-xs text-muted-foreground",children:"…"},`ellipsis-${f}`):m.jsx(Fe,{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))}),m.jsxs(Fe,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-full px-2.5",onClick:()=>l(e+1),disabled:e===t,children:[m.jsx("span",{className:"hidden sm:inline",children:"Siguiente"}),m.jsx(xg,{className:"h-4 w-4"})]})]})]})}function E6(e,t){if(t<=7)return Array.from({length:t},(i,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(i=>i>=1&&i<=t).sort((i,l)=>i-l).reduce((i,l)=>{const u=i[i.length-1];return typeof u=="number"&&l-u>1&&i.push("ellipsis"),i.push(l),i},[])}function C6(){return m.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)=>m.jsxs("div",{className:"min-h-[230px] overflow-hidden rounded-2xl border border-border bg-card",children:[m.jsx("div",{className:"h-14 bg-muted animate-pulse"}),m.jsxs("div",{className:"space-y-3 p-4",children:[m.jsx("div",{className:"h-3 w-3/4 rounded-full bg-muted animate-pulse"}),m.jsx("div",{className:"h-3 w-2/3 rounded-full bg-muted animate-pulse"}),m.jsx("div",{className:"h-3 w-1/2 rounded-full bg-muted animate-pulse"}),m.jsx("div",{className:"mt-6 h-8 rounded-full bg-muted animate-pulse"})]})]},t))})}function T6({onNew:e,hasProjects:t,filter:r,query:s,activeAdvancedFilterCount:i}){const l=s.trim().length>0,u=i>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."),m.jsxs("div",{className:"text-center py-24 rounded-2xl border border-dashed border-border bg-card/40",children:[m.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 mx-auto flex items-center justify-center mb-4",children:m.jsx(jP,{className:"w-6 h-6 text-primary"})}),m.jsx("h3",{className:"text-lg font-semibold",children:d}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm mx-auto",children:f}),!t&&m.jsxs(Fe,{onClick:e,className:"mt-5 gap-1.5 rounded-full",children:[m.jsx(es,{className:"w-4 h-4"})," Crear proyecto"]})]})}const N6=({...e})=>m.jsx(EB,{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 A6 extends y.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?m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:m.jsxs("div",{className:"max-w-md text-center",children:[m.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Ocurrió un error al cargar el tablero."}),m.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Intenta recargar la página."}),m.jsx("div",{className:"mt-6",children:m.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 R6(){const{user:e,loading:t}=Ld();return t&&!e?m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:m.jsxs("div",{className:"flex flex-col items-center gap-3",children:[m.jsx("div",{className:"animate-pulse",children:m.jsx(yg,{showWordmark:!1})}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"Cargando tablero…"})]})}):e?m.jsx(ek,{children:m.jsx(L_,{path:"/*",element:m.jsx(b6,{})})}):m.jsx($D,{})}function j6(){return m.jsx(A6,{children:m.jsx(UM,{children:m.jsxs(Ek,{basename:"/tablero-cdc/",children:[m.jsx(R6,{}),m.jsx(N6,{richColors:!0,position:"top-right"})]})})})}tj.createRoot(document.getElementById("root")).render(m.jsx(y.StrictMode,{children:m.jsx(j6,{})}));