HEX
Server: Apache
System: Linux www3.pit.tblive.com 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64
User: awaldron (1020)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/awaldron/_insulwise/ipadmin.insulwise.com/assets/index-BBCKZwyw.js
var Mp=e=>{throw TypeError(e)};var bu=(e,t,n)=>t.has(e)||Mp("Cannot "+n);var O=(e,t,n)=>(bu(e,t,"read from private field"),n?n.call(e):t.get(e)),pe=(e,t,n)=>t.has(e)?Mp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ee=(e,t,n,r)=>(bu(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),it=(e,t,n)=>(bu(e,t,"access private method"),n);var La=(e,t,n,r)=>({set _(s){ee(e,t,s,n)},get _(){return O(e,t,r)}});function l_(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>r[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var Qt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c_(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var Pv={exports:{}},wc={},jv={exports:{}},ae={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ga=Symbol.for("react.element"),u_=Symbol.for("react.portal"),d_=Symbol.for("react.fragment"),f_=Symbol.for("react.strict_mode"),h_=Symbol.for("react.profiler"),p_=Symbol.for("react.provider"),m_=Symbol.for("react.context"),g_=Symbol.for("react.forward_ref"),v_=Symbol.for("react.suspense"),y_=Symbol.for("react.memo"),w_=Symbol.for("react.lazy"),$p=Symbol.iterator;function x_(e){return e===null||typeof e!="object"?null:(e=$p&&e[$p]||e["@@iterator"],typeof e=="function"?e:null)}var Nv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ov=Object.assign,Av={};function Fo(e,t,n){this.props=e,this.context=t,this.refs=Av,this.updater=n||Nv}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Fo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Iv(){}Iv.prototype=Fo.prototype;function Yf(e,t,n){this.props=e,this.context=t,this.refs=Av,this.updater=n||Nv}var Jf=Yf.prototype=new Iv;Jf.constructor=Yf;Ov(Jf,Fo.prototype);Jf.isPureReactComponent=!0;var Fp=Array.isArray,Dv=Object.prototype.hasOwnProperty,Xf={current:null},Lv={key:!0,ref:!0,__self:!0,__source:!0};function Mv(e,t,n){var r,s={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Dv.call(t,r)&&!Lv.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];s.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return{$$typeof:ga,type:e,key:o,ref:i,props:s,_owner:Xf.current}}function b_(e,t){return{$$typeof:ga,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Zf(e){return typeof e=="object"&&e!==null&&e.$$typeof===ga}function S_(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Up=/\/+/g;function Su(e,t){return typeof e=="object"&&e!==null&&e.key!=null?S_(""+e.key):t.toString(36)}function pl(e,t,n,r,s){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case ga:case u_:i=!0}}if(i)return i=e,s=s(i),e=r===""?"."+Su(i,0):r,Fp(s)?(n="",e!=null&&(n=e.replace(Up,"$&/")+"/"),pl(s,t,n,"",function(c){return c})):s!=null&&(Zf(s)&&(s=b_(s,n+(!s.key||i&&i.key===s.key?"":(""+s.key).replace(Up,"$&/")+"/")+e)),t.push(s)),1;if(i=0,r=r===""?".":r+":",Fp(e))for(var a=0;a<e.length;a++){o=e[a];var l=r+Su(o,a);i+=pl(o,t,n,l,s)}else if(l=x_(e),typeof l=="function")for(e=l.call(e),a=0;!(o=e.next()).done;)o=o.value,l=r+Su(o,a++),i+=pl(o,t,n,l,s);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function Ma(e,t,n){if(e==null)return e;var r=[],s=0;return pl(e,r,"","",function(o){return t.call(n,o,s++)}),r}function __(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var yt={current:null},ml={transition:null},E_={ReactCurrentDispatcher:yt,ReactCurrentBatchConfig:ml,ReactCurrentOwner:Xf};function $v(){throw Error("act(...) is not supported in production builds of React.")}ae.Children={map:Ma,forEach:function(e,t,n){Ma(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ma(e,function(){t++}),t},toArray:function(e){return Ma(e,function(t){return t})||[]},only:function(e){if(!Zf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ae.Component=Fo;ae.Fragment=d_;ae.Profiler=h_;ae.PureComponent=Yf;ae.StrictMode=f_;ae.Suspense=v_;ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=E_;ae.act=$v;ae.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Ov({},e.props),s=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=Xf.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Dv.call(t,l)&&!Lv.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:ga,type:e.type,key:s,ref:o,props:r,_owner:i}};ae.createContext=function(e){return e={$$typeof:m_,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:p_,_context:e},e.Consumer=e};ae.createElement=Mv;ae.createFactory=function(e){var t=Mv.bind(null,e);return t.type=e,t};ae.createRef=function(){return{current:null}};ae.forwardRef=function(e){return{$$typeof:g_,render:e}};ae.isValidElement=Zf;ae.lazy=function(e){return{$$typeof:w_,_payload:{_status:-1,_result:e},_init:__}};ae.memo=function(e,t){return{$$typeof:y_,type:e,compare:t===void 0?null:t}};ae.startTransition=function(e){var t=ml.transition;ml.transition={};try{e()}finally{ml.transition=t}};ae.unstable_act=$v;ae.useCallback=function(e,t){return yt.current.useCallback(e,t)};ae.useContext=function(e){return yt.current.useContext(e)};ae.useDebugValue=function(){};ae.useDeferredValue=function(e){return yt.current.useDeferredValue(e)};ae.useEffect=function(e,t){return yt.current.useEffect(e,t)};ae.useId=function(){return yt.current.useId()};ae.useImperativeHandle=function(e,t,n){return yt.current.useImperativeHandle(e,t,n)};ae.useInsertionEffect=function(e,t){return yt.current.useInsertionEffect(e,t)};ae.useLayoutEffect=function(e,t){return yt.current.useLayoutEffect(e,t)};ae.useMemo=function(e,t){return yt.current.useMemo(e,t)};ae.useReducer=function(e,t,n){return yt.current.useReducer(e,t,n)};ae.useRef=function(e){return yt.current.useRef(e)};ae.useState=function(e){return yt.current.useState(e)};ae.useSyncExternalStore=function(e,t,n){return yt.current.useSyncExternalStore(e,t,n)};ae.useTransition=function(){return yt.current.useTransition()};ae.version="18.3.1";jv.exports=ae;var f=jv.exports;const D=Rv(f),eh=l_({__proto__:null,default:D},[f]);/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var C_=f,k_=Symbol.for("react.element"),T_=Symbol.for("react.fragment"),R_=Object.prototype.hasOwnProperty,P_=C_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,j_={key:!0,ref:!0,__self:!0,__source:!0};function Fv(e,t,n){var r,s={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)R_.call(t,r)&&!j_.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:k_,type:e,key:o,ref:i,props:s,_owner:P_.current}}wc.Fragment=T_;wc.jsx=Fv;wc.jsxs=Fv;Pv.exports=wc;var p=Pv.exports,Uv={exports:{}},Ut={},zv={exports:{}},Bv={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(R,P){var M=R.length;R.push(P);e:for(;0<M;){var q=M-1>>>1,U=R[q];if(0<s(U,P))R[q]=P,R[M]=U,M=q;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var P=R[0],M=R.pop();if(M!==P){R[0]=M;e:for(var q=0,U=R.length,Q=U>>>1;q<Q;){var Y=2*(q+1)-1,ge=R[Y],ce=Y+1,$=R[ce];if(0>s(ge,M))ce<U&&0>s($,ge)?(R[q]=$,R[ce]=M,q=ce):(R[q]=ge,R[Y]=M,q=Y);else if(ce<U&&0>s($,M))R[q]=$,R[ce]=M,q=ce;else break e}}return P}function s(R,P){var M=R.sortIndex-P.sortIndex;return M!==0?M:R.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var l=[],c=[],u=1,d=null,m=3,h=!1,b=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(R){for(var P=n(c);P!==null;){if(P.callback===null)r(c);else if(P.startTime<=R)r(c),P.sortIndex=P.expirationTime,t(l,P);else break;P=n(c)}}function S(R){if(v=!1,y(R),!b)if(n(l)!==null)b=!0,z(_);else{var P=n(c);P!==null&&B(S,P.startTime-R)}}function _(R,P){b=!1,v&&(v=!1,w(k),k=-1),h=!0;var M=m;try{for(y(P),d=n(l);d!==null&&(!(d.expirationTime>P)||R&&!j());){var q=d.callback;if(typeof q=="function"){d.callback=null,m=d.priorityLevel;var U=q(d.expirationTime<=P);P=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),y(P)}else r(l);d=n(l)}if(d!==null)var Q=!0;else{var Y=n(c);Y!==null&&B(S,Y.startTime-P),Q=!1}return Q}finally{d=null,m=M,h=!1}}var E=!1,C=null,k=-1,T=5,N=-1;function j(){return!(e.unstable_now()-N<T)}function A(){if(C!==null){var R=e.unstable_now();N=R;var P=!0;try{P=C(!0,R)}finally{P?F():(E=!1,C=null)}}else E=!1}var F;if(typeof g=="function")F=function(){g(A)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,H=I.port2;I.port1.onmessage=A,F=function(){H.postMessage(null)}}else F=function(){x(A,0)};function z(R){C=R,E||(E=!0,F())}function B(R,P){k=x(function(){R(e.unstable_now())},P)}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(R){R.callback=null},e.unstable_continueExecution=function(){b||h||(b=!0,z(_))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(R){switch(m){case 1:case 2:case 3:var P=3;break;default:P=m}var M=m;m=P;try{return R()}finally{m=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,P){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var M=m;m=R;try{return P()}finally{m=M}},e.unstable_scheduleCallback=function(R,P,M){var q=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?q+M:q):M=q,R){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=M+U,R={id:u++,callback:P,priorityLevel:R,startTime:M,expirationTime:U,sortIndex:-1},M>q?(R.sortIndex=M,t(c,R),n(l)===null&&R===n(c)&&(v?(w(k),k=-1):v=!0,B(S,M-q))):(R.sortIndex=U,t(l,R),b||h||(b=!0,z(_))),R},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(R){var P=m;return function(){var M=m;m=P;try{return R.apply(this,arguments)}finally{m=M}}}})(Bv);zv.exports=Bv;var N_=zv.exports;/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var O_=f,Ft=N_;function L(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Wv=new Set,$i={};function Rs(e,t){To(e,t),To(e+"Capture",t)}function To(e,t){for($i[e]=t,e=0;e<t.length;e++)Wv.add(t[e])}var Jn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bd=Object.prototype.hasOwnProperty,A_=/^[: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]*$/,zp={},Bp={};function I_(e){return bd.call(Bp,e)?!0:bd.call(zp,e)?!1:A_.test(e)?Bp[e]=!0:(zp[e]=!0,!1)}function D_(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function L_(e,t,n,r){if(t===null||typeof t>"u"||D_(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function wt(e,t,n,r,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var rt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){rt[e]=new wt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];rt[t]=new wt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){rt[e]=new wt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){rt[e]=new wt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){rt[e]=new wt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){rt[e]=new wt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){rt[e]=new wt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){rt[e]=new wt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){rt[e]=new wt(e,5,!1,e.toLowerCase(),null,!1,!1)});var th=/[\-:]([a-z])/g;function nh(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(th,nh);rt[t]=new wt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(th,nh);rt[t]=new wt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(th,nh);rt[t]=new wt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){rt[e]=new wt(e,1,!1,e.toLowerCase(),null,!1,!1)});rt.xlinkHref=new wt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){rt[e]=new wt(e,1,!1,e.toLowerCase(),null,!0,!0)});function rh(e,t,n,r){var s=rt.hasOwnProperty(t)?rt[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(L_(t,n,s,r)&&(n=null),r||s===null?I_(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var sr=O_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$a=Symbol.for("react.element"),Ks=Symbol.for("react.portal"),Gs=Symbol.for("react.fragment"),sh=Symbol.for("react.strict_mode"),Sd=Symbol.for("react.profiler"),Vv=Symbol.for("react.provider"),Hv=Symbol.for("react.context"),oh=Symbol.for("react.forward_ref"),_d=Symbol.for("react.suspense"),Ed=Symbol.for("react.suspense_list"),ih=Symbol.for("react.memo"),vr=Symbol.for("react.lazy"),qv=Symbol.for("react.offscreen"),Wp=Symbol.iterator;function oi(e){return e===null||typeof e!="object"?null:(e=Wp&&e[Wp]||e["@@iterator"],typeof e=="function"?e:null)}var Ne=Object.assign,_u;function gi(e){if(_u===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);_u=t&&t[1]||""}return`
`+_u+e}var Eu=!1;function Cu(e,t){if(!e||Eu)return"";Eu=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var s=c.stack.split(`
`),o=r.stack.split(`
`),i=s.length-1,a=o.length-1;1<=i&&0<=a&&s[i]!==o[a];)a--;for(;1<=i&&0<=a;i--,a--)if(s[i]!==o[a]){if(i!==1||a!==1)do if(i--,a--,0>a||s[i]!==o[a]){var l=`
`+s[i].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=i&&0<=a);break}}}finally{Eu=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?gi(e):""}function M_(e){switch(e.tag){case 5:return gi(e.type);case 16:return gi("Lazy");case 13:return gi("Suspense");case 19:return gi("SuspenseList");case 0:case 2:case 15:return e=Cu(e.type,!1),e;case 11:return e=Cu(e.type.render,!1),e;case 1:return e=Cu(e.type,!0),e;default:return""}}function Cd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Gs:return"Fragment";case Ks:return"Portal";case Sd:return"Profiler";case sh:return"StrictMode";case _d:return"Suspense";case Ed:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hv:return(e.displayName||"Context")+".Consumer";case Vv:return(e._context.displayName||"Context")+".Provider";case oh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ih:return t=e.displayName||null,t!==null?t:Cd(e.type)||"Memo";case vr:t=e._payload,e=e._init;try{return Cd(e(t))}catch{}}return null}function $_(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Cd(t);case 8:return t===sh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Fr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Kv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function F_(e){var t=Kv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fa(e){e._valueTracker||(e._valueTracker=F_(e))}function Gv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Kv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ol(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function kd(e,t){var n=t.checked;return Ne({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Vp(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Fr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Qv(e,t){t=t.checked,t!=null&&rh(e,"checked",t,!1)}function Td(e,t){Qv(e,t);var n=Fr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Rd(e,t.type,n):t.hasOwnProperty("defaultValue")&&Rd(e,t.type,Fr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Hp(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Rd(e,t,n){(t!=="number"||Ol(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var vi=Array.isArray;function oo(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Fr(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Pd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(L(91));return Ne({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function qp(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(L(92));if(vi(n)){if(1<n.length)throw Error(L(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Fr(n)}}function Yv(e,t){var n=Fr(t.value),r=Fr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Kp(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Jv(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function jd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Jv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ua,Xv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ua=Ua||document.createElement("div"),Ua.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ua.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Fi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Si={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},U_=["Webkit","ms","Moz","O"];Object.keys(Si).forEach(function(e){U_.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Si[t]=Si[e]})});function Zv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Si.hasOwnProperty(e)&&Si[e]?(""+t).trim():t+"px"}function ey(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Zv(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var z_=Ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Nd(e,t){if(t){if(z_[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function Od(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Ad=null;function ah(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Id=null,io=null,ao=null;function Gp(e){if(e=wa(e)){if(typeof Id!="function")throw Error(L(280));var t=e.stateNode;t&&(t=Ec(t),Id(e.stateNode,e.type,t))}}function ty(e){io?ao?ao.push(e):ao=[e]:io=e}function ny(){if(io){var e=io,t=ao;if(ao=io=null,Gp(e),t)for(e=0;e<t.length;e++)Gp(t[e])}}function ry(e,t){return e(t)}function sy(){}var ku=!1;function oy(e,t,n){if(ku)return e(t,n);ku=!0;try{return ry(e,t,n)}finally{ku=!1,(io!==null||ao!==null)&&(sy(),ny())}}function Ui(e,t){var n=e.stateNode;if(n===null)return null;var r=Ec(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(L(231,t,typeof n));return n}var Dd=!1;if(Jn)try{var ii={};Object.defineProperty(ii,"passive",{get:function(){Dd=!0}}),window.addEventListener("test",ii,ii),window.removeEventListener("test",ii,ii)}catch{Dd=!1}function B_(e,t,n,r,s,o,i,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var _i=!1,Al=null,Il=!1,Ld=null,W_={onError:function(e){_i=!0,Al=e}};function V_(e,t,n,r,s,o,i,a,l){_i=!1,Al=null,B_.apply(W_,arguments)}function H_(e,t,n,r,s,o,i,a,l){if(V_.apply(this,arguments),_i){if(_i){var c=Al;_i=!1,Al=null}else throw Error(L(198));Il||(Il=!0,Ld=c)}}function Ps(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function iy(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Qp(e){if(Ps(e)!==e)throw Error(L(188))}function q_(e){var t=e.alternate;if(!t){if(t=Ps(e),t===null)throw Error(L(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var o=s.alternate;if(o===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===n)return Qp(s),e;if(o===r)return Qp(s),t;o=o.sibling}throw Error(L(188))}if(n.return!==r.return)n=s,r=o;else{for(var i=!1,a=s.child;a;){if(a===n){i=!0,n=s,r=o;break}if(a===r){i=!0,r=s,n=o;break}a=a.sibling}if(!i){for(a=o.child;a;){if(a===n){i=!0,n=o,r=s;break}if(a===r){i=!0,r=o,n=s;break}a=a.sibling}if(!i)throw Error(L(189))}}if(n.alternate!==r)throw Error(L(190))}if(n.tag!==3)throw Error(L(188));return n.stateNode.current===n?e:t}function ay(e){return e=q_(e),e!==null?ly(e):null}function ly(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ly(e);if(t!==null)return t;e=e.sibling}return null}var cy=Ft.unstable_scheduleCallback,Yp=Ft.unstable_cancelCallback,K_=Ft.unstable_shouldYield,G_=Ft.unstable_requestPaint,$e=Ft.unstable_now,Q_=Ft.unstable_getCurrentPriorityLevel,lh=Ft.unstable_ImmediatePriority,uy=Ft.unstable_UserBlockingPriority,Dl=Ft.unstable_NormalPriority,Y_=Ft.unstable_LowPriority,dy=Ft.unstable_IdlePriority,xc=null,In=null;function J_(e){if(In&&typeof In.onCommitFiberRoot=="function")try{In.onCommitFiberRoot(xc,e,void 0,(e.current.flags&128)===128)}catch{}}var fn=Math.clz32?Math.clz32:e1,X_=Math.log,Z_=Math.LN2;function e1(e){return e>>>=0,e===0?32:31-(X_(e)/Z_|0)|0}var za=64,Ba=4194304;function yi(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ll(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~s;a!==0?r=yi(a):(o&=i,o!==0&&(r=yi(o)))}else i=n&~s,i!==0?r=yi(i):o!==0&&(r=yi(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-fn(t),s=1<<n,r|=e[n],t&=~s;return r}function t1(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function n1(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-fn(o),a=1<<i,l=s[i];l===-1?(!(a&n)||a&r)&&(s[i]=t1(a,t)):l<=t&&(e.expiredLanes|=a),o&=~a}}function Md(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function fy(){var e=za;return za<<=1,!(za&4194240)&&(za=64),e}function Tu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function va(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-fn(t),e[t]=n}function r1(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-fn(n),o=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~o}}function ch(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-fn(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var ve=0;function hy(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var py,uh,my,gy,vy,$d=!1,Wa=[],Nr=null,Or=null,Ar=null,zi=new Map,Bi=new Map,xr=[],s1="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 submit".split(" ");function Jp(e,t){switch(e){case"focusin":case"focusout":Nr=null;break;case"dragenter":case"dragleave":Or=null;break;case"mouseover":case"mouseout":Ar=null;break;case"pointerover":case"pointerout":zi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bi.delete(t.pointerId)}}function ai(e,t,n,r,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[s]},t!==null&&(t=wa(t),t!==null&&uh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function o1(e,t,n,r,s){switch(t){case"focusin":return Nr=ai(Nr,e,t,n,r,s),!0;case"dragenter":return Or=ai(Or,e,t,n,r,s),!0;case"mouseover":return Ar=ai(Ar,e,t,n,r,s),!0;case"pointerover":var o=s.pointerId;return zi.set(o,ai(zi.get(o)||null,e,t,n,r,s)),!0;case"gotpointercapture":return o=s.pointerId,Bi.set(o,ai(Bi.get(o)||null,e,t,n,r,s)),!0}return!1}function yy(e){var t=os(e.target);if(t!==null){var n=Ps(t);if(n!==null){if(t=n.tag,t===13){if(t=iy(n),t!==null){e.blockedOn=t,vy(e.priority,function(){my(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function gl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Fd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ad=r,n.target.dispatchEvent(r),Ad=null}else return t=wa(n),t!==null&&uh(t),e.blockedOn=n,!1;t.shift()}return!0}function Xp(e,t,n){gl(e)&&n.delete(t)}function i1(){$d=!1,Nr!==null&&gl(Nr)&&(Nr=null),Or!==null&&gl(Or)&&(Or=null),Ar!==null&&gl(Ar)&&(Ar=null),zi.forEach(Xp),Bi.forEach(Xp)}function li(e,t){e.blockedOn===t&&(e.blockedOn=null,$d||($d=!0,Ft.unstable_scheduleCallback(Ft.unstable_NormalPriority,i1)))}function Wi(e){function t(s){return li(s,e)}if(0<Wa.length){li(Wa[0],e);for(var n=1;n<Wa.length;n++){var r=Wa[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Nr!==null&&li(Nr,e),Or!==null&&li(Or,e),Ar!==null&&li(Ar,e),zi.forEach(t),Bi.forEach(t),n=0;n<xr.length;n++)r=xr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<xr.length&&(n=xr[0],n.blockedOn===null);)yy(n),n.blockedOn===null&&xr.shift()}var lo=sr.ReactCurrentBatchConfig,Ml=!0;function a1(e,t,n,r){var s=ve,o=lo.transition;lo.transition=null;try{ve=1,dh(e,t,n,r)}finally{ve=s,lo.transition=o}}function l1(e,t,n,r){var s=ve,o=lo.transition;lo.transition=null;try{ve=4,dh(e,t,n,r)}finally{ve=s,lo.transition=o}}function dh(e,t,n,r){if(Ml){var s=Fd(e,t,n,r);if(s===null)Mu(e,t,r,$l,n),Jp(e,r);else if(o1(s,e,t,n,r))r.stopPropagation();else if(Jp(e,r),t&4&&-1<s1.indexOf(e)){for(;s!==null;){var o=wa(s);if(o!==null&&py(o),o=Fd(e,t,n,r),o===null&&Mu(e,t,r,$l,n),o===s)break;s=o}s!==null&&r.stopPropagation()}else Mu(e,t,r,null,n)}}var $l=null;function Fd(e,t,n,r){if($l=null,e=ah(r),e=os(e),e!==null)if(t=Ps(e),t===null)e=null;else if(n=t.tag,n===13){if(e=iy(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return $l=e,null}function wy(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Q_()){case lh:return 1;case uy:return 4;case Dl:case Y_:return 16;case dy:return 536870912;default:return 16}default:return 16}}var Rr=null,fh=null,vl=null;function xy(){if(vl)return vl;var e,t=fh,n=t.length,r,s="value"in Rr?Rr.value:Rr.textContent,o=s.length;for(e=0;e<n&&t[e]===s[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===s[o-r];r++);return vl=s.slice(e,1<r?1-r:void 0)}function yl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Va(){return!0}function Zp(){return!1}function zt(e){function t(n,r,s,o,i){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(o):o[a]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Va:Zp,this.isPropagationStopped=Zp,this}return Ne(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Va)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Va)},persist:function(){},isPersistent:Va}),t}var Uo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hh=zt(Uo),ya=Ne({},Uo,{view:0,detail:0}),c1=zt(ya),Ru,Pu,ci,bc=Ne({},ya,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ph,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ci&&(ci&&e.type==="mousemove"?(Ru=e.screenX-ci.screenX,Pu=e.screenY-ci.screenY):Pu=Ru=0,ci=e),Ru)},movementY:function(e){return"movementY"in e?e.movementY:Pu}}),em=zt(bc),u1=Ne({},bc,{dataTransfer:0}),d1=zt(u1),f1=Ne({},ya,{relatedTarget:0}),ju=zt(f1),h1=Ne({},Uo,{animationName:0,elapsedTime:0,pseudoElement:0}),p1=zt(h1),m1=Ne({},Uo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),g1=zt(m1),v1=Ne({},Uo,{data:0}),tm=zt(v1),y1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},w1={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"},x1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function b1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=x1[e])?!!t[e]:!1}function ph(){return b1}var S1=Ne({},ya,{key:function(e){if(e.key){var t=y1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=yl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?w1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ph,charCode:function(e){return e.type==="keypress"?yl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?yl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),_1=zt(S1),E1=Ne({},bc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nm=zt(E1),C1=Ne({},ya,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ph}),k1=zt(C1),T1=Ne({},Uo,{propertyName:0,elapsedTime:0,pseudoElement:0}),R1=zt(T1),P1=Ne({},bc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),j1=zt(P1),N1=[9,13,27,32],mh=Jn&&"CompositionEvent"in window,Ei=null;Jn&&"documentMode"in document&&(Ei=document.documentMode);var O1=Jn&&"TextEvent"in window&&!Ei,by=Jn&&(!mh||Ei&&8<Ei&&11>=Ei),rm=" ",sm=!1;function Sy(e,t){switch(e){case"keyup":return N1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _y(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qs=!1;function A1(e,t){switch(e){case"compositionend":return _y(t);case"keypress":return t.which!==32?null:(sm=!0,rm);case"textInput":return e=t.data,e===rm&&sm?null:e;default:return null}}function I1(e,t){if(Qs)return e==="compositionend"||!mh&&Sy(e,t)?(e=xy(),vl=fh=Rr=null,Qs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return by&&t.locale!=="ko"?null:t.data;default:return null}}var D1={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 om(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!D1[e.type]:t==="textarea"}function Ey(e,t,n,r){ty(r),t=Fl(t,"onChange"),0<t.length&&(n=new hh("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ci=null,Vi=null;function L1(e){Dy(e,0)}function Sc(e){var t=Xs(e);if(Gv(t))return e}function M1(e,t){if(e==="change")return t}var Cy=!1;if(Jn){var Nu;if(Jn){var Ou="oninput"in document;if(!Ou){var im=document.createElement("div");im.setAttribute("oninput","return;"),Ou=typeof im.oninput=="function"}Nu=Ou}else Nu=!1;Cy=Nu&&(!document.documentMode||9<document.documentMode)}function am(){Ci&&(Ci.detachEvent("onpropertychange",ky),Vi=Ci=null)}function ky(e){if(e.propertyName==="value"&&Sc(Vi)){var t=[];Ey(t,Vi,e,ah(e)),oy(L1,t)}}function $1(e,t,n){e==="focusin"?(am(),Ci=t,Vi=n,Ci.attachEvent("onpropertychange",ky)):e==="focusout"&&am()}function F1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Sc(Vi)}function U1(e,t){if(e==="click")return Sc(t)}function z1(e,t){if(e==="input"||e==="change")return Sc(t)}function B1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pn=typeof Object.is=="function"?Object.is:B1;function Hi(e,t){if(pn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!bd.call(t,s)||!pn(e[s],t[s]))return!1}return!0}function lm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function cm(e,t){var n=lm(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=lm(n)}}function Ty(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ty(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ry(){for(var e=window,t=Ol();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ol(e.document)}return t}function gh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function W1(e){var t=Ry(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ty(n.ownerDocument.documentElement,n)){if(r!==null&&gh(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=cm(n,o);var i=cm(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var V1=Jn&&"documentMode"in document&&11>=document.documentMode,Ys=null,Ud=null,ki=null,zd=!1;function um(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zd||Ys==null||Ys!==Ol(r)||(r=Ys,"selectionStart"in r&&gh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ki&&Hi(ki,r)||(ki=r,r=Fl(Ud,"onSelect"),0<r.length&&(t=new hh("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ys)))}function Ha(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Js={animationend:Ha("Animation","AnimationEnd"),animationiteration:Ha("Animation","AnimationIteration"),animationstart:Ha("Animation","AnimationStart"),transitionend:Ha("Transition","TransitionEnd")},Au={},Py={};Jn&&(Py=document.createElement("div").style,"AnimationEvent"in window||(delete Js.animationend.animation,delete Js.animationiteration.animation,delete Js.animationstart.animation),"TransitionEvent"in window||delete Js.transitionend.transition);function _c(e){if(Au[e])return Au[e];if(!Js[e])return e;var t=Js[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Py)return Au[e]=t[n];return e}var jy=_c("animationend"),Ny=_c("animationiteration"),Oy=_c("animationstart"),Ay=_c("transitionend"),Iy=new Map,dm="abort auxClick 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(" ");function Wr(e,t){Iy.set(e,t),Rs(t,[e])}for(var Iu=0;Iu<dm.length;Iu++){var Du=dm[Iu],H1=Du.toLowerCase(),q1=Du[0].toUpperCase()+Du.slice(1);Wr(H1,"on"+q1)}Wr(jy,"onAnimationEnd");Wr(Ny,"onAnimationIteration");Wr(Oy,"onAnimationStart");Wr("dblclick","onDoubleClick");Wr("focusin","onFocus");Wr("focusout","onBlur");Wr(Ay,"onTransitionEnd");To("onMouseEnter",["mouseout","mouseover"]);To("onMouseLeave",["mouseout","mouseover"]);To("onPointerEnter",["pointerout","pointerover"]);To("onPointerLeave",["pointerout","pointerover"]);Rs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Rs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Rs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Rs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Rs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Rs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wi="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(" "),K1=new Set("cancel close invalid load scroll toggle".split(" ").concat(wi));function fm(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,H_(r,t,void 0,e),e.currentTarget=null}function Dy(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var a=r[i],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==o&&s.isPropagationStopped())break e;fm(s,a,c),o=l}else for(i=0;i<r.length;i++){if(a=r[i],l=a.instance,c=a.currentTarget,a=a.listener,l!==o&&s.isPropagationStopped())break e;fm(s,a,c),o=l}}}if(Il)throw e=Ld,Il=!1,Ld=null,e}function Ee(e,t){var n=t[qd];n===void 0&&(n=t[qd]=new Set);var r=e+"__bubble";n.has(r)||(Ly(t,e,2,!1),n.add(r))}function Lu(e,t,n){var r=0;t&&(r|=4),Ly(n,e,r,t)}var qa="_reactListening"+Math.random().toString(36).slice(2);function qi(e){if(!e[qa]){e[qa]=!0,Wv.forEach(function(n){n!=="selectionchange"&&(K1.has(n)||Lu(n,!1,e),Lu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qa]||(t[qa]=!0,Lu("selectionchange",!1,t))}}function Ly(e,t,n,r){switch(wy(t)){case 1:var s=a1;break;case 4:s=l1;break;default:s=dh}n=s.bind(null,t,n,e),s=void 0,!Dd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Mu(e,t,n,r,s){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var a=r.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(i===4)for(i=r.return;i!==null;){var l=i.tag;if((l===3||l===4)&&(l=i.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;i=i.return}for(;a!==null;){if(i=os(a),i===null)return;if(l=i.tag,l===5||l===6){r=o=i;continue e}a=a.parentNode}}r=r.return}oy(function(){var c=o,u=ah(n),d=[];e:{var m=Iy.get(e);if(m!==void 0){var h=hh,b=e;switch(e){case"keypress":if(yl(n)===0)break e;case"keydown":case"keyup":h=_1;break;case"focusin":b="focus",h=ju;break;case"focusout":b="blur",h=ju;break;case"beforeblur":case"afterblur":h=ju;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=em;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=d1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=k1;break;case jy:case Ny:case Oy:h=p1;break;case Ay:h=R1;break;case"scroll":h=c1;break;case"wheel":h=j1;break;case"copy":case"cut":case"paste":h=g1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=nm}var v=(t&4)!==0,x=!v&&e==="scroll",w=v?m!==null?m+"Capture":null:m;v=[];for(var g=c,y;g!==null;){y=g;var S=y.stateNode;if(y.tag===5&&S!==null&&(y=S,w!==null&&(S=Ui(g,w),S!=null&&v.push(Ki(g,S,y)))),x)break;g=g.return}0<v.length&&(m=new h(m,b,null,n,u),d.push({event:m,listeners:v}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",m&&n!==Ad&&(b=n.relatedTarget||n.fromElement)&&(os(b)||b[Xn]))break e;if((h||m)&&(m=u.window===u?u:(m=u.ownerDocument)?m.defaultView||m.parentWindow:window,h?(b=n.relatedTarget||n.toElement,h=c,b=b?os(b):null,b!==null&&(x=Ps(b),b!==x||b.tag!==5&&b.tag!==6)&&(b=null)):(h=null,b=c),h!==b)){if(v=em,S="onMouseLeave",w="onMouseEnter",g="mouse",(e==="pointerout"||e==="pointerover")&&(v=nm,S="onPointerLeave",w="onPointerEnter",g="pointer"),x=h==null?m:Xs(h),y=b==null?m:Xs(b),m=new v(S,g+"leave",h,n,u),m.target=x,m.relatedTarget=y,S=null,os(u)===c&&(v=new v(w,g+"enter",b,n,u),v.target=y,v.relatedTarget=x,S=v),x=S,h&&b)t:{for(v=h,w=b,g=0,y=v;y;y=Is(y))g++;for(y=0,S=w;S;S=Is(S))y++;for(;0<g-y;)v=Is(v),g--;for(;0<y-g;)w=Is(w),y--;for(;g--;){if(v===w||w!==null&&v===w.alternate)break t;v=Is(v),w=Is(w)}v=null}else v=null;h!==null&&hm(d,m,h,v,!1),b!==null&&x!==null&&hm(d,x,b,v,!0)}}e:{if(m=c?Xs(c):window,h=m.nodeName&&m.nodeName.toLowerCase(),h==="select"||h==="input"&&m.type==="file")var _=M1;else if(om(m))if(Cy)_=z1;else{_=F1;var E=$1}else(h=m.nodeName)&&h.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(_=U1);if(_&&(_=_(e,c))){Ey(d,_,n,u);break e}E&&E(e,m,c),e==="focusout"&&(E=m._wrapperState)&&E.controlled&&m.type==="number"&&Rd(m,"number",m.value)}switch(E=c?Xs(c):window,e){case"focusin":(om(E)||E.contentEditable==="true")&&(Ys=E,Ud=c,ki=null);break;case"focusout":ki=Ud=Ys=null;break;case"mousedown":zd=!0;break;case"contextmenu":case"mouseup":case"dragend":zd=!1,um(d,n,u);break;case"selectionchange":if(V1)break;case"keydown":case"keyup":um(d,n,u)}var C;if(mh)e:{switch(e){case"compositionstart":var k="onCompositionStart";break e;case"compositionend":k="onCompositionEnd";break e;case"compositionupdate":k="onCompositionUpdate";break e}k=void 0}else Qs?Sy(e,n)&&(k="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(k="onCompositionStart");k&&(by&&n.locale!=="ko"&&(Qs||k!=="onCompositionStart"?k==="onCompositionEnd"&&Qs&&(C=xy()):(Rr=u,fh="value"in Rr?Rr.value:Rr.textContent,Qs=!0)),E=Fl(c,k),0<E.length&&(k=new tm(k,e,null,n,u),d.push({event:k,listeners:E}),C?k.data=C:(C=_y(n),C!==null&&(k.data=C)))),(C=O1?A1(e,n):I1(e,n))&&(c=Fl(c,"onBeforeInput"),0<c.length&&(u=new tm("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=C))}Dy(d,t)})}function Ki(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Fl(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=Ui(e,n),o!=null&&r.unshift(Ki(e,o,s)),o=Ui(e,t),o!=null&&r.push(Ki(e,o,s))),e=e.return}return r}function Is(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function hm(e,t,n,r,s){for(var o=t._reactName,i=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,s?(l=Ui(n,o),l!=null&&i.unshift(Ki(n,l,a))):s||(l=Ui(n,o),l!=null&&i.push(Ki(n,l,a)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var G1=/\r\n?/g,Q1=/\u0000|\uFFFD/g;function pm(e){return(typeof e=="string"?e:""+e).replace(G1,`
`).replace(Q1,"")}function Ka(e,t,n){if(t=pm(t),pm(e)!==t&&n)throw Error(L(425))}function Ul(){}var Bd=null,Wd=null;function Vd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Hd=typeof setTimeout=="function"?setTimeout:void 0,Y1=typeof clearTimeout=="function"?clearTimeout:void 0,mm=typeof Promise=="function"?Promise:void 0,J1=typeof queueMicrotask=="function"?queueMicrotask:typeof mm<"u"?function(e){return mm.resolve(null).then(e).catch(X1)}:Hd;function X1(e){setTimeout(function(){throw e})}function $u(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),Wi(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Wi(t)}function Ir(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function gm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var zo=Math.random().toString(36).slice(2),Nn="__reactFiber$"+zo,Gi="__reactProps$"+zo,Xn="__reactContainer$"+zo,qd="__reactEvents$"+zo,Z1="__reactListeners$"+zo,eE="__reactHandles$"+zo;function os(e){var t=e[Nn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Xn]||n[Nn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=gm(e);e!==null;){if(n=e[Nn])return n;e=gm(e)}return t}e=n,n=e.parentNode}return null}function wa(e){return e=e[Nn]||e[Xn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Xs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(L(33))}function Ec(e){return e[Gi]||null}var Kd=[],Zs=-1;function Vr(e){return{current:e}}function Ce(e){0>Zs||(e.current=Kd[Zs],Kd[Zs]=null,Zs--)}function Se(e,t){Zs++,Kd[Zs]=e.current,e.current=t}var Ur={},dt=Vr(Ur),Tt=Vr(!1),ws=Ur;function Ro(e,t){var n=e.type.contextTypes;if(!n)return Ur;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Rt(e){return e=e.childContextTypes,e!=null}function zl(){Ce(Tt),Ce(dt)}function vm(e,t,n){if(dt.current!==Ur)throw Error(L(168));Se(dt,t),Se(Tt,n)}function My(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(L(108,$_(e)||"Unknown",s));return Ne({},n,r)}function Bl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ur,ws=dt.current,Se(dt,e),Se(Tt,Tt.current),!0}function ym(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=My(e,t,ws),r.__reactInternalMemoizedMergedChildContext=e,Ce(Tt),Ce(dt),Se(dt,e)):Ce(Tt),Se(Tt,n)}var Hn=null,Cc=!1,Fu=!1;function $y(e){Hn===null?Hn=[e]:Hn.push(e)}function tE(e){Cc=!0,$y(e)}function Hr(){if(!Fu&&Hn!==null){Fu=!0;var e=0,t=ve;try{var n=Hn;for(ve=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Hn=null,Cc=!1}catch(s){throw Hn!==null&&(Hn=Hn.slice(e+1)),cy(lh,Hr),s}finally{ve=t,Fu=!1}}return null}var eo=[],to=0,Wl=null,Vl=0,Vt=[],Ht=0,xs=null,Kn=1,Gn="";function es(e,t){eo[to++]=Vl,eo[to++]=Wl,Wl=e,Vl=t}function Fy(e,t,n){Vt[Ht++]=Kn,Vt[Ht++]=Gn,Vt[Ht++]=xs,xs=e;var r=Kn;e=Gn;var s=32-fn(r)-1;r&=~(1<<s),n+=1;var o=32-fn(t)+s;if(30<o){var i=s-s%5;o=(r&(1<<i)-1).toString(32),r>>=i,s-=i,Kn=1<<32-fn(t)+s|n<<s|r,Gn=o+e}else Kn=1<<o|n<<s|r,Gn=e}function vh(e){e.return!==null&&(es(e,1),Fy(e,1,0))}function yh(e){for(;e===Wl;)Wl=eo[--to],eo[to]=null,Vl=eo[--to],eo[to]=null;for(;e===xs;)xs=Vt[--Ht],Vt[Ht]=null,Gn=Vt[--Ht],Vt[Ht]=null,Kn=Vt[--Ht],Vt[Ht]=null}var Mt=null,Lt=null,ke=!1,un=null;function Uy(e,t){var n=qt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function wm(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Mt=e,Lt=Ir(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Mt=e,Lt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=xs!==null?{id:Kn,overflow:Gn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=qt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Mt=e,Lt=null,!0):!1;default:return!1}}function Gd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Qd(e){if(ke){var t=Lt;if(t){var n=t;if(!wm(e,t)){if(Gd(e))throw Error(L(418));t=Ir(n.nextSibling);var r=Mt;t&&wm(e,t)?Uy(r,n):(e.flags=e.flags&-4097|2,ke=!1,Mt=e)}}else{if(Gd(e))throw Error(L(418));e.flags=e.flags&-4097|2,ke=!1,Mt=e}}}function xm(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Mt=e}function Ga(e){if(e!==Mt)return!1;if(!ke)return xm(e),ke=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Vd(e.type,e.memoizedProps)),t&&(t=Lt)){if(Gd(e))throw zy(),Error(L(418));for(;t;)Uy(e,t),t=Ir(t.nextSibling)}if(xm(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Lt=Ir(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Lt=null}}else Lt=Mt?Ir(e.stateNode.nextSibling):null;return!0}function zy(){for(var e=Lt;e;)e=Ir(e.nextSibling)}function Po(){Lt=Mt=null,ke=!1}function wh(e){un===null?un=[e]:un.push(e)}var nE=sr.ReactCurrentBatchConfig;function ui(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(L(309));var r=n.stateNode}if(!r)throw Error(L(147,e));var s=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(i){var a=s.refs;i===null?delete a[o]:a[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(L(284));if(!n._owner)throw Error(L(290,e))}return e}function Qa(e,t){throw e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function bm(e){var t=e._init;return t(e._payload)}function By(e){function t(w,g){if(e){var y=w.deletions;y===null?(w.deletions=[g],w.flags|=16):y.push(g)}}function n(w,g){if(!e)return null;for(;g!==null;)t(w,g),g=g.sibling;return null}function r(w,g){for(w=new Map;g!==null;)g.key!==null?w.set(g.key,g):w.set(g.index,g),g=g.sibling;return w}function s(w,g){return w=$r(w,g),w.index=0,w.sibling=null,w}function o(w,g,y){return w.index=y,e?(y=w.alternate,y!==null?(y=y.index,y<g?(w.flags|=2,g):y):(w.flags|=2,g)):(w.flags|=1048576,g)}function i(w){return e&&w.alternate===null&&(w.flags|=2),w}function a(w,g,y,S){return g===null||g.tag!==6?(g=qu(y,w.mode,S),g.return=w,g):(g=s(g,y),g.return=w,g)}function l(w,g,y,S){var _=y.type;return _===Gs?u(w,g,y.props.children,S,y.key):g!==null&&(g.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===vr&&bm(_)===g.type)?(S=s(g,y.props),S.ref=ui(w,g,y),S.return=w,S):(S=Cl(y.type,y.key,y.props,null,w.mode,S),S.ref=ui(w,g,y),S.return=w,S)}function c(w,g,y,S){return g===null||g.tag!==4||g.stateNode.containerInfo!==y.containerInfo||g.stateNode.implementation!==y.implementation?(g=Ku(y,w.mode,S),g.return=w,g):(g=s(g,y.children||[]),g.return=w,g)}function u(w,g,y,S,_){return g===null||g.tag!==7?(g=gs(y,w.mode,S,_),g.return=w,g):(g=s(g,y),g.return=w,g)}function d(w,g,y){if(typeof g=="string"&&g!==""||typeof g=="number")return g=qu(""+g,w.mode,y),g.return=w,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case $a:return y=Cl(g.type,g.key,g.props,null,w.mode,y),y.ref=ui(w,null,g),y.return=w,y;case Ks:return g=Ku(g,w.mode,y),g.return=w,g;case vr:var S=g._init;return d(w,S(g._payload),y)}if(vi(g)||oi(g))return g=gs(g,w.mode,y,null),g.return=w,g;Qa(w,g)}return null}function m(w,g,y,S){var _=g!==null?g.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return _!==null?null:a(w,g,""+y,S);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case $a:return y.key===_?l(w,g,y,S):null;case Ks:return y.key===_?c(w,g,y,S):null;case vr:return _=y._init,m(w,g,_(y._payload),S)}if(vi(y)||oi(y))return _!==null?null:u(w,g,y,S,null);Qa(w,y)}return null}function h(w,g,y,S,_){if(typeof S=="string"&&S!==""||typeof S=="number")return w=w.get(y)||null,a(g,w,""+S,_);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case $a:return w=w.get(S.key===null?y:S.key)||null,l(g,w,S,_);case Ks:return w=w.get(S.key===null?y:S.key)||null,c(g,w,S,_);case vr:var E=S._init;return h(w,g,y,E(S._payload),_)}if(vi(S)||oi(S))return w=w.get(y)||null,u(g,w,S,_,null);Qa(g,S)}return null}function b(w,g,y,S){for(var _=null,E=null,C=g,k=g=0,T=null;C!==null&&k<y.length;k++){C.index>k?(T=C,C=null):T=C.sibling;var N=m(w,C,y[k],S);if(N===null){C===null&&(C=T);break}e&&C&&N.alternate===null&&t(w,C),g=o(N,g,k),E===null?_=N:E.sibling=N,E=N,C=T}if(k===y.length)return n(w,C),ke&&es(w,k),_;if(C===null){for(;k<y.length;k++)C=d(w,y[k],S),C!==null&&(g=o(C,g,k),E===null?_=C:E.sibling=C,E=C);return ke&&es(w,k),_}for(C=r(w,C);k<y.length;k++)T=h(C,w,k,y[k],S),T!==null&&(e&&T.alternate!==null&&C.delete(T.key===null?k:T.key),g=o(T,g,k),E===null?_=T:E.sibling=T,E=T);return e&&C.forEach(function(j){return t(w,j)}),ke&&es(w,k),_}function v(w,g,y,S){var _=oi(y);if(typeof _!="function")throw Error(L(150));if(y=_.call(y),y==null)throw Error(L(151));for(var E=_=null,C=g,k=g=0,T=null,N=y.next();C!==null&&!N.done;k++,N=y.next()){C.index>k?(T=C,C=null):T=C.sibling;var j=m(w,C,N.value,S);if(j===null){C===null&&(C=T);break}e&&C&&j.alternate===null&&t(w,C),g=o(j,g,k),E===null?_=j:E.sibling=j,E=j,C=T}if(N.done)return n(w,C),ke&&es(w,k),_;if(C===null){for(;!N.done;k++,N=y.next())N=d(w,N.value,S),N!==null&&(g=o(N,g,k),E===null?_=N:E.sibling=N,E=N);return ke&&es(w,k),_}for(C=r(w,C);!N.done;k++,N=y.next())N=h(C,w,k,N.value,S),N!==null&&(e&&N.alternate!==null&&C.delete(N.key===null?k:N.key),g=o(N,g,k),E===null?_=N:E.sibling=N,E=N);return e&&C.forEach(function(A){return t(w,A)}),ke&&es(w,k),_}function x(w,g,y,S){if(typeof y=="object"&&y!==null&&y.type===Gs&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case $a:e:{for(var _=y.key,E=g;E!==null;){if(E.key===_){if(_=y.type,_===Gs){if(E.tag===7){n(w,E.sibling),g=s(E,y.props.children),g.return=w,w=g;break e}}else if(E.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===vr&&bm(_)===E.type){n(w,E.sibling),g=s(E,y.props),g.ref=ui(w,E,y),g.return=w,w=g;break e}n(w,E);break}else t(w,E);E=E.sibling}y.type===Gs?(g=gs(y.props.children,w.mode,S,y.key),g.return=w,w=g):(S=Cl(y.type,y.key,y.props,null,w.mode,S),S.ref=ui(w,g,y),S.return=w,w=S)}return i(w);case Ks:e:{for(E=y.key;g!==null;){if(g.key===E)if(g.tag===4&&g.stateNode.containerInfo===y.containerInfo&&g.stateNode.implementation===y.implementation){n(w,g.sibling),g=s(g,y.children||[]),g.return=w,w=g;break e}else{n(w,g);break}else t(w,g);g=g.sibling}g=Ku(y,w.mode,S),g.return=w,w=g}return i(w);case vr:return E=y._init,x(w,g,E(y._payload),S)}if(vi(y))return b(w,g,y,S);if(oi(y))return v(w,g,y,S);Qa(w,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,g!==null&&g.tag===6?(n(w,g.sibling),g=s(g,y),g.return=w,w=g):(n(w,g),g=qu(y,w.mode,S),g.return=w,w=g),i(w)):n(w,g)}return x}var jo=By(!0),Wy=By(!1),Hl=Vr(null),ql=null,no=null,xh=null;function bh(){xh=no=ql=null}function Sh(e){var t=Hl.current;Ce(Hl),e._currentValue=t}function Yd(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function co(e,t){ql=e,xh=no=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(kt=!0),e.firstContext=null)}function Yt(e){var t=e._currentValue;if(xh!==e)if(e={context:e,memoizedValue:t,next:null},no===null){if(ql===null)throw Error(L(308));no=e,ql.dependencies={lanes:0,firstContext:e}}else no=no.next=e;return t}var is=null;function _h(e){is===null?is=[e]:is.push(e)}function Vy(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,_h(t)):(n.next=s.next,s.next=n),t.interleaved=n,Zn(e,r)}function Zn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var yr=!1;function Eh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hy(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Yn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Dr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,fe&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Zn(e,n)}return s=r.interleaved,s===null?(t.next=t,_h(r)):(t.next=s.next,s.next=t),r.interleaved=t,Zn(e,n)}function wl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ch(e,n)}}function Sm(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?s=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Kl(e,t,n,r){var s=e.updateQueue;yr=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,i===null?o=c:i.next=c,i=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==i&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(o!==null){var d=s.baseState;i=0,u=c=l=null,a=o;do{var m=a.lane,h=a.eventTime;if((r&m)===m){u!==null&&(u=u.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var b=e,v=a;switch(m=t,h=n,v.tag){case 1:if(b=v.payload,typeof b=="function"){d=b.call(h,d,m);break e}d=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=v.payload,m=typeof b=="function"?b.call(h,d,m):b,m==null)break e;d=Ne({},d,m);break e;case 2:yr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=s.effects,m===null?s.effects=[a]:m.push(a))}else h={eventTime:h,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,i|=m;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;m=a,a=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(u===null&&(l=d),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=u,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);Ss|=i,e.lanes=i,e.memoizedState=d}}function _m(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(L(191,s));s.call(r)}}}var xa={},Dn=Vr(xa),Qi=Vr(xa),Yi=Vr(xa);function as(e){if(e===xa)throw Error(L(174));return e}function Ch(e,t){switch(Se(Yi,t),Se(Qi,e),Se(Dn,xa),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:jd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=jd(t,e)}Ce(Dn),Se(Dn,t)}function No(){Ce(Dn),Ce(Qi),Ce(Yi)}function qy(e){as(Yi.current);var t=as(Dn.current),n=jd(t,e.type);t!==n&&(Se(Qi,e),Se(Dn,n))}function kh(e){Qi.current===e&&(Ce(Dn),Ce(Qi))}var Pe=Vr(0);function Gl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uu=[];function Th(){for(var e=0;e<Uu.length;e++)Uu[e]._workInProgressVersionPrimary=null;Uu.length=0}var xl=sr.ReactCurrentDispatcher,zu=sr.ReactCurrentBatchConfig,bs=0,je=null,He=null,Je=null,Ql=!1,Ti=!1,Ji=0,rE=0;function at(){throw Error(L(321))}function Rh(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!pn(e[n],t[n]))return!1;return!0}function Ph(e,t,n,r,s,o){if(bs=o,je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,xl.current=e===null||e.memoizedState===null?aE:lE,e=n(r,s),Ti){o=0;do{if(Ti=!1,Ji=0,25<=o)throw Error(L(301));o+=1,Je=He=null,t.updateQueue=null,xl.current=cE,e=n(r,s)}while(Ti)}if(xl.current=Yl,t=He!==null&&He.next!==null,bs=0,Je=He=je=null,Ql=!1,t)throw Error(L(300));return e}function jh(){var e=Ji!==0;return Ji=0,e}function kn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Je===null?je.memoizedState=Je=e:Je=Je.next=e,Je}function Jt(){if(He===null){var e=je.alternate;e=e!==null?e.memoizedState:null}else e=He.next;var t=Je===null?je.memoizedState:Je.next;if(t!==null)Je=t,He=e;else{if(e===null)throw Error(L(310));He=e,e={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},Je===null?je.memoizedState=Je=e:Je=Je.next=e}return Je}function Xi(e,t){return typeof t=="function"?t(e):t}function Bu(e){var t=Jt(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=He,s=r.baseQueue,o=n.pending;if(o!==null){if(s!==null){var i=s.next;s.next=o.next,o.next=i}r.baseQueue=s=o,n.pending=null}if(s!==null){o=s.next,r=r.baseState;var a=i=null,l=null,c=o;do{var u=c.lane;if((bs&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,i=r):l=l.next=d,je.lanes|=u,Ss|=u}c=c.next}while(c!==null&&c!==o);l===null?i=r:l.next=a,pn(r,t.memoizedState)||(kt=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do o=s.lane,je.lanes|=o,Ss|=o,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Wu(e){var t=Jt(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,o=t.memoizedState;if(s!==null){n.pending=null;var i=s=s.next;do o=e(o,i.action),i=i.next;while(i!==s);pn(o,t.memoizedState)||(kt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ky(){}function Gy(e,t){var n=je,r=Jt(),s=t(),o=!pn(r.memoizedState,s);if(o&&(r.memoizedState=s,kt=!0),r=r.queue,Nh(Jy.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||Je!==null&&Je.memoizedState.tag&1){if(n.flags|=2048,Zi(9,Yy.bind(null,n,r,s,t),void 0,null),Ze===null)throw Error(L(349));bs&30||Qy(n,t,s)}return s}function Qy(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=je.updateQueue,t===null?(t={lastEffect:null,stores:null},je.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Yy(e,t,n,r){t.value=n,t.getSnapshot=r,Xy(t)&&Zy(e)}function Jy(e,t,n){return n(function(){Xy(t)&&Zy(e)})}function Xy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!pn(e,n)}catch{return!0}}function Zy(e){var t=Zn(e,1);t!==null&&hn(t,e,1,-1)}function Em(e){var t=kn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xi,lastRenderedState:e},t.queue=e,e=e.dispatch=iE.bind(null,je,e),[t.memoizedState,e]}function Zi(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=je.updateQueue,t===null?(t={lastEffect:null,stores:null},je.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function ew(){return Jt().memoizedState}function bl(e,t,n,r){var s=kn();je.flags|=e,s.memoizedState=Zi(1|t,n,void 0,r===void 0?null:r)}function kc(e,t,n,r){var s=Jt();r=r===void 0?null:r;var o=void 0;if(He!==null){var i=He.memoizedState;if(o=i.destroy,r!==null&&Rh(r,i.deps)){s.memoizedState=Zi(t,n,o,r);return}}je.flags|=e,s.memoizedState=Zi(1|t,n,o,r)}function Cm(e,t){return bl(8390656,8,e,t)}function Nh(e,t){return kc(2048,8,e,t)}function tw(e,t){return kc(4,2,e,t)}function nw(e,t){return kc(4,4,e,t)}function rw(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function sw(e,t,n){return n=n!=null?n.concat([e]):null,kc(4,4,rw.bind(null,t,e),n)}function Oh(){}function ow(e,t){var n=Jt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Rh(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function iw(e,t){var n=Jt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Rh(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function aw(e,t,n){return bs&21?(pn(n,t)||(n=fy(),je.lanes|=n,Ss|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,kt=!0),e.memoizedState=n)}function sE(e,t){var n=ve;ve=n!==0&&4>n?n:4,e(!0);var r=zu.transition;zu.transition={};try{e(!1),t()}finally{ve=n,zu.transition=r}}function lw(){return Jt().memoizedState}function oE(e,t,n){var r=Mr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cw(e))uw(t,n);else if(n=Vy(e,t,n,r),n!==null){var s=vt();hn(n,e,r,s),dw(n,t,r)}}function iE(e,t,n){var r=Mr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cw(e))uw(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,a=o(i,n);if(s.hasEagerState=!0,s.eagerState=a,pn(a,i)){var l=t.interleaved;l===null?(s.next=s,_h(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=Vy(e,t,s,r),n!==null&&(s=vt(),hn(n,e,r,s),dw(n,t,r))}}function cw(e){var t=e.alternate;return e===je||t!==null&&t===je}function uw(e,t){Ti=Ql=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ch(e,n)}}var Yl={readContext:Yt,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useInsertionEffect:at,useLayoutEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useMutableSource:at,useSyncExternalStore:at,useId:at,unstable_isNewReconciler:!1},aE={readContext:Yt,useCallback:function(e,t){return kn().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:Cm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,bl(4194308,4,rw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return bl(4194308,4,e,t)},useInsertionEffect:function(e,t){return bl(4,2,e,t)},useMemo:function(e,t){var n=kn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=oE.bind(null,je,e),[r.memoizedState,e]},useRef:function(e){var t=kn();return e={current:e},t.memoizedState=e},useState:Em,useDebugValue:Oh,useDeferredValue:function(e){return kn().memoizedState=e},useTransition:function(){var e=Em(!1),t=e[0];return e=sE.bind(null,e[1]),kn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=je,s=kn();if(ke){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),Ze===null)throw Error(L(349));bs&30||Qy(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,Cm(Jy.bind(null,r,o,e),[e]),r.flags|=2048,Zi(9,Yy.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=kn(),t=Ze.identifierPrefix;if(ke){var n=Gn,r=Kn;n=(r&~(1<<32-fn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ji++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=rE++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},lE={readContext:Yt,useCallback:ow,useContext:Yt,useEffect:Nh,useImperativeHandle:sw,useInsertionEffect:tw,useLayoutEffect:nw,useMemo:iw,useReducer:Bu,useRef:ew,useState:function(){return Bu(Xi)},useDebugValue:Oh,useDeferredValue:function(e){var t=Jt();return aw(t,He.memoizedState,e)},useTransition:function(){var e=Bu(Xi)[0],t=Jt().memoizedState;return[e,t]},useMutableSource:Ky,useSyncExternalStore:Gy,useId:lw,unstable_isNewReconciler:!1},cE={readContext:Yt,useCallback:ow,useContext:Yt,useEffect:Nh,useImperativeHandle:sw,useInsertionEffect:tw,useLayoutEffect:nw,useMemo:iw,useReducer:Wu,useRef:ew,useState:function(){return Wu(Xi)},useDebugValue:Oh,useDeferredValue:function(e){var t=Jt();return He===null?t.memoizedState=e:aw(t,He.memoizedState,e)},useTransition:function(){var e=Wu(Xi)[0],t=Jt().memoizedState;return[e,t]},useMutableSource:Ky,useSyncExternalStore:Gy,useId:lw,unstable_isNewReconciler:!1};function rn(e,t){if(e&&e.defaultProps){t=Ne({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Jd(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ne({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Tc={isMounted:function(e){return(e=e._reactInternals)?Ps(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vt(),s=Mr(e),o=Yn(r,s);o.payload=t,n!=null&&(o.callback=n),t=Dr(e,o,s),t!==null&&(hn(t,e,s,r),wl(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vt(),s=Mr(e),o=Yn(r,s);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Dr(e,o,s),t!==null&&(hn(t,e,s,r),wl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vt(),r=Mr(e),s=Yn(n,r);s.tag=2,t!=null&&(s.callback=t),t=Dr(e,s,r),t!==null&&(hn(t,e,r,n),wl(t,e,r))}};function km(e,t,n,r,s,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,i):t.prototype&&t.prototype.isPureReactComponent?!Hi(n,r)||!Hi(s,o):!0}function fw(e,t,n){var r=!1,s=Ur,o=t.contextType;return typeof o=="object"&&o!==null?o=Yt(o):(s=Rt(t)?ws:dt.current,r=t.contextTypes,o=(r=r!=null)?Ro(e,s):Ur),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Tc,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function Tm(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Tc.enqueueReplaceState(t,t.state,null)}function Xd(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Eh(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=Yt(o):(o=Rt(t)?ws:dt.current,s.context=Ro(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Jd(e,t,o,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Tc.enqueueReplaceState(s,s.state,null),Kl(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Oo(e,t){try{var n="",r=t;do n+=M_(r),r=r.return;while(r);var s=n}catch(o){s=`
Error generating stack: `+o.message+`
`+o.stack}return{value:e,source:t,stack:s,digest:null}}function Vu(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Zd(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var uE=typeof WeakMap=="function"?WeakMap:Map;function hw(e,t,n){n=Yn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Xl||(Xl=!0,uf=r),Zd(e,t)},n}function pw(e,t,n){n=Yn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Zd(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Zd(e,t),typeof r!="function"&&(Lr===null?Lr=new Set([this]):Lr.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function Rm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new uE;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=EE.bind(null,e,t,n),t.then(e,e))}function Pm(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function jm(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Yn(-1,1),t.tag=2,Dr(n,t,1))),n.lanes|=1),e)}var dE=sr.ReactCurrentOwner,kt=!1;function mt(e,t,n,r){t.child=e===null?Wy(t,null,n,r):jo(t,e.child,n,r)}function Nm(e,t,n,r,s){n=n.render;var o=t.ref;return co(t,s),r=Ph(e,t,n,r,o,s),n=jh(),e!==null&&!kt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,er(e,t,s)):(ke&&n&&vh(t),t.flags|=1,mt(e,t,r,s),t.child)}function Om(e,t,n,r,s){if(e===null){var o=n.type;return typeof o=="function"&&!Uh(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,mw(e,t,o,r,s)):(e=Cl(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&s)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:Hi,n(i,r)&&e.ref===t.ref)return er(e,t,s)}return t.flags|=1,e=$r(o,r),e.ref=t.ref,e.return=t,t.child=e}function mw(e,t,n,r,s){if(e!==null){var o=e.memoizedProps;if(Hi(o,r)&&e.ref===t.ref)if(kt=!1,t.pendingProps=r=o,(e.lanes&s)!==0)e.flags&131072&&(kt=!0);else return t.lanes=e.lanes,er(e,t,s)}return ef(e,t,n,r,s)}function gw(e,t,n){var r=t.pendingProps,s=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Se(so,At),At|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Se(so,At),At|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,Se(so,At),At|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,Se(so,At),At|=r;return mt(e,t,s,n),t.child}function vw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ef(e,t,n,r,s){var o=Rt(n)?ws:dt.current;return o=Ro(t,o),co(t,s),n=Ph(e,t,n,r,o,s),r=jh(),e!==null&&!kt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,er(e,t,s)):(ke&&r&&vh(t),t.flags|=1,mt(e,t,n,s),t.child)}function Am(e,t,n,r,s){if(Rt(n)){var o=!0;Bl(t)}else o=!1;if(co(t,s),t.stateNode===null)Sl(e,t),fw(t,n,r),Xd(t,n,r,s),r=!0;else if(e===null){var i=t.stateNode,a=t.memoizedProps;i.props=a;var l=i.context,c=n.contextType;typeof c=="object"&&c!==null?c=Yt(c):(c=Rt(n)?ws:dt.current,c=Ro(t,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof i.getSnapshotBeforeUpdate=="function";d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==r||l!==c)&&Tm(t,i,r,c),yr=!1;var m=t.memoizedState;i.state=m,Kl(t,r,i,s),l=t.memoizedState,a!==r||m!==l||Tt.current||yr?(typeof u=="function"&&(Jd(t,n,u,r),l=t.memoizedState),(a=yr||km(t,n,a,r,m,l,c))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),i.props=r,i.state=l,i.context=c,r=a):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Hy(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:rn(t.type,a),i.props=c,d=t.pendingProps,m=i.context,l=n.contextType,typeof l=="object"&&l!==null?l=Yt(l):(l=Rt(n)?ws:dt.current,l=Ro(t,l));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==d||m!==l)&&Tm(t,i,r,l),yr=!1,m=t.memoizedState,i.state=m,Kl(t,r,i,s);var b=t.memoizedState;a!==d||m!==b||Tt.current||yr?(typeof h=="function"&&(Jd(t,n,h,r),b=t.memoizedState),(c=yr||km(t,n,c,r,m,b,l)||!1)?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,b,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,b,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=b),i.props=r,i.state=b,i.context=l,r=c):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return tf(e,t,n,r,o,s)}function tf(e,t,n,r,s,o){vw(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return s&&ym(t,n,!1),er(e,t,o);r=t.stateNode,dE.current=t;var a=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=jo(t,e.child,null,o),t.child=jo(t,null,a,o)):mt(e,t,a,o),t.memoizedState=r.state,s&&ym(t,n,!0),t.child}function yw(e){var t=e.stateNode;t.pendingContext?vm(e,t.pendingContext,t.pendingContext!==t.context):t.context&&vm(e,t.context,!1),Ch(e,t.containerInfo)}function Im(e,t,n,r,s){return Po(),wh(s),t.flags|=256,mt(e,t,n,r),t.child}var nf={dehydrated:null,treeContext:null,retryLane:0};function rf(e){return{baseLanes:e,cachePool:null,transitions:null}}function ww(e,t,n){var r=t.pendingProps,s=Pe.current,o=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(s&2)!==0),a?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Se(Pe,s&1),e===null)return Qd(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=jc(i,r,0,null),e=gs(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=rf(n),t.memoizedState=nf,e):Ah(t,i));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return fE(e,t,i,r,a,s,n);if(o){o=r.fallback,i=t.mode,s=e.child,a=s.sibling;var l={mode:"hidden",children:r.children};return!(i&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=$r(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?o=$r(a,o):(o=gs(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?rf(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=nf,r}return o=e.child,e=o.sibling,r=$r(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ah(e,t){return t=jc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ya(e,t,n,r){return r!==null&&wh(r),jo(t,e.child,null,n),e=Ah(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fE(e,t,n,r,s,o,i){if(n)return t.flags&256?(t.flags&=-257,r=Vu(Error(L(422))),Ya(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,s=t.mode,r=jc({mode:"visible",children:r.children},s,0,null),o=gs(o,s,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&jo(t,e.child,null,i),t.child.memoizedState=rf(i),t.memoizedState=nf,o);if(!(t.mode&1))return Ya(e,t,i,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,o=Error(L(419)),r=Vu(o,r,void 0),Ya(e,t,i,r)}if(a=(i&e.childLanes)!==0,kt||a){if(r=Ze,r!==null){switch(i&-i){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|i)?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,Zn(e,s),hn(r,e,s,-1))}return Fh(),r=Vu(Error(L(421))),Ya(e,t,i,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=CE.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,Lt=Ir(s.nextSibling),Mt=t,ke=!0,un=null,e!==null&&(Vt[Ht++]=Kn,Vt[Ht++]=Gn,Vt[Ht++]=xs,Kn=e.id,Gn=e.overflow,xs=t),t=Ah(t,r.children),t.flags|=4096,t)}function Dm(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Yd(e.return,t,n)}function Hu(e,t,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s)}function xw(e,t,n){var r=t.pendingProps,s=r.revealOrder,o=r.tail;if(mt(e,t,r.children,n),r=Pe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dm(e,n,t);else if(e.tag===19)Dm(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Se(Pe,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&Gl(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Hu(t,!1,s,n,o);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Gl(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Hu(t,!0,n,null,o);break;case"together":Hu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Sl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function er(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ss|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(L(153));if(t.child!==null){for(e=t.child,n=$r(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=$r(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function hE(e,t,n){switch(t.tag){case 3:yw(t),Po();break;case 5:qy(t);break;case 1:Rt(t.type)&&Bl(t);break;case 4:Ch(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Se(Hl,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Se(Pe,Pe.current&1),t.flags|=128,null):n&t.child.childLanes?ww(e,t,n):(Se(Pe,Pe.current&1),e=er(e,t,n),e!==null?e.sibling:null);Se(Pe,Pe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return xw(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Se(Pe,Pe.current),r)break;return null;case 22:case 23:return t.lanes=0,gw(e,t,n)}return er(e,t,n)}var bw,sf,Sw,_w;bw=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};sf=function(){};Sw=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,as(Dn.current);var o=null;switch(n){case"input":s=kd(e,s),r=kd(e,r),o=[];break;case"select":s=Ne({},s,{value:void 0}),r=Ne({},r,{value:void 0}),o=[];break;case"textarea":s=Pd(e,s),r=Pd(e,r),o=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ul)}Nd(n,r);var i;n=null;for(c in s)if(!r.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var a=s[c];for(i in a)a.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&($i.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var l=r[c];if(a=s!=null?s[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(i in a)!a.hasOwnProperty(i)||l&&l.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in l)l.hasOwnProperty(i)&&a[i]!==l[i]&&(n||(n={}),n[i]=l[i])}else n||(o||(o=[]),o.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(o=o||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&($i.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ee("scroll",e),o||a===l||(o=[])):(o=o||[]).push(c,l))}n&&(o=o||[]).push("style",n);var c=o;(t.updateQueue=c)&&(t.flags|=4)}};_w=function(e,t,n,r){n!==r&&(t.flags|=4)};function di(e,t){if(!ke)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function lt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function pE(e,t,n){var r=t.pendingProps;switch(yh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lt(t),null;case 1:return Rt(t.type)&&zl(),lt(t),null;case 3:return r=t.stateNode,No(),Ce(Tt),Ce(dt),Th(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ga(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,un!==null&&(hf(un),un=null))),sf(e,t),lt(t),null;case 5:kh(t);var s=as(Yi.current);if(n=t.type,e!==null&&t.stateNode!=null)Sw(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(L(166));return lt(t),null}if(e=as(Dn.current),Ga(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Nn]=t,r[Gi]=o,e=(t.mode&1)!==0,n){case"dialog":Ee("cancel",r),Ee("close",r);break;case"iframe":case"object":case"embed":Ee("load",r);break;case"video":case"audio":for(s=0;s<wi.length;s++)Ee(wi[s],r);break;case"source":Ee("error",r);break;case"img":case"image":case"link":Ee("error",r),Ee("load",r);break;case"details":Ee("toggle",r);break;case"input":Vp(r,o),Ee("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Ee("invalid",r);break;case"textarea":qp(r,o),Ee("invalid",r)}Nd(n,o),s=null;for(var i in o)if(o.hasOwnProperty(i)){var a=o[i];i==="children"?typeof a=="string"?r.textContent!==a&&(o.suppressHydrationWarning!==!0&&Ka(r.textContent,a,e),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&Ka(r.textContent,a,e),s=["children",""+a]):$i.hasOwnProperty(i)&&a!=null&&i==="onScroll"&&Ee("scroll",r)}switch(n){case"input":Fa(r),Hp(r,o,!0);break;case"textarea":Fa(r),Kp(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=Ul)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Jv(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Nn]=t,e[Gi]=r,bw(e,t,!1,!1),t.stateNode=e;e:{switch(i=Od(n,r),n){case"dialog":Ee("cancel",e),Ee("close",e),s=r;break;case"iframe":case"object":case"embed":Ee("load",e),s=r;break;case"video":case"audio":for(s=0;s<wi.length;s++)Ee(wi[s],e);s=r;break;case"source":Ee("error",e),s=r;break;case"img":case"image":case"link":Ee("error",e),Ee("load",e),s=r;break;case"details":Ee("toggle",e),s=r;break;case"input":Vp(e,r),s=kd(e,r),Ee("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Ne({},r,{value:void 0}),Ee("invalid",e);break;case"textarea":qp(e,r),s=Pd(e,r),Ee("invalid",e);break;default:s=r}Nd(n,s),a=s;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?ey(e,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Xv(e,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Fi(e,l):typeof l=="number"&&Fi(e,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&($i.hasOwnProperty(o)?l!=null&&o==="onScroll"&&Ee("scroll",e):l!=null&&rh(e,o,l,i))}switch(n){case"input":Fa(e),Hp(e,r,!1);break;case"textarea":Fa(e),Kp(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Fr(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?oo(e,!!r.multiple,o,!1):r.defaultValue!=null&&oo(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Ul)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return lt(t),null;case 6:if(e&&t.stateNode!=null)_w(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(n=as(Yi.current),as(Dn.current),Ga(t)){if(r=t.stateNode,n=t.memoizedProps,r[Nn]=t,(o=r.nodeValue!==n)&&(e=Mt,e!==null))switch(e.tag){case 3:Ka(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ka(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Nn]=t,t.stateNode=r}return lt(t),null;case 13:if(Ce(Pe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ke&&Lt!==null&&t.mode&1&&!(t.flags&128))zy(),Po(),t.flags|=98560,o=!1;else if(o=Ga(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(L(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(L(317));o[Nn]=t}else Po(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;lt(t),o=!1}else un!==null&&(hf(un),un=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Pe.current&1?Ke===0&&(Ke=3):Fh())),t.updateQueue!==null&&(t.flags|=4),lt(t),null);case 4:return No(),sf(e,t),e===null&&qi(t.stateNode.containerInfo),lt(t),null;case 10:return Sh(t.type._context),lt(t),null;case 17:return Rt(t.type)&&zl(),lt(t),null;case 19:if(Ce(Pe),o=t.memoizedState,o===null)return lt(t),null;if(r=(t.flags&128)!==0,i=o.rendering,i===null)if(r)di(o,!1);else{if(Ke!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Gl(e),i!==null){for(t.flags|=128,di(o,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Se(Pe,Pe.current&1|2),t.child}e=e.sibling}o.tail!==null&&$e()>Ao&&(t.flags|=128,r=!0,di(o,!1),t.lanes=4194304)}else{if(!r)if(e=Gl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),di(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!ke)return lt(t),null}else 2*$e()-o.renderingStartTime>Ao&&n!==1073741824&&(t.flags|=128,r=!0,di(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=$e(),t.sibling=null,n=Pe.current,Se(Pe,r?n&1|2:n&1),t):(lt(t),null);case 22:case 23:return $h(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?At&1073741824&&(lt(t),t.subtreeFlags&6&&(t.flags|=8192)):lt(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function mE(e,t){switch(yh(t),t.tag){case 1:return Rt(t.type)&&zl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return No(),Ce(Tt),Ce(dt),Th(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return kh(t),null;case 13:if(Ce(Pe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));Po()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ce(Pe),null;case 4:return No(),null;case 10:return Sh(t.type._context),null;case 22:case 23:return $h(),null;case 24:return null;default:return null}}var Ja=!1,ut=!1,gE=typeof WeakSet=="function"?WeakSet:Set,W=null;function ro(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Me(e,t,r)}else n.current=null}function of(e,t,n){try{n()}catch(r){Me(e,t,r)}}var Lm=!1;function vE(e,t){if(Bd=Ml,e=Ry(),gh(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,a=-1,l=-1,c=0,u=0,d=e,m=null;t:for(;;){for(var h;d!==n||s!==0&&d.nodeType!==3||(a=i+s),d!==o||r!==0&&d.nodeType!==3||(l=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(h=d.firstChild)!==null;)m=d,d=h;for(;;){if(d===e)break t;if(m===n&&++c===s&&(a=i),m===o&&++u===r&&(l=i),(h=d.nextSibling)!==null)break;d=m,m=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Wd={focusedElem:e,selectionRange:n},Ml=!1,W=t;W!==null;)if(t=W,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var v=b.memoizedProps,x=b.memoizedState,w=t.stateNode,g=w.getSnapshotBeforeUpdate(t.elementType===t.type?v:rn(t.type,v),x);w.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(L(163))}}catch(S){Me(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return b=Lm,Lm=!1,b}function Ri(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&of(t,n,o)}s=s.next}while(s!==r)}}function Rc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function af(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ew(e){var t=e.alternate;t!==null&&(e.alternate=null,Ew(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Nn],delete t[Gi],delete t[qd],delete t[Z1],delete t[eE])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Cw(e){return e.tag===5||e.tag===3||e.tag===4}function Mm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function lf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ul));else if(r!==4&&(e=e.child,e!==null))for(lf(e,t,n),e=e.sibling;e!==null;)lf(e,t,n),e=e.sibling}function cf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(cf(e,t,n),e=e.sibling;e!==null;)cf(e,t,n),e=e.sibling}var tt=null,ln=!1;function cr(e,t,n){for(n=n.child;n!==null;)kw(e,t,n),n=n.sibling}function kw(e,t,n){if(In&&typeof In.onCommitFiberUnmount=="function")try{In.onCommitFiberUnmount(xc,n)}catch{}switch(n.tag){case 5:ut||ro(n,t);case 6:var r=tt,s=ln;tt=null,cr(e,t,n),tt=r,ln=s,tt!==null&&(ln?(e=tt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):tt.removeChild(n.stateNode));break;case 18:tt!==null&&(ln?(e=tt,n=n.stateNode,e.nodeType===8?$u(e.parentNode,n):e.nodeType===1&&$u(e,n),Wi(e)):$u(tt,n.stateNode));break;case 4:r=tt,s=ln,tt=n.stateNode.containerInfo,ln=!0,cr(e,t,n),tt=r,ln=s;break;case 0:case 11:case 14:case 15:if(!ut&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&of(n,t,i),s=s.next}while(s!==r)}cr(e,t,n);break;case 1:if(!ut&&(ro(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Me(n,t,a)}cr(e,t,n);break;case 21:cr(e,t,n);break;case 22:n.mode&1?(ut=(r=ut)||n.memoizedState!==null,cr(e,t,n),ut=r):cr(e,t,n);break;default:cr(e,t,n)}}function $m(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gE),t.forEach(function(r){var s=kE.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Zt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var o=e,i=t,a=i;e:for(;a!==null;){switch(a.tag){case 5:tt=a.stateNode,ln=!1;break e;case 3:tt=a.stateNode.containerInfo,ln=!0;break e;case 4:tt=a.stateNode.containerInfo,ln=!0;break e}a=a.return}if(tt===null)throw Error(L(160));kw(o,i,s),tt=null,ln=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(c){Me(s,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Tw(t,e),t=t.sibling}function Tw(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Zt(t,e),Cn(e),r&4){try{Ri(3,e,e.return),Rc(3,e)}catch(v){Me(e,e.return,v)}try{Ri(5,e,e.return)}catch(v){Me(e,e.return,v)}}break;case 1:Zt(t,e),Cn(e),r&512&&n!==null&&ro(n,n.return);break;case 5:if(Zt(t,e),Cn(e),r&512&&n!==null&&ro(n,n.return),e.flags&32){var s=e.stateNode;try{Fi(s,"")}catch(v){Me(e,e.return,v)}}if(r&4&&(s=e.stateNode,s!=null)){var o=e.memoizedProps,i=n!==null?n.memoizedProps:o,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&Qv(s,o),Od(a,i);var c=Od(a,o);for(i=0;i<l.length;i+=2){var u=l[i],d=l[i+1];u==="style"?ey(s,d):u==="dangerouslySetInnerHTML"?Xv(s,d):u==="children"?Fi(s,d):rh(s,u,d,c)}switch(a){case"input":Td(s,o);break;case"textarea":Yv(s,o);break;case"select":var m=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var h=o.value;h!=null?oo(s,!!o.multiple,h,!1):m!==!!o.multiple&&(o.defaultValue!=null?oo(s,!!o.multiple,o.defaultValue,!0):oo(s,!!o.multiple,o.multiple?[]:"",!1))}s[Gi]=o}catch(v){Me(e,e.return,v)}}break;case 6:if(Zt(t,e),Cn(e),r&4){if(e.stateNode===null)throw Error(L(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(v){Me(e,e.return,v)}}break;case 3:if(Zt(t,e),Cn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Wi(t.containerInfo)}catch(v){Me(e,e.return,v)}break;case 4:Zt(t,e),Cn(e);break;case 13:Zt(t,e),Cn(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(Lh=$e())),r&4&&$m(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(ut=(c=ut)||u,Zt(t,e),ut=c):Zt(t,e),Cn(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(W=e,u=e.child;u!==null;){for(d=W=u;W!==null;){switch(m=W,h=m.child,m.tag){case 0:case 11:case 14:case 15:Ri(4,m,m.return);break;case 1:ro(m,m.return);var b=m.stateNode;if(typeof b.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(v){Me(r,n,v)}}break;case 5:ro(m,m.return);break;case 22:if(m.memoizedState!==null){Um(d);continue}}h!==null?(h.return=m,W=h):Um(d)}u=u.sibling}e:for(u=null,d=e;;){if(d.tag===5){if(u===null){u=d;try{s=d.stateNode,c?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=d.stateNode,l=d.memoizedProps.style,i=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Zv("display",i))}catch(v){Me(e,e.return,v)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(v){Me(e,e.return,v)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Zt(t,e),Cn(e),r&4&&$m(e);break;case 21:break;default:Zt(t,e),Cn(e)}}function Cn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Cw(n)){var r=n;break e}n=n.return}throw Error(L(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Fi(s,""),r.flags&=-33);var o=Mm(e);cf(e,o,s);break;case 3:case 4:var i=r.stateNode.containerInfo,a=Mm(e);lf(e,a,i);break;default:throw Error(L(161))}}catch(l){Me(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yE(e,t,n){W=e,Rw(e)}function Rw(e,t,n){for(var r=(e.mode&1)!==0;W!==null;){var s=W,o=s.child;if(s.tag===22&&r){var i=s.memoizedState!==null||Ja;if(!i){var a=s.alternate,l=a!==null&&a.memoizedState!==null||ut;a=Ja;var c=ut;if(Ja=i,(ut=l)&&!c)for(W=s;W!==null;)i=W,l=i.child,i.tag===22&&i.memoizedState!==null?zm(s):l!==null?(l.return=i,W=l):zm(s);for(;o!==null;)W=o,Rw(o),o=o.sibling;W=s,Ja=a,ut=c}Fm(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,W=o):Fm(e)}}function Fm(e){for(;W!==null;){var t=W;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:ut||Rc(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!ut)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:rn(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&_m(t,o,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}_m(t,i,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&Wi(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(L(163))}ut||t.flags&512&&af(t)}catch(m){Me(t,t.return,m)}}if(t===e){W=null;break}if(n=t.sibling,n!==null){n.return=t.return,W=n;break}W=t.return}}function Um(e){for(;W!==null;){var t=W;if(t===e){W=null;break}var n=t.sibling;if(n!==null){n.return=t.return,W=n;break}W=t.return}}function zm(e){for(;W!==null;){var t=W;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Rc(4,t)}catch(l){Me(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(l){Me(t,s,l)}}var o=t.return;try{af(t)}catch(l){Me(t,o,l)}break;case 5:var i=t.return;try{af(t)}catch(l){Me(t,i,l)}}}catch(l){Me(t,t.return,l)}if(t===e){W=null;break}var a=t.sibling;if(a!==null){a.return=t.return,W=a;break}W=t.return}}var wE=Math.ceil,Jl=sr.ReactCurrentDispatcher,Ih=sr.ReactCurrentOwner,Gt=sr.ReactCurrentBatchConfig,fe=0,Ze=null,We=null,nt=0,At=0,so=Vr(0),Ke=0,ea=null,Ss=0,Pc=0,Dh=0,Pi=null,Et=null,Lh=0,Ao=1/0,Wn=null,Xl=!1,uf=null,Lr=null,Xa=!1,Pr=null,Zl=0,ji=0,df=null,_l=-1,El=0;function vt(){return fe&6?$e():_l!==-1?_l:_l=$e()}function Mr(e){return e.mode&1?fe&2&&nt!==0?nt&-nt:nE.transition!==null?(El===0&&(El=fy()),El):(e=ve,e!==0||(e=window.event,e=e===void 0?16:wy(e.type)),e):1}function hn(e,t,n,r){if(50<ji)throw ji=0,df=null,Error(L(185));va(e,n,r),(!(fe&2)||e!==Ze)&&(e===Ze&&(!(fe&2)&&(Pc|=n),Ke===4&&br(e,nt)),Pt(e,r),n===1&&fe===0&&!(t.mode&1)&&(Ao=$e()+500,Cc&&Hr()))}function Pt(e,t){var n=e.callbackNode;n1(e,t);var r=Ll(e,e===Ze?nt:0);if(r===0)n!==null&&Yp(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Yp(n),t===1)e.tag===0?tE(Bm.bind(null,e)):$y(Bm.bind(null,e)),J1(function(){!(fe&6)&&Hr()}),n=null;else{switch(hy(r)){case 1:n=lh;break;case 4:n=uy;break;case 16:n=Dl;break;case 536870912:n=dy;break;default:n=Dl}n=Lw(n,Pw.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Pw(e,t){if(_l=-1,El=0,fe&6)throw Error(L(327));var n=e.callbackNode;if(uo()&&e.callbackNode!==n)return null;var r=Ll(e,e===Ze?nt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ec(e,r);else{t=r;var s=fe;fe|=2;var o=Nw();(Ze!==e||nt!==t)&&(Wn=null,Ao=$e()+500,ms(e,t));do try{SE();break}catch(a){jw(e,a)}while(!0);bh(),Jl.current=o,fe=s,We!==null?t=0:(Ze=null,nt=0,t=Ke)}if(t!==0){if(t===2&&(s=Md(e),s!==0&&(r=s,t=ff(e,s))),t===1)throw n=ea,ms(e,0),br(e,r),Pt(e,$e()),n;if(t===6)br(e,r);else{if(s=e.current.alternate,!(r&30)&&!xE(s)&&(t=ec(e,r),t===2&&(o=Md(e),o!==0&&(r=o,t=ff(e,o))),t===1))throw n=ea,ms(e,0),br(e,r),Pt(e,$e()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(L(345));case 2:ts(e,Et,Wn);break;case 3:if(br(e,r),(r&130023424)===r&&(t=Lh+500-$e(),10<t)){if(Ll(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){vt(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Hd(ts.bind(null,e,Et,Wn),t);break}ts(e,Et,Wn);break;case 4:if(br(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var i=31-fn(r);o=1<<i,i=t[i],i>s&&(s=i),r&=~o}if(r=s,r=$e()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wE(r/1960))-r,10<r){e.timeoutHandle=Hd(ts.bind(null,e,Et,Wn),r);break}ts(e,Et,Wn);break;case 5:ts(e,Et,Wn);break;default:throw Error(L(329))}}}return Pt(e,$e()),e.callbackNode===n?Pw.bind(null,e):null}function ff(e,t){var n=Pi;return e.current.memoizedState.isDehydrated&&(ms(e,t).flags|=256),e=ec(e,t),e!==2&&(t=Et,Et=n,t!==null&&hf(t)),e}function hf(e){Et===null?Et=e:Et.push.apply(Et,e)}function xE(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],o=s.getSnapshot;s=s.value;try{if(!pn(o(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function br(e,t){for(t&=~Dh,t&=~Pc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-fn(t),r=1<<n;e[n]=-1,t&=~r}}function Bm(e){if(fe&6)throw Error(L(327));uo();var t=Ll(e,0);if(!(t&1))return Pt(e,$e()),null;var n=ec(e,t);if(e.tag!==0&&n===2){var r=Md(e);r!==0&&(t=r,n=ff(e,r))}if(n===1)throw n=ea,ms(e,0),br(e,t),Pt(e,$e()),n;if(n===6)throw Error(L(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ts(e,Et,Wn),Pt(e,$e()),null}function Mh(e,t){var n=fe;fe|=1;try{return e(t)}finally{fe=n,fe===0&&(Ao=$e()+500,Cc&&Hr())}}function _s(e){Pr!==null&&Pr.tag===0&&!(fe&6)&&uo();var t=fe;fe|=1;var n=Gt.transition,r=ve;try{if(Gt.transition=null,ve=1,e)return e()}finally{ve=r,Gt.transition=n,fe=t,!(fe&6)&&Hr()}}function $h(){At=so.current,Ce(so)}function ms(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Y1(n)),We!==null)for(n=We.return;n!==null;){var r=n;switch(yh(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&zl();break;case 3:No(),Ce(Tt),Ce(dt),Th();break;case 5:kh(r);break;case 4:No();break;case 13:Ce(Pe);break;case 19:Ce(Pe);break;case 10:Sh(r.type._context);break;case 22:case 23:$h()}n=n.return}if(Ze=e,We=e=$r(e.current,null),nt=At=t,Ke=0,ea=null,Dh=Pc=Ss=0,Et=Pi=null,is!==null){for(t=0;t<is.length;t++)if(n=is[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,o=n.pending;if(o!==null){var i=o.next;o.next=s,r.next=i}n.pending=r}is=null}return e}function jw(e,t){do{var n=We;try{if(bh(),xl.current=Yl,Ql){for(var r=je.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Ql=!1}if(bs=0,Je=He=je=null,Ti=!1,Ji=0,Ih.current=null,n===null||n.return===null){Ke=1,ea=t,We=null;break}e:{var o=e,i=n.return,a=n,l=t;if(t=nt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var m=u.alternate;m?(u.updateQueue=m.updateQueue,u.memoizedState=m.memoizedState,u.lanes=m.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=Pm(i);if(h!==null){h.flags&=-257,jm(h,i,a,o,t),h.mode&1&&Rm(o,c,t),t=h,l=c;var b=t.updateQueue;if(b===null){var v=new Set;v.add(l),t.updateQueue=v}else b.add(l);break e}else{if(!(t&1)){Rm(o,c,t),Fh();break e}l=Error(L(426))}}else if(ke&&a.mode&1){var x=Pm(i);if(x!==null){!(x.flags&65536)&&(x.flags|=256),jm(x,i,a,o,t),wh(Oo(l,a));break e}}o=l=Oo(l,a),Ke!==4&&(Ke=2),Pi===null?Pi=[o]:Pi.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var w=hw(o,l,t);Sm(o,w);break e;case 1:a=l;var g=o.type,y=o.stateNode;if(!(o.flags&128)&&(typeof g.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Lr===null||!Lr.has(y)))){o.flags|=65536,t&=-t,o.lanes|=t;var S=pw(o,a,t);Sm(o,S);break e}}o=o.return}while(o!==null)}Aw(n)}catch(_){t=_,We===n&&n!==null&&(We=n=n.return);continue}break}while(!0)}function Nw(){var e=Jl.current;return Jl.current=Yl,e===null?Yl:e}function Fh(){(Ke===0||Ke===3||Ke===2)&&(Ke=4),Ze===null||!(Ss&268435455)&&!(Pc&268435455)||br(Ze,nt)}function ec(e,t){var n=fe;fe|=2;var r=Nw();(Ze!==e||nt!==t)&&(Wn=null,ms(e,t));do try{bE();break}catch(s){jw(e,s)}while(!0);if(bh(),fe=n,Jl.current=r,We!==null)throw Error(L(261));return Ze=null,nt=0,Ke}function bE(){for(;We!==null;)Ow(We)}function SE(){for(;We!==null&&!K_();)Ow(We)}function Ow(e){var t=Dw(e.alternate,e,At);e.memoizedProps=e.pendingProps,t===null?Aw(e):We=t,Ih.current=null}function Aw(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mE(n,t),n!==null){n.flags&=32767,We=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ke=6,We=null;return}}else if(n=pE(n,t,At),n!==null){We=n;return}if(t=t.sibling,t!==null){We=t;return}We=t=e}while(t!==null);Ke===0&&(Ke=5)}function ts(e,t,n){var r=ve,s=Gt.transition;try{Gt.transition=null,ve=1,_E(e,t,n,r)}finally{Gt.transition=s,ve=r}return null}function _E(e,t,n,r){do uo();while(Pr!==null);if(fe&6)throw Error(L(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(L(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(r1(e,o),e===Ze&&(We=Ze=null,nt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xa||(Xa=!0,Lw(Dl,function(){return uo(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Gt.transition,Gt.transition=null;var i=ve;ve=1;var a=fe;fe|=4,Ih.current=null,vE(e,n),Tw(n,e),W1(Wd),Ml=!!Bd,Wd=Bd=null,e.current=n,yE(n),G_(),fe=a,ve=i,Gt.transition=o}else e.current=n;if(Xa&&(Xa=!1,Pr=e,Zl=s),o=e.pendingLanes,o===0&&(Lr=null),J_(n.stateNode),Pt(e,$e()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Xl)throw Xl=!1,e=uf,uf=null,e;return Zl&1&&e.tag!==0&&uo(),o=e.pendingLanes,o&1?e===df?ji++:(ji=0,df=e):ji=0,Hr(),null}function uo(){if(Pr!==null){var e=hy(Zl),t=Gt.transition,n=ve;try{if(Gt.transition=null,ve=16>e?16:e,Pr===null)var r=!1;else{if(e=Pr,Pr=null,Zl=0,fe&6)throw Error(L(331));var s=fe;for(fe|=4,W=e.current;W!==null;){var o=W,i=o.child;if(W.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(W=c;W!==null;){var u=W;switch(u.tag){case 0:case 11:case 15:Ri(8,u,o)}var d=u.child;if(d!==null)d.return=u,W=d;else for(;W!==null;){u=W;var m=u.sibling,h=u.return;if(Ew(u),u===c){W=null;break}if(m!==null){m.return=h,W=m;break}W=h}}}var b=o.alternate;if(b!==null){var v=b.child;if(v!==null){b.child=null;do{var x=v.sibling;v.sibling=null,v=x}while(v!==null)}}W=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,W=i;else e:for(;W!==null;){if(o=W,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Ri(9,o,o.return)}var w=o.sibling;if(w!==null){w.return=o.return,W=w;break e}W=o.return}}var g=e.current;for(W=g;W!==null;){i=W;var y=i.child;if(i.subtreeFlags&2064&&y!==null)y.return=i,W=y;else e:for(i=g;W!==null;){if(a=W,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Rc(9,a)}}catch(_){Me(a,a.return,_)}if(a===i){W=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,W=S;break e}W=a.return}}if(fe=s,Hr(),In&&typeof In.onPostCommitFiberRoot=="function")try{In.onPostCommitFiberRoot(xc,e)}catch{}r=!0}return r}finally{ve=n,Gt.transition=t}}return!1}function Wm(e,t,n){t=Oo(n,t),t=hw(e,t,1),e=Dr(e,t,1),t=vt(),e!==null&&(va(e,1,t),Pt(e,t))}function Me(e,t,n){if(e.tag===3)Wm(e,e,n);else for(;t!==null;){if(t.tag===3){Wm(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Lr===null||!Lr.has(r))){e=Oo(n,e),e=pw(t,e,1),t=Dr(t,e,1),e=vt(),t!==null&&(va(t,1,e),Pt(t,e));break}}t=t.return}}function EE(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vt(),e.pingedLanes|=e.suspendedLanes&n,Ze===e&&(nt&n)===n&&(Ke===4||Ke===3&&(nt&130023424)===nt&&500>$e()-Lh?ms(e,0):Dh|=n),Pt(e,t)}function Iw(e,t){t===0&&(e.mode&1?(t=Ba,Ba<<=1,!(Ba&130023424)&&(Ba=4194304)):t=1);var n=vt();e=Zn(e,t),e!==null&&(va(e,t,n),Pt(e,n))}function CE(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Iw(e,n)}function kE(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(L(314))}r!==null&&r.delete(t),Iw(e,n)}var Dw;Dw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Tt.current)kt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return kt=!1,hE(e,t,n);kt=!!(e.flags&131072)}else kt=!1,ke&&t.flags&1048576&&Fy(t,Vl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Sl(e,t),e=t.pendingProps;var s=Ro(t,dt.current);co(t,n),s=Ph(null,t,r,e,s,n);var o=jh();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Rt(r)?(o=!0,Bl(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Eh(t),s.updater=Tc,t.stateNode=s,s._reactInternals=t,Xd(t,r,e,n),t=tf(null,t,r,!0,o,n)):(t.tag=0,ke&&o&&vh(t),mt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Sl(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=RE(r),e=rn(r,e),s){case 0:t=ef(null,t,r,e,n);break e;case 1:t=Am(null,t,r,e,n);break e;case 11:t=Nm(null,t,r,e,n);break e;case 14:t=Om(null,t,r,rn(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:rn(r,s),ef(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:rn(r,s),Am(e,t,r,s,n);case 3:e:{if(yw(t),e===null)throw Error(L(387));r=t.pendingProps,o=t.memoizedState,s=o.element,Hy(e,t),Kl(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=Oo(Error(L(423)),t),t=Im(e,t,r,n,s);break e}else if(r!==s){s=Oo(Error(L(424)),t),t=Im(e,t,r,n,s);break e}else for(Lt=Ir(t.stateNode.containerInfo.firstChild),Mt=t,ke=!0,un=null,n=Wy(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Po(),r===s){t=er(e,t,n);break e}mt(e,t,r,n)}t=t.child}return t;case 5:return qy(t),e===null&&Qd(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,Vd(r,s)?i=null:o!==null&&Vd(r,o)&&(t.flags|=32),vw(e,t),mt(e,t,i,n),t.child;case 6:return e===null&&Qd(t),null;case 13:return ww(e,t,n);case 4:return Ch(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=jo(t,null,r,n):mt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:rn(r,s),Nm(e,t,r,s,n);case 7:return mt(e,t,t.pendingProps,n),t.child;case 8:return mt(e,t,t.pendingProps.children,n),t.child;case 12:return mt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,Se(Hl,r._currentValue),r._currentValue=i,o!==null)if(pn(o.value,i)){if(o.children===s.children&&!Tt.current){t=er(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Yn(-1,n&-n),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Yd(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(L(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Yd(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}mt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,co(t,n),s=Yt(s),r=r(s),t.flags|=1,mt(e,t,r,n),t.child;case 14:return r=t.type,s=rn(r,t.pendingProps),s=rn(r.type,s),Om(e,t,r,s,n);case 15:return mw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:rn(r,s),Sl(e,t),t.tag=1,Rt(r)?(e=!0,Bl(t)):e=!1,co(t,n),fw(t,r,s),Xd(t,r,s,n),tf(null,t,r,!0,e,n);case 19:return xw(e,t,n);case 22:return gw(e,t,n)}throw Error(L(156,t.tag))};function Lw(e,t){return cy(e,t)}function TE(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qt(e,t,n,r){return new TE(e,t,n,r)}function Uh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function RE(e){if(typeof e=="function")return Uh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===oh)return 11;if(e===ih)return 14}return 2}function $r(e,t){var n=e.alternate;return n===null?(n=qt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Cl(e,t,n,r,s,o){var i=2;if(r=e,typeof e=="function")Uh(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Gs:return gs(n.children,s,o,t);case sh:i=8,s|=8;break;case Sd:return e=qt(12,n,t,s|2),e.elementType=Sd,e.lanes=o,e;case _d:return e=qt(13,n,t,s),e.elementType=_d,e.lanes=o,e;case Ed:return e=qt(19,n,t,s),e.elementType=Ed,e.lanes=o,e;case qv:return jc(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Vv:i=10;break e;case Hv:i=9;break e;case oh:i=11;break e;case ih:i=14;break e;case vr:i=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=qt(i,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function gs(e,t,n,r){return e=qt(7,e,r,t),e.lanes=n,e}function jc(e,t,n,r){return e=qt(22,e,r,t),e.elementType=qv,e.lanes=n,e.stateNode={isHidden:!1},e}function qu(e,t,n){return e=qt(6,e,null,t),e.lanes=n,e}function Ku(e,t,n){return t=qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function PE(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tu(0),this.expirationTimes=Tu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tu(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function zh(e,t,n,r,s,o,i,a,l){return e=new PE(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=qt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Eh(o),e}function jE(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ks,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Mw(e){if(!e)return Ur;e=e._reactInternals;e:{if(Ps(e)!==e||e.tag!==1)throw Error(L(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Rt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(L(171))}if(e.tag===1){var n=e.type;if(Rt(n))return My(e,n,t)}return t}function $w(e,t,n,r,s,o,i,a,l){return e=zh(n,r,!0,e,s,o,i,a,l),e.context=Mw(null),n=e.current,r=vt(),s=Mr(n),o=Yn(r,s),o.callback=t??null,Dr(n,o,s),e.current.lanes=s,va(e,s,r),Pt(e,r),e}function Nc(e,t,n,r){var s=t.current,o=vt(),i=Mr(s);return n=Mw(n),t.context===null?t.context=n:t.pendingContext=n,t=Yn(o,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Dr(s,t,i),e!==null&&(hn(e,s,i,o),wl(e,s,i)),i}function tc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Vm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Bh(e,t){Vm(e,t),(e=e.alternate)&&Vm(e,t)}function NE(){return null}var Fw=typeof reportError=="function"?reportError:function(e){console.error(e)};function Wh(e){this._internalRoot=e}Oc.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));Nc(e,t,null,null)};Oc.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;_s(function(){Nc(null,e,null,null)}),t[Xn]=null}};function Oc(e){this._internalRoot=e}Oc.prototype.unstable_scheduleHydration=function(e){if(e){var t=gy();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xr.length&&t!==0&&t<xr[n].priority;n++);xr.splice(n,0,e),n===0&&yy(e)}};function Vh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ac(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Hm(){}function OE(e,t,n,r,s){if(s){if(typeof r=="function"){var o=r;r=function(){var c=tc(i);o.call(c)}}var i=$w(t,r,e,0,null,!1,!1,"",Hm);return e._reactRootContainer=i,e[Xn]=i.current,qi(e.nodeType===8?e.parentNode:e),_s(),i}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var c=tc(l);a.call(c)}}var l=zh(e,0,!1,null,null,!1,!1,"",Hm);return e._reactRootContainer=l,e[Xn]=l.current,qi(e.nodeType===8?e.parentNode:e),_s(function(){Nc(t,l,n,r)}),l}function Ic(e,t,n,r,s){var o=n._reactRootContainer;if(o){var i=o;if(typeof s=="function"){var a=s;s=function(){var l=tc(i);a.call(l)}}Nc(t,i,e,s)}else i=OE(n,t,e,s,r);return tc(i)}py=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=yi(t.pendingLanes);n!==0&&(ch(t,n|1),Pt(t,$e()),!(fe&6)&&(Ao=$e()+500,Hr()))}break;case 13:_s(function(){var r=Zn(e,1);if(r!==null){var s=vt();hn(r,e,1,s)}}),Bh(e,1)}};uh=function(e){if(e.tag===13){var t=Zn(e,134217728);if(t!==null){var n=vt();hn(t,e,134217728,n)}Bh(e,134217728)}};my=function(e){if(e.tag===13){var t=Mr(e),n=Zn(e,t);if(n!==null){var r=vt();hn(n,e,t,r)}Bh(e,t)}};gy=function(){return ve};vy=function(e,t){var n=ve;try{return ve=e,t()}finally{ve=n}};Id=function(e,t,n){switch(t){case"input":if(Td(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Ec(r);if(!s)throw Error(L(90));Gv(r),Td(r,s)}}}break;case"textarea":Yv(e,n);break;case"select":t=n.value,t!=null&&oo(e,!!n.multiple,t,!1)}};ry=Mh;sy=_s;var AE={usingClientEntryPoint:!1,Events:[wa,Xs,Ec,ty,ny,Mh]},fi={findFiberByHostInstance:os,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},IE={bundleType:fi.bundleType,version:fi.version,rendererPackageName:fi.rendererPackageName,rendererConfig:fi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:sr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ay(e),e===null?null:e.stateNode},findFiberByHostInstance:fi.findFiberByHostInstance||NE,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Za.isDisabled&&Za.supportsFiber)try{xc=Za.inject(IE),In=Za}catch{}}Ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AE;Ut.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Vh(t))throw Error(L(200));return jE(e,t,null,n)};Ut.createRoot=function(e,t){if(!Vh(e))throw Error(L(299));var n=!1,r="",s=Fw;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=zh(e,1,!1,null,null,n,!1,r,s),e[Xn]=t.current,qi(e.nodeType===8?e.parentNode:e),new Wh(t)};Ut.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=ay(t),e=e===null?null:e.stateNode,e};Ut.flushSync=function(e){return _s(e)};Ut.hydrate=function(e,t,n){if(!Ac(t))throw Error(L(200));return Ic(null,e,t,!0,n)};Ut.hydrateRoot=function(e,t,n){if(!Vh(e))throw Error(L(405));var r=n!=null&&n.hydratedSources||null,s=!1,o="",i=Fw;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=$w(t,null,e,1,n??null,s,!1,o,i),e[Xn]=t.current,qi(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new Oc(t)};Ut.render=function(e,t,n){if(!Ac(t))throw Error(L(200));return Ic(null,e,t,!1,n)};Ut.unmountComponentAtNode=function(e){if(!Ac(e))throw Error(L(40));return e._reactRootContainer?(_s(function(){Ic(null,null,e,!1,function(){e._reactRootContainer=null,e[Xn]=null})}),!0):!1};Ut.unstable_batchedUpdates=Mh;Ut.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ac(n))throw Error(L(200));if(e==null||e._reactInternals===void 0)throw Error(L(38));return Ic(e,t,n,!1,r)};Ut.version="18.3.1-next-f1338f8080-20240426";function Uw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uw)}catch(e){console.error(e)}}Uw(),Uv.exports=Ut;var Kt=Uv.exports;const zw=Rv(Kt);var Bw,qm=Kt;Bw=qm.createRoot,qm.hydrateRoot;const DE=1,LE=1e6;let Gu=0;function ME(){return Gu=(Gu+1)%Number.MAX_SAFE_INTEGER,Gu.toString()}const Qu=new Map,Km=e=>{if(Qu.has(e))return;const t=setTimeout(()=>{Qu.delete(e),Ni({type:"REMOVE_TOAST",toastId:e})},LE);Qu.set(e,t)},$E=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,DE)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Km(n):e.toasts.forEach(r=>{Km(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},kl=[];let Tl={toasts:[]};function Ni(e){Tl=$E(Tl,e),kl.forEach(t=>{t(Tl)})}function FE({...e}){const t=ME(),n=s=>Ni({type:"UPDATE_TOAST",toast:{...s,id:t}}),r=()=>Ni({type:"DISMISS_TOAST",toastId:t});return Ni({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||r()}}}),{id:t,dismiss:r,update:n}}function UE(){const[e,t]=f.useState(Tl);return f.useEffect(()=>(kl.push(t),()=>{const n=kl.indexOf(t);n>-1&&kl.splice(n,1)}),[e]),{...e,toast:FE,dismiss:n=>Ni({type:"DISMISS_TOAST",toastId:n})}}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Gm(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ww(...e){return t=>{let n=!1;const r=e.map(s=>{const o=Gm(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Gm(e[s],null)}}}}function we(...e){return f.useCallback(Ww(...e),e)}function zE(e,t){const n=f.createContext(t),r=o=>{const{children:i,...a}=o,l=f.useMemo(()=>a,Object.values(a));return p.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function s(o){const i=f.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function js(e,t=[]){let n=[];function r(o,i){const a=f.createContext(i),l=n.length;n=[...n,i];const c=d=>{var w;const{scope:m,children:h,...b}=d,v=((w=m==null?void 0:m[e])==null?void 0:w[l])||a,x=f.useMemo(()=>b,Object.values(b));return p.jsx(v.Provider,{value:x,children:h})};c.displayName=o+"Provider";function u(d,m){var v;const h=((v=m==null?void 0:m[e])==null?void 0:v[l])||a,b=f.useContext(h);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[c,u]}const s=()=>{const o=n.map(i=>f.createContext(i));return function(a){const l=(a==null?void 0:a[e])||o;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return s.scopeName=e,[r,BE(s,...t)]}function BE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(o)[`__scope${c}`];return{...a,...d}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Io(e){const t=VE(e),n=f.forwardRef((r,s)=>{const{children:o,...i}=r,a=f.Children.toArray(o),l=a.find(qE);if(l){const c=l.props.children,u=a.map(d=>d===l?f.Children.count(c)>1?f.Children.only(null):f.isValidElement(c)?c.props.children:null:d);return p.jsx(t,{...i,ref:s,children:f.isValidElement(c)?f.cloneElement(c,void 0,u):null})}return p.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var WE=Io("Slot");function VE(e){const t=f.forwardRef((n,r)=>{const{children:s,...o}=n;if(f.isValidElement(s)){const i=GE(s),a=KE(o,s.props);return s.type!==f.Fragment&&(a.ref=r?Ww(r,i):i),f.cloneElement(s,a)}return f.Children.count(s)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Vw=Symbol("radix.slottable");function HE(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Vw,t}function qE(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Vw}function KE(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...a)=>{const l=o(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function GE(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Hw(e){const t=e+"CollectionProvider",[n,r]=js(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:x,children:w}=v,g=D.useRef(null),y=D.useRef(new Map).current;return p.jsx(s,{scope:x,itemMap:y,collectionRef:g,children:w})};i.displayName=t;const a=e+"CollectionSlot",l=Io(a),c=D.forwardRef((v,x)=>{const{scope:w,children:g}=v,y=o(a,w),S=we(x,y.collectionRef);return p.jsx(l,{ref:S,children:g})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",m=Io(u),h=D.forwardRef((v,x)=>{const{scope:w,children:g,...y}=v,S=D.useRef(null),_=we(x,S),E=o(u,w);return D.useEffect(()=>(E.itemMap.set(S,{ref:S,...y}),()=>void E.itemMap.delete(S))),p.jsx(m,{[d]:"",ref:_,children:g})});h.displayName=u;function b(v){const x=o(e+"CollectionConsumer",v);return D.useCallback(()=>{const g=x.collectionRef.current;if(!g)return[];const y=Array.from(g.querySelectorAll(`[${d}]`));return Array.from(x.itemMap.values()).sort((E,C)=>y.indexOf(E.ref.current)-y.indexOf(C.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:c,ItemSlot:h},b,r]}var QE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=QE.reduce((e,t)=>{const n=Io(`Primitive.${t}`),r=f.forwardRef((s,o)=>{const{asChild:i,...a}=s,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function qw(e,t){e&&Kt.flushSync(()=>e.dispatchEvent(t))}function mn(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function YE(e,t=globalThis==null?void 0:globalThis.document){const n=mn(e);f.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var JE="DismissableLayer",pf="dismissableLayer.update",XE="dismissableLayer.pointerDownOutside",ZE="dismissableLayer.focusOutside",Qm,Kw=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ba=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...l}=e,c=f.useContext(Kw),[u,d]=f.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=f.useState({}),b=we(t,C=>d(C)),v=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=v.indexOf(x),g=u?v.indexOf(u):-1,y=c.layersWithOutsidePointerEventsDisabled.size>0,S=g>=w,_=tC(C=>{const k=C.target,T=[...c.branches].some(N=>N.contains(k));!S||T||(s==null||s(C),i==null||i(C),C.defaultPrevented||a==null||a())},m),E=nC(C=>{const k=C.target;[...c.branches].some(N=>N.contains(k))||(o==null||o(C),i==null||i(C),C.defaultPrevented||a==null||a())},m);return YE(C=>{g===c.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&a&&(C.preventDefault(),a()))},m),f.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Qm=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Ym(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Qm)}},[u,m,n,c]),f.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Ym())},[u,c]),f.useEffect(()=>{const C=()=>h({});return document.addEventListener(pf,C),()=>document.removeEventListener(pf,C)},[]),p.jsx(le.div,{...l,ref:b,style:{pointerEvents:y?S?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,E.onFocusCapture),onBlurCapture:te(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,_.onPointerDownCapture)})});ba.displayName=JE;var eC="DismissableLayerBranch",Gw=f.forwardRef((e,t)=>{const n=f.useContext(Kw),r=f.useRef(null),s=we(t,r);return f.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),p.jsx(le.div,{...e,ref:s})});Gw.displayName=eC;function tC(e,t=globalThis==null?void 0:globalThis.document){const n=mn(e),r=f.useRef(!1),s=f.useRef(()=>{});return f.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let l=function(){Qw(XE,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=l,t.addEventListener("click",s.current,{once:!0})):l()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function nC(e,t=globalThis==null?void 0:globalThis.document){const n=mn(e),r=f.useRef(!1);return f.useEffect(()=>{const s=o=>{o.target&&!r.current&&Qw(ZE,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ym(){const e=new CustomEvent(pf);document.dispatchEvent(e)}function Qw(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?qw(s,o):s.dispatchEvent(o)}var rC=ba,sC=Gw,st=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},oC="Portal",Dc=f.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,o]=f.useState(!1);st(()=>o(!0),[]);const i=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?zw.createPortal(p.jsx(le.div,{...r,ref:t}),i):null});Dc.displayName=oC;function iC(e,t){return f.useReducer((n,r)=>t[n][r]??n,e)}var Bo=e=>{const{present:t,children:n}=e,r=aC(t),s=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),o=we(r.ref,lC(s));return typeof n=="function"||r.isPresent?f.cloneElement(s,{ref:o}):null};Bo.displayName="Presence";function aC(e){const[t,n]=f.useState(),r=f.useRef(null),s=f.useRef(e),o=f.useRef("none"),i=e?"mounted":"unmounted",[a,l]=iC(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const c=el(r.current);o.current=a==="mounted"?c:"none"},[a]),st(()=>{const c=r.current,u=s.current;if(u!==e){const m=o.current,h=el(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&m!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),st(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=h=>{const v=el(r.current).includes(h.animationName);if(h.target===t&&v&&(l("ANIMATION_END"),!s.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},m=h=>{h.target===t&&(o.current=el(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:f.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function el(e){return(e==null?void 0:e.animationName)||"none"}function lC(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cC=eh[" useInsertionEffect ".trim().toString()]||st;function ta({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=uC({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const u=f.useRef(e!==void 0);f.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"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.`),u.current=a},[a,r])}const c=f.useCallback(u=>{var d;if(a){const m=dC(u)?u(e):u;m!==e&&((d=i.current)==null||d.call(i,m))}else o(u)},[a,e,o,i]);return[l,c]}function uC({defaultProp:e,onChange:t}){const[n,r]=f.useState(e),s=f.useRef(n),o=f.useRef(t);return cC(()=>{o.current=t},[t]),f.useEffect(()=>{var i;s.current!==n&&((i=o.current)==null||i.call(o,n),s.current=n)},[n,s]),[n,r,o]}function dC(e){return typeof e=="function"}var Yw=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"}),fC="VisuallyHidden",Lc=f.forwardRef((e,t)=>p.jsx(le.span,{...e,ref:t,style:{...Yw,...e.style}}));Lc.displayName=fC;var hC=Lc,Hh="ToastProvider",[qh,pC,mC]=Hw("Toast"),[Jw,I2]=js("Toast",[mC]),[gC,Mc]=Jw(Hh),Xw=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,l]=f.useState(null),[c,u]=f.useState(0),d=f.useRef(!1),m=f.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Hh}\`. Expected non-empty \`string\`.`),p.jsx(qh.Provider,{scope:t,children:p.jsx(gC,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:o,toastCount:c,viewport:a,onViewportChange:l,onToastAdd:f.useCallback(()=>u(h=>h+1),[]),onToastRemove:f.useCallback(()=>u(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:m,children:i})})};Xw.displayName=Hh;var Zw="ToastViewport",vC=["F8"],mf="toast.viewportPause",gf="toast.viewportResume",e0=f.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=vC,label:s="Notifications ({hotkey})",...o}=e,i=Mc(Zw,n),a=pC(n),l=f.useRef(null),c=f.useRef(null),u=f.useRef(null),d=f.useRef(null),m=we(t,d,i.onViewportChange),h=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=i.toastCount>0;f.useEffect(()=>{const x=w=>{var y;r.length!==0&&r.every(S=>w[S]||w.code===S)&&((y=d.current)==null||y.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),f.useEffect(()=>{const x=l.current,w=d.current;if(b&&x&&w){const g=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(mf);w.dispatchEvent(E),i.isClosePausedRef.current=!0}},y=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(gf);w.dispatchEvent(E),i.isClosePausedRef.current=!1}},S=E=>{!x.contains(E.relatedTarget)&&y()},_=()=>{x.contains(document.activeElement)||y()};return x.addEventListener("focusin",g),x.addEventListener("focusout",S),x.addEventListener("pointermove",g),x.addEventListener("pointerleave",_),window.addEventListener("blur",g),window.addEventListener("focus",y),()=>{x.removeEventListener("focusin",g),x.removeEventListener("focusout",S),x.removeEventListener("pointermove",g),x.removeEventListener("pointerleave",_),window.removeEventListener("blur",g),window.removeEventListener("focus",y)}}},[b,i.isClosePausedRef]);const v=f.useCallback(({tabbingDirection:x})=>{const g=a().map(y=>{const S=y.ref.current,_=[S,...jC(S)];return x==="forwards"?_:_.reverse()});return(x==="forwards"?g.reverse():g).flat()},[a]);return f.useEffect(()=>{const x=d.current;if(x){const w=g=>{var _,E,C;const y=g.altKey||g.ctrlKey||g.metaKey;if(g.key==="Tab"&&!y){const k=document.activeElement,T=g.shiftKey;if(g.target===x&&T){(_=c.current)==null||_.focus();return}const A=v({tabbingDirection:T?"backwards":"forwards"}),F=A.findIndex(I=>I===k);Yu(A.slice(F+1))?g.preventDefault():T?(E=c.current)==null||E.focus():(C=u.current)==null||C.focus()}};return x.addEventListener("keydown",w),()=>x.removeEventListener("keydown",w)}},[a,v]),p.jsxs(sC,{ref:l,role:"region","aria-label":s.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&p.jsx(vf,{ref:c,onFocusFromOutsideViewport:()=>{const x=v({tabbingDirection:"forwards"});Yu(x)}}),p.jsx(qh.Slot,{scope:n,children:p.jsx(le.ol,{tabIndex:-1,...o,ref:m})}),b&&p.jsx(vf,{ref:u,onFocusFromOutsideViewport:()=>{const x=v({tabbingDirection:"backwards"});Yu(x)}})]})});e0.displayName=Zw;var t0="ToastFocusProxy",vf=f.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,o=Mc(t0,n);return p.jsx(Lc,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var c;const a=i.relatedTarget;!((c=o.viewport)!=null&&c.contains(a))&&r()}})});vf.displayName=t0;var Sa="Toast",yC="toast.swipeStart",wC="toast.swipeMove",xC="toast.swipeCancel",bC="toast.swipeEnd",n0=f.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:o,...i}=e,[a,l]=ta({prop:r,defaultProp:s??!0,onChange:o,caller:Sa});return p.jsx(Bo,{present:n||a,children:p.jsx(EC,{open:a,...i,ref:t,onClose:()=>l(!1),onPause:mn(e.onPause),onResume:mn(e.onResume),onSwipeStart:te(e.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:te(e.onSwipeMove,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:te(e.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:te(e.onSwipeEnd,c=>{const{x:u,y:d}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});n0.displayName=Sa;var[SC,_C]=Jw(Sa,{onClose(){}}),EC=f.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:l,onResume:c,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:m,onSwipeEnd:h,...b}=e,v=Mc(Sa,n),[x,w]=f.useState(null),g=we(t,I=>w(I)),y=f.useRef(null),S=f.useRef(null),_=s||v.duration,E=f.useRef(0),C=f.useRef(_),k=f.useRef(0),{onToastAdd:T,onToastRemove:N}=v,j=mn(()=>{var H;(x==null?void 0:x.contains(document.activeElement))&&((H=v.viewport)==null||H.focus()),i()}),A=f.useCallback(I=>{!I||I===1/0||(window.clearTimeout(k.current),E.current=new Date().getTime(),k.current=window.setTimeout(j,I))},[j]);f.useEffect(()=>{const I=v.viewport;if(I){const H=()=>{A(C.current),c==null||c()},z=()=>{const B=new Date().getTime()-E.current;C.current=C.current-B,window.clearTimeout(k.current),l==null||l()};return I.addEventListener(mf,z),I.addEventListener(gf,H),()=>{I.removeEventListener(mf,z),I.removeEventListener(gf,H)}}},[v.viewport,_,l,c,A]),f.useEffect(()=>{o&&!v.isClosePausedRef.current&&A(_)},[o,_,v.isClosePausedRef,A]),f.useEffect(()=>(T(),()=>N()),[T,N]);const F=f.useMemo(()=>x?c0(x):null,[x]);return v.viewport?p.jsxs(p.Fragment,{children:[F&&p.jsx(CC,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:F}),p.jsx(SC,{scope:n,onClose:j,children:Kt.createPortal(p.jsx(qh.ItemSlot,{scope:n,children:p.jsx(rC,{asChild:!0,onEscapeKeyDown:te(a,()=>{v.isFocusedToastEscapeKeyDownRef.current||j(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:p.jsx(le.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":v.swipeDirection,...b,ref:g,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:te(e.onKeyDown,I=>{I.key==="Escape"&&(a==null||a(I.nativeEvent),I.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,j()))}),onPointerDown:te(e.onPointerDown,I=>{I.button===0&&(y.current={x:I.clientX,y:I.clientY})}),onPointerMove:te(e.onPointerMove,I=>{if(!y.current)return;const H=I.clientX-y.current.x,z=I.clientY-y.current.y,B=!!S.current,R=["left","right"].includes(v.swipeDirection),P=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,M=R?P(0,H):0,q=R?0:P(0,z),U=I.pointerType==="touch"?10:2,Q={x:M,y:q},Y={originalEvent:I,delta:Q};B?(S.current=Q,tl(wC,d,Y,{discrete:!1})):Jm(Q,v.swipeDirection,U)?(S.current=Q,tl(yC,u,Y,{discrete:!1}),I.target.setPointerCapture(I.pointerId)):(Math.abs(H)>U||Math.abs(z)>U)&&(y.current=null)}),onPointerUp:te(e.onPointerUp,I=>{const H=S.current,z=I.target;if(z.hasPointerCapture(I.pointerId)&&z.releasePointerCapture(I.pointerId),S.current=null,y.current=null,H){const B=I.currentTarget,R={originalEvent:I,delta:H};Jm(H,v.swipeDirection,v.swipeThreshold)?tl(bC,h,R,{discrete:!0}):tl(xC,m,R,{discrete:!0}),B.addEventListener("click",P=>P.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),CC=e=>{const{__scopeToast:t,children:n,...r}=e,s=Mc(Sa,t),[o,i]=f.useState(!1),[a,l]=f.useState(!1);return RC(()=>i(!0)),f.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),a?null:p.jsx(Dc,{asChild:!0,children:p.jsx(Lc,{...r,children:o&&p.jsxs(p.Fragment,{children:[s.label," ",n]})})})},kC="ToastTitle",r0=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(le.div,{...r,ref:t})});r0.displayName=kC;var TC="ToastDescription",s0=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(le.div,{...r,ref:t})});s0.displayName=TC;var o0="ToastAction",i0=f.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?p.jsx(l0,{altText:n,asChild:!0,children:p.jsx(Kh,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${o0}\`. Expected non-empty \`string\`.`),null)});i0.displayName=o0;var a0="ToastClose",Kh=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=_C(a0,n);return p.jsx(l0,{asChild:!0,children:p.jsx(le.button,{type:"button",...r,ref:t,onClick:te(e.onClick,s.onClose)})})});Kh.displayName=a0;var l0=f.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return p.jsx(le.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function c0(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),PC(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...c0(r))}}),t}function tl(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?qw(s,o):s.dispatchEvent(o)}var Jm=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),o=r>s;return t==="left"||t==="right"?o&&r>n:!o&&s>n};function RC(e=()=>{}){const t=mn(e);st(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function PC(e){return e.nodeType===e.ELEMENT_NODE}function jC(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Yu(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var NC=Xw,u0=e0,d0=n0,f0=r0,h0=s0,p0=i0,m0=Kh;function g0(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=g0(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function v0(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=g0(e))&&(r&&(r+=" "),r+=t);return r}const Xm=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Zm=v0,Gh=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Zm(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(c=>{const u=n==null?void 0:n[c],d=o==null?void 0:o[c];if(u===null)return null;const m=Xm(u)||Xm(d);return s[c][m]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,m]=u;return m===void 0||(c[d]=m),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:m,...h}=u;return Object.entries(h).every(b=>{let[v,x]=b;return Array.isArray(x)?x.includes({...o,...a}[v]):{...o,...a}[v]===x})?[...c,d,m]:c},[]);return Zm(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const OC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var AC={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.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IC=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...a},l)=>f.createElement("svg",{ref:l,...AC,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:y0("lucide",s),...a},[...i.map(([c,u])=>f.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const et=(e,t)=>{const n=f.forwardRef(({className:r,...s},o)=>f.createElement(IC,{ref:o,iconNode:t,className:y0(`lucide-${OC(e)}`,r),...s}));return n.displayName=`${e}`,n};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qh=et("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const DC=et("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const w0=et("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LC=et("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MC=et("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $C=et("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FC=et("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UC=et("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const x0=et("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tr=et("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zC=et("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const b0=et("Pencil",[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $c=et("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BC=et("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const WC=et("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fc=et("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VC=et("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yh=et("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Jh="-",HC=e=>{const t=KC(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Jh);return a[0]===""&&a.length!==1&&a.shift(),S0(a,t)||qC(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},S0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?S0(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(Jh);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},eg=/^\[(.+)\]$/,qC=e=>{if(eg.test(e)){const t=eg.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},KC=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return QC(Object.entries(e.classGroups),n).forEach(([o,i])=>{yf(i,r,o,t)}),r},yf=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:tg(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(GC(s)){yf(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{yf(i,tg(t,o),n,r)})})},tg=(e,t)=>{let n=e;return t.split(Jh).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},GC=e=>e.isThemeGetter,QC=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,a])=>[t+i,a])):o);return[n,s]}):e,YC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},_0="!",JC=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=a=>{const l=[];let c=0,u=0,d;for(let x=0;x<a.length;x++){let w=a[x];if(c===0){if(w===s&&(r||a.slice(x,x+o)===t)){l.push(a.slice(u,x)),u=x+o;continue}if(w==="/"){d=x;continue}}w==="["?c++:w==="]"&&c--}const m=l.length===0?a:a.substring(u),h=m.startsWith(_0),b=h?m.substring(1):m,v=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:b,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:i}):i},XC=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},ZC=e=>({cache:YC(e.cacheSize),parseClassName:JC(e),...HC(e)}),ek=/\s+/,tk=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(ek);let a="";for(let l=i.length-1;l>=0;l-=1){const c=i[l],{modifiers:u,hasImportantModifier:d,baseClassName:m,maybePostfixModifierPosition:h}=n(c);let b=!!h,v=r(b?m.substring(0,h):m);if(!v){if(!b){a=c+(a.length>0?" "+a:a);continue}if(v=r(m),!v){a=c+(a.length>0?" "+a:a);continue}b=!1}const x=XC(u).join(":"),w=d?x+_0:x,g=w+v;if(o.includes(g))continue;o.push(g);const y=s(v,b);for(let S=0;S<y.length;++S){const _=y[S];o.push(w+_)}a=c+(a.length>0?" "+a:a)}return a};function nk(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=E0(t))&&(r&&(r+=" "),r+=n);return r}const E0=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=E0(e[r]))&&(n&&(n+=" "),n+=t);return n};function rk(e,...t){let n,r,s,o=i;function i(l){const c=t.reduce((u,d)=>d(u),e());return n=ZC(c),r=n.cache.get,s=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=tk(l,n);return s(l,u),u}return function(){return o(nk.apply(null,arguments))}}const _e=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},C0=/^\[(?:([a-z-]+):)?(.+)\]$/i,sk=/^\d+\/\d+$/,ok=new Set(["px","full","screen"]),ik=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ak=/\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$/,lk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ck=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zn=e=>fo(e)||ok.has(e)||sk.test(e),ur=e=>Wo(e,"length",yk),fo=e=>!!e&&!Number.isNaN(Number(e)),Ju=e=>Wo(e,"number",fo),hi=e=>!!e&&Number.isInteger(Number(e)),dk=e=>e.endsWith("%")&&fo(e.slice(0,-1)),re=e=>C0.test(e),dr=e=>ik.test(e),fk=new Set(["length","size","percentage"]),hk=e=>Wo(e,fk,k0),pk=e=>Wo(e,"position",k0),mk=new Set(["image","url"]),gk=e=>Wo(e,mk,xk),vk=e=>Wo(e,"",wk),pi=()=>!0,Wo=(e,t,n)=>{const r=C0.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},yk=e=>ak.test(e)&&!lk.test(e),k0=()=>!1,wk=e=>ck.test(e),xk=e=>uk.test(e),bk=()=>{const e=_e("colors"),t=_e("spacing"),n=_e("blur"),r=_e("brightness"),s=_e("borderColor"),o=_e("borderRadius"),i=_e("borderSpacing"),a=_e("borderWidth"),l=_e("contrast"),c=_e("grayscale"),u=_e("hueRotate"),d=_e("invert"),m=_e("gap"),h=_e("gradientColorStops"),b=_e("gradientColorStopPositions"),v=_e("inset"),x=_e("margin"),w=_e("opacity"),g=_e("padding"),y=_e("saturate"),S=_e("scale"),_=_e("sepia"),E=_e("skew"),C=_e("space"),k=_e("translate"),T=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",re,t],A=()=>[re,t],F=()=>["",zn,ur],I=()=>["auto",fo,re],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],z=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>["start","end","center","between","around","evenly","stretch"],P=()=>["","0",re],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[fo,re];return{cacheSize:500,separator:":",theme:{colors:[pi],spacing:[zn,ur],blur:["none","",dr,re],brightness:q(),borderColor:[e],borderRadius:["none","","full",dr,re],borderSpacing:A(),borderWidth:F(),contrast:q(),grayscale:P(),hueRotate:q(),invert:P(),gap:A(),gradientColorStops:[e],gradientColorStopPositions:[dk,ur],inset:j(),margin:j(),opacity:q(),padding:A(),saturate:q(),scale:q(),sepia:P(),skew:q(),space:A(),translate:A()},classGroups:{aspect:[{aspect:["auto","square","video",re]}],container:["container"],columns:[{columns:[dr]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"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"],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:[...H(),re]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",hi,re]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",re]}],grow:[{grow:P()}],shrink:[{shrink:P()}],order:[{order:["first","last","none",hi,re]}],"grid-cols":[{"grid-cols":[pi]}],"col-start-end":[{col:["auto",{span:["full",hi,re]},re]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[pi]}],"row-start-end":[{row:["auto",{span:[hi,re]},re]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",re]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",re]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...R()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",re,t]}],"min-w":[{"min-w":[re,t,"min","max","fit"]}],"max-w":[{"max-w":[re,t,"none","full","min","max","fit","prose",{screen:[dr]},dr]}],h:[{h:[re,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[re,t,"auto","min","max","fit"]}],"font-size":[{text:["base",dr,ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ju]}],"font-family":[{font:[pi]}],"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:["tighter","tight","normal","wide","wider","widest",re]}],"line-clamp":[{"line-clamp":["none",fo,Ju]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",zn,re]}],"list-image":[{"list-image":["none",re]}],"list-style-type":[{list:["none","disc","decimal",re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",zn,ur]}],"underline-offset":[{"underline-offset":["auto",zn,re]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),pk]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",hk]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},gk]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...z(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:z()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...z()]}],"outline-offset":[{"outline-offset":[zn,re]}],"outline-w":[{outline:[zn,ur]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[zn,ur]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",dr,vk]}],"shadow-color":[{shadow:[pi]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",dr,re]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",re]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",re]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[hi,re]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",re]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",re]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",re]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[zn,ur,Ju]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},Sk=rk(bk);function J(...e){return Sk(v0(e))}const _k=NC,T0=f.forwardRef(({className:e,...t},n)=>p.jsx(u0,{ref:n,className:J("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));T0.displayName=u0.displayName;const Ek=Gh("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),R0=f.forwardRef(({className:e,variant:t,...n},r)=>p.jsx(d0,{ref:r,className:J(Ek({variant:t}),e),...n}));R0.displayName=d0.displayName;const Ck=f.forwardRef(({className:e,...t},n)=>p.jsx(p0,{ref:n,className:J("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));Ck.displayName=p0.displayName;const P0=f.forwardRef(({className:e,...t},n)=>p.jsx(m0,{ref:n,className:J("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:p.jsx(Yh,{className:"h-4 w-4"})}));P0.displayName=m0.displayName;const j0=f.forwardRef(({className:e,...t},n)=>p.jsx(f0,{ref:n,className:J("text-sm font-semibold",e),...t}));j0.displayName=f0.displayName;const N0=f.forwardRef(({className:e,...t},n)=>p.jsx(h0,{ref:n,className:J("text-sm opacity-90",e),...t}));N0.displayName=h0.displayName;function kk(){const{toasts:e}=UE();return p.jsxs(_k,{children:[e.map(function({id:t,title:n,description:r,action:s,...o}){return p.jsxs(R0,{...o,children:[p.jsxs("div",{className:"grid gap-1",children:[n&&p.jsx(j0,{children:n}),r&&p.jsx(N0,{children:r})]}),s,p.jsx(P0,{})]},t)}),p.jsx(T0,{})]})}var ng=["light","dark"],Tk="(prefers-color-scheme: dark)",Rk=f.createContext(void 0),Pk={setTheme:e=>{},themes:[]},jk=()=>{var e;return(e=f.useContext(Rk))!=null?e:Pk};f.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:o,value:i,attrs:a,nonce:l})=>{let c=o==="system",u=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(b=>`'${b}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=s?ng.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(b,v=!1,x=!0)=>{let w=i?i[b]:b,g=v?b+"|| ''":`'${w}'`,y="";return s&&x&&!v&&ng.includes(b)&&(y+=`d.style.colorScheme = '${b}';`),n==="class"?v||w?y+=`c.add(${g})`:y+="null":w&&(y+=`d[s](n,${g})`),y},h=e?`!function(){${u}${m(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${c})){var t='${Tk}',m=window.matchMedia(t);if(m.media!==t||m.matches){${m("dark")}}else{${m("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${m(i?"x[e]":"e",!0)}}${c?"":"else{"+m(o,!1,!1)+"}"}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${m(i?"x[e]":"e",!0)}}else{${m(o,!1,!1)};}${d}}catch(t){}}();`;return f.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:h}})});var Nk=e=>{switch(e){case"success":return Ik;case"info":return Lk;case"warning":return Dk;case"error":return Mk;default:return null}},Ok=Array(12).fill(0),Ak=({visible:e,className:t})=>D.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},D.createElement("div",{className:"sonner-spinner"},Ok.map((n,r)=>D.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Ik=D.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},D.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"})),Dk=D.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},D.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"})),Lk=D.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},D.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"})),Mk=D.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},D.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"})),$k=D.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"},D.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),D.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Fk=()=>{let[e,t]=D.useState(document.hidden);return D.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},wf=1,Uk=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:wf++,o=this.toasts.find(a=>a.id===s),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(a=>a.id===s?(this.publish({...a,...e,id:s,title:n}),{...a,...e,id:s,dismissible:i,title:n}):a):this.addToast({title:n,...r,dismissible:i,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0,o,i=r.then(async l=>{if(o=["resolve",l],D.isValidElement(l))s=!1,this.create({id:n,type:"default",message:l});else if(Bk(l)&&!l.ok){s=!1;let c=typeof t.error=="function"?await t.error(`HTTP error! status: ${l.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${l.status}`):t.description;this.create({id:n,type:"error",message:c,description:u})}else if(t.success!==void 0){s=!1;let c=typeof t.success=="function"?await t.success(l):t.success,u=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"success",message:c,description:u})}}).catch(async l=>{if(o=["reject",l],t.error!==void 0){s=!1;let c=typeof t.error=="function"?await t.error(l):t.error,u=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"error",message:c,description:u})}}).finally(()=>{var l;s&&(this.dismiss(n),n=void 0),(l=t.finally)==null||l.call(t)}),a=()=>new Promise((l,c)=>i.then(()=>o[0]==="reject"?c(o[1]):l(o[1])).catch(c));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||wf++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},_t=new Uk,zk=(e,t)=>{let n=(t==null?void 0:t.id)||wf++;return _t.addToast({title:e,...t,id:n}),n},Bk=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Wk=zk,Vk=()=>_t.toasts,Hk=()=>_t.getActiveToasts(),de=Object.assign(Wk,{success:_t.success,info:_t.info,warning:_t.warning,error:_t.error,custom:_t.custom,message:_t.message,promise:_t.promise,dismiss:_t.dismiss,loading:_t.loading},{getHistory:Vk,getToasts:Hk});function qk(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}qk(`:where(html[dir="ltr"]),:where([data-sonner-toaster][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%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][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%)}:where([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:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([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);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([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 #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([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)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([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;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([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);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-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([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}:where([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}:where([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, 0px)) translate(var(--swipe-amount-x, 0px));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{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{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{0%{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-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--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-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-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-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, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--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-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-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],[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],[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],[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],[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:nth-child(1){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)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{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 nl(e){return e.label!==void 0}var Kk=3,Gk="32px",Qk="16px",rg=4e3,Yk=356,Jk=14,Xk=20,Zk=200;function en(...e){return e.filter(Boolean).join(" ")}function eT(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var tT=e=>{var t,n,r,s,o,i,a,l,c,u,d;let{invert:m,toast:h,unstyled:b,interacting:v,setHeights:x,visibleToasts:w,heights:g,index:y,toasts:S,expanded:_,removeToast:E,defaultRichColors:C,closeButton:k,style:T,cancelButtonStyle:N,actionButtonStyle:j,className:A="",descriptionClassName:F="",duration:I,position:H,gap:z,loadingIcon:B,expandByDefault:R,classNames:P,icons:M,closeButtonAriaLabel:q="Close toast",pauseWhenPageIsHidden:U}=e,[Q,Y]=D.useState(null),[ge,ce]=D.useState(null),[$,oe]=D.useState(!1),[he,V]=D.useState(!1),[se,Z]=D.useState(!1),[Re,Oe]=D.useState(!1),[xt,ft]=D.useState(!1),[xn,or]=D.useState(0),[bn,Xt]=D.useState(0),Sn=D.useRef(h.duration||I||rg),Qr=D.useRef(null),_n=D.useRef(null),Oa=y===0,vu=y+1<=w,bt=h.type,Nt=h.dismissible!==!1,ir=h.className||"",Yr=h.descriptionClassName||"",Jr=D.useMemo(()=>g.findIndex(K=>K.toastId===h.id)||0,[g,h.id]),En=D.useMemo(()=>{var K;return(K=h.closeButton)!=null?K:k},[h.closeButton,k]),ei=D.useMemo(()=>h.duration||I||rg,[h.duration,I]),ti=D.useRef(0),ar=D.useRef(0),As=D.useRef(0),Un=D.useRef(null),[yu,Aa]=H.split("-"),Ia=D.useMemo(()=>g.reduce((K,ne,ie)=>ie>=Jr?K:K+ne.height,0),[g,Jr]),Da=Fk(),wu=h.invert||m,Ue=bt==="loading";ar.current=D.useMemo(()=>Jr*z+Ia,[Jr,Ia]),D.useEffect(()=>{Sn.current=ei},[ei]),D.useEffect(()=>{oe(!0)},[]),D.useEffect(()=>{let K=_n.current;if(K){let ne=K.getBoundingClientRect().height;return Xt(ne),x(ie=>[{toastId:h.id,height:ne,position:h.position},...ie]),()=>x(ie=>ie.filter(Ie=>Ie.toastId!==h.id))}},[x,h.id]),D.useLayoutEffect(()=>{if(!$)return;let K=_n.current,ne=K.style.height;K.style.height="auto";let ie=K.getBoundingClientRect().height;K.style.height=ne,Xt(ie),x(Ie=>Ie.find(Qe=>Qe.toastId===h.id)?Ie.map(Qe=>Qe.toastId===h.id?{...Qe,height:ie}:Qe):[{toastId:h.id,height:ie,position:h.position},...Ie])},[$,h.title,h.description,x,h.id]);let Ae=D.useCallback(()=>{V(!0),or(ar.current),x(K=>K.filter(ne=>ne.toastId!==h.id)),setTimeout(()=>{E(h)},Zk)},[h,E,x,ar]);D.useEffect(()=>{if(h.promise&&bt==="loading"||h.duration===1/0||h.type==="loading")return;let K;return _||v||U&&Da?(()=>{if(As.current<ti.current){let ne=new Date().getTime()-ti.current;Sn.current=Sn.current-ne}As.current=new Date().getTime()})():Sn.current!==1/0&&(ti.current=new Date().getTime(),K=setTimeout(()=>{var ne;(ne=h.onAutoClose)==null||ne.call(h,h),Ae()},Sn.current)),()=>clearTimeout(K)},[_,v,h,bt,U,Da,Ae]),D.useEffect(()=>{h.delete&&Ae()},[Ae,h.delete]);function ht(){var K,ne,ie;return M!=null&&M.loading?D.createElement("div",{className:en(P==null?void 0:P.loader,(K=h==null?void 0:h.classNames)==null?void 0:K.loader,"sonner-loader"),"data-visible":bt==="loading"},M.loading):B?D.createElement("div",{className:en(P==null?void 0:P.loader,(ne=h==null?void 0:h.classNames)==null?void 0:ne.loader,"sonner-loader"),"data-visible":bt==="loading"},B):D.createElement(Ak,{className:en(P==null?void 0:P.loader,(ie=h==null?void 0:h.classNames)==null?void 0:ie.loader),visible:bt==="loading"})}return D.createElement("li",{tabIndex:0,ref:_n,className:en(A,ir,P==null?void 0:P.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,P==null?void 0:P.default,P==null?void 0:P[bt],(n=h==null?void 0:h.classNames)==null?void 0:n[bt]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:C,"data-styled":!(h.jsx||h.unstyled||b),"data-mounted":$,"data-promise":!!h.promise,"data-swiped":xt,"data-removed":he,"data-visible":vu,"data-y-position":yu,"data-x-position":Aa,"data-index":y,"data-front":Oa,"data-swiping":se,"data-dismissible":Nt,"data-type":bt,"data-invert":wu,"data-swipe-out":Re,"data-swipe-direction":ge,"data-expanded":!!(_||R&&$),style:{"--index":y,"--toasts-before":y,"--z-index":S.length-y,"--offset":`${he?xn:ar.current}px`,"--initial-height":R?"auto":`${bn}px`,...T,...h.style},onDragEnd:()=>{Z(!1),Y(null),Un.current=null},onPointerDown:K=>{Ue||!Nt||(Qr.current=new Date,or(ar.current),K.target.setPointerCapture(K.pointerId),K.target.tagName!=="BUTTON"&&(Z(!0),Un.current={x:K.clientX,y:K.clientY}))},onPointerUp:()=>{var K,ne,ie,Ie;if(Re||!Nt)return;Un.current=null;let Qe=Number(((K=_n.current)==null?void 0:K.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),xe=Number(((ne=_n.current)==null?void 0:ne.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ot=new Date().getTime()-((ie=Qr.current)==null?void 0:ie.getTime()),De=Q==="x"?Qe:xe,Ye=Math.abs(De)/ot;if(Math.abs(De)>=Xk||Ye>.11){or(ar.current),(Ie=h.onDismiss)==null||Ie.call(h,h),ce(Q==="x"?Qe>0?"right":"left":xe>0?"down":"up"),Ae(),Oe(!0),ft(!1);return}Z(!1),Y(null)},onPointerMove:K=>{var ne,ie,Ie,Qe;if(!Un.current||!Nt||((ne=window.getSelection())==null?void 0:ne.toString().length)>0)return;let xe=K.clientY-Un.current.y,ot=K.clientX-Un.current.x,De=(ie=e.swipeDirections)!=null?ie:eT(H);!Q&&(Math.abs(ot)>1||Math.abs(xe)>1)&&Y(Math.abs(ot)>Math.abs(xe)?"x":"y");let Ye={x:0,y:0};Q==="y"?(De.includes("top")||De.includes("bottom"))&&(De.includes("top")&&xe<0||De.includes("bottom")&&xe>0)&&(Ye.y=xe):Q==="x"&&(De.includes("left")||De.includes("right"))&&(De.includes("left")&&ot<0||De.includes("right")&&ot>0)&&(Ye.x=ot),(Math.abs(Ye.x)>0||Math.abs(Ye.y)>0)&&ft(!0),(Ie=_n.current)==null||Ie.style.setProperty("--swipe-amount-x",`${Ye.x}px`),(Qe=_n.current)==null||Qe.style.setProperty("--swipe-amount-y",`${Ye.y}px`)}},En&&!h.jsx?D.createElement("button",{"aria-label":q,"data-disabled":Ue,"data-close-button":!0,onClick:Ue||!Nt?()=>{}:()=>{var K;Ae(),(K=h.onDismiss)==null||K.call(h,h)},className:en(P==null?void 0:P.closeButton,(s=h==null?void 0:h.classNames)==null?void 0:s.closeButton)},(o=M==null?void 0:M.close)!=null?o:$k):null,h.jsx||f.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:D.createElement(D.Fragment,null,bt||h.icon||h.promise?D.createElement("div",{"data-icon":"",className:en(P==null?void 0:P.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||ht():null,h.type!=="loading"?h.icon||(M==null?void 0:M[bt])||Nk(bt):null):null,D.createElement("div",{"data-content":"",className:en(P==null?void 0:P.content,(a=h==null?void 0:h.classNames)==null?void 0:a.content)},D.createElement("div",{"data-title":"",className:en(P==null?void 0:P.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},typeof h.title=="function"?h.title():h.title),h.description?D.createElement("div",{"data-description":"",className:en(F,Yr,P==null?void 0:P.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),f.isValidElement(h.cancel)?h.cancel:h.cancel&&nl(h.cancel)?D.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||N,onClick:K=>{var ne,ie;nl(h.cancel)&&Nt&&((ie=(ne=h.cancel).onClick)==null||ie.call(ne,K),Ae())},className:en(P==null?void 0:P.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,f.isValidElement(h.action)?h.action:h.action&&nl(h.action)?D.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||j,onClick:K=>{var ne,ie;nl(h.action)&&((ie=(ne=h.action).onClick)==null||ie.call(ne,K),!K.defaultPrevented&&Ae())},className:en(P==null?void 0:P.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function sg(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function nT(e,t){let n={};return[e,t].forEach((r,s)=>{let o=s===1,i=o?"--mobile-offset":"--offset",a=o?Qk:Gk;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${i}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${i}-${c}`]=a:n[`${i}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}var rT=f.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:o,closeButton:i,className:a,offset:l,mobileOffset:c,theme:u="light",richColors:d,duration:m,style:h,visibleToasts:b=Kk,toastOptions:v,dir:x=sg(),gap:w=Jk,loadingIcon:g,icons:y,containerAriaLabel:S="Notifications",pauseWhenPageIsHidden:_}=e,[E,C]=D.useState([]),k=D.useMemo(()=>Array.from(new Set([r].concat(E.filter(U=>U.position).map(U=>U.position)))),[E,r]),[T,N]=D.useState([]),[j,A]=D.useState(!1),[F,I]=D.useState(!1),[H,z]=D.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),B=D.useRef(null),R=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),P=D.useRef(null),M=D.useRef(!1),q=D.useCallback(U=>{C(Q=>{var Y;return(Y=Q.find(ge=>ge.id===U.id))!=null&&Y.delete||_t.dismiss(U.id),Q.filter(({id:ge})=>ge!==U.id)})},[]);return D.useEffect(()=>_t.subscribe(U=>{if(U.dismiss){C(Q=>Q.map(Y=>Y.id===U.id?{...Y,delete:!0}:Y));return}setTimeout(()=>{zw.flushSync(()=>{C(Q=>{let Y=Q.findIndex(ge=>ge.id===U.id);return Y!==-1?[...Q.slice(0,Y),{...Q[Y],...U},...Q.slice(Y+1)]:[U,...Q]})})})}),[]),D.useEffect(()=>{if(u!=="system"){z(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;let U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:Q})=>{z(Q?"dark":"light")})}catch{U.addListener(({matches:Y})=>{try{z(Y?"dark":"light")}catch(ge){console.error(ge)}})}},[u]),D.useEffect(()=>{E.length<=1&&A(!1)},[E]),D.useEffect(()=>{let U=Q=>{var Y,ge;s.every(ce=>Q[ce]||Q.code===ce)&&(A(!0),(Y=B.current)==null||Y.focus()),Q.code==="Escape"&&(document.activeElement===B.current||(ge=B.current)!=null&&ge.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[s]),D.useEffect(()=>{if(B.current)return()=>{P.current&&(P.current.focus({preventScroll:!0}),P.current=null,M.current=!1)}},[B.current]),D.createElement("section",{ref:t,"aria-label":`${S} ${R}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},k.map((U,Q)=>{var Y;let[ge,ce]=U.split("-");return E.length?D.createElement("ol",{key:U,dir:x==="auto"?sg():x,tabIndex:-1,ref:B,className:a,"data-sonner-toaster":!0,"data-theme":H,"data-y-position":ge,"data-lifted":j&&E.length>1&&!o,"data-x-position":ce,style:{"--front-toast-height":`${((Y=T[0])==null?void 0:Y.height)||0}px`,"--width":`${Yk}px`,"--gap":`${w}px`,...h,...nT(l,c)},onBlur:$=>{M.current&&!$.currentTarget.contains($.relatedTarget)&&(M.current=!1,P.current&&(P.current.focus({preventScroll:!0}),P.current=null))},onFocus:$=>{$.target instanceof HTMLElement&&$.target.dataset.dismissible==="false"||M.current||(M.current=!0,P.current=$.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{F||A(!1)},onDragEnd:()=>A(!1),onPointerDown:$=>{$.target instanceof HTMLElement&&$.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},E.filter($=>!$.position&&Q===0||$.position===U).map(($,oe)=>{var he,V;return D.createElement(tT,{key:$.id,icons:y,index:oe,toast:$,defaultRichColors:d,duration:(he=v==null?void 0:v.duration)!=null?he:m,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:n,visibleToasts:b,closeButton:(V=v==null?void 0:v.closeButton)!=null?V:i,interacting:F,position:U,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,removeToast:q,toasts:E.filter(se=>se.position==$.position),heights:T.filter(se=>se.position==$.position),setHeights:N,expandByDefault:o,gap:w,loadingIcon:g,expanded:j,pauseWhenPageIsHidden:_,swipeDirections:e.swipeDirections})})):null}))});const sT=({...e})=>{const{theme:t="system"}=jk();return p.jsx(rT,{theme:t,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})};var oT=eh[" useId ".trim().toString()]||(()=>{}),iT=0;function ho(e){const[t,n]=f.useState(oT());return st(()=>{n(r=>r??String(iT++))},[e]),t?`radix-${t}`:""}const aT=["top","right","bottom","left"],zr=Math.min,Dt=Math.max,nc=Math.round,rl=Math.floor,Ln=e=>({x:e,y:e}),lT={left:"right",right:"left",bottom:"top",top:"bottom"},cT={start:"end",end:"start"};function xf(e,t,n){return Dt(e,zr(t,n))}function nr(e,t){return typeof e=="function"?e(t):e}function rr(e){return e.split("-")[0]}function Vo(e){return e.split("-")[1]}function Xh(e){return e==="x"?"y":"x"}function Zh(e){return e==="y"?"height":"width"}const uT=new Set(["top","bottom"]);function An(e){return uT.has(rr(e))?"y":"x"}function ep(e){return Xh(An(e))}function dT(e,t,n){n===void 0&&(n=!1);const r=Vo(e),s=ep(e),o=Zh(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=rc(i)),[i,rc(i)]}function fT(e){const t=rc(e);return[bf(e),t,bf(t)]}function bf(e){return e.replace(/start|end/g,t=>cT[t])}const og=["left","right"],ig=["right","left"],hT=["top","bottom"],pT=["bottom","top"];function mT(e,t,n){switch(e){case"top":case"bottom":return n?t?ig:og:t?og:ig;case"left":case"right":return t?hT:pT;default:return[]}}function gT(e,t,n,r){const s=Vo(e);let o=mT(rr(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(bf)))),o}function rc(e){return e.replace(/left|right|bottom|top/g,t=>lT[t])}function vT(e){return{top:0,right:0,bottom:0,left:0,...e}}function O0(e){return typeof e!="number"?vT(e):{top:e,right:e,bottom:e,left:e}}function sc(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function ag(e,t,n){let{reference:r,floating:s}=e;const o=An(t),i=ep(t),a=Zh(i),l=rr(t),c=o==="y",u=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,m=r[a]/2-s[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-s.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Vo(t)){case"start":h[i]-=m*(n&&c?-1:1);break;case"end":h[i]+=m*(n&&c?-1:1);break}return h}const yT=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=o.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=ag(c,r,l),m=r,h={},b=0;for(let v=0;v<a.length;v++){const{name:x,fn:w}=a[v],{x:g,y,data:S,reset:_}=await w({x:u,y:d,initialPlacement:r,placement:m,strategy:s,middlewareData:h,rects:c,platform:i,elements:{reference:e,floating:t}});u=g??u,d=y??d,h={...h,[x]:{...h[x],...S}},_&&b<=50&&(b++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(c=_.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):_.rects),{x:u,y:d}=ag(c,m,l)),v=-1)}return{x:u,y:d,placement:m,strategy:s,middlewareData:h}};async function na(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:h=0}=nr(t,e),b=O0(h),x=a[m?d==="floating"?"reference":"floating":d],w=sc(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),g=d==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),S=await(o.isElement==null?void 0:o.isElement(y))?await(o.getScale==null?void 0:o.getScale(y))||{x:1,y:1}:{x:1,y:1},_=sc(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:y,strategy:l}):g);return{top:(w.top-_.top+b.top)/S.y,bottom:(_.bottom-w.bottom+b.bottom)/S.y,left:(w.left-_.left+b.left)/S.x,right:(_.right-w.right+b.right)/S.x}}const wT=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=nr(e,t)||{};if(c==null)return{};const d=O0(u),m={x:n,y:r},h=ep(s),b=Zh(h),v=await i.getDimensions(c),x=h==="y",w=x?"top":"left",g=x?"bottom":"right",y=x?"clientHeight":"clientWidth",S=o.reference[b]+o.reference[h]-m[h]-o.floating[b],_=m[h]-o.reference[h],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let C=E?E[y]:0;(!C||!await(i.isElement==null?void 0:i.isElement(E)))&&(C=a.floating[y]||o.floating[b]);const k=S/2-_/2,T=C/2-v[b]/2-1,N=zr(d[w],T),j=zr(d[g],T),A=N,F=C-v[b]-j,I=C/2-v[b]/2+k,H=xf(A,I,F),z=!l.arrow&&Vo(s)!=null&&I!==H&&o.reference[b]/2-(I<A?N:j)-v[b]/2<0,B=z?I<A?I-A:I-F:0;return{[h]:m[h]+B,data:{[h]:H,centerOffset:I-H-B,...z&&{alignmentOffset:B}},reset:z}}}),xT=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...x}=nr(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=rr(s),g=An(a),y=rr(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),_=m||(y||!v?[rc(a)]:fT(a)),E=b!=="none";!m&&E&&_.push(...gT(a,v,b,S));const C=[a,..._],k=await na(t,x),T=[];let N=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&T.push(k[w]),d){const I=dT(s,i,S);T.push(k[I[0]],k[I[1]])}if(N=[...N,{placement:s,overflows:T}],!T.every(I=>I<=0)){var j,A;const I=(((j=o.flip)==null?void 0:j.index)||0)+1,H=C[I];if(H&&(!(d==="alignment"?g!==An(H):!1)||N.every(R=>R.overflows[0]>0&&An(R.placement)===g)))return{data:{index:I,overflows:N},reset:{placement:H}};let z=(A=N.filter(B=>B.overflows[0]<=0).sort((B,R)=>B.overflows[1]-R.overflows[1])[0])==null?void 0:A.placement;if(!z)switch(h){case"bestFit":{var F;const B=(F=N.filter(R=>{if(E){const P=An(R.placement);return P===g||P==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(P=>P>0).reduce((P,M)=>P+M,0)]).sort((R,P)=>R[1]-P[1])[0])==null?void 0:F[0];B&&(z=B);break}case"initialPlacement":z=a;break}if(s!==z)return{reset:{placement:z}}}return{}}}};function lg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function cg(e){return aT.some(t=>e[t]>=0)}const bT=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=nr(e,t);switch(r){case"referenceHidden":{const o=await na(t,{...s,elementContext:"reference"}),i=lg(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:cg(i)}}}case"escaped":{const o=await na(t,{...s,altBoundary:!0}),i=lg(o,n.floating);return{data:{escapedOffsets:i,escaped:cg(i)}}}default:return{}}}}},A0=new Set(["left","top"]);async function ST(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=rr(n),a=Vo(n),l=An(n)==="y",c=A0.has(i)?-1:1,u=o&&l?-1:1,d=nr(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof b=="number"&&(h=a==="end"?b*-1:b),l?{x:h*u,y:m*c}:{x:m*c,y:h*u}}const _T=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:a}=t,l=await ST(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:i}}}}},ET=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:x=>{let{x:w,y:g}=x;return{x:w,y:g}}},...l}=nr(e,t),c={x:n,y:r},u=await na(t,l),d=An(rr(s)),m=Xh(d);let h=c[m],b=c[d];if(o){const x=m==="y"?"top":"left",w=m==="y"?"bottom":"right",g=h+u[x],y=h-u[w];h=xf(g,h,y)}if(i){const x=d==="y"?"top":"left",w=d==="y"?"bottom":"right",g=b+u[x],y=b-u[w];b=xf(g,b,y)}const v=a.fn({...t,[m]:h,[d]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:o,[d]:i}}}}}},CT=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=nr(e,t),u={x:n,y:r},d=An(s),m=Xh(d);let h=u[m],b=u[d];const v=nr(a,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const y=m==="y"?"height":"width",S=o.reference[m]-o.floating[y]+x.mainAxis,_=o.reference[m]+o.reference[y]-x.mainAxis;h<S?h=S:h>_&&(h=_)}if(c){var w,g;const y=m==="y"?"width":"height",S=A0.has(rr(s)),_=o.reference[d]-o.floating[y]+(S&&((w=i.offset)==null?void 0:w[d])||0)+(S?0:x.crossAxis),E=o.reference[d]+o.reference[y]+(S?0:((g=i.offset)==null?void 0:g[d])||0)-(S?x.crossAxis:0);b<_?b=_:b>E&&(b=E)}return{[m]:h,[d]:b}}}},kT=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:l=()=>{},...c}=nr(e,t),u=await na(t,c),d=rr(s),m=Vo(s),h=An(s)==="y",{width:b,height:v}=o.floating;let x,w;d==="top"||d==="bottom"?(x=d,w=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=d,x=m==="end"?"top":"bottom");const g=v-u.top-u.bottom,y=b-u.left-u.right,S=zr(v-u[x],g),_=zr(b-u[w],y),E=!t.middlewareData.shift;let C=S,k=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=g),E&&!m){const N=Dt(u.left,0),j=Dt(u.right,0),A=Dt(u.top,0),F=Dt(u.bottom,0);h?k=b-2*(N!==0||j!==0?N+j:Dt(u.left,u.right)):C=v-2*(A!==0||F!==0?A+F:Dt(u.top,u.bottom))}await l({...t,availableWidth:k,availableHeight:C});const T=await i.getDimensions(a.floating);return b!==T.width||v!==T.height?{reset:{rects:!0}}:{}}}};function Uc(){return typeof window<"u"}function Ho(e){return I0(e)?(e.nodeName||"").toLowerCase():"#document"}function $t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fn(e){var t;return(t=(I0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function I0(e){return Uc()?e instanceof Node||e instanceof $t(e).Node:!1}function gn(e){return Uc()?e instanceof Element||e instanceof $t(e).Element:!1}function Mn(e){return Uc()?e instanceof HTMLElement||e instanceof $t(e).HTMLElement:!1}function ug(e){return!Uc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $t(e).ShadowRoot}const TT=new Set(["inline","contents"]);function _a(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=vn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!TT.has(s)}const RT=new Set(["table","td","th"]);function PT(e){return RT.has(Ho(e))}const jT=[":popover-open",":modal"];function zc(e){return jT.some(t=>{try{return e.matches(t)}catch{return!1}})}const NT=["transform","translate","scale","rotate","perspective"],OT=["transform","translate","scale","rotate","perspective","filter"],AT=["paint","layout","strict","content"];function tp(e){const t=np(),n=gn(e)?vn(e):e;return NT.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||OT.some(r=>(n.willChange||"").includes(r))||AT.some(r=>(n.contain||"").includes(r))}function IT(e){let t=Br(e);for(;Mn(t)&&!Do(t);){if(tp(t))return t;if(zc(t))return null;t=Br(t)}return null}function np(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const DT=new Set(["html","body","#document"]);function Do(e){return DT.has(Ho(e))}function vn(e){return $t(e).getComputedStyle(e)}function Bc(e){return gn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Br(e){if(Ho(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ug(e)&&e.host||Fn(e);return ug(t)?t.host:t}function D0(e){const t=Br(e);return Do(t)?e.ownerDocument?e.ownerDocument.body:e.body:Mn(t)&&_a(t)?t:D0(t)}function ra(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=D0(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=$t(s);if(o){const a=Sf(i);return t.concat(i,i.visualViewport||[],_a(s)?s:[],a&&n?ra(a):[])}return t.concat(s,ra(s,[],n))}function Sf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L0(e){const t=vn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Mn(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=nc(n)!==o||nc(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function rp(e){return gn(e)?e:e.contextElement}function po(e){const t=rp(e);if(!Mn(t))return Ln(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=L0(t);let i=(o?nc(n.width):n.width)/r,a=(o?nc(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const LT=Ln(0);function M0(e){const t=$t(e);return!np()||!t.visualViewport?LT:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function MT(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==$t(e)?!1:t}function Es(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=rp(e);let i=Ln(1);t&&(r?gn(r)&&(i=po(r)):i=po(e));const a=MT(o,n,r)?M0(o):Ln(0);let l=(s.left+a.x)/i.x,c=(s.top+a.y)/i.y,u=s.width/i.x,d=s.height/i.y;if(o){const m=$t(o),h=r&&gn(r)?$t(r):r;let b=m,v=Sf(b);for(;v&&r&&h!==b;){const x=po(v),w=v.getBoundingClientRect(),g=vn(v),y=w.left+(v.clientLeft+parseFloat(g.paddingLeft))*x.x,S=w.top+(v.clientTop+parseFloat(g.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,d*=x.y,l+=y,c+=S,b=$t(v),v=Sf(b)}}return sc({width:u,height:d,x:l,y:c})}function sp(e,t){const n=Bc(e).scrollLeft;return t?t.left+n:Es(Fn(e)).left+n}function $0(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:sp(e,r)),o=r.top+t.scrollTop;return{x:s,y:o}}function $T(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=Fn(r),a=t?zc(t.floating):!1;if(r===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Ln(1);const u=Ln(0),d=Mn(r);if((d||!d&&!o)&&((Ho(r)!=="body"||_a(i))&&(l=Bc(r)),Mn(r))){const h=Es(r);c=po(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const m=i&&!d&&!o?$0(i,l,!0):Ln(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-l.scrollTop*c.y+u.y+m.y}}function FT(e){return Array.from(e.getClientRects())}function UT(e){const t=Fn(e),n=Bc(e),r=e.ownerDocument.body,s=Dt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Dt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+sp(e);const a=-n.scrollTop;return vn(r).direction==="rtl"&&(i+=Dt(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}function zT(e,t){const n=$t(e),r=Fn(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,a=0,l=0;if(s){o=s.width,i=s.height;const c=np();(!c||c&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:o,height:i,x:a,y:l}}const BT=new Set(["absolute","fixed"]);function WT(e,t){const n=Es(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Mn(e)?po(e):Ln(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,l=s*o.x,c=r*o.y;return{width:i,height:a,x:l,y:c}}function dg(e,t,n){let r;if(t==="viewport")r=zT(e,n);else if(t==="document")r=UT(Fn(e));else if(gn(t))r=WT(t,n);else{const s=M0(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return sc(r)}function F0(e,t){const n=Br(e);return n===t||!gn(n)||Do(n)?!1:vn(n).position==="fixed"||F0(n,t)}function VT(e,t){const n=t.get(e);if(n)return n;let r=ra(e,[],!1).filter(a=>gn(a)&&Ho(a)!=="body"),s=null;const o=vn(e).position==="fixed";let i=o?Br(e):e;for(;gn(i)&&!Do(i);){const a=vn(i),l=tp(i);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&!!s&&BT.has(s.position)||_a(i)&&!l&&F0(e,i))?r=r.filter(u=>u!==i):s=a,i=Br(i)}return t.set(e,r),r}function HT(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?zc(t)?[]:VT(t,this._c):[].concat(n),r],a=i[0],l=i.reduce((c,u)=>{const d=dg(t,u,s);return c.top=Dt(d.top,c.top),c.right=zr(d.right,c.right),c.bottom=zr(d.bottom,c.bottom),c.left=Dt(d.left,c.left),c},dg(t,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function qT(e){const{width:t,height:n}=L0(e);return{width:t,height:n}}function KT(e,t,n){const r=Mn(t),s=Fn(t),o=n==="fixed",i=Es(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Ln(0);function c(){l.x=sp(s)}if(r||!r&&!o)if((Ho(t)!=="body"||_a(s))&&(a=Bc(t)),r){const h=Es(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else s&&c();o&&!r&&s&&c();const u=s&&!r&&!o?$0(s,a):Ln(0),d=i.left+a.scrollLeft-l.x-u.x,m=i.top+a.scrollTop-l.y-u.y;return{x:d,y:m,width:i.width,height:i.height}}function Xu(e){return vn(e).position==="static"}function fg(e,t){if(!Mn(e)||vn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Fn(e)===n&&(n=n.ownerDocument.body),n}function U0(e,t){const n=$t(e);if(zc(e))return n;if(!Mn(e)){let s=Br(e);for(;s&&!Do(s);){if(gn(s)&&!Xu(s))return s;s=Br(s)}return n}let r=fg(e,t);for(;r&&PT(r)&&Xu(r);)r=fg(r,t);return r&&Do(r)&&Xu(r)&&!tp(r)?n:r||IT(e)||n}const GT=async function(e){const t=this.getOffsetParent||U0,n=this.getDimensions,r=await n(e.floating);return{reference:KT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function QT(e){return vn(e).direction==="rtl"}const YT={convertOffsetParentRelativeRectToViewportRelativeRect:$T,getDocumentElement:Fn,getClippingRect:HT,getOffsetParent:U0,getElementRects:GT,getClientRects:FT,getDimensions:qT,getScale:po,isElement:gn,isRTL:QT};function z0(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function JT(e,t){let n=null,r;const s=Fn(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=e.getBoundingClientRect(),{left:u,top:d,width:m,height:h}=c;if(a||t(),!m||!h)return;const b=rl(d),v=rl(s.clientWidth-(u+m)),x=rl(s.clientHeight-(d+h)),w=rl(u),y={rootMargin:-b+"px "+-v+"px "+-x+"px "+-w+"px",threshold:Dt(0,zr(1,l))||1};let S=!0;function _(E){const C=E[0].intersectionRatio;if(C!==l){if(!S)return i();C?i(!1,C):r=setTimeout(()=>{i(!1,1e-7)},1e3)}C===1&&!z0(c,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(_,{...y,root:s.ownerDocument})}catch{n=new IntersectionObserver(_,y)}n.observe(e)}return i(!0),o}function XT(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=rp(e),u=s||o?[...c?ra(c):[],...ra(t)]:[];u.forEach(w=>{s&&w.addEventListener("scroll",n,{passive:!0}),o&&w.addEventListener("resize",n)});const d=c&&a?JT(c,n):null;let m=-1,h=null;i&&(h=new ResizeObserver(w=>{let[g]=w;g&&g.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let b,v=l?Es(e):null;l&&x();function x(){const w=Es(e);v&&!z0(v,w)&&n(),v=w,b=requestAnimationFrame(x)}return n(),()=>{var w;u.forEach(g=>{s&&g.removeEventListener("scroll",n),o&&g.removeEventListener("resize",n)}),d==null||d(),(w=h)==null||w.disconnect(),h=null,l&&cancelAnimationFrame(b)}}const ZT=_T,eR=ET,tR=xT,nR=kT,rR=bT,hg=wT,sR=CT,oR=(e,t,n)=>{const r=new Map,s={platform:YT,...n},o={...s.platform,_c:r};return yT(e,t,{...s,platform:o})};var iR=typeof document<"u",aR=function(){},Rl=iR?f.useLayoutEffect:aR;function oc(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 n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!oc(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!oc(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function B0(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pg(e,t){const n=B0(e);return Math.round(t*n)/n}function Zu(e){const t=f.useRef(e);return Rl(()=>{t.current=e}),t}function lR(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=f.useState(r);oc(m,r)||h(r);const[b,v]=f.useState(null),[x,w]=f.useState(null),g=f.useCallback(R=>{R!==E.current&&(E.current=R,v(R))},[]),y=f.useCallback(R=>{R!==C.current&&(C.current=R,w(R))},[]),S=o||b,_=i||x,E=f.useRef(null),C=f.useRef(null),k=f.useRef(u),T=l!=null,N=Zu(l),j=Zu(s),A=Zu(c),F=f.useCallback(()=>{if(!E.current||!C.current)return;const R={placement:t,strategy:n,middleware:m};j.current&&(R.platform=j.current),oR(E.current,C.current,R).then(P=>{const M={...P,isPositioned:A.current!==!1};I.current&&!oc(k.current,M)&&(k.current=M,Kt.flushSync(()=>{d(M)}))})},[m,t,n,j,A]);Rl(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[c]);const I=f.useRef(!1);Rl(()=>(I.current=!0,()=>{I.current=!1}),[]),Rl(()=>{if(S&&(E.current=S),_&&(C.current=_),S&&_){if(N.current)return N.current(S,_,F);F()}},[S,_,F,N,T]);const H=f.useMemo(()=>({reference:E,floating:C,setReference:g,setFloating:y}),[g,y]),z=f.useMemo(()=>({reference:S,floating:_}),[S,_]),B=f.useMemo(()=>{const R={position:n,left:0,top:0};if(!z.floating)return R;const P=pg(z.floating,u.x),M=pg(z.floating,u.y);return a?{...R,transform:"translate("+P+"px, "+M+"px)",...B0(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:M}},[n,a,z.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:F,refs:H,elements:z,floatingStyles:B}),[u,F,H,z,B])}const cR=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?hg({element:r.current,padding:s}).fn(n):{}:r?hg({element:r,padding:s}).fn(n):{}}}},uR=(e,t)=>({...ZT(e),options:[e,t]}),dR=(e,t)=>({...eR(e),options:[e,t]}),fR=(e,t)=>({...sR(e),options:[e,t]}),hR=(e,t)=>({...tR(e),options:[e,t]}),pR=(e,t)=>({...nR(e),options:[e,t]}),mR=(e,t)=>({...rR(e),options:[e,t]}),gR=(e,t)=>({...cR(e),options:[e,t]});var vR="Arrow",W0=f.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return p.jsx(le.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});W0.displayName=vR;var yR=W0;function V0(e){const[t,n]=f.useState(void 0);return st(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,a;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;i=c.inlineSize,a=c.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var op="Popper",[H0,Wc]=js(op),[wR,q0]=H0(op),K0=e=>{const{__scopePopper:t,children:n}=e,[r,s]=f.useState(null);return p.jsx(wR,{scope:t,anchor:r,onAnchorChange:s,children:n})};K0.displayName=op;var G0="PopperAnchor",Q0=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=q0(G0,n),i=f.useRef(null),a=we(t,i);return f.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:p.jsx(le.div,{...s,ref:a})});Q0.displayName=G0;var ip="PopperContent",[xR,bR]=H0(ip),Y0=f.forwardRef((e,t)=>{var $,oe,he,V,se,Z;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:b,...v}=e,x=q0(ip,n),[w,g]=f.useState(null),y=we(t,Re=>g(Re)),[S,_]=f.useState(null),E=V0(S),C=(E==null?void 0:E.width)??0,k=(E==null?void 0:E.height)??0,T=r+(o!=="center"?"-"+o:""),N=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},j=Array.isArray(c)?c:[c],A=j.length>0,F={padding:N,boundary:j.filter(_R),altBoundary:A},{refs:I,floatingStyles:H,placement:z,isPositioned:B,middlewareData:R}=lR({strategy:"fixed",placement:T,whileElementsMounted:(...Re)=>XT(...Re,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[uR({mainAxis:s+k,alignmentAxis:i}),l&&dR({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?fR():void 0,...F}),l&&hR({...F}),pR({...F,apply:({elements:Re,rects:Oe,availableWidth:xt,availableHeight:ft})=>{const{width:xn,height:or}=Oe.reference,bn=Re.floating.style;bn.setProperty("--radix-popper-available-width",`${xt}px`),bn.setProperty("--radix-popper-available-height",`${ft}px`),bn.setProperty("--radix-popper-anchor-width",`${xn}px`),bn.setProperty("--radix-popper-anchor-height",`${or}px`)}}),S&&gR({element:S,padding:a}),ER({arrowWidth:C,arrowHeight:k}),m&&mR({strategy:"referenceHidden",...F})]}),[P,M]=Z0(z),q=mn(b);st(()=>{B&&(q==null||q())},[B,q]);const U=($=R.arrow)==null?void 0:$.x,Q=(oe=R.arrow)==null?void 0:oe.y,Y=((he=R.arrow)==null?void 0:he.centerOffset)!==0,[ge,ce]=f.useState();return st(()=>{w&&ce(window.getComputedStyle(w).zIndex)},[w]),p.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:B?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(V=R.transformOrigin)==null?void 0:V.x,(se=R.transformOrigin)==null?void 0:se.y].join(" "),...((Z=R.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(xR,{scope:n,placedSide:P,onArrowChange:_,arrowX:U,arrowY:Q,shouldHideArrow:Y,children:p.jsx(le.div,{"data-side":P,"data-align":M,...v,ref:y,style:{...v.style,animation:B?void 0:"none"}})})})});Y0.displayName=ip;var J0="PopperArrow",SR={top:"bottom",right:"left",bottom:"top",left:"right"},X0=f.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=bR(J0,r),i=SR[o.placedSide];return p.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:p.jsx(yR,{...s,ref:n,style:{...s.style,display:"block"}})})});X0.displayName=J0;function _R(e){return e!==null}var ER=e=>({name:"transformOrigin",options:e,fn(t){var x,w,g;const{placement:n,rects:r,middlewareData:s}=t,i=((x=s.arrow)==null?void 0:x.centerOffset)!==0,a=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[c,u]=Z0(n),d={start:"0%",center:"50%",end:"100%"}[u],m=(((w=s.arrow)==null?void 0:w.x)??0)+a/2,h=(((g=s.arrow)==null?void 0:g.y)??0)+l/2;let b="",v="";return c==="bottom"?(b=i?d:`${m}px`,v=`${-l}px`):c==="top"?(b=i?d:`${m}px`,v=`${r.floating.height+l}px`):c==="right"?(b=`${-l}px`,v=i?d:`${h}px`):c==="left"&&(b=`${r.floating.width+l}px`,v=i?d:`${h}px`),{data:{x:b,y:v}}}});function Z0(e){const[t,n="center"]=e.split("-");return[t,n]}var CR=K0,ex=Q0,tx=Y0,nx=X0,[Vc,D2]=js("Tooltip",[Wc]),ap=Wc(),rx="TooltipProvider",kR=700,mg="tooltip.open",[TR,sx]=Vc(rx),ox=e=>{const{__scopeTooltip:t,delayDuration:n=kR,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,i=f.useRef(!0),a=f.useRef(!1),l=f.useRef(0);return f.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),p.jsx(TR,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(l.current),i.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:f.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:o})};ox.displayName=rx;var ix="Tooltip",[L2,Hc]=Vc(ix),_f="TooltipTrigger",RR=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Hc(_f,n),o=sx(_f,n),i=ap(n),a=f.useRef(null),l=we(t,a,s.onTriggerChange),c=f.useRef(!1),u=f.useRef(!1),d=f.useCallback(()=>c.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx(ex,{asChild:!0,...i,children:p.jsx(le.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:te(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:te(e.onPointerDown,()=>{s.open&&s.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:te(e.onFocus,()=>{c.current||s.onOpen()}),onBlur:te(e.onBlur,s.onClose),onClick:te(e.onClick,s.onClose)})})});RR.displayName=_f;var PR="TooltipPortal",[M2,jR]=Vc(PR,{forceMount:void 0}),Lo="TooltipContent",ax=f.forwardRef((e,t)=>{const n=jR(Lo,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,i=Hc(Lo,e.__scopeTooltip);return p.jsx(Bo,{present:r||i.open,children:i.disableHoverableContent?p.jsx(lx,{side:s,...o,ref:t}):p.jsx(NR,{side:s,...o,ref:t})})}),NR=f.forwardRef((e,t)=>{const n=Hc(Lo,e.__scopeTooltip),r=sx(Lo,e.__scopeTooltip),s=f.useRef(null),o=we(t,s),[i,a]=f.useState(null),{trigger:l,onClose:c}=n,u=s.current,{onPointerInTransitChange:d}=r,m=f.useCallback(()=>{a(null),d(!1)},[d]),h=f.useCallback((b,v)=>{const x=b.currentTarget,w={x:b.clientX,y:b.clientY},g=LR(w,x.getBoundingClientRect()),y=MR(w,g),S=$R(v.getBoundingClientRect()),_=UR([...y,...S]);a(_),d(!0)},[d]);return f.useEffect(()=>()=>m(),[m]),f.useEffect(()=>{if(l&&u){const b=x=>h(x,u),v=x=>h(x,l);return l.addEventListener("pointerleave",b),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",b),u.removeEventListener("pointerleave",v)}}},[l,u,h,m]),f.useEffect(()=>{if(i){const b=v=>{const x=v.target,w={x:v.clientX,y:v.clientY},g=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),y=!FR(w,i);g?m():y&&(m(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,u,i,c,m]),p.jsx(lx,{...e,ref:o})}),[OR,AR]=Vc(ix,{isInside:!1}),IR=HE("TooltipContent"),lx=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,l=Hc(Lo,n),c=ap(n),{onClose:u}=l;return f.useEffect(()=>(document.addEventListener(mg,u),()=>document.removeEventListener(mg,u)),[u]),f.useEffect(()=>{if(l.trigger){const d=m=>{const h=m.target;h!=null&&h.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),p.jsx(ba,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:p.jsxs(tx,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(IR,{children:r}),p.jsx(OR,{scope:n,isInside:!0,children:p.jsx(hC,{id:l.contentId,role:"tooltip",children:s||r})})]})})});ax.displayName=Lo;var cx="TooltipArrow",DR=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=ap(n);return AR(cx,n).isInside?null:p.jsx(nx,{...s,...r,ref:t})});DR.displayName=cx;function LR(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function MR(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function $R(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function FR(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],l=t[i],c=a.x,u=a.y,d=l.x,m=l.y;u>r!=m>r&&n<(d-c)*(r-u)/(m-u)+c&&(s=!s)}return s}function UR(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),zR(t)}function zR(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],i=n[n.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var BR=ox,ux=ax;const WR=BR,VR=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(ux,{ref:r,sideOffset:t,className:J("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...n}));VR.displayName=ux.displayName;var qc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Kc=typeof window>"u"||"Deno"in globalThis;function sn(){}function HR(e,t){return typeof e=="function"?e(t):e}function qR(e){return typeof e=="number"&&e>=0&&e!==1/0}function KR(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ef(e,t){return typeof e=="function"?e(t):e}function GR(e,t){return typeof e=="function"?e(t):e}function gg(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==lp(i,t.options))return!1}else if(!oa(t.queryKey,i))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||o&&!o(t))}function vg(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(sa(t.options.mutationKey)!==sa(o))return!1}else if(!oa(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function lp(e,t){return((t==null?void 0:t.queryKeyHashFn)||sa)(e)}function sa(e){return JSON.stringify(e,(t,n)=>Cf(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function oa(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>oa(e[n],t[n])):!1}function dx(e,t){if(e===t)return e;const n=yg(e)&&yg(t);if(n||Cf(e)&&Cf(t)){const r=n?e:Object.keys(e),s=r.length,o=n?t:Object.keys(t),i=o.length,a=n?[]:{},l=new Set(r);let c=0;for(let u=0;u<i;u++){const d=n?u:o[u];(!n&&l.has(d)||n)&&e[d]===void 0&&t[d]===void 0?(a[d]=void 0,c++):(a[d]=dx(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&c++)}return s===i&&c===s?e:a}return t}function yg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Cf(e){if(!wg(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!wg(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function wg(e){return Object.prototype.toString.call(e)==="[object Object]"}function QR(e){return new Promise(t=>{setTimeout(t,e)})}function YR(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?dx(e,t):t}function JR(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function XR(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var cp=Symbol();function fx(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===cp?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var cs,_r,wo,xv,ZR=(xv=class extends qc{constructor(){super();pe(this,cs);pe(this,_r);pe(this,wo);ee(this,wo,t=>{if(!Kc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,_r)||this.setEventListener(O(this,wo))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,_r))==null||t.call(this),ee(this,_r,void 0))}setEventListener(t){var n;ee(this,wo,t),(n=O(this,_r))==null||n.call(this),ee(this,_r,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,cs)!==t&&(ee(this,cs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,cs)=="boolean"?O(this,cs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},cs=new WeakMap,_r=new WeakMap,wo=new WeakMap,xv),hx=new ZR,xo,Er,bo,bv,eP=(bv=class extends qc{constructor(){super();pe(this,xo,!0);pe(this,Er);pe(this,bo);ee(this,bo,t=>{if(!Kc&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,Er)||this.setEventListener(O(this,bo))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Er))==null||t.call(this),ee(this,Er,void 0))}setEventListener(t){var n;ee(this,bo,t),(n=O(this,Er))==null||n.call(this),ee(this,Er,t(this.setOnline.bind(this)))}setOnline(t){O(this,xo)!==t&&(ee(this,xo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,xo)}},xo=new WeakMap,Er=new WeakMap,bo=new WeakMap,bv),ic=new eP;function tP(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}function nP(e){return Math.min(1e3*2**e,3e4)}function px(e){return(e??"online")==="online"?ic.isOnline():!0}var mx=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ed(e){return e instanceof mx}function gx(e){let t=!1,n=0,r=!1,s;const o=tP(),i=v=>{var x;r||(m(new mx(v)),(x=e.abort)==null||x.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>hx.isFocused()&&(e.networkMode==="always"||ic.isOnline())&&e.canRun(),u=()=>px(e.networkMode)&&e.canRun(),d=v=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,v),s==null||s(),o.resolve(v))},m=v=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,v),s==null||s(),o.reject(v))},h=()=>new Promise(v=>{var x;s=w=>{(r||c())&&v(w)},(x=e.onPause)==null||x.call(e)}).then(()=>{var v;s=void 0,r||(v=e.onContinue)==null||v.call(e)}),b=()=>{if(r)return;let v;const x=n===0?e.initialPromise:void 0;try{v=x??e.fn()}catch(w){v=Promise.reject(w)}Promise.resolve(v).then(d).catch(w=>{var E;if(r)return;const g=e.retry??(Kc?0:3),y=e.retryDelay??nP,S=typeof y=="function"?y(n,w):y,_=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,w);if(t||!_){m(w);return}n++,(E=e.onFail)==null||E.call(e,n,w),QR(S).then(()=>c()?void 0:h()).then(()=>{t?m(w):b()})})};return{promise:o,cancel:i,continue:()=>(s==null||s(),o),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?b():h().then(b),o)}}var rP=e=>setTimeout(e,0);function sP(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=rP;const o=a=>{t?e.push(a):s(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||i()}return l},batchCalls:a=>(...l)=>{o(()=>{a(...l)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var gt=sP(),us,Sv,vx=(Sv=class{constructor(){pe(this,us)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qR(this.gcTime)&&ee(this,us,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Kc?1/0:5*60*1e3))}clearGcTimeout(){O(this,us)&&(clearTimeout(O(this,us)),ee(this,us,void 0))}},us=new WeakMap,Sv),So,ds,Bt,fs,ct,pa,hs,on,Bn,_v,oP=(_v=class extends vx{constructor(t){super();pe(this,on);pe(this,So);pe(this,ds);pe(this,Bt);pe(this,fs);pe(this,ct);pe(this,pa);pe(this,hs);ee(this,hs,!1),ee(this,pa,t.defaultOptions),this.setOptions(t.options),this.observers=[],ee(this,fs,t.client),ee(this,Bt,O(this,fs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ee(this,So,aP(this.options)),this.state=t.state??O(this,So),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,ct))==null?void 0:t.promise}setOptions(t){this.options={...O(this,pa),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Bt).remove(this)}setData(t,n){const r=YR(this.state.data,t,this.options);return it(this,on,Bn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){it(this,on,Bn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=O(this,ct))==null?void 0:r.promise;return(s=O(this,ct))==null||s.cancel(t),n?n.then(sn).catch(sn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,So))}isActive(){return this.observers.some(t=>GR(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cp||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ef(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!KR(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,ct))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,ct))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Bt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,ct)&&(O(this,hs)?O(this,ct).cancel({revert:!0}):O(this,ct).cancelRetry()),this.scheduleGc()),O(this,Bt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||it(this,on,Bn).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,ct))return O(this,ct).continueRetry(),O(this,ct).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(h=>h.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,s=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(ee(this,hs,!0),r.signal)})},o=()=>{const m=fx(this.options,n),b=(()=>{const v={client:O(this,fs),queryKey:this.queryKey,meta:this.meta};return s(v),v})();return ee(this,hs,!1),this.options.persister?this.options.persister(m,b,this):m(b)},a=(()=>{const m={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,fs),state:this.state,fetchFn:o};return s(m),m})();(c=this.options.behavior)==null||c.onFetch(a,this),ee(this,ds,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&it(this,on,Bn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta});const l=m=>{var h,b,v,x;ed(m)&&m.silent||it(this,on,Bn).call(this,{type:"error",error:m}),ed(m)||((b=(h=O(this,Bt).config).onError)==null||b.call(h,m,this),(x=(v=O(this,Bt).config).onSettled)==null||x.call(v,this.state.data,m,this)),this.scheduleGc()};return ee(this,ct,gx({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var h,b,v,x;if(m===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(w){l(w);return}(b=(h=O(this,Bt).config).onSuccess)==null||b.call(h,m,this),(x=(v=O(this,Bt).config).onSettled)==null||x.call(v,m,this.state.error,this),this.scheduleGc()},onError:l,onFail:(m,h)=>{it(this,on,Bn).call(this,{type:"failed",failureCount:m,error:h})},onPause:()=>{it(this,on,Bn).call(this,{type:"pause"})},onContinue:()=>{it(this,on,Bn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),O(this,ct).start()}},So=new WeakMap,ds=new WeakMap,Bt=new WeakMap,fs=new WeakMap,ct=new WeakMap,pa=new WeakMap,hs=new WeakMap,on=new WeakSet,Bn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...iP(r.data,this.options),fetchMeta:t.meta??null};case"success":return ee(this,ds,void 0),{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return ed(s)&&s.revert&&O(this,ds)?{...O(this,ds),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),gt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,Bt).notify({query:this,type:"updated",action:t})})},_v);function iP(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:px(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function aP(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Rn,Ev,lP=(Ev=class extends qc{constructor(t={}){super();pe(this,Rn);this.config=t,ee(this,Rn,new Map)}build(t,n,r){const s=n.queryKey,o=n.queryHash??lp(s,n);let i=this.get(o);return i||(i=new oP({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(i)),i}add(t){O(this,Rn).has(t.queryHash)||(O(this,Rn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,Rn).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,Rn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){gt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,Rn).get(t)}getAll(){return[...O(this,Rn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>gg(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>gg(t,r)):n}notify(t){gt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){gt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){gt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Rn=new WeakMap,Ev),Pn,pt,ps,jn,hr,Cv,cP=(Cv=class extends vx{constructor(t){super();pe(this,jn);pe(this,Pn);pe(this,pt);pe(this,ps);this.mutationId=t.mutationId,ee(this,pt,t.mutationCache),ee(this,Pn,[]),this.state=t.state||uP(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,Pn).includes(t)||(O(this,Pn).push(t),this.clearGcTimeout(),O(this,pt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ee(this,Pn,O(this,Pn).filter(n=>n!==t)),this.scheduleGc(),O(this,pt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,Pn).length||(this.state.status==="pending"?this.scheduleGc():O(this,pt).remove(this))}continue(){var t;return((t=O(this,ps))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,a,l,c,u,d,m,h,b,v,x,w,g,y,S,_,E,C,k;const n=()=>{it(this,jn,hr).call(this,{type:"continue"})};ee(this,ps,gx({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(T,N)=>{it(this,jn,hr).call(this,{type:"failed",failureCount:T,error:N})},onPause:()=>{it(this,jn,hr).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,pt).canRun(this)}));const r=this.state.status==="pending",s=!O(this,ps).canStart();try{if(r)n();else{it(this,jn,hr).call(this,{type:"pending",variables:t,isPaused:s}),await((i=(o=O(this,pt).config).onMutate)==null?void 0:i.call(o,t,this));const N=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,t));N!==this.state.context&&it(this,jn,hr).call(this,{type:"pending",context:N,variables:t,isPaused:s})}const T=await O(this,ps).start();return await((u=(c=O(this,pt).config).onSuccess)==null?void 0:u.call(c,T,t,this.state.context,this)),await((m=(d=this.options).onSuccess)==null?void 0:m.call(d,T,t,this.state.context)),await((b=(h=O(this,pt).config).onSettled)==null?void 0:b.call(h,T,null,this.state.variables,this.state.context,this)),await((x=(v=this.options).onSettled)==null?void 0:x.call(v,T,null,t,this.state.context)),it(this,jn,hr).call(this,{type:"success",data:T}),T}catch(T){try{throw await((g=(w=O(this,pt).config).onError)==null?void 0:g.call(w,T,t,this.state.context,this)),await((S=(y=this.options).onError)==null?void 0:S.call(y,T,t,this.state.context)),await((E=(_=O(this,pt).config).onSettled)==null?void 0:E.call(_,void 0,T,this.state.variables,this.state.context,this)),await((k=(C=this.options).onSettled)==null?void 0:k.call(C,void 0,T,t,this.state.context)),T}finally{it(this,jn,hr).call(this,{type:"error",error:T})}}finally{O(this,pt).runNext(this)}}},Pn=new WeakMap,pt=new WeakMap,ps=new WeakMap,jn=new WeakSet,hr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),gt.batch(()=>{O(this,Pn).forEach(r=>{r.onMutationUpdate(t)}),O(this,pt).notify({mutation:this,type:"updated",action:t})})},Cv);function uP(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var qn,an,ma,kv,dP=(kv=class extends qc{constructor(t={}){super();pe(this,qn);pe(this,an);pe(this,ma);this.config=t,ee(this,qn,new Set),ee(this,an,new Map),ee(this,ma,0)}build(t,n,r){const s=new cP({mutationCache:this,mutationId:++La(this,ma)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){O(this,qn).add(t);const n=sl(t);if(typeof n=="string"){const r=O(this,an).get(n);r?r.push(t):O(this,an).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,qn).delete(t)){const n=sl(t);if(typeof n=="string"){const r=O(this,an).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&O(this,an).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=sl(t);if(typeof n=="string"){const r=O(this,an).get(n),s=r==null?void 0:r.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=sl(t);if(typeof n=="string"){const s=(r=O(this,an).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){gt.batch(()=>{O(this,qn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,qn).clear(),O(this,an).clear()})}getAll(){return Array.from(O(this,qn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>vg(n,r))}findAll(t={}){return this.getAll().filter(n=>vg(t,n))}notify(t){gt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return gt.batch(()=>Promise.all(t.map(n=>n.continue().catch(sn))))}},qn=new WeakMap,an=new WeakMap,ma=new WeakMap,kv);function sl(e){var t;return(t=e.options.scope)==null?void 0:t.id}function xg(e){return{onFetch:(t,n)=>{var u,d,m,h,b;const r=t.options,s=(m=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:m.direction,o=((h=t.state.data)==null?void 0:h.pages)||[],i=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let v=!1;const x=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},w=fx(t.options,t.fetchOptions),g=async(y,S,_)=>{if(v)return Promise.reject();if(S==null&&y.pages.length)return Promise.resolve(y);const C=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:S,direction:_?"backward":"forward",meta:t.options.meta};return x(j),j})(),k=await w(C),{maxPages:T}=t.options,N=_?XR:JR;return{pages:N(y.pages,k,T),pageParams:N(y.pageParams,S,T)}};if(s&&o.length){const y=s==="backward",S=y?fP:bg,_={pages:o,pageParams:i},E=S(r,_);a=await g(_,E,y)}else{const y=e??o.length;do{const S=l===0?i[0]??r.initialPageParam:bg(r,a);if(l>0&&S==null)break;a=await g(a,S),l++}while(l<y)}return a};t.options.persister?t.fetchFn=()=>{var v,x;return(x=(v=t.options).persister)==null?void 0:x.call(v,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function bg(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function fP(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Le,Cr,kr,_o,Eo,Tr,Co,ko,Tv,hP=(Tv=class{constructor(e={}){pe(this,Le);pe(this,Cr);pe(this,kr);pe(this,_o);pe(this,Eo);pe(this,Tr);pe(this,Co);pe(this,ko);ee(this,Le,e.queryCache||new lP),ee(this,Cr,e.mutationCache||new dP),ee(this,kr,e.defaultOptions||{}),ee(this,_o,new Map),ee(this,Eo,new Map),ee(this,Tr,0)}mount(){La(this,Tr)._++,O(this,Tr)===1&&(ee(this,Co,hx.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Le).onFocus())})),ee(this,ko,ic.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Le).onOnline())})))}unmount(){var e,t;La(this,Tr)._--,O(this,Tr)===0&&((e=O(this,Co))==null||e.call(this),ee(this,Co,void 0),(t=O(this,ko))==null||t.call(this),ee(this,ko,void 0))}isFetching(e){return O(this,Le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Cr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Le).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Le).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ef(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,Le).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=O(this,Le).get(r.queryHash),o=s==null?void 0:s.state.data,i=HR(t,o);if(i!==void 0)return O(this,Le).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return gt.batch(()=>O(this,Le).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Le).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Le);gt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Le);return gt.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=gt.batch(()=>O(this,Le).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(sn).catch(sn)}invalidateQueries(e,t={}){return gt.batch(()=>(O(this,Le).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=gt.batch(()=>O(this,Le).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(sn)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(sn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Le).build(this,t);return n.isStaleByTime(Ef(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(sn).catch(sn)}fetchInfiniteQuery(e){return e.behavior=xg(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(sn).catch(sn)}ensureInfiniteQueryData(e){return e.behavior=xg(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ic.isOnline()?O(this,Cr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Le)}getMutationCache(){return O(this,Cr)}getDefaultOptions(){return O(this,kr)}setDefaultOptions(e){ee(this,kr,e)}setQueryDefaults(e,t){O(this,_o).set(sa(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,_o).values()],n={};return t.forEach(r=>{oa(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Eo).set(sa(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Eo).values()],n={};return t.forEach(r=>{oa(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,kr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=lp(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===cp&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,kr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Le).clear(),O(this,Cr).clear()}},Le=new WeakMap,Cr=new WeakMap,kr=new WeakMap,_o=new WeakMap,Eo=new WeakMap,Tr=new WeakMap,Co=new WeakMap,ko=new WeakMap,Tv),pP=f.createContext(void 0),mP=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(pP.Provider,{value:e,children:t}));/**
 * @remix-run/router v1.23.0
 *
 * 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
 */function ia(){return ia=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ia.apply(this,arguments)}var jr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(jr||(jr={}));const Sg="popstate";function gP(e){e===void 0&&(e={});function t(r,s){let{pathname:o,search:i,hash:a}=r.location;return kf("",{pathname:o,search:i,hash:a},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:wx(s)}return yP(t,n,null,e)}function Ge(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function yx(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function vP(){return Math.random().toString(36).substr(2,8)}function _g(e,t){return{usr:e.state,key:e.key,idx:t}}function kf(e,t,n,r){return n===void 0&&(n=null),ia({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?qo(t):t,{state:n,key:t&&t.key||r||vP()})}function wx(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function qo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function yP(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,a=jr.Pop,l=null,c=u();c==null&&(c=0,i.replaceState(ia({},i.state,{idx:c}),""));function u(){return(i.state||{idx:null}).idx}function d(){a=jr.Pop;let x=u(),w=x==null?null:x-c;c=x,l&&l({action:a,location:v.location,delta:w})}function m(x,w){a=jr.Push;let g=kf(v.location,x,w);c=u()+1;let y=_g(g,c),S=v.createHref(g);try{i.pushState(y,"",S)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;s.location.assign(S)}o&&l&&l({action:a,location:v.location,delta:1})}function h(x,w){a=jr.Replace;let g=kf(v.location,x,w);c=u();let y=_g(g,c),S=v.createHref(g);i.replaceState(y,"",S),o&&l&&l({action:a,location:v.location,delta:0})}function b(x){let w=s.location.origin!=="null"?s.location.origin:s.location.href,g=typeof x=="string"?x:wx(x);return g=g.replace(/ $/,"%20"),Ge(w,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,w)}let v={get action(){return a},get location(){return e(s,i)},listen(x){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(Sg,d),l=x,()=>{s.removeEventListener(Sg,d),l=null}},createHref(x){return t(s,x)},createURL:b,encodeLocation(x){let w=b(x);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:m,replace:h,go(x){return i.go(x)}};return v}var Eg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Eg||(Eg={}));function wP(e,t,n){return n===void 0&&(n="/"),xP(e,t,n,!1)}function xP(e,t,n,r){let s=typeof t=="string"?qo(t):t,o=Sx(s.pathname||"/",n);if(o==null)return null;let i=xx(e);bP(i);let a=null;for(let l=0;a==null&&l<i.length;++l){let c=OP(o);a=jP(i[l],c,r)}return a}function xx(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(o,i,a)=>{let l={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};l.relativePath.startsWith("/")&&(Ge(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let c=vs([r,l.relativePath]),u=n.concat(l);o.children&&o.children.length>0&&(Ge(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),xx(o.children,t,u,c)),!(o.path==null&&!o.index)&&t.push({path:c,score:RP(c,o.index),routesMeta:u})};return e.forEach((o,i)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))s(o,i);else for(let l of bx(o.path))s(o,i,l)}),t}function bx(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=bx(r.join("/")),a=[];return a.push(...i.map(l=>l===""?o:[o,l].join("/"))),s&&a.push(...i),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function bP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:PP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const SP=/^:[\w-]+$/,_P=3,EP=2,CP=1,kP=10,TP=-2,Cg=e=>e==="*";function RP(e,t){let n=e.split("/"),r=n.length;return n.some(Cg)&&(r+=TP),t&&(r+=EP),n.filter(s=>!Cg(s)).reduce((s,o)=>s+(SP.test(o)?_P:o===""?CP:kP),r)}function PP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function jP(e,t,n){let{routesMeta:r}=e,s={},o="/",i=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,u=o==="/"?t:t.slice(o.length)||"/",d=kg({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),m=l.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=kg({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;Object.assign(s,d.params),i.push({params:s,pathname:vs([o,d.pathname]),pathnameBase:$P(vs([o,d.pathnameBase])),route:m}),d.pathnameBase!=="/"&&(o=vs([o,d.pathnameBase]))}return i}function kg(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=NP(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],i=o.replace(/(.)\/+$/,"$1"),a=s.slice(1);return{params:r.reduce((c,u,d)=>{let{paramName:m,isOptional:h}=u;if(m==="*"){let v=a[d]||"";i=o.slice(0,o.length-v.length).replace(/(.)\/+$/,"$1")}const b=a[d];return h&&!b?c[m]=void 0:c[m]=(b||"").replace(/%2F/g,"/"),c},{}),pathname:o,pathnameBase:i,pattern:e}}function NP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),yx(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 r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function OP(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return yx(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Sx(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function AP(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?qo(e):e;return{pathname:n?n.startsWith("/")?n:IP(n,t):t,search:FP(r),hash:UP(s)}}function IP(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function td(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function DP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function LP(e,t){let n=DP(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function MP(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=qo(e):(s=ia({},e),Ge(!s.pathname||!s.pathname.includes("?"),td("?","pathname","search",s)),Ge(!s.pathname||!s.pathname.includes("#"),td("#","pathname","hash",s)),Ge(!s.search||!s.search.includes("#"),td("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,a;if(i==null)a=n;else{let d=t.length-1;if(!r&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;s.pathname=m.join("/")}a=d>=0?t[d]:"/"}let l=AP(s,a),c=i&&i!=="/"&&i.endsWith("/"),u=(o||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const vs=e=>e.join("/").replace(/\/\/+/g,"/"),$P=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),FP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,UP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function zP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const _x=["post","put","patch","delete"];new Set(_x);const BP=["get",..._x];new Set(BP);/**
 * React Router v6.30.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
 */function aa(){return aa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},aa.apply(this,arguments)}const up=f.createContext(null),WP=f.createContext(null),Gc=f.createContext(null),Qc=f.createContext(null),Ns=f.createContext({outlet:null,matches:[],isDataRoute:!1}),Ex=f.createContext(null);function Yc(){return f.useContext(Qc)!=null}function dp(){return Yc()||Ge(!1),f.useContext(Qc).location}function Cx(e){f.useContext(Gc).static||f.useLayoutEffect(e)}function Ko(){let{isDataRoute:e}=f.useContext(Ns);return e?rj():VP()}function VP(){Yc()||Ge(!1);let e=f.useContext(up),{basename:t,future:n,navigator:r}=f.useContext(Gc),{matches:s}=f.useContext(Ns),{pathname:o}=dp(),i=JSON.stringify(LP(s,n.v7_relativeSplatPath)),a=f.useRef(!1);return Cx(()=>{a.current=!0}),f.useCallback(function(c,u){if(u===void 0&&(u={}),!a.current)return;if(typeof c=="number"){r.go(c);return}let d=MP(c,JSON.parse(i),o,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:vs([t,d.pathname])),(u.replace?r.replace:r.push)(d,u.state,u)},[t,r,i,o,e])}function HP(){let{matches:e}=f.useContext(Ns),t=e[e.length-1];return t?t.params:{}}function qP(e,t){return KP(e,t)}function KP(e,t,n,r){Yc()||Ge(!1);let{navigator:s}=f.useContext(Gc),{matches:o}=f.useContext(Ns),i=o[o.length-1],a=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let c=dp(),u;if(t){var d;let x=typeof t=="string"?qo(t):t;l==="/"||(d=x.pathname)!=null&&d.startsWith(l)||Ge(!1),u=x}else u=c;let m=u.pathname||"/",h=m;if(l!=="/"){let x=l.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(x.length).join("/")}let b=wP(e,{pathname:h}),v=XP(b&&b.map(x=>Object.assign({},x,{params:Object.assign({},a,x.params),pathname:vs([l,s.encodeLocation?s.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:vs([l,s.encodeLocation?s.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),o,n,r);return t&&v?f.createElement(Qc.Provider,{value:{location:aa({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:jr.Pop}},v):v}function GP(){let e=nj(),t=zP(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:s},n):null,null)}const QP=f.createElement(GP,null);class YP extends f.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?f.createElement(Ns.Provider,{value:this.props.routeContext},f.createElement(Ex.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function JP(e){let{routeContext:t,match:n,children:r}=e,s=f.useContext(up);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),f.createElement(Ns.Provider,{value:t},r)}function XP(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,a=(s=n)==null?void 0:s.errors;if(a!=null){let u=i.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);u>=0||Ge(!1),i=i.slice(0,Math.min(i.length,u+1))}let l=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<i.length;u++){let d=i[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=u),d.route.id){let{loaderData:m,errors:h}=n,b=d.route.loader&&m[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||b){l=!0,c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}return i.reduceRight((u,d,m)=>{let h,b=!1,v=null,x=null;n&&(h=a&&d.route.id?a[d.route.id]:void 0,v=d.route.errorElement||QP,l&&(c<0&&m===0?(b=!0,x=null):c===m&&(b=!0,x=d.route.hydrateFallbackElement||null)));let w=t.concat(i.slice(0,m+1)),g=()=>{let y;return h?y=v:b?y=x:d.route.Component?y=f.createElement(d.route.Component,null):d.route.element?y=d.route.element:y=u,f.createElement(JP,{match:d,routeContext:{outlet:u,matches:w,isDataRoute:n!=null},children:y})};return n&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?f.createElement(YP,{location:n.location,revalidation:n.revalidation,component:v,error:h,children:g(),routeContext:{outlet:null,matches:w,isDataRoute:!0}}):g()},null)}var kx=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(kx||{}),ac=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ac||{});function ZP(e){let t=f.useContext(up);return t||Ge(!1),t}function ej(e){let t=f.useContext(WP);return t||Ge(!1),t}function tj(e){let t=f.useContext(Ns);return t||Ge(!1),t}function Tx(e){let t=tj(),n=t.matches[t.matches.length-1];return n.route.id||Ge(!1),n.route.id}function nj(){var e;let t=f.useContext(Ex),n=ej(ac.UseRouteError),r=Tx(ac.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function rj(){let{router:e}=ZP(kx.UseNavigateStable),t=Tx(ac.UseNavigateStable),n=f.useRef(!1);return Cx(()=>{n.current=!0}),f.useCallback(function(s,o){o===void 0&&(o={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,aa({fromRouteId:t},o)))},[e,t])}function sj(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function pr(e){Ge(!1)}function oj(e){let{basename:t="/",children:n=null,location:r,navigationType:s=jr.Pop,navigator:o,static:i=!1,future:a}=e;Yc()&&Ge(!1);let l=t.replace(/^\/*/,"/"),c=f.useMemo(()=>({basename:l,navigator:o,static:i,future:aa({v7_relativeSplatPath:!1},a)}),[l,a,o,i]);typeof r=="string"&&(r=qo(r));let{pathname:u="/",search:d="",hash:m="",state:h=null,key:b="default"}=r,v=f.useMemo(()=>{let x=Sx(u,l);return x==null?null:{location:{pathname:x,search:d,hash:m,state:h,key:b},navigationType:s}},[l,u,d,m,h,b,s]);return v==null?null:f.createElement(Gc.Provider,{value:c},f.createElement(Qc.Provider,{children:n,value:v}))}function ij(e){let{children:t,location:n}=e;return qP(Tf(t),n)}new Promise(()=>{});function Tf(e,t){t===void 0&&(t=[]);let n=[];return f.Children.forEach(e,(r,s)=>{if(!f.isValidElement(r))return;let o=[...t,s];if(r.type===f.Fragment){n.push.apply(n,Tf(r.props.children,o));return}r.type!==pr&&Ge(!1),!r.props.index||!r.props.children||Ge(!1);let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=Tf(r.props.children,o)),n.push(i)}),n}/**
 * React Router DOM v6.30.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
 */const aj="6";try{window.__reactRouterVersion=aj}catch{}const lj="startTransition",Tg=eh[lj];function cj(e){let{basename:t,children:n,future:r,window:s}=e,o=f.useRef();o.current==null&&(o.current=gP({window:s,v5Compat:!0}));let i=o.current,[a,l]=f.useState({action:i.action,location:i.location}),{v7_startTransition:c}=r||{},u=f.useCallback(d=>{c&&Tg?Tg(()=>l(d)):l(d)},[l,c]);return f.useLayoutEffect(()=>i.listen(u),[i,u]),f.useEffect(()=>sj(r),[r]),f.createElement(oj,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:i,future:r})}var Rg;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Rg||(Rg={}));var Pg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Pg||(Pg={}));const Rx=Gh("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Te=f.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?WE:"button";return p.jsx(i,{className:J(Rx({variant:t,size:n,className:e})),ref:o,...s})});Te.displayName="Button";const Fe=f.forwardRef(({className:e,type:t,...n},r)=>p.jsx("input",{type:t,className:J("flex h-10 w-full rounded-md border border-input bg-white px-3 py-2 text-base ring-offset-background 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));Fe.displayName="Input";var uj="Label",Px=f.forwardRef((e,t)=>p.jsx(le.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Px.displayName=uj;var jx=Px;const dj=Gh("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),me=f.forwardRef(({className:e,...t},n)=>p.jsx(jx,{ref:n,className:J(dj(),e),...t}));me.displayName=jx.displayName;const fp=f.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:J("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));fp.displayName="Card";const hp=f.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:J("flex flex-col space-y-1.5 p-6",e),...t}));hp.displayName="CardHeader";const pp=f.forwardRef(({className:e,...t},n)=>p.jsx("h3",{ref:n,className:J("text-2xl font-semibold leading-none tracking-tight",e),...t}));pp.displayName="CardTitle";const mp=f.forwardRef(({className:e,...t},n)=>p.jsx("p",{ref:n,className:J("text-sm text-muted-foreground",e),...t}));mp.displayName="CardDescription";const gp=f.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:J("p-6 pt-0",e),...t}));gp.displayName="CardContent";const fj=f.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:J("flex items-center p-6 pt-0",e),...t}));fj.displayName="CardFooter";const hj="modulepreload",pj=function(e){return"/"+e},jg={},Ea=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=pj(l),l in jg)return;jg[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":hj,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((m,h)=>{d.addEventListener("load",m),d.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return s.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})},mj=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Ea(async()=>{const{default:r}=await Promise.resolve().then(()=>Go);return{default:r}},void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)};class vp extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class Ng extends vp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Og extends vp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Ag extends vp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Rf;(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"})(Rf||(Rf={}));var gj=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};class vj{constructor(t,{headers:n={},customFetch:r,region:s=Rf.Any}={}){this.url=t,this.headers=n,this.region=s,this.fetch=mj(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return gj(this,arguments,void 0,function*(n,r={}){var s;try{const{headers:o,method:i,body:a,signal:l}=r;let c={},{region:u}=r;u||(u=this.region);const d=new URL(`${this.url}/${n}`);u&&u!=="any"&&(c["x-region"]=u,d.searchParams.set("forceFunctionRegion",u));let m;a&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)&&(typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",m=a):typeof a=="string"?(c["Content-Type"]="text/plain",m=a):typeof FormData<"u"&&a instanceof FormData?m=a:(c["Content-Type"]="application/json",m=JSON.stringify(a)));const h=yield this.fetch(d.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),o),body:m,signal:l}).catch(w=>{throw w.name==="AbortError"?w:new Ng(w)}),b=h.headers.get("x-relay-error");if(b&&b==="true")throw new Og(h);if(!h.ok)throw new Ag(h);let v=((s=h.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return v==="application/json"?x=yield h.json():v==="application/octet-stream"?x=yield h.blob():v==="text/event-stream"?x=h:v==="multipart/form-data"?x=yield h.formData():x=yield h.text(),{data:x,error:null,response:h}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new Ng(o)}:{data:null,error:o,response:o instanceof Ag||o instanceof Og?o.context:void 0}}})}}var Ct={},yp={},Jc={},Ca={},Xc={},Zc={},yj=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},Mo=yj();const wj=Mo.fetch,Nx=Mo.fetch.bind(Mo),Ox=Mo.Headers,xj=Mo.Request,bj=Mo.Response,Go=Object.freeze(Object.defineProperty({__proto__:null,Headers:Ox,Request:xj,Response:bj,default:Nx,fetch:wj},Symbol.toStringTag,{value:"Module"})),Sj=c_(Go);var eu={};Object.defineProperty(eu,"__esModule",{value:!0});let _j=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}};eu.default=_j;var Ax=Qt&&Qt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zc,"__esModule",{value:!0});const Ej=Ax(Sj),Cj=Ax(eu);let kj=class{constructor(t){var n,r;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(n=t.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,t.fetch?this.fetch=t.fetch:typeof fetch>"u"?this.fetch=Ej.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,n){return this.headers=new Headers(this.headers),this.headers.set(t,n),this}then(t,n){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");const r=this.fetch;let s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var i,a,l,c;let u=null,d=null,m=null,h=o.status,b=o.statusText;if(o.ok){if(this.method!=="HEAD"){const g=await o.text();g===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text"))?d=g:d=JSON.parse(g))}const x=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),w=(l=o.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");x&&w&&w.length>1&&(m=parseInt(w[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,m=null,h=406,b="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{const x=await o.text();try{u=JSON.parse(x),Array.isArray(u)&&o.status===404&&(d=[],u=null,h=200,b="OK")}catch{o.status===404&&x===""?(h=204,b="No Content"):u={message:x}}if(u&&this.isMaybeSingle&&(!((c=u==null?void 0:u.details)===null||c===void 0)&&c.includes("0 rows"))&&(u=null,h=200,b="OK"),u&&this.shouldThrowOnError)throw new Cj.default(u)}return{error:u,data:d,count:m,status:h,statusText:b}});return this.shouldThrowOnError||(s=s.catch(o=>{var i,a,l;return{error:{message:`${(i=o==null?void 0:o.name)!==null&&i!==void 0?i:"FetchError"}: ${o==null?void 0:o.message}`,details:`${(a=o==null?void 0:o.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(l=o==null?void 0:o.code)!==null&&l!==void 0?l:""}`},data:null,count:null,status:0,statusText:""}})),s.then(t,n)}returns(){return this}overrideTypes(){return this}};Zc.default=kj;var Tj=Qt&&Qt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xc,"__esModule",{value:!0});const Rj=Tj(Zc);let Pj=class extends Rj.default{select(t){let n=!1;const r=(t??"*").split("").map(s=>/\s/.test(s)&&!n?"":(s==='"'&&(n=!n),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:n=!0,nullsFirst:r,foreignTable:s,referencedTable:o=s}={}){const i=o?`${o}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${t}.${n?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,n,{foreignTable:r,referencedTable:s=r}={}){const o=typeof s>"u"?"offset":`${s}.offset`,i=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(o,`${t}`),this.url.searchParams.set(i,`${n-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),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:t=!1,verbose:n=!1,settings:r=!1,buffers:s=!1,wal:o=!1,format:i="text"}={}){var a;const l=[t?"analyze":null,n?"verbose":null,r?"settings":null,s?"buffers":null,o?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${l};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};Xc.default=Pj;var jj=Qt&&Qt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ca,"__esModule",{value:!0});const Nj=jj(Xc);let Oj=class extends Nj.default{eq(t,n){return this.url.searchParams.append(t,`eq.${n}`),this}neq(t,n){return this.url.searchParams.append(t,`neq.${n}`),this}gt(t,n){return this.url.searchParams.append(t,`gt.${n}`),this}gte(t,n){return this.url.searchParams.append(t,`gte.${n}`),this}lt(t,n){return this.url.searchParams.append(t,`lt.${n}`),this}lte(t,n){return this.url.searchParams.append(t,`lte.${n}`),this}like(t,n){return this.url.searchParams.append(t,`like.${n}`),this}likeAllOf(t,n){return this.url.searchParams.append(t,`like(all).{${n.join(",")}}`),this}likeAnyOf(t,n){return this.url.searchParams.append(t,`like(any).{${n.join(",")}}`),this}ilike(t,n){return this.url.searchParams.append(t,`ilike.${n}`),this}ilikeAllOf(t,n){return this.url.searchParams.append(t,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(t,n){return this.url.searchParams.append(t,`ilike(any).{${n.join(",")}}`),this}is(t,n){return this.url.searchParams.append(t,`is.${n}`),this}in(t,n){const r=Array.from(new Set(n)).map(s=>typeof s=="string"&&new RegExp("[,()]").test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}contains(t,n){return typeof n=="string"?this.url.searchParams.append(t,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(t,`cs.{${n.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(n)}`),this}containedBy(t,n){return typeof n=="string"?this.url.searchParams.append(t,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(t,`cd.{${n.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(n)}`),this}rangeGt(t,n){return this.url.searchParams.append(t,`sr.${n}`),this}rangeGte(t,n){return this.url.searchParams.append(t,`nxl.${n}`),this}rangeLt(t,n){return this.url.searchParams.append(t,`sl.${n}`),this}rangeLte(t,n){return this.url.searchParams.append(t,`nxr.${n}`),this}rangeAdjacent(t,n){return this.url.searchParams.append(t,`adj.${n}`),this}overlaps(t,n){return typeof n=="string"?this.url.searchParams.append(t,`ov.${n}`):this.url.searchParams.append(t,`ov.{${n.join(",")}}`),this}textSearch(t,n,{config:r,type:s}={}){let o="";s==="plain"?o="pl":s==="phrase"?o="ph":s==="websearch"&&(o="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${o}fts${i}.${n}`),this}match(t){return Object.entries(t).forEach(([n,r])=>{this.url.searchParams.append(n,`eq.${r}`)}),this}not(t,n,r){return this.url.searchParams.append(t,`not.${n}.${r}`),this}or(t,{foreignTable:n,referencedTable:r=n}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,n,r){return this.url.searchParams.append(t,`${n}.${r}`),this}};Ca.default=Oj;var Aj=Qt&&Qt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Jc,"__esModule",{value:!0});const mi=Aj(Ca);let Ij=class{constructor(t,{headers:n={},schema:r,fetch:s}){this.url=t,this.headers=new Headers(n),this.schema=r,this.fetch=s}select(t,n){const{head:r=!1,count:s}=n??{},o=r?"HEAD":"GET";let i=!1;const a=(t??"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join("");return this.url.searchParams.set("select",a),s&&this.headers.append("Prefer",`count=${s}`),new mi.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:n,defaultToNull:r=!0}={}){var s;const o="POST";if(n&&this.headers.append("Prefer",`count=${n}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const i=t.reduce((a,l)=>a.concat(Object.keys(l)),[]);if(i.length>0){const a=[...new Set(i)].map(l=>`"${l}"`);this.url.searchParams.set("columns",a.join(","))}}return new mi.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}upsert(t,{onConflict:n,ignoreDuplicates:r=!1,count:s,defaultToNull:o=!0}={}){var i;const a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),s&&this.headers.append("Prefer",`count=${s}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const l=t.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new mi.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(t,{count:n}={}){var r;const s="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new mi.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:t}={}){var n;const r="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new mi.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};Jc.default=Ij;var Ix=Qt&&Qt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yp,"__esModule",{value:!0});const Dj=Ix(Jc),Lj=Ix(Ca);let Mj=class Dx{constructor(t,{headers:n={},schema:r,fetch:s}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.fetch=s}from(t){const n=new URL(`${this.url}/${t}`);return new Dj.default(n,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new Dx(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:r=!1,get:s=!1,count:o}={}){var i;let a;const l=new URL(`${this.url}/rpc/${t}`);let c;r||s?(a=r?"HEAD":"GET",Object.entries(n).filter(([d,m])=>m!==void 0).map(([d,m])=>[d,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([d,m])=>{l.searchParams.append(d,m)})):(a="POST",c=n);const u=new Headers(this.headers);return o&&u.set("Prefer",`count=${o}`),new Lj.default({method:a,url:l,headers:u,schema:this.schemaName,body:c,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}};yp.default=Mj;var Qo=Qt&&Qt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.PostgrestError=Ct.PostgrestBuilder=Ct.PostgrestTransformBuilder=Ct.PostgrestFilterBuilder=Ct.PostgrestQueryBuilder=Ct.PostgrestClient=void 0;const Lx=Qo(yp);Ct.PostgrestClient=Lx.default;const Mx=Qo(Jc);Ct.PostgrestQueryBuilder=Mx.default;const $x=Qo(Ca);Ct.PostgrestFilterBuilder=$x.default;const Fx=Qo(Xc);Ct.PostgrestTransformBuilder=Fx.default;const Ux=Qo(Zc);Ct.PostgrestBuilder=Ux.default;const zx=Qo(eu);Ct.PostgrestError=zx.default;var $j=Ct.default={PostgrestClient:Lx.default,PostgrestQueryBuilder:Mx.default,PostgrestFilterBuilder:$x.default,PostgrestTransformBuilder:Fx.default,PostgrestBuilder:Ux.default,PostgrestError:zx.default};const{PostgrestClient:Fj,PostgrestQueryBuilder:W2,PostgrestFilterBuilder:V2,PostgrestTransformBuilder:H2,PostgrestBuilder:q2,PostgrestError:K2}=$j;class Uj{static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.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"&&globalThis.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."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const r=n.node,s=parseInt(r.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} 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.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`

Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const r=this.getWebSocketConstructor();return new r(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const zj="2.75.0",Bj=`realtime-js/${zj}`,Wj="1.0.0",Pf=1e4,Vj=1e3,Hj=100;var Oi;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Oi||(Oi={}));var Ve;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(Ve||(Ve={}));var cn;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(cn||(cn={}));var jf;(function(e){e.websocket="websocket"})(jf||(jf={}));var rs;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(rs||(rs={}));class qj{constructor(){this.HEADER_LENGTH=1}decode(t,n){return t.constructor===ArrayBuffer?n(this._binaryDecode(t)):n(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const n=new DataView(t),r=new TextDecoder;return this._decodeBroadcast(t,n,r)}_decodeBroadcast(t,n,r){const s=n.getUint8(1),o=n.getUint8(2);let i=this.HEADER_LENGTH+2;const a=r.decode(t.slice(i,i+s));i=i+s;const l=r.decode(t.slice(i,i+o));i=i+o;const c=JSON.parse(r.decode(t.slice(i,t.byteLength)));return{ref:null,topic:a,event:l,payload:c}}}class Bx{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var be;(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"})(be||(be={}));const Ig=(e,t,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((o,i)=>(o[i]=Kj(i,e,t,s),o),{}):{}},Kj=(e,t,n,r)=>{const s=t.find(a=>a.name===e),o=s==null?void 0:s.type,i=n[e];return o&&!r.includes(o)?Wx(o,i):Nf(i)},Wx=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Jj(t,n)}switch(e){case be.bool:return Gj(t);case be.float4:case be.float8:case be.int2:case be.int4:case be.int8:case be.numeric:case be.oid:return Qj(t);case be.json:case be.jsonb:return Yj(t);case be.timestamp:return Xj(t);case be.abstime:case be.date:case be.daterange:case be.int4range:case be.int8range:case be.money:case be.reltime:case be.text:case be.time:case be.timestamptz:case be.timetz:case be.tsrange:case be.tstzrange:return Nf(t);default:return Nf(t)}},Nf=e=>e,Gj=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Qj=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Yj=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},Jj=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let o;const i=e.slice(1,n);try{o=JSON.parse("["+i+"]")}catch{o=i?i.split(","):[]}return o.map(a=>Wx(t,a))}return e},Xj=e=>typeof e=="string"?e.replace(" ","T"):e,Vx=e=>{let t=e;return t=t.replace(/^ws/i,"http"),t=t.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),t.replace(/\/+$/,"")+"/api/broadcast"};class nd{constructor(t,n,r={},s=Pf){this.channel=t,this.event=n,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,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()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var Dg;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Dg||(Dg={}));class Ai{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},s=>{const{onJoin:o,onLeave:i,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=Ai.syncState(this.state,s,o,i),this.pendingDiffs.forEach(l=>{this.state=Ai.syncDiff(this.state,l,o,i)}),this.pendingDiffs=[],a()}),this.channel._on(r.diff,{},s=>{const{onJoin:o,onLeave:i,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=Ai.syncDiff(this.state,s,o,i),a())}),this.onJoin((s,o,i)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:o,newPresences:i})}),this.onLeave((s,o,i)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:o,leftPresences:i})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,s){const o=this.cloneDeep(t),i=this.transformState(n),a={},l={};return this.map(o,(c,u)=>{i[c]||(l[c]=u)}),this.map(i,(c,u)=>{const d=o[c];if(d){const m=u.map(x=>x.presence_ref),h=d.map(x=>x.presence_ref),b=u.filter(x=>h.indexOf(x.presence_ref)<0),v=d.filter(x=>m.indexOf(x.presence_ref)<0);b.length>0&&(a[c]=b),v.length>0&&(l[c]=v)}else a[c]=u}),this.syncDiff(o,{joins:a,leaves:l},r,s)}static syncDiff(t,n,r,s){const{joins:o,leaves:i}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(o,(a,l)=>{var c;const u=(c=t[a])!==null&&c!==void 0?c:[];if(t[a]=this.cloneDeep(l),u.length>0){const d=t[a].map(h=>h.presence_ref),m=u.filter(h=>d.indexOf(h.presence_ref)<0);t[a].unshift(...m)}r(a,u,l)}),this.map(i,(a,l)=>{let c=t[a];if(!c)return;const u=l.map(d=>d.presence_ref);c=c.filter(d=>u.indexOf(d.presence_ref)<0),t[a]=c,s(a,c,l),c.length===0&&delete t[a]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const s=t[r];return"metas"in s?n[r]=s.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[r]=s,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Lg;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(Lg||(Lg={}));var Ii;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Ii||(Ii={}));var Vn;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Vn||(Vn={}));class wp{constructor(t,n={config:{}},r){var s,o;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=Ve.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new nd(this,cn.join,this.params,this.timeout),this.rejoinTimer=new Bx(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ve.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ve.closed,this.socket._remove(this)}),this._onError(i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=Ve.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ve.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=Ve.errored,this.rejoinTimer.scheduleTimeout())}),this._on(cn.reply,{},(i,a)=>{this._trigger(this._replyEventName(a),i)}),this.presence=new Ai(this),this.broadcastEndpointURL=Vx(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var r,s,o;if(this.socket.isConnected()||this.socket.connect(),this.state==Ve.closed){const{config:{broadcast:i,presence:a,private:l}}=this.params,c=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(h=>h.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[Ii.PRESENCE]&&this.bindings[Ii.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,d={},m={broadcast:i,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(h=>t==null?void 0:t(Vn.CHANNEL_ERROR,h)),this._onClose(()=>t==null?void 0:t(Vn.CLOSED)),this.updateJoinPayload(Object.assign({config:m},d)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:h})=>{var b;if(this.socket.setAuth(),h===void 0){t==null||t(Vn.SUBSCRIBED);return}else{const v=this.bindings.postgres_changes,x=(b=v==null?void 0:v.length)!==null&&b!==void 0?b:0,w=[];for(let g=0;g<x;g++){const y=v[g],{filter:{event:S,schema:_,table:E,filter:C}}=y,k=h&&h[g];if(k&&k.event===S&&k.schema===_&&k.table===E&&k.filter===C)w.push(Object.assign(Object.assign({},y),{id:k.id}));else{this.unsubscribe(),this.state=Ve.errored,t==null||t(Vn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=w,t&&t(Vn.SUBSCRIBED);return}}).receive("error",h=>{this.state=Ve.errored,t==null||t(Vn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(h).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Vn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){return this.state===Ve.joined&&t===Ii.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(t,n,r)}async send(t,n={}){var r,s;if(!this._canPush()&&t.type==="broadcast"){const{event:o,payload:i}=t,l={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:i,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var i,a,l;const c=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(a=(i=this.params)===null||i===void 0?void 0:i.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&o("ok"),c.receive("ok",()=>o("ok")),c.receive("error",()=>o("error")),c.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=Ve.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(cn.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new nd(this,cn.leave,{},t),r.receive("ok",()=>{n(),s("ok")}).receive("timeout",()=>{n(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ve.closed,this.bindings={}}async _fetchWithTimeout(t,n,r){const s=new AbortController,o=setTimeout(()=>s.abort(),r),i=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(o),i}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new nd(this,t,n,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>Hj){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var s,o;const i=t.toLocaleLowerCase(),{close:a,error:l,leave:c,join:u}=cn;if(r&&[a,l,c,u].indexOf(i)>=0&&r!==this._joinRef())return;let m=this._onMessage(i,n,r);if(n&&!m)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(i)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(h=>{var b,v,x;return((b=h.filter)===null||b===void 0?void 0:b.event)==="*"||((x=(v=h.filter)===null||v===void 0?void 0:v.event)===null||x===void 0?void 0:x.toLocaleLowerCase())===i}).map(h=>h.callback(m,r)):(o=this.bindings[i])===null||o===void 0||o.filter(h=>{var b,v,x,w,g,y;if(["broadcast","presence","postgres_changes"].includes(i))if("id"in h){const S=h.id,_=(b=h.filter)===null||b===void 0?void 0:b.event;return S&&((v=n.ids)===null||v===void 0?void 0:v.includes(S))&&(_==="*"||(_==null?void 0:_.toLocaleLowerCase())===((x=n.data)===null||x===void 0?void 0:x.type.toLocaleLowerCase()))}else{const S=(g=(w=h==null?void 0:h.filter)===null||w===void 0?void 0:w.event)===null||g===void 0?void 0:g.toLocaleLowerCase();return S==="*"||S===((y=n==null?void 0:n.event)===null||y===void 0?void 0:y.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===i}).map(h=>{if(typeof m=="object"&&"ids"in m){const b=m.data,{schema:v,table:x,commit_timestamp:w,type:g,errors:y}=b;m=Object.assign(Object.assign({},{schema:v,table:x,commit_timestamp:w,eventType:g,new:{},old:{},errors:y}),this._getPayloadRecords(b))}h.callback(m,r)})}_isClosed(){return this.state===Ve.closed}_isJoined(){return this.state===Ve.joined}_isJoining(){return this.state===Ve.joining}_isLeaving(){return this.state===Ve.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const s=t.toLocaleLowerCase(),o={type:s,filter:n,callback:r};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var o;return!(((o=s.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===r&&wp.isEqual(s.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(cn.close,{},t)}_onError(t){this._on(cn.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ve.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=Ig(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=Ig(t.columns,t.old_record)),n}}const rd=()=>{},ol={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Zj=[1e3,2e3,5e3,1e4],eN=1e4,tN=`
  addEventListener("message", (e) => {
    if (e.data.event === "start") {
      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
    }
  });`;class nN{constructor(t,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Pf,this.transport=null,this.heartbeatIntervalMs=ol.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=rd,this.ref=0,this.reconnectTimer=null,this.logger=rd,this.conn=null,this.sendBuffer=[],this.serializer=new qj,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=s=>{let o;return s?o=s:typeof fetch>"u"?o=(...i)=>Ea(async()=>{const{default:a}=await Promise.resolve().then(()=>Go);return{default:a}},void 0).then(({default:a})=>a(...i)).catch(a=>{throw new Error(`Failed to load @supabase/node-fetch: ${a.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):o=fetch,(...i)=>o(...i)},!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${jf.websocket}`,this.httpEndpoint=Vx(t),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Uj.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n}

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: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Wj}))}disconnect(t,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},t?this.conn.close(t,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,r){this.logger(t,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case Oi.connecting:return rs.Connecting;case Oi.open:return rs.Open;case Oi.closing:return rs.Closing;default:return rs.Closed}}isConnected(){return this.connectionState()===rs.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const r=`realtime:${t}`,s=this.getChannels().find(o=>o.topic===r);if(s)return s;{const o=new wp(`realtime:${t}`,n,this);return this.channels.push(o),o}}push(t){const{topic:n,event:r,payload:s,ref:o}=t,i=()=>{this.encode(t,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${n} ${r} (${o})`,s),this.isConnected()?i():this.sendBuffer.push(i)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(Vj,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},ol.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(r=>r.topic===t&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:s,payload:o,ref:i}=n,a=i?`(${i})`:"",l=o.status||"";this.log("receive",`${l} ${r} ${s} ${a}`.trim(),o),this.channels.filter(c=>c._isMember(r)).forEach(c=>c._trigger(s,o,i)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),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))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_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=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger(cn.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",s=new URLSearchParams(n);return`${t}${r}${s}`}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([tN],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n;t?n=t:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(r=>{const s={access_token:n,version:Bj};n&&r.updateJoinPayload(s),r.joinedOnce&&r._isJoined()&&r._push(cn.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(r=>{try{r(n)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Bx(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},ol.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,r,s,o,i,a,l,c,u;if(this.transport=(n=t==null?void 0:t.transport)!==null&&n!==void 0?n:null,this.timeout=(r=t==null?void 0:t.timeout)!==null&&r!==void 0?r:Pf,this.heartbeatIntervalMs=(s=t==null?void 0:t.heartbeatIntervalMs)!==null&&s!==void 0?s:ol.HEARTBEAT_INTERVAL,this.worker=(o=t==null?void 0:t.worker)!==null&&o!==void 0?o:!1,this.accessToken=(i=t==null?void 0:t.accessToken)!==null&&i!==void 0?i:null,this.heartbeatCallback=(a=t==null?void 0:t.heartbeatCallback)!==null&&a!==void 0?a:rd,t!=null&&t.params&&(this.params=t.params),t!=null&&t.logger&&(this.logger=t.logger),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(l=t==null?void 0:t.reconnectAfterMs)!==null&&l!==void 0?l:d=>Zj[d-1]||eN,this.encode=(c=t==null?void 0:t.encode)!==null&&c!==void 0?c:(d,m)=>m(JSON.stringify(d)),this.decode=(u=t==null?void 0:t.decode)!==null&&u!==void 0?u:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl}}}class xp extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Be(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class rN extends xp{constructor(t,n,r){super(t),this.name="StorageApiError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Of extends xp{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}var sN=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};const Hx=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Ea(async()=>{const{default:r}=await Promise.resolve().then(()=>Go);return{default:r}},void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)},oN=()=>sN(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Ea(()=>Promise.resolve().then(()=>Go),void 0)).Response:Response}),Af=e=>{if(Array.isArray(e))return e.map(n=>Af(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[s]=Af(r)}),t},iN=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)};var Os=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};const sd=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),aN=(e,t,n)=>Os(void 0,void 0,void 0,function*(){const r=yield oN();e instanceof r&&!(n!=null&&n.noResolveJson)?e.json().then(s=>{const o=e.status||500,i=(s==null?void 0:s.statusCode)||o+"";t(new rN(sd(s),o,i))}).catch(s=>{t(new Of(sd(s),s))}):t(new Of(sd(e),e))}),lN=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!r?s:(iN(r)?(s.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),s.body=JSON.stringify(r)):s.body=r,t!=null&&t.duplex&&(s.duplex=t.duplex),Object.assign(Object.assign({},s),n))};function ka(e,t,n,r,s,o){return Os(this,void 0,void 0,function*(){return new Promise((i,a)=>{e(n,lN(t,r,s,o)).then(l=>{if(!l.ok)throw l;return r!=null&&r.noResolveJson?l:l.json()}).then(l=>i(l)).catch(l=>aN(l,a,r))})})}function lc(e,t,n,r){return Os(this,void 0,void 0,function*(){return ka(e,"GET",t,n,r)})}function Tn(e,t,n,r,s){return Os(this,void 0,void 0,function*(){return ka(e,"POST",t,r,s,n)})}function If(e,t,n,r,s){return Os(this,void 0,void 0,function*(){return ka(e,"PUT",t,r,s,n)})}function cN(e,t,n,r){return Os(this,void 0,void 0,function*(){return ka(e,"HEAD",t,Object.assign(Object.assign({},n),{noResolveJson:!0}),r)})}function qx(e,t,n,r,s){return Os(this,void 0,void 0,function*(){return ka(e,"DELETE",t,r,s,n)})}var uN=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};class dN{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n}then(t,n){return this.execute().then(t,n)}execute(){return uN(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Be(t))return{data:null,error:t};throw t}})}}var fN=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};class hN{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n}asStream(){return new dN(this.downloadFn,this.shouldThrowOnError)}then(t,n){return this.execute().then(t,n)}execute(){return fN(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Be(t))return{data:null,error:t};throw t}})}}var St=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};const pN={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Mg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class mN{constructor(t,n={},r,s){this.shouldThrowOnError=!1,this.url=t,this.headers=n,this.bucketId=r,this.fetch=Hx(s)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,n,r,s){return St(this,void 0,void 0,function*(){try{let o;const i=Object.assign(Object.assign({},Mg),s);let a=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(i.upsert)});const l=i.metadata;typeof Blob<"u"&&r instanceof Blob?(o=new FormData,o.append("cacheControl",i.cacheControl),l&&o.append("metadata",this.encodeMetadata(l)),o.append("",r)):typeof FormData<"u"&&r instanceof FormData?(o=r,o.append("cacheControl",i.cacheControl),l&&o.append("metadata",this.encodeMetadata(l))):(o=r,a["cache-control"]=`max-age=${i.cacheControl}`,a["content-type"]=i.contentType,l&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(l)))),s!=null&&s.headers&&(a=Object.assign(Object.assign({},a),s.headers));const c=this._removeEmptyFolders(n),u=this._getFinalPath(c),d=yield(t=="PUT"?If:Tn)(this.fetch,`${this.url}/object/${u}`,o,Object.assign({headers:a},i!=null&&i.duplex?{duplex:i.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(Be(o))return{data:null,error:o};throw o}})}upload(t,n,r){return St(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,r)})}uploadToSignedUrl(t,n,r,s){return St(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(t),i=this._getFinalPath(o),a=new URL(this.url+`/object/upload/sign/${i}`);a.searchParams.set("token",n);try{let l;const c=Object.assign({upsert:Mg.upsert},s),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.append("cacheControl",c.cacheControl)):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType);const d=yield If(this.fetch,a.toString(),l,{headers:u});return{data:{path:o,fullPath:d.Key},error:null}}catch(l){if(this.shouldThrowOnError)throw l;if(Be(l))return{data:null,error:l};throw l}})}createSignedUploadUrl(t,n){return St(this,void 0,void 0,function*(){try{let r=this._getFinalPath(t);const s=Object.assign({},this.headers);n!=null&&n.upsert&&(s["x-upsert"]="true");const o=yield Tn(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:s}),i=new URL(this.url+o.url),a=i.searchParams.get("token");if(!a)throw new xp("No token returned by API");return{data:{signedUrl:i.toString(),path:t,token:a},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Be(r))return{data:null,error:r};throw r}})}update(t,n,r){return St(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,r)})}move(t,n,r){return St(this,void 0,void 0,function*(){try{return{data:yield Tn(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:r==null?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Be(s))return{data:null,error:s};throw s}})}copy(t,n,r){return St(this,void 0,void 0,function*(){try{return{data:{path:(yield Tn(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:r==null?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Be(s))return{data:null,error:s};throw s}})}createSignedUrl(t,n,r){return St(this,void 0,void 0,function*(){try{let s=this._getFinalPath(t),o=yield Tn(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:n},r!=null&&r.transform?{transform:r.transform}:{}),{headers:this.headers});const i=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${i}`)},{data:o,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Be(s))return{data:null,error:s};throw s}})}createSignedUrls(t,n,r){return St(this,void 0,void 0,function*(){try{const s=yield Tn(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:t},{headers:this.headers}),o=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return{data:s.map(i=>Object.assign(Object.assign({},i),{signedUrl:i.signedURL?encodeURI(`${this.url}${i.signedURL}${o}`):null})),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Be(s))return{data:null,error:s};throw s}})}download(t,n){const s=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),i=o?`?${o}`:"",a=this._getFinalPath(t),l=()=>lc(this.fetch,`${this.url}/${s}/${a}${i}`,{headers:this.headers,noResolveJson:!0});return new hN(l,this.shouldThrowOnError)}info(t){return St(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{const r=yield lc(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Af(r),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Be(r))return{data:null,error:r};throw r}})}exists(t){return St(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{return yield cN(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Be(r)&&r instanceof Of){const s=r.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:r}}throw r}})}getPublicUrl(t,n){const r=this._getFinalPath(t),s=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&s.push(o);const a=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",l=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});l!==""&&s.push(l);let c=s.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}${c}`)}}}remove(t){return St(this,void 0,void 0,function*(){try{return{data:yield qx(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Be(n))return{data:null,error:n};throw n}})}list(t,n,r){return St(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},pN),n),{prefix:t||""});return{data:yield Tn(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Be(s))return{data:null,error:s};throw s}})}listV2(t,n){return St(this,void 0,void 0,function*(){try{const r=Object.assign({},t);return{data:yield Tn(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},n),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Be(r))return{data:null,error:r};throw r}})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const n=[];return t.width&&n.push(`width=${t.width}`),t.height&&n.push(`height=${t.height}`),t.resize&&n.push(`resize=${t.resize}`),t.format&&n.push(`format=${t.format}`),t.quality&&n.push(`quality=${t.quality}`),n.join("&")}}const gN="2.75.0",vN={"X-Client-Info":`storage-js/${gN}`};var Ds=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};class yN{constructor(t,n={},r,s){this.shouldThrowOnError=!1;const o=new URL(t);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},vN),n),this.fetch=Hx(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return Ds(this,void 0,void 0,function*(){try{return{data:yield lc(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Be(t))return{data:null,error:t};throw t}})}getBucket(t){return Ds(this,void 0,void 0,function*(){try{return{data:yield lc(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Be(n))return{data:null,error:n};throw n}})}createBucket(t){return Ds(this,arguments,void 0,function*(n,r={public:!1}){try{return{data:yield Tn(this.fetch,`${this.url}/bucket`,{id:n,name:n,type:r.type,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Be(s))return{data:null,error:s};throw s}})}updateBucket(t,n){return Ds(this,void 0,void 0,function*(){try{return{data:yield If(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Be(r))return{data:null,error:r};throw r}})}emptyBucket(t){return Ds(this,void 0,void 0,function*(){try{return{data:yield Tn(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Be(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Ds(this,void 0,void 0,function*(){try{return{data:yield qx(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Be(n))return{data:null,error:n};throw n}})}}class wN extends yN{constructor(t,n={},r,s){super(t,n,r,s)}from(t){return new mN(this.url,this.headers,t,this.fetch)}}const xN="2.75.0";let xi="";typeof Deno<"u"?xi="deno":typeof document<"u"?xi="web":typeof navigator<"u"&&navigator.product==="ReactNative"?xi="react-native":xi="node";const bN={"X-Client-Info":`supabase-js-${xi}/${xN}`},SN={headers:bN},_N={schema:"public"},EN={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},CN={};var kN=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};const TN=e=>{let t;return e?t=e:typeof fetch>"u"?t=Nx:t=fetch,(...n)=>t(...n)},RN=()=>typeof Headers>"u"?Ox:Headers,PN=(e,t,n)=>{const r=TN(n),s=RN();return(o,i)=>kN(void 0,void 0,void 0,function*(){var a;const l=(a=yield t())!==null&&a!==void 0?a:e;let c=new s(i==null?void 0:i.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(o,Object.assign(Object.assign({},i),{headers:c}))})};var jN=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};function NN(e){return e.endsWith("/")?e:e+"/"}function ON(e,t){var n,r;const{db:s,auth:o,realtime:i,global:a}=e,{db:l,auth:c,realtime:u,global:d}=t,m={db:Object.assign(Object.assign({},l),s),auth:Object.assign(Object.assign({},c),o),realtime:Object.assign(Object.assign({},u),i),storage:{},global:Object.assign(Object.assign(Object.assign({},d),a),{headers:Object.assign(Object.assign({},(n=d==null?void 0:d.headers)!==null&&n!==void 0?n:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:()=>jN(this,void 0,void 0,function*(){return""})};return e.accessToken?m.accessToken=e.accessToken:delete m.accessToken,m}function AN(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(NN(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const Kx="2.75.0",Vs=30*1e3,Df=3,od=Df*Vs,IN="http://localhost:9999",DN="supabase.auth.token",LN={"X-Client-Info":`gotrue-js/${Kx}`},Lf="X-Supabase-Api-Version",Gx={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},MN=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,$N=10*60*1e3;class la extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function G(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class FN extends la{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function UN(e){return G(e)&&e.name==="AuthApiError"}class ss extends la{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class qr extends la{constructor(t,n,r,s){super(t,r,s),this.name=n,this.status=r}}class mr extends qr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function zN(e){return G(e)&&e.name==="AuthSessionMissingError"}class Ls extends qr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class il extends qr{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class al extends qr{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function BN(e){return G(e)&&e.name==="AuthImplicitGrantRedirectError"}class $g extends qr{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Mf extends qr{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function id(e){return G(e)&&e.name==="AuthRetryableFetchError"}class Fg extends qr{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class $f extends qr{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const cc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Ug=` 	
\r=`.split(""),WN=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Ug.length;t+=1)e[Ug[t].charCodeAt(0)]=-2;for(let t=0;t<cc.length;t+=1)e[cc[t].charCodeAt(0)]=t;return e})();function zg(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(cc[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(cc[r]),t.queuedBits-=6}}function Qx(e,t,n){const r=WN[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function Bg(e){const t=[],n=i=>{t.push(String.fromCodePoint(i))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},o=i=>{qN(i,r,n)};for(let i=0;i<e.length;i+=1)Qx(e.charCodeAt(i),s,o);return t.join("")}function VN(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 HN(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}VN(r,t)}}function qN(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if(!(e>>7-r&1)){t.utf8seq=r;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&&n(t.codepoint)}}function mo(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)Qx(e.charCodeAt(s),n,r);return new Uint8Array(t)}function KN(e){const t=[];return HN(e,n=>t.push(n)),new Uint8Array(t)}function ls(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};return e.forEach(s=>zg(s,n,r)),zg(null,n,r),t.join("")}function GN(e){return Math.round(Date.now()/1e3)+e}function QN(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}const Ot=()=>typeof window<"u"&&typeof document<"u",Xr={tested:!1,writable:!1},Yx=()=>{if(!Ot())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Xr.tested)return Xr.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Xr.tested=!0,Xr.writable=!0}catch{Xr.tested=!0,Xr.writable=!1}return Xr.writable};function YN(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,o)=>{t[o]=s})}catch{}return n.searchParams.forEach((r,s)=>{t[s]=r}),t}const Jx=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Ea(async()=>{const{default:r}=await Promise.resolve().then(()=>Go);return{default:r}},void 0).then(({default:r})=>r(...n)):t=fetch,(...n)=>t(...n)},JN=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Hs=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Zr=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},fr=async(e,t)=>{await e.removeItem(t)};class tu{constructor(){this.promise=new tu.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}tu.promiseConstructor=Promise;function ad(e){const t=e.split(".");if(t.length!==3)throw new $f("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!MN.test(t[r]))throw new $f("JWT not in base64url format");return{header:JSON.parse(Bg(t[0])),payload:JSON.parse(Bg(t[1])),signature:mo(t[2]),raw:{header:t[0],payload:t[1]}}}async function XN(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function ZN(e,t){return new Promise((r,s)=>{(async()=>{for(let o=0;o<1/0;o++)try{const i=await e(o);if(!t(o,null,i)){r(i);return}}catch(i){if(!t(o,i)){s(i);return}}})()})}function eO(e){return("0"+e.toString(16)).substr(-2)}function tO(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let o=0;o<56;o++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(t),Array.from(t,eO).join("")}async function nO(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(o=>String.fromCharCode(o)).join("")}async function rO(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 n=await nO(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ms(e,t,n=!1){const r=tO();let s=r;n&&(s+="/PASSWORD_RECOVERY"),await Hs(e,`${t}-code-verifier`,s);const o=await rO(r);return[o,r===o?"plain":"s256"]}const sO=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function oO(e){const t=e.headers.get(Lf);if(!t||!t.match(sO))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function iO(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 aO(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 $s(e){if(!lO.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ld(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Wg(e){return JSON.parse(JSON.stringify(e))}var cO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n};const ns=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),uO=[502,503,504];async function Vg(e){var t;if(!JN(e))throw new Mf(ns(e),0);if(uO.includes(e.status))throw new Mf(ns(e),e.status);let n;try{n=await e.json()}catch(o){throw new ss(ns(o),o)}let r;const s=oO(e);if(s&&s.getTime()>=Gx["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new Fg(ns(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new mr}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((o,i)=>o&&typeof i=="string",!0))throw new Fg(ns(n),e.status,n.weak_password.reasons);throw new FN(ns(n),e.status||500,r)}const dO=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function X(e,t,n,r){var s;const o=Object.assign({},r==null?void 0:r.headers);o[Lf]||(o[Lf]=Gx["2024-01-01"].name),r!=null&&r.jwt&&(o.Authorization=`Bearer ${r.jwt}`);const i=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(i.redirect_to=r.redirectTo);const a=Object.keys(i).length?"?"+new URLSearchParams(i).toString():"",l=await fO(e,t,n+a,{headers:o,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function fO(e,t,n,r,s,o){const i=dO(t,r,s,o);let a;try{a=await e(n,Object.assign({},i))}catch(l){throw console.error(l),new Mf(ns(l),0)}if(a.ok||await Vg(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await Vg(l)}}function tn(e){var t;let n=null;mO(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=GN(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function Hg(e){const t=tn(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((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function Sr(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function hO(e){return{data:e,error:null}}function pO(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:o}=e,i=cO(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:o},l=Object.assign({},i);return{data:{properties:a,user:l},error:null}}function qg(e){return e}function mO(e){return e.access_token&&e.refresh_token&&e.expires_in}const cd=["global","local","others"];var gO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n};class vO{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=Jx(r),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),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(t,n=cd[0]){if(cd.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${cd.join(", ")}`);try{return await X(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(G(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await X(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Sr})}catch(r){if(G(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=gO(t,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r==null?void 0:r.newEmail,delete s.newEmail),await X(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:pO,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(G(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await X(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Sr})}catch(n){if(G(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,s,o,i,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await X(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(o=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:qg});if(u.error)throw u.error;const d=await u.json(),m=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,h=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return h.length>0&&(h.forEach(b=>{const v=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(b.split(";")[1].split("=")[1]);c[`${x}Page`]=v}),c.total=parseInt(m)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(G(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){$s(t);try{return await X(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Sr})}catch(n){if(G(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){$s(t);try{return await X(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:Sr})}catch(r){if(G(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){$s(t);try{return await X(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:Sr})}catch(r){if(G(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){$s(t.userId);try{const{data:n,error:r}=await X(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(G(n))return{data:null,error:n};throw n}}async _deleteFactor(t){$s(t.userId),$s(t.id);try{return{data:await X(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(G(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,s,o,i,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await X(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(o=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&o!==void 0?o:""},xform:qg});if(u.error)throw u.error;const d=await u.json(),m=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,h=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return h.length>0&&(h.forEach(b=>{const v=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(b.split(";")[1].split("=")[1]);c[`${x}Page`]=v}),c.total=parseInt(m)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(G(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await X(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await X(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await X(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await X(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(G(n))return{data:null,error:n};throw n}}}function Kg(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const Fs={debug:!!(globalThis&&Yx()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Xx extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class yO extends Xx{}async function wO(e,t,n){Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout(()=>{r.abort(),Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await n()}finally{Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}else{if(t===0)throw Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new yO(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Fs.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null,"  "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}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"),await n()}}))}function xO(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Zx(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function bO(e){return parseInt(e,16)}function SO(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function _O(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:o=new Date,nonce:i,notBefore:a,requestId:l,resources:c,scheme:u,uri:d,version:m}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(i&&i.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${i}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);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 h=Zx(e.address),b=u?`${u}://${r}`:r,v=e.statement?`${e.statement}
`:"",x=`${b} wants you to sign in with your Ethereum account:
${h}

${v}`;let w=`URI: ${d}
Version: ${m}
Chain ID: ${n}${i?`
Nonce: ${i}`:""}
Issued At: ${o.toISOString()}`;if(s&&(w+=`
Expiration Time: ${s.toISOString()}`),a&&(w+=`
Not Before: ${a.toISOString()}`),l&&(w+=`
Request ID: ${l}`),c){let g=`
Resources:`;for(const y of c){if(!y||typeof y!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${y}`);g+=`
- ${y}`}w+=g}return`${x}
${w}`}class ze extends Error{constructor({message:t,code:n,cause:r,name:s}){var o;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(o=s??(r instanceof Error?r.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class uc extends ze{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function EO({error:e,options:t}){var n,r,s;const{publicKey:o}=t;if(!o)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ze({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new ze({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=o.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new ze({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new ze({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 ze({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new ze({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return o.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new ze({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new ze({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 i=window.location.hostname;if(tb(i)){if(o.rp.id!==i)return new ze({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ze({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new ze({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 ze({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 ze({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function CO({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ze({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new ze({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(tb(r)){if(n.rpId!==r)return new ze({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ze({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new ze({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 ze({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}var eb=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n};class kO{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}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 TO=new kO;function RO(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:n,excludeCredentials:r}=e,s=eb(e,["challenge","user","excludeCredentials"]),o=mo(t).buffer,i=Object.assign(Object.assign({},n),{id:mo(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:o,user:i});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:mo(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function PO(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:n}=e,r=eb(e,["challenge","allowCredentials"]),s=mo(t).buffer,o=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){o.allowCredentials=new Array(n.length);for(let i=0;i<n.length;i++){const a=n[i];o.allowCredentials[i]=Object.assign(Object.assign({},a),{id:mo(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return o}function jO(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:ls(new Uint8Array(e.response.attestationObject)),clientDataJSON:ls(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function NO(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:ls(new Uint8Array(s.authenticatorData)),clientDataJSON:ls(new Uint8Array(s.clientDataJSON)),signature:ls(new Uint8Array(s.signature)),userHandle:s.userHandle?ls(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function tb(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Gg(){var e,t;return!!(Ot()&&"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 OO(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new uc("Browser returned unexpected credential type",t)}:{data:null,error:new uc("Empty credential response",t)}}catch(t){return{data:null,error:EO({error:t,options:e})}}}async function AO(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new uc("Browser returned unexpected credential type",t)}:{data:null,error:new uc("Empty credential response",t)}}catch(t){return{data:null,error:CO({error:t,options:e})}}}const IO={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"},DO={userVerification:"preferred",hints:["security-key"]};function dc(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of e)if(s)for(const o in s){const i=s[o];if(i!==void 0)if(Array.isArray(i))r[o]=i;else if(n(i))r[o]=i;else if(t(i)){const a=r[o];t(a)?r[o]=dc(a,i):r[o]=dc(i)}else r[o]=i}return r}function LO(e,t){return dc(IO,e,t||{})}function MO(e,t){return dc(DO,e,t||{})}class $O{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:n,friendlyName:r,signal:s},o){try{const{data:i,error:a}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:a};const l=s??TO.createNewAbortSignal();if(i.webauthn.type==="create"){const{user:c}=i.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${r}`),c.displayName||(c.displayName=c.name)}switch(i.webauthn.type){case"create":{const c=LO(i.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:u,error:d}=await OO({publicKey:c,signal:l});return u?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}case"request":{const c=MO(i.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:u,error:d}=await AO(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:c,signal:l}));return u?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}}}catch(i){return G(i)?{data:null,error:i}:{data:null,error:new ss("Unexpected error in challenge",i)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}},o){if(!n)return{data:null,error:new la("rpId is required for WebAuthn authentication")};try{if(!Gg())return{data:null,error:new ss("Browser does not support WebAuthn",null)};const{data:i,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:o});if(!i)return{data:null,error:a};const{webauthn:l}=i;return this._verify({factorId:t,challengeId:i.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(i){return G(i)?{data:null,error:i}:{data:null,error:new ss("Unexpected error in authenticate",i)}}}async _register({friendlyName:t,rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s},o){if(!n)return{data:null,error:new la("rpId is required for WebAuthn registration")};try{if(!Gg())return{data:null,error:new ss("Browser does not support WebAuthn",null)};const{data:i,error:a}=await this._enroll({friendlyName:t});if(!i)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===t&&m.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:i.id,friendlyName:i.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:s},{create:o});return l?this._verify({factorId:i.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(i){return G(i)?{data:null,error:i}:{data:null,error:new ss("Unexpected error in register",i)}}}}xO();const FO={url:IN,storageKey:DN,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:LN,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Qg(e,t,n){return await n()}const Us={};class ca{get jwks(){var t,n;return(n=(t=Us[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Us[this.storageKey]=Object.assign(Object.assign({},Us[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Us[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Us[this.storageKey]=Object.assign(Object.assign({},Us[this.storageKey]),{cachedAt:t})}constructor(t){var n,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=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,this.instanceID=ca.nextInstanceID,ca.nextInstanceID+=1,this.instanceID>0&&Ot()&&console.warn("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.");const s=Object.assign(Object.assign({},FO),t);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new vO({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=Jx(s.fetch),this.lock=s.lock||Qg,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Ot()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=wO:this.lock=Qg,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 $O(this)},this.persistSession?(s.storage?this.storage=s.storage:Yx()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Kg(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=Kg(this.memoryStorage)),Ot()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(r=this.broadcastChannel)===null||r===void 0||r.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${Kx}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{const n=YN(window.location.href);let r="none";if(this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce"),Ot()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:o}=await this._getSessionFromURL(n,r);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),BN(o)){const l=(t=o.details)===null||t===void 0?void 0:t.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:i,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",i,"redirect type",a),await this._saveSession(i),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return G(n)?{error:n}:{error:new ss("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,s;try{const o=await X(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:tn}),{data:i,error:a}=o;if(a||!i)return{data:{user:null,session:null},error:a};const l=i.session,c=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(o){if(G(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(t){var n,r,s;try{let o;if("email"in t){const{email:u,password:d,options:m}=t;let h=null,b=null;this.flowType==="pkce"&&([h,b]=await Ms(this.storage,this.storageKey)),o=await X(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:u,password:d,data:(n=m==null?void 0:m.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:h,code_challenge_method:b},xform:tn})}else if("phone"in t){const{phone:u,password:d,options:m}=t;o=await X(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(r=m==null?void 0:m.data)!==null&&r!==void 0?r:{},channel:(s=m==null?void 0:m.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:tn})}else throw new il("You must provide either an email or phone number and a password");const{data:i,error:a}=o;if(a||!i)return{data:{user:null,session:null},error:a};const l=i.session,c=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(o){if(G(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(t){try{let n;if("email"in t){const{email:o,password:i,options:a}=t;n=await X(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Hg})}else if("phone"in t){const{phone:o,password:i,options:a}=t;n=await X(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Hg})}else throw new il("You must provide either an email or phone number and a password");const{data:r,error:s}=n;return s?{data:{user:null,session:null},error:s}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new Ls}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(G(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(t){var n,r,s,o;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,s,o,i,a,l,c,u,d,m;let h,b;if("message"in t)h=t.message,b=t.signature;else{const{chain:v,wallet:x,statement:w,options:g}=t;let y;if(Ot())if(typeof x=="object")y=x;else{const T=window;if("ethereum"in T&&typeof T.ethereum=="object"&&"request"in T.ethereum&&typeof T.ethereum.request=="function")y=T.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 x!="object"||!(g!=null&&g.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");y=x}const S=new URL((n=g==null?void 0:g.url)!==null&&n!==void 0?n:window.location.href),_=await y.request({method:"eth_requestAccounts"}).then(T=>T).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!_||_.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const E=Zx(_[0]);let C=(r=g==null?void 0:g.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!C){const T=await y.request({method:"eth_chainId"});C=bO(T)}const k={domain:S.host,address:E,statement:w,uri:S.href,version:"1",chainId:C,nonce:(s=g==null?void 0:g.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(i=(o=g==null?void 0:g.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&i!==void 0?i:new Date,expirationTime:(a=g==null?void 0:g.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=g==null?void 0:g.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=g==null?void 0:g.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=g==null?void 0:g.signInWithEthereum)===null||u===void 0?void 0:u.resources};h=_O(k),b=await y.request({method:"personal_sign",params:[SO(h),E]})}try{const{data:v,error:x}=await X(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:b},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:tn});if(x)throw x;return!v||!v.session||!v.user?{data:{user:null,session:null},error:new Ls}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),{data:Object.assign({},v),error:x})}catch(v){if(G(v))return{data:{user:null,session:null},error:v};throw v}}async signInWithSolana(t){var n,r,s,o,i,a,l,c,u,d,m,h;let b,v;if("message"in t)b=t.message,v=t.signature;else{const{chain:x,wallet:w,statement:g,options:y}=t;let S;if(Ot())if(typeof w=="object")S=w;else{const E=window;if("solana"in E&&typeof E.solana=="object"&&("signIn"in E.solana&&typeof E.solana.signIn=="function"||"signMessage"in E.solana&&typeof E.solana.signMessage=="function"))S=E.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 w!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");S=w}const _=new URL((n=y==null?void 0:y.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in S&&S.signIn){const E=await S.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},y==null?void 0:y.signInWithSolana),{version:"1",domain:_.host,uri:_.href}),g?{statement:g}:null));let C;if(Array.isArray(E)&&E[0]&&typeof E[0]=="object")C=E[0];else if(E&&typeof E=="object"&&"signedMessage"in E&&"signature"in E)C=E;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)b=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),v=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in S)||typeof S.signMessage!="function"||!("publicKey"in S)||typeof S!="object"||!S.publicKey||!("toBase58"in S.publicKey)||typeof S.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${_.host} wants you to sign in with your Solana account:`,S.publicKey.toBase58(),...g?["",g,""]:[""],"Version: 1",`URI: ${_.href}`,`Issued At: ${(s=(r=y==null?void 0:y.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((o=y==null?void 0:y.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${y.signInWithSolana.notBefore}`]:[],...!((i=y==null?void 0:y.signInWithSolana)===null||i===void 0)&&i.expirationTime?[`Expiration Time: ${y.signInWithSolana.expirationTime}`]:[],...!((a=y==null?void 0:y.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${y.signInWithSolana.chainId}`]:[],...!((l=y==null?void 0:y.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${y.signInWithSolana.nonce}`]:[],...!((c=y==null?void 0:y.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${y.signInWithSolana.requestId}`]:[],...!((d=(u=y==null?void 0:y.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...y.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
`);const E=await S.signMessage(new TextEncoder().encode(b),"utf8");if(!E||!(E instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=E}}try{const{data:x,error:w}=await X(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:ls(v)},!((m=t.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:tn});if(w)throw w;return!x||!x.session||!x.user?{data:{user:null,session:null},error:new Ls}:(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),{data:Object.assign({},x),error:w})}catch(x){if(G(x))return{data:{user:null,session:null},error:x};throw x}}async _exchangeCodeForSession(t){const n=await Zr(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{const{data:o,error:i}=await X(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:tn});if(await fr(this.storage,`${this.storageKey}-code-verifier`),i)throw i;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new Ls}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:s??null}),error:i})}catch(o){if(G(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(t){try{const{options:n,provider:r,token:s,access_token:o,nonce:i}=t,a=await X(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:o,nonce:i,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:tn}),{data:l,error:c}=a;return c?{data:{user:null,session:null},error:c}:!l||!l.session||!l.user?{data:{user:null,session:null},error:new Ls}:(l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),{data:l,error:c})}catch(n){if(G(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(t){var n,r,s,o,i;try{if("email"in t){const{email:a,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Ms(this.storage,this.storageKey));const{error:d}=await X(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in t){const{phone:a,options:l}=t,{data:c,error:u}=await X(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(o=l==null?void 0:l.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(i=l==null?void 0:l.channel)!==null&&i!==void 0?i:"sms"}});return{data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u}}throw new il("You must provide either an email or phone number.")}catch(a){if(G(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(t){var n,r;try{let s,o;"options"in t&&(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo,o=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:i,error:a}=await X(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:s,xform:tn});if(a)throw a;if(!i)throw new Error("An error occurred on token verification.");const l=i.session,c=i.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(s){if(G(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(t){var n,r,s;try{let o=null,i=null;return this.flowType==="pkce"&&([o,i]=await Ms(this.storage,this.storageKey)),await X(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:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:i}),headers:this.headers,xform:hO})}catch(o){if(G(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new mr;const{error:s}=await X(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:s}})}catch(t){if(G(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:s,options:o}=t,{error:i}=await X(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return{data:{user:null,session:null},error:i}}else if("phone"in t){const{phone:r,type:s,options:o}=t,{data:i,error:a}=await X(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:i==null?void 0:i.message_id},error:a}}throw new il("You must provide either an email or phone number and a type")}catch(n){if(G(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}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 n=await this.__loadSession();return await t(n)}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 n=await Zr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<od:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const i=await Zr(this.userStorage,this.storageKey+"-user");i!=null&&i.user?t.user=i.user:t.user=ld()}if(this.storage.isServer&&t.user){let i=this.suppressGetSessionWarning;t=new Proxy(t,{get:(l,c,u)=>(!i&&c==="user"&&(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."),i=!0,this.suppressGetSessionWarning=!0),Reflect.get(l,c,u))})}return{data:{session:t},error:null}}const{data:s,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{session:null},error:o}:{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await X(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Sr}):await this._useSession(async n=>{var r,s,o;const{data:i,error:a}=n;if(a)throw a;return!(!((r=i.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new mr}:await X(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&o!==void 0?o:void 0,xform:Sr})})}catch(n){if(G(n))return zN(n)&&(await this._removeSession(),await fr(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:s,error:o}=r;if(o)throw o;if(!s.session)throw new mr;const i=s.session;let a=null,l=null;this.flowType==="pkce"&&t.email!=null&&([a,l]=await Ms(this.storage,this.storageKey));const{data:c,error:u}=await X(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:a,code_challenge_method:l}),jwt:i.access_token,xform:Sr});if(u)throw u;return i.user=c.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),{data:{user:i.user},error:null}})}catch(r){if(G(r))return{data:{user:null},error:r};throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new mr;const n=Date.now()/1e3;let r=n,s=!0,o=null;const{payload:i}=ad(t.access_token);if(i.exp&&(r=i.exp,s=r<=n),s){const{data:a,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return{data:{user:null,session:null},error:l};if(!a)return{data:{user:null,session:null},error:null};o=a}else{const{data:a,error:l}=await this._getUser(t.access_token);if(l)throw l;o={access_token:t.access_token,refresh_token:t.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(n){if(G(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:i,error:a}=n;if(a)throw a;t=(r=i.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new mr;const{data:s,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{user:null,session:null},error:o}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(G(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(t,n){try{if(!Ot())throw new al("No browser detected.");if(t.error||t.error_description||t.error_code)throw new al(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new $g("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new al("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new $g("No code detected.");const{data:g,error:y}=await this._exchangeCodeForSession(t.code);if(y)throw y;const S=new URL(window.location.href);return S.searchParams.delete("code"),window.history.replaceState(window.history.state,"",S.toString()),{data:{session:g.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:s,access_token:o,refresh_token:i,expires_in:a,expires_at:l,token_type:c}=t;if(!o||!a||!i||!c)throw new al("No session defined in URL");const u=Math.round(Date.now()/1e3),d=parseInt(a);let m=u+d;l&&(m=parseInt(l));const h=m-u;h*1e3<=Vs&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${d}s`);const b=m-d;u-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,m,u):u-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,m,u);const{data:v,error:x}=await this._getUser(o);if(x)throw x;const w={provider_token:r,provider_refresh_token:s,access_token:o,expires_in:d,expires_at:m,refresh_token:i,token_type:c,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:w,redirectType:t.type},error:null}}catch(r){if(G(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantCallback(t){return!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await Zr(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return{error:o};const i=(r=s.session)===null||r===void 0?void 0:r.access_token;if(i){const{error:a}=await this.admin.signOut(i,t);if(a&&!(UN(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return t!=="others"&&(await this._removeSession(),await fr(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(t){const n=QN(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,s;try{const{data:{session:o},error:i}=n;if(i)throw i;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await Ms(this.storage,this.storageKey,!0));try{return await X(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(G(o))return{data:null,error:o};throw o}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return{data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(n){if(G(n))return{data:null,error:n};throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:s}=await this._useSession(async o=>{var i,a,l,c,u;const{data:d,error:m}=o;if(m)throw m;const h=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(i=t.options)===null||i===void 0?void 0:i.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await X(this.fetch,"GET",h,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(s)throw s;return Ot()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),{data:{provider:t.provider,url:r==null?void 0:r.url},error:null}}catch(r){if(G(r))return{data:{provider:t.provider,url:null},error:r};throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:o}}=n;if(s)throw s;const{options:i,provider:a,token:l,access_token:c,nonce:u}=t,d=await X(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=o==null?void 0:o.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:tn}),{data:m,error:h}=d;return h?{data:{user:null,session:null},error:h}:!m||!m.session||!m.user?{data:{user:null,session:null},error:new Ls}:(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),{data:m,error:h})}catch(s){if(G(s))return{data:{user:null,session:null},error:s};throw s}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,s;const{data:o,error:i}=n;if(i)throw i;return await X(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await ZN(async s=>(s>0&&await XN(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await X(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:tn})),(s,o)=>{const i=200*Math.pow(2,s);return o&&id(o)&&Date.now()+i-r<Vs})}catch(r){if(this._debug(n,"error",r),G(r))return{data:{session:null,user:null},error:r};throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),Ot()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await Zr(this.storage,this.storageKey);if(s&&this.userStorage){let i=await Zr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!i&&(i={user:s.user},await Hs(this.userStorage,this.storageKey+"-user",i)),s.user=(t=i==null?void 0:i.user)!==null&&t!==void 0?t:ld()}else if(s&&!s.user&&!s.user){const i=await Zr(this.storage,this.storageKey+"-user");i&&(i!=null&&i.user)?(s.user=i.user,await fr(this.storage,this.storageKey+"-user"),await Hs(this.storage,this.storageKey,s)):s.user=ld()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const o=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<od;if(this._debug(r,`session has${o?"":" not"} expired with margin of ${od}s`),o){if(this.autoRefreshToken&&s.refresh_token){const{error:i}=await this._callRefreshToken(s.refresh_token);i&&(console.error(i),id(i)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",i),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:i,error:a}=await this._getUser(s.access_token);!a&&(i!=null&&i.user)?(s.user=i.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(i){console.error("Error getting user data:",i),this._debug(r,"error getting user data, skipping SIGNED_IN notification",i)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new mr;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new tu;const{data:o,error:i}=await this._refreshAccessToken(t);if(i)throw i;if(!o.session)throw new mr;await this._saveSession(o.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const a={data:o.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(o){if(this._debug(s,"error",o),G(o)){const i={data:null,error:o};return id(o)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(i),i}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(o),o}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,n,r=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const o=[],i=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(t,n)}catch(l){o.push(l)}});if(await Promise.all(i),o.length>0){for(let a=0;a<o.length;a+=1)console.error(o[a]);throw o[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0;const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Hs(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const o=Wg(s);await Hs(this.storage,this.storageKey,o)}else{const s=Wg(n);await Hs(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),await fr(this.storage,this.storageKey),await fr(this.storage,this.storageKey+"-code-verifier"),await fr(this.storage,this.storageKey+"-user"),this.userStorage&&await fr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ot()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Vs);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}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 n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-t)/Vs);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Vs}ms, refresh threshold is ${Df} ticks`),s<=Df&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof Xx)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ot()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"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,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[o,i]=await Ms(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(i)}`});s.push(a.toString())}if(r!=null&&r.queryParams){const o=new URLSearchParams(r.queryParams);s.push(o.toString())}return r!=null&&r.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;return o?{data:null,error:o}:await X(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,s;const{data:o,error:i}=n;if(i)return{data:null,error:i};const a=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:c}=await X(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=o==null?void 0:o.session)===null||r===void 0?void 0:r.access_token});return c?{data:null,error:c}:(t.factorType==="totp"&&l.type==="totp"&&(!((s=l==null?void 0:l.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),{data:l,error:null})})}catch(n){if(G(n))return{data:null,error:n};throw n}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return{data:null,error:o};const i=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?jO(t.webauthn.credential_response):NO(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:l}=await X(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:i,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:l})})}catch(n){if(G(n))return{data:null,error:n};throw n}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:o}=n;if(o)return{data:null,error:o};const i=await X(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});if(i.error)return i;const{data:a}=i;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:RO(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:PO(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(G(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?{data:null,error:r}:await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const o of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])s.all.push(o),o.status==="verified"&&s[o.factor_type].push(o);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var n,r;const{data:{session:s},error:o}=t;if(o)return{data:null,error:o};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:i}=ad(s.access_token);let a=null;i.aal&&(a=i.aal);let l=a;((r=(n=s.user.factors)===null||n===void 0?void 0:n.filter(d=>d.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(l="aal2");const u=i.amr||[];return{data:{currentLevel:a,nextLevel:l,currentAuthenticationMethods:u},error:null}}))}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(a=>a.kid===t);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(a=>a.kid===t),r&&this.jwks_cached_at+$N>s)return r;const{data:o,error:i}=await X(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=s,r=o.keys.find(a=>a.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:h,error:b}=await this.getSession();if(b||!h.session)return{data:null,error:b};r=h.session.access_token}const{header:s,payload:o,signature:i,raw:{header:a,payload:l}}=ad(r);n!=null&&n.allowExpired||iO(o.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:h}=await this.getUser(r);if(h)throw h;return{data:{claims:o,header:s,signature:i},error:null}}const u=aO(s.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,i,KN(`${a}.${l}`)))throw new $f("Invalid JWT signature");return{data:{claims:o,header:s,signature:i},error:null}}catch(r){if(G(r))return{data:null,error:r};throw r}}}ca.nextInstanceID=0;const UO=ca;class zO extends UO{constructor(t){super(t)}}var BO=function(e,t,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})};class WO{constructor(t,n,r){var s,o,i;this.supabaseUrl=t,this.supabaseKey=n;const a=AN(t);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const l=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:_N,realtime:CN,auth:Object.assign(Object.assign({},EN),{storageKey:l}),global:SN},u=ON(r??{},c);this.storageKey=(s=u.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(o=u.global.headers)!==null&&o!==void 0?o:{},u.accessToken?(this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(d,m)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(m)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((i=u.auth)!==null&&i!==void 0?i:{},this.headers,u.global.fetch),this.fetch=PN(n,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.rest=new Fj(new URL("rest/v1",a).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new wN(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new vj(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,n={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,n,r)}channel(t,n={config:{}}){return this.realtime.channel(t,n)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){return BO(this,void 0,void 0,function*(){var t,n;if(this.accessToken)return yield this.accessToken();const{data:r}=yield this.auth.getSession();return(n=(t=r.session)===null||t===void 0?void 0:t.access_token)!==null&&n!==void 0?n:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:n,detectSessionInUrl:r,storage:s,userStorage:o,storageKey:i,flowType:a,lock:l,debug:c},u,d){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new zO({url:this.authUrl.href,headers:Object.assign(Object.assign({},m),u),storageKey:i,autoRefreshToken:t,persistSession:n,detectSessionInUrl:r,storage:s,userStorage:o,flowType:a,lock:l,debug:c,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(h=>h.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new nN(this.realtimeUrl.href,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,r)=>{this._handleTokenChanged(n,"CLIENT",r==null?void 0:r.access_token)})}_handleTokenChanged(t,n,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const VO=(e,t,n)=>new WO(e,t,n);function HO(){if(typeof window<"u"||typeof process>"u")return!1;const e=process.version;if(e==null)return!1;const t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}HO()&&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 qO="https://ttkyysguzxrghohzxbxk.supabase.co",KO="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR0a3l5c2d1enhyZ2hvaHp4YnhrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjA1NDQ3OTEsImV4cCI6MjA3NjEyMDc5MX0.8r7zNEfRe4ZZ5Z-zZusI7VYiPd1XQcf2Ct9vYZiqals",ye=VO(qO,KO,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0,storage:window.localStorage}}),GO="/assets/logo-BEgPLwKe.png",QO=()=>{const[e,t]=f.useState(""),[n,r]=f.useState(""),[s,o]=f.useState(!1),[i,a]=f.useState(!1),l=Ko();f.useEffect(()=>{ye.auth.getSession().then(({data:{session:m}})=>{m&&l("/dashboard")});const{data:{subscription:d}}=ye.auth.onAuthStateChange((m,h)=>{h&&l("/dashboard")});return()=>d.unsubscribe()},[l]);const c=async d=>{if(d.preventDefault(),!e||!n){de.error("Please fill in all fields");return}o(!0);try{const{error:m}=await ye.auth.signInWithPassword({email:e,password:n});m?de.error(m.message):de.success("Login successful!")}catch{de.error("An unexpected error occurred")}finally{o(!1)}},u=async d=>{if(d.preventDefault(),!e){de.error("Please enter your email address");return}o(!0);try{const{error:m}=await ye.auth.resetPasswordForEmail(e,{redirectTo:`${window.location.origin}/reset-password`});m?de.error(m.message):(de.success("Password reset email sent! Please check your inbox."),a(!1))}catch{de.error("An unexpected error occurred")}finally{o(!1)}};return p.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:p.jsxs(fp,{className:"w-full max-w-md shadow-lg",children:[p.jsxs(hp,{className:"space-y-1 text-center",children:[p.jsx(pp,{className:"text-3xl font-bold text-foreground",children:p.jsx("img",{src:GO,style:{maxWidth:"200px",margin:"0 auto 20px"}})}),p.jsx(mp,{children:i?"Enter your email to reset your password":"Enter your credentials to access the admin panel"})]}),p.jsx(gp,{children:p.jsxs("form",{onSubmit:i?u:c,className:"space-y-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(me,{htmlFor:"email",children:"Email"}),p.jsx(Fe,{id:"email",type:"email",placeholder:"admin@insulpro.com",value:e,onChange:d=>t(d.target.value),disabled:s,required:!0})]}),!i&&p.jsxs("div",{className:"space-y-2",children:[p.jsx(me,{htmlFor:"password",children:"Password"}),p.jsx(Fe,{id:"password",type:"password",placeholder:"••••••••",value:n,onChange:d=>r(d.target.value),disabled:s,required:!0})]}),p.jsxs(Te,{type:"submit",className:"w-full",disabled:s,children:[s&&p.jsx(tr,{className:"mr-2 h-4 w-4 animate-spin"}),i?"Send Reset Link":"Sign In"]}),p.jsx("div",{className:"text-center",children:p.jsx("button",{type:"button",onClick:()=>a(!i),className:"text-sm text-muted-foreground hover:text-primary transition-colors",disabled:s,children:i?"Back to login":"Forgot password?"})})]})})]})})},bp=f.forwardRef(({className:e,...t},n)=>p.jsx("div",{className:"relative w-full overflow-auto",children:p.jsx("table",{ref:n,className:J("w-full caption-bottom text-sm",e),...t})}));bp.displayName="Table";const Sp=f.forwardRef(({className:e,...t},n)=>p.jsx("thead",{ref:n,className:J("[&_tr]:border-b",e),...t}));Sp.displayName="TableHeader";const _p=f.forwardRef(({className:e,...t},n)=>p.jsx("tbody",{ref:n,className:J("[&_tr:last-child]:border-0",e),...t}));_p.displayName="TableBody";const YO=f.forwardRef(({className:e,...t},n)=>p.jsx("tfoot",{ref:n,className:J("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));YO.displayName="TableFooter";const ys=f.forwardRef(({className:e,...t},n)=>p.jsx("tr",{ref:n,className:J("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));ys.displayName="TableRow";const dn=f.forwardRef(({className:e,...t},n)=>p.jsx("th",{ref:n,className:J("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));dn.displayName="TableHead";const It=f.forwardRef(({className:e,...t},n)=>p.jsx("td",{ref:n,className:J("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));It.displayName="TableCell";const JO=f.forwardRef(({className:e,...t},n)=>p.jsx("caption",{ref:n,className:J("mt-4 text-sm text-muted-foreground",e),...t}));JO.displayName="TableCaption";const nb=({className:e,...t})=>p.jsx("nav",{role:"navigation","aria-label":"pagination",className:J("mx-auto flex w-full justify-center",e),...t});nb.displayName="Pagination";const rb=f.forwardRef(({className:e,...t},n)=>p.jsx("ul",{ref:n,className:J("flex flex-row items-center gap-1",e),...t}));rb.displayName="PaginationContent";const qs=f.forwardRef(({className:e,...t},n)=>p.jsx("li",{ref:n,className:J("",e),...t}));qs.displayName="PaginationItem";const go=({className:e,isActive:t,size:n="icon",...r})=>p.jsx("a",{"aria-current":t?"page":void 0,className:J(Rx({variant:t?"outline":"ghost",size:n}),e),...r});go.displayName="PaginationLink";const sb=({className:e,...t})=>p.jsxs(go,{"aria-label":"Go to previous page",size:"default",className:J("gap-1 pl-2.5",e),...t,children:[p.jsx(LC,{className:"h-4 w-4"}),p.jsx("span",{children:"Previous"})]});sb.displayName="PaginationPrevious";const ob=({className:e,...t})=>p.jsxs(go,{"aria-label":"Go to next page",size:"default",className:J("gap-1 pr-2.5",e),...t,children:[p.jsx("span",{children:"Next"}),p.jsx(MC,{className:"h-4 w-4"})]});ob.displayName="PaginationNext";function Yg(e,[t,n]){return Math.min(n,Math.max(t,e))}var XO=f.createContext(void 0);function ZO(e){const t=f.useContext(XO);return e||t||"ltr"}var ud=0;function ib(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Jg()),document.body.insertAdjacentElement("beforeend",e[1]??Jg()),ud++,()=>{ud===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ud--}},[])}function Jg(){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 dd="focusScope.autoFocusOnMount",fd="focusScope.autoFocusOnUnmount",Xg={bubbles:!1,cancelable:!0},eA="FocusScope",Ep=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,l]=f.useState(null),c=mn(s),u=mn(o),d=f.useRef(null),m=we(t,v=>l(v)),h=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let v=function(y){if(h.paused||!a)return;const S=y.target;a.contains(S)?d.current=S:gr(d.current,{select:!0})},x=function(y){if(h.paused||!a)return;const S=y.relatedTarget;S!==null&&(a.contains(S)||gr(d.current,{select:!0}))},w=function(y){if(document.activeElement===document.body)for(const _ of y)_.removedNodes.length>0&&gr(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",x);const g=new MutationObserver(w);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",x),g.disconnect()}}},[r,a,h.paused]),f.useEffect(()=>{if(a){ev.add(h);const v=document.activeElement;if(!a.contains(v)){const w=new CustomEvent(dd,Xg);a.addEventListener(dd,c),a.dispatchEvent(w),w.defaultPrevented||(tA(iA(ab(a)),{select:!0}),document.activeElement===v&&gr(a))}return()=>{a.removeEventListener(dd,c),setTimeout(()=>{const w=new CustomEvent(fd,Xg);a.addEventListener(fd,u),a.dispatchEvent(w),w.defaultPrevented||gr(v??document.body,{select:!0}),a.removeEventListener(fd,u),ev.remove(h)},0)}}},[a,c,u,h]);const b=f.useCallback(v=>{if(!n&&!r||h.paused)return;const x=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,w=document.activeElement;if(x&&w){const g=v.currentTarget,[y,S]=nA(g);y&&S?!v.shiftKey&&w===S?(v.preventDefault(),n&&gr(y,{select:!0})):v.shiftKey&&w===y&&(v.preventDefault(),n&&gr(S,{select:!0})):w===g&&v.preventDefault()}},[n,r,h.paused]);return p.jsx(le.div,{tabIndex:-1,...i,ref:m,onKeyDown:b})});Ep.displayName=eA;function tA(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(gr(r,{select:t}),document.activeElement!==n)return}function nA(e){const t=ab(e),n=Zg(t,e),r=Zg(t.reverse(),e);return[n,r]}function ab(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Zg(e,t){for(const n of e)if(!rA(n,{upTo:t}))return n}function rA(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 sA(e){return e instanceof HTMLInputElement&&"select"in e}function gr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&sA(e)&&t&&e.select()}}var ev=oA();function oA(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=tv(e,t),e.unshift(t)},remove(t){var n;e=tv(e,t),(n=e[0])==null||n.resume()}}}function tv(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function iA(e){return e.filter(t=>t.tagName!=="A")}function lb(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var aA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},zs=new WeakMap,ll=new WeakMap,cl={},hd=0,cb=function(e){return e&&(e.host||cb(e.parentNode))},lA=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=cb(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},cA=function(e,t,n,r){var s=lA(t,Array.isArray(e)?e:[e]);cl[n]||(cl[n]=new WeakMap);var o=cl[n],i=[],a=new Set,l=new Set(s),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};s.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(m){if(a.has(m))u(m);else try{var h=m.getAttribute(r),b=h!==null&&h!=="false",v=(zs.get(m)||0)+1,x=(o.get(m)||0)+1;zs.set(m,v),o.set(m,x),i.push(m),v===1&&b&&ll.set(m,!0),x===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return u(t),a.clear(),hd++,function(){i.forEach(function(d){var m=zs.get(d)-1,h=o.get(d)-1;zs.set(d,m),o.set(d,h),m||(ll.has(d)||d.removeAttribute(r),ll.delete(d)),h||d.removeAttribute(n)}),hd--,hd||(zs=new WeakMap,zs=new WeakMap,ll=new WeakMap,cl={})}},ub=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=aA(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),cA(r,s,n,"aria-hidden")):function(){return null}},On=function(){return On=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},On.apply(this,arguments)};function db(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function uA(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Pl="right-scroll-bar-position",jl="width-before-scroll-bar",dA="with-scroll-bars-hidden",fA="--removed-body-scroll-bar-size";function pd(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function hA(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var pA=typeof window<"u"?f.useLayoutEffect:f.useEffect,nv=new WeakMap;function mA(e,t){var n=hA(null,function(r){return e.forEach(function(s){return pd(s,r)})});return pA(function(){var r=nv.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(a){o.has(a)||pd(a,null)}),o.forEach(function(a){s.has(a)||pd(a,i)})}nv.set(n,e)},[e]),n}function gA(e){return e}function vA(e,t){t===void 0&&(t=gA);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(o),i=n}var l=function(){var u=i;i=[],u.forEach(o)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){i.push(u),c()},filter:function(u){return i=i.filter(u),n}}}};return s}function yA(e){e===void 0&&(e={});var t=vA(null);return t.options=On({async:!0,ssr:!1},e),t}var fb=function(e){var t=e.sideCar,n=db(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return f.createElement(r,On({},n))};fb.isSideCarExport=!0;function wA(e,t){return e.useMedium(t),fb}var hb=yA(),md=function(){},nu=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:md,onWheelCapture:md,onTouchMoveCapture:md}),s=r[0],o=r[1],i=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,m=e.sideCar,h=e.noRelative,b=e.noIsolation,v=e.inert,x=e.allowPinchZoom,w=e.as,g=w===void 0?"div":w,y=e.gapMode,S=db(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=m,E=mA([n,t]),C=On(On({},S),s);return f.createElement(f.Fragment,null,u&&f.createElement(_,{sideCar:hb,removeScrollBar:c,shards:d,noRelative:h,noIsolation:b,inert:v,setCallbacks:o,allowPinchZoom:!!x,lockRef:n,gapMode:y}),i?f.cloneElement(f.Children.only(a),On(On({},C),{ref:E})):f.createElement(g,On({},C,{className:l,ref:E}),a))});nu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};nu.classNames={fullWidth:jl,zeroRight:Pl};var xA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function bA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=xA();return t&&e.setAttribute("nonce",t),e}function SA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function _A(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var EA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=bA())&&(SA(t,n),_A(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},CA=function(){var e=EA();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pb=function(){var e=CA(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},kA={left:0,top:0,right:0,gap:0},gd=function(e){return parseInt(e||"",10)||0},TA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[gd(n),gd(r),gd(s)]},RA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return kA;var t=TA(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},PA=pb(),vo="data-scroll-locked",jA=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(dA,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(a,"px ").concat(r,`;
  }
  body[`).concat(vo,`] {
    overflow: hidden `).concat(r,`;
    overscroll-behavior: contain;
    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
    padding-left: `.concat(s,`px;
    padding-top: `).concat(o,`px;
    padding-right: `).concat(i,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(Pl,` {
    right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(jl,` {
    margin-right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(Pl," .").concat(Pl,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(jl," .").concat(jl,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(vo,`] {
    `).concat(fA,": ").concat(a,`px;
  }
`)},rv=function(){var e=parseInt(document.body.getAttribute(vo)||"0",10);return isFinite(e)?e:0},NA=function(){f.useEffect(function(){return document.body.setAttribute(vo,(rv()+1).toString()),function(){var e=rv()-1;e<=0?document.body.removeAttribute(vo):document.body.setAttribute(vo,e.toString())}},[])},OA=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;NA();var o=f.useMemo(function(){return RA(s)},[s]);return f.createElement(PA,{styles:jA(o,!t,s,n?"":"!important")})},Ff=!1;if(typeof window<"u")try{var ul=Object.defineProperty({},"passive",{get:function(){return Ff=!0,!0}});window.addEventListener("test",ul,ul),window.removeEventListener("test",ul,ul)}catch{Ff=!1}var Bs=Ff?{passive:!1}:!1,AA=function(e){return e.tagName==="TEXTAREA"},mb=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!AA(e)&&n[t]==="visible")},IA=function(e){return mb(e,"overflowY")},DA=function(e){return mb(e,"overflowX")},sv=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=gb(e,r);if(s){var o=vb(e,r),i=o[1],a=o[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},LA=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},MA=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},gb=function(e,t){return e==="v"?IA(t):DA(t)},vb=function(e,t){return e==="v"?LA(t):MA(t)},$A=function(e,t){return e==="h"&&t==="rtl"?-1:1},FA=function(e,t,n,r,s){var o=$A(e,window.getComputedStyle(t).direction),i=o*r,a=n.target,l=t.contains(a),c=!1,u=i>0,d=0,m=0;do{if(!a)break;var h=vb(e,a),b=h[0],v=h[1],x=h[2],w=v-x-o*b;(b||w)&&gb(e,a)&&(d+=w,m+=b);var g=a.parentNode;a=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(Math.abs(d)<1||!s)||!u&&(Math.abs(m)<1||!s))&&(c=!0),c},dl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ov=function(e){return[e.deltaX,e.deltaY]},iv=function(e){return e&&"current"in e?e.current:e},UA=function(e,t){return e[0]===t[0]&&e[1]===t[1]},zA=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},BA=0,Ws=[];function WA(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),s=f.useState(BA++)[0],o=f.useState(pb)[0],i=f.useRef(e);f.useEffect(function(){i.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var v=uA([e.lockRef.current],(e.shards||[]).map(iv),!0).filter(Boolean);return v.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(v,x){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var w=dl(v),g=n.current,y="deltaX"in v?v.deltaX:g[0]-w[0],S="deltaY"in v?v.deltaY:g[1]-w[1],_,E=v.target,C=Math.abs(y)>Math.abs(S)?"h":"v";if("touches"in v&&C==="h"&&E.type==="range")return!1;var k=sv(C,E);if(!k)return!0;if(k?_=C:(_=C==="v"?"h":"v",k=sv(C,E)),!k)return!1;if(!r.current&&"changedTouches"in v&&(y||S)&&(r.current=_),!_)return!0;var T=r.current||_;return FA(T,x,v,T==="h"?y:S,!0)},[]),l=f.useCallback(function(v){var x=v;if(!(!Ws.length||Ws[Ws.length-1]!==o)){var w="deltaY"in x?ov(x):dl(x),g=t.current.filter(function(_){return _.name===x.type&&(_.target===x.target||x.target===_.shadowParent)&&UA(_.delta,w)})[0];if(g&&g.should){x.cancelable&&x.preventDefault();return}if(!g){var y=(i.current.shards||[]).map(iv).filter(Boolean).filter(function(_){return _.contains(x.target)}),S=y.length>0?a(x,y[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),c=f.useCallback(function(v,x,w,g){var y={name:v,delta:x,target:w,should:g,shadowParent:VA(w)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(S){return S!==y})},1)},[]),u=f.useCallback(function(v){n.current=dl(v),r.current=void 0},[]),d=f.useCallback(function(v){c(v.type,ov(v),v.target,a(v,e.lockRef.current))},[]),m=f.useCallback(function(v){c(v.type,dl(v),v.target,a(v,e.lockRef.current))},[]);f.useEffect(function(){return Ws.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Bs),document.addEventListener("touchmove",l,Bs),document.addEventListener("touchstart",u,Bs),function(){Ws=Ws.filter(function(v){return v!==o}),document.removeEventListener("wheel",l,Bs),document.removeEventListener("touchmove",l,Bs),document.removeEventListener("touchstart",u,Bs)}},[]);var h=e.removeScrollBar,b=e.inert;return f.createElement(f.Fragment,null,b?f.createElement(o,{styles:zA(s)}):null,h?f.createElement(OA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function VA(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const HA=wA(hb,WA);var Cp=f.forwardRef(function(e,t){return f.createElement(nu,On({},e,{ref:t,sideCar:HA}))});Cp.classNames=nu.classNames;var qA=[" ","Enter","ArrowUp","ArrowDown"],KA=[" ","Enter"],Cs="Select",[ru,su,GA]=Hw(Cs),[Yo,G2]=js(Cs,[GA,Wc]),ou=Wc(),[QA,Kr]=Yo(Cs),[YA,JA]=Yo(Cs),yb=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:m,required:h,form:b}=e,v=ou(t),[x,w]=f.useState(null),[g,y]=f.useState(null),[S,_]=f.useState(!1),E=ZO(c),[C,k]=ta({prop:r,defaultProp:s??!1,onChange:o,caller:Cs}),[T,N]=ta({prop:i,defaultProp:a,onChange:l,caller:Cs}),j=f.useRef(null),A=x?b||!!x.closest("form"):!0,[F,I]=f.useState(new Set),H=Array.from(F).map(z=>z.props.value).join(";");return p.jsx(CR,{...v,children:p.jsxs(QA,{required:h,scope:t,trigger:x,onTriggerChange:w,valueNode:g,onValueNodeChange:y,valueNodeHasChildren:S,onValueNodeHasChildrenChange:_,contentId:ho(),value:T,onValueChange:N,open:C,onOpenChange:k,dir:E,triggerPointerDownPosRef:j,disabled:m,children:[p.jsx(ru.Provider,{scope:t,children:p.jsx(YA,{scope:e.__scopeSelect,onNativeOptionAdd:f.useCallback(z=>{I(B=>new Set(B).add(z))},[]),onNativeOptionRemove:f.useCallback(z=>{I(B=>{const R=new Set(B);return R.delete(z),R})},[]),children:n})}),A?p.jsxs(Bb,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:z=>N(z.target.value),disabled:m,form:b,children:[T===void 0?p.jsx("option",{value:""}):null,Array.from(F)]},H):null]})})};yb.displayName=Cs;var wb="SelectTrigger",xb=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=ou(n),i=Kr(wb,n),a=i.disabled||r,l=we(t,i.onTriggerChange),c=su(n),u=f.useRef("touch"),[d,m,h]=Vb(v=>{const x=c().filter(y=>!y.disabled),w=x.find(y=>y.value===i.value),g=Hb(x,v,w);g!==void 0&&i.onValueChange(g.value)}),b=v=>{a||(i.onOpenChange(!0),h()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return p.jsx(ex,{asChild:!0,...o,children:p.jsx(le.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Wb(i.value)?"":void 0,...s,ref:l,onClick:te(s.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&b(v)}),onPointerDown:te(s.onPointerDown,v=>{u.current=v.pointerType;const x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(b(v),v.preventDefault())}),onKeyDown:te(s.onKeyDown,v=>{const x=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(x&&v.key===" ")&&qA.includes(v.key)&&(b(),v.preventDefault())})})})});xb.displayName=wb;var bb="SelectValue",Sb=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...a}=e,l=Kr(bb,n),{onValueNodeHasChildrenChange:c}=l,u=o!==void 0,d=we(t,l.onValueNodeChange);return st(()=>{c(u)},[c,u]),p.jsx(le.span,{...a,ref:d,style:{pointerEvents:"none"},children:Wb(l.value)?p.jsx(p.Fragment,{children:i}):o})});Sb.displayName=bb;var XA="SelectIcon",_b=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return p.jsx(le.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});_b.displayName=XA;var ZA="SelectPortal",Eb=e=>p.jsx(Dc,{asChild:!0,...e});Eb.displayName=ZA;var ks="SelectContent",Cb=f.forwardRef((e,t)=>{const n=Kr(ks,e.__scopeSelect),[r,s]=f.useState();if(st(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?Kt.createPortal(p.jsx(kb,{scope:e.__scopeSelect,children:p.jsx(ru.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),o):null}return p.jsx(Tb,{...e,ref:t})});Cb.displayName=ks;var nn=10,[kb,Gr]=Yo(ks),eI="SelectContentImpl",tI=Io("SelectContent.RemoveScroll"),Tb=f.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:m,collisionPadding:h,sticky:b,hideWhenDetached:v,avoidCollisions:x,...w}=e,g=Kr(ks,n),[y,S]=f.useState(null),[_,E]=f.useState(null),C=we(t,$=>S($)),[k,T]=f.useState(null),[N,j]=f.useState(null),A=su(n),[F,I]=f.useState(!1),H=f.useRef(!1);f.useEffect(()=>{if(y)return ub(y)},[y]),ib();const z=f.useCallback($=>{const[oe,...he]=A().map(Z=>Z.ref.current),[V]=he.slice(-1),se=document.activeElement;for(const Z of $)if(Z===se||(Z==null||Z.scrollIntoView({block:"nearest"}),Z===oe&&_&&(_.scrollTop=0),Z===V&&_&&(_.scrollTop=_.scrollHeight),Z==null||Z.focus(),document.activeElement!==se))return},[A,_]),B=f.useCallback(()=>z([k,y]),[z,k,y]);f.useEffect(()=>{F&&B()},[F,B]);const{onOpenChange:R,triggerPointerDownPosRef:P}=g;f.useEffect(()=>{if(y){let $={x:0,y:0};const oe=V=>{var se,Z;$={x:Math.abs(Math.round(V.pageX)-(((se=P.current)==null?void 0:se.x)??0)),y:Math.abs(Math.round(V.pageY)-(((Z=P.current)==null?void 0:Z.y)??0))}},he=V=>{$.x<=10&&$.y<=10?V.preventDefault():y.contains(V.target)||R(!1),document.removeEventListener("pointermove",oe),P.current=null};return P.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",he,{capture:!0})}}},[y,R,P]),f.useEffect(()=>{const $=()=>R(!1);return window.addEventListener("blur",$),window.addEventListener("resize",$),()=>{window.removeEventListener("blur",$),window.removeEventListener("resize",$)}},[R]);const[M,q]=Vb($=>{const oe=A().filter(se=>!se.disabled),he=oe.find(se=>se.ref.current===document.activeElement),V=Hb(oe,$,he);V&&setTimeout(()=>V.ref.current.focus())}),U=f.useCallback(($,oe,he)=>{const V=!H.current&&!he;(g.value!==void 0&&g.value===oe||V)&&(T($),V&&(H.current=!0))},[g.value]),Q=f.useCallback(()=>y==null?void 0:y.focus(),[y]),Y=f.useCallback(($,oe,he)=>{const V=!H.current&&!he;(g.value!==void 0&&g.value===oe||V)&&j($)},[g.value]),ge=r==="popper"?Uf:Rb,ce=ge===Uf?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:m,collisionPadding:h,sticky:b,hideWhenDetached:v,avoidCollisions:x}:{};return p.jsx(kb,{scope:n,content:y,viewport:_,onViewportChange:E,itemRefCallback:U,selectedItem:k,onItemLeave:Q,itemTextRefCallback:Y,focusSelectedItem:B,selectedItemText:N,position:r,isPositioned:F,searchRef:M,children:p.jsx(Cp,{as:tI,allowPinchZoom:!0,children:p.jsx(Ep,{asChild:!0,trapped:g.open,onMountAutoFocus:$=>{$.preventDefault()},onUnmountAutoFocus:te(s,$=>{var oe;(oe=g.trigger)==null||oe.focus({preventScroll:!0}),$.preventDefault()}),children:p.jsx(ba,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:$=>$.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:p.jsx(ge,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:$=>$.preventDefault(),...w,...ce,onPlaced:()=>I(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:te(w.onKeyDown,$=>{const oe=$.ctrlKey||$.altKey||$.metaKey;if($.key==="Tab"&&$.preventDefault(),!oe&&$.key.length===1&&q($.key),["ArrowUp","ArrowDown","Home","End"].includes($.key)){let V=A().filter(se=>!se.disabled).map(se=>se.ref.current);if(["ArrowUp","End"].includes($.key)&&(V=V.slice().reverse()),["ArrowUp","ArrowDown"].includes($.key)){const se=$.target,Z=V.indexOf(se);V=V.slice(Z+1)}setTimeout(()=>z(V)),$.preventDefault()}})})})})})})});Tb.displayName=eI;var nI="SelectItemAlignedPosition",Rb=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=Kr(ks,n),i=Gr(ks,n),[a,l]=f.useState(null),[c,u]=f.useState(null),d=we(t,C=>u(C)),m=su(n),h=f.useRef(!1),b=f.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:w,focusSelectedItem:g}=i,y=f.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&c&&v&&x&&w){const C=o.trigger.getBoundingClientRect(),k=c.getBoundingClientRect(),T=o.valueNode.getBoundingClientRect(),N=w.getBoundingClientRect();if(o.dir!=="rtl"){const se=N.left-k.left,Z=T.left-se,Re=C.left-Z,Oe=C.width+Re,xt=Math.max(Oe,k.width),ft=window.innerWidth-nn,xn=Yg(Z,[nn,Math.max(nn,ft-xt)]);a.style.minWidth=Oe+"px",a.style.left=xn+"px"}else{const se=k.right-N.right,Z=window.innerWidth-T.right-se,Re=window.innerWidth-C.right-Z,Oe=C.width+Re,xt=Math.max(Oe,k.width),ft=window.innerWidth-nn,xn=Yg(Z,[nn,Math.max(nn,ft-xt)]);a.style.minWidth=Oe+"px",a.style.right=xn+"px"}const j=m(),A=window.innerHeight-nn*2,F=v.scrollHeight,I=window.getComputedStyle(c),H=parseInt(I.borderTopWidth,10),z=parseInt(I.paddingTop,10),B=parseInt(I.borderBottomWidth,10),R=parseInt(I.paddingBottom,10),P=H+z+F+R+B,M=Math.min(x.offsetHeight*5,P),q=window.getComputedStyle(v),U=parseInt(q.paddingTop,10),Q=parseInt(q.paddingBottom,10),Y=C.top+C.height/2-nn,ge=A-Y,ce=x.offsetHeight/2,$=x.offsetTop+ce,oe=H+z+$,he=P-oe;if(oe<=Y){const se=j.length>0&&x===j[j.length-1].ref.current;a.style.bottom="0px";const Z=c.clientHeight-v.offsetTop-v.offsetHeight,Re=Math.max(ge,ce+(se?Q:0)+Z+B),Oe=oe+Re;a.style.height=Oe+"px"}else{const se=j.length>0&&x===j[0].ref.current;a.style.top="0px";const Re=Math.max(Y,H+v.offsetTop+(se?U:0)+ce)+he;a.style.height=Re+"px",v.scrollTop=oe-Y+v.offsetTop}a.style.margin=`${nn}px 0`,a.style.minHeight=M+"px",a.style.maxHeight=A+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,a,c,v,x,w,o.dir,r]);st(()=>y(),[y]);const[S,_]=f.useState();st(()=>{c&&_(window.getComputedStyle(c).zIndex)},[c]);const E=f.useCallback(C=>{C&&b.current===!0&&(y(),g==null||g(),b.current=!1)},[y,g]);return p.jsx(sI,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:E,children:p.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:p.jsx(le.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Rb.displayName=nI;var rI="SelectPopperPosition",Uf=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=nn,...o}=e,i=ou(n);return p.jsx(tx,{...i,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});Uf.displayName=rI;var[sI,kp]=Yo(ks,{}),zf="SelectViewport",Pb=f.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=Gr(zf,n),i=kp(zf,n),a=we(t,o.onViewportChange),l=f.useRef(0);return p.jsxs(p.Fragment,{children:[p.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:r}),p.jsx(ru.Slot,{scope:n,children:p.jsx(le.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:te(s.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&d){const h=Math.abs(l.current-u.scrollTop);if(h>0){const b=window.innerHeight-nn*2,v=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),w=Math.max(v,x);if(w<b){const g=w+h,y=Math.min(b,g),S=g-y;d.style.height=y+"px",d.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Pb.displayName=zf;var jb="SelectGroup",[oI,iI]=Yo(jb),aI=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=ho();return p.jsx(oI,{scope:n,id:s,children:p.jsx(le.div,{role:"group","aria-labelledby":s,...r,ref:t})})});aI.displayName=jb;var Nb="SelectLabel",Ob=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=iI(Nb,n);return p.jsx(le.div,{id:s.id,...r,ref:t})});Ob.displayName=Nb;var fc="SelectItem",[lI,Ab]=Yo(fc),Ib=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...i}=e,a=Kr(fc,n),l=Gr(fc,n),c=a.value===r,[u,d]=f.useState(o??""),[m,h]=f.useState(!1),b=we(t,g=>{var y;return(y=l.itemRefCallback)==null?void 0:y.call(l,g,r,s)}),v=ho(),x=f.useRef("touch"),w=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")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 p.jsx(lI,{scope:n,value:r,disabled:s,textId:v,isSelected:c,onItemTextChange:f.useCallback(g=>{d(y=>y||((g==null?void 0:g.textContent)??"").trim())},[]),children:p.jsx(ru.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:p.jsx(le.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:b,onFocus:te(i.onFocus,()=>h(!0)),onBlur:te(i.onBlur,()=>h(!1)),onClick:te(i.onClick,()=>{x.current!=="mouse"&&w()}),onPointerUp:te(i.onPointerUp,()=>{x.current==="mouse"&&w()}),onPointerDown:te(i.onPointerDown,g=>{x.current=g.pointerType}),onPointerMove:te(i.onPointerMove,g=>{var y;x.current=g.pointerType,s?(y=l.onItemLeave)==null||y.call(l):x.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:te(i.onPointerLeave,g=>{var y;g.currentTarget===document.activeElement&&((y=l.onItemLeave)==null||y.call(l))}),onKeyDown:te(i.onKeyDown,g=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&g.key===" "||(KA.includes(g.key)&&w(),g.key===" "&&g.preventDefault())})})})})});Ib.displayName=fc;var bi="SelectItemText",Db=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=Kr(bi,n),a=Gr(bi,n),l=Ab(bi,n),c=JA(bi,n),[u,d]=f.useState(null),m=we(t,w=>d(w),l.onItemTextChange,w=>{var g;return(g=a.itemTextRefCallback)==null?void 0:g.call(a,w,l.value,l.disabled)}),h=u==null?void 0:u.textContent,b=f.useMemo(()=>p.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=c;return st(()=>(v(b),()=>x(b)),[v,x,b]),p.jsxs(p.Fragment,{children:[p.jsx(le.span,{id:l.textId,...o,ref:m}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Kt.createPortal(o.children,i.valueNode):null]})});Db.displayName=bi;var Lb="SelectItemIndicator",Mb=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Ab(Lb,n).isSelected?p.jsx(le.span,{"aria-hidden":!0,...r,ref:t}):null});Mb.displayName=Lb;var Bf="SelectScrollUpButton",$b=f.forwardRef((e,t)=>{const n=Gr(Bf,e.__scopeSelect),r=kp(Bf,e.__scopeSelect),[s,o]=f.useState(!1),i=we(t,r.onScrollButtonChange);return st(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;o(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?p.jsx(Ub,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});$b.displayName=Bf;var Wf="SelectScrollDownButton",Fb=f.forwardRef((e,t)=>{const n=Gr(Wf,e.__scopeSelect),r=kp(Wf,e.__scopeSelect),[s,o]=f.useState(!1),i=we(t,r.onScrollButtonChange);return st(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;o(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?p.jsx(Ub,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Fb.displayName=Wf;var Ub=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=Gr("SelectScrollButton",n),i=f.useRef(null),a=su(n),l=f.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return f.useEffect(()=>()=>l(),[l]),st(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),p.jsx(le.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:te(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:te(s.onPointerMove,()=>{var c;(c=o.onItemLeave)==null||c.call(o),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:te(s.onPointerLeave,()=>{l()})})}),cI="SelectSeparator",zb=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(le.div,{"aria-hidden":!0,...r,ref:t})});zb.displayName=cI;var Vf="SelectArrow",uI=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=ou(n),o=Kr(Vf,n),i=Gr(Vf,n);return o.open&&i.position==="popper"?p.jsx(nx,{...s,...r,ref:t}):null});uI.displayName=Vf;var dI="SelectBubbleInput",Bb=f.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=f.useRef(null),o=we(r,s),i=lb(t);return f.useEffect(()=>{const a=s.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==t&&u){const d=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(d)}},[i,t]),p.jsx(le.select,{...n,style:{...Yw,...n.style},ref:o,defaultValue:t})});Bb.displayName=dI;function Wb(e){return e===""||e===void 0}function Vb(e){const t=mn(e),n=f.useRef(""),r=f.useRef(0),s=f.useCallback(i=>{const a=n.current+i;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),o=f.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function Hb(e,t,n){const s=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=fI(e,Math.max(o,0));s.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function fI(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var hI=yb,qb=xb,pI=Sb,mI=_b,gI=Eb,Kb=Cb,vI=Pb,Gb=Ob,Qb=Ib,yI=Db,wI=Mb,Yb=$b,Jb=Fb,Xb=zb;const iu=hI,au=pI,Ta=f.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(qb,{ref:r,className:J("flex h-10 w-full items-center justify-between rounded-md border border-input bg-white px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,p.jsx(mI,{asChild:!0,children:p.jsx(w0,{className:"h-4 w-4 opacity-50"})})]}));Ta.displayName=qb.displayName;const Zb=f.forwardRef(({className:e,...t},n)=>p.jsx(Yb,{ref:n,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx($C,{className:"h-4 w-4"})}));Zb.displayName=Yb.displayName;const eS=f.forwardRef(({className:e,...t},n)=>p.jsx(Jb,{ref:n,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(w0,{className:"h-4 w-4"})}));eS.displayName=Jb.displayName;const Ra=f.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>p.jsx(gI,{children:p.jsxs(Kb,{ref:s,className:J("relative z-50 max-h-96 min-w-[8rem] overflow-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",n==="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:n,...r,children:[p.jsx(Zb,{}),p.jsx(vI,{className:J("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),p.jsx(eS,{})]})}));Ra.displayName=Kb.displayName;const xI=f.forwardRef(({className:e,...t},n)=>p.jsx(Gb,{ref:n,className:J("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));xI.displayName=Gb.displayName;const Qn=f.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Qb,{ref:r,className:J("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(wI,{children:p.jsx(DC,{className:"h-4 w-4"})})}),p.jsx(yI,{children:t})]}));Qn.displayName=Qb.displayName;const bI=f.forwardRef(({className:e,...t},n)=>p.jsx(Xb,{ref:n,className:J("-mx-1 my-1 h-px bg-muted",e),...t}));bI.displayName=Xb.displayName;const SI="/assets/icon-CM9ppjm6.png",_I=()=>{const[e,t]=f.useState(""),[n,r]=f.useState(!0),[s,o]=f.useState([]),[i,a]=f.useState(!1),[l,c]=f.useState(""),[u,d]=f.useState(""),[m,h]=f.useState(1),[b,v]=f.useState(10),x=Ko();f.useEffect(()=>{const j=setTimeout(()=>{d(l)},500);return()=>clearTimeout(j)},[l]),f.useEffect(()=>{const j=async(F,I)=>{const{data:H,error:z}=await ye.from("agents").select("role").eq("user_id",F).eq("role","admin").maybeSingle();if(z||!H){x("/access-denied");return}t(I),r(!1),w()};ye.auth.getSession().then(({data:{session:F}})=>{F?j(F.user.id,F.user.email||""):x("/")});const{data:{subscription:A}}=ye.auth.onAuthStateChange((F,I)=>{I?j(I.user.id,I.user.email||""):x("/")});return()=>A.unsubscribe()},[x]);const w=async()=>{a(!0);const{data:j,error:A}=await ye.from("workscopes").select("*").order("wsid",{ascending:!0});A?de.error("Failed to load workscopes"):o(j||[]),a(!1)},g=async j=>{if(!confirm("Are you sure you want to delete this workscope?"))return;const{error:A}=await ye.from("workscopes").delete().eq("wsid",j);A?de.error("Failed to delete workscope"):(de.success("Workscope deleted successfully"),w())},y=j=>{x(`/dashboard/edit-workscope/${j}`)},S=(j,A=100)=>j.length>A?j.substring(0,A)+"...":j,_=s.filter(j=>{const A=u.toLowerCase().trim();return A?j.wsid.toLowerCase().includes(A)||j.name.toLowerCase().includes(A)||j.description.toLowerCase().includes(A):!0}),E=Math.ceil(_.length/b),C=(m-1)*b,k=C+b,T=_.slice(C,k);f.useEffect(()=>{h(1)},[u]);const N=async()=>{const{error:j}=await ye.auth.signOut();j?de.error("Error logging out"):(de.success("Logged out successfully"),x("/"))};return n?p.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:p.jsx(tr,{className:"h-8 w-8 animate-spin text-primary"})}):p.jsx("div",{className:"min-h-screen bg-background p-6",children:p.jsxs("div",{className:"max-w-7xl mx-auto",children:[p.jsxs("div",{className:"flex items-center justify-between mb-8",children:[p.jsx("div",{children:p.jsxs("h1",{className:"text-4xl font-bold text-foreground",children:[p.jsx("img",{src:SI,style:{display:"inline-block",maxWidth:"40px",top:"-5px",position:"relative"}}),"  Manage Workscopes"]})}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs(Te,{variant:"outline",onClick:()=>x("/dashboard/manage-users"),children:[p.jsx(VC,{className:"mr-2 h-4 w-4"}),"Manage Users"]}),p.jsxs(Te,{variant:"outline",onClick:N,children:[p.jsx(zC,{className:"mr-2 h-4 w-4"}),"Logout"]})]})]}),p.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[p.jsxs(Te,{onClick:()=>x("/dashboard/create-workscope"),children:[p.jsx($c,{className:"mr-2 h-4 w-4"}),"Create New Workscope"]}),p.jsxs("div",{className:"relative max-w-xs",children:[p.jsx(BC,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),p.jsx(Fe,{type:"text",placeholder:"Search by ID, Name, or Description...",value:l,onChange:j=>c(j.target.value),className:"pl-9 pr-9"}),l&&p.jsx("button",{onClick:()=>c(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",type:"button",children:p.jsx(Yh,{className:"h-4 w-4"})})]})]}),p.jsx("div",{className:"bg-card rounded-lg border",children:i?p.jsx("div",{className:"flex items-center justify-center p-12",children:p.jsx(tr,{className:"h-8 w-8 animate-spin text-primary"})}):p.jsxs(bp,{children:[p.jsx(Sp,{children:p.jsxs(ys,{children:[p.jsx(dn,{className:"w-24",children:"ID"}),p.jsx(dn,{children:"Name"}),p.jsx(dn,{children:"Description"}),p.jsx(dn,{className:"w-24 text-right",children:"Actions"})]})}),p.jsx(_p,{children:T.length===0?p.jsx(ys,{children:p.jsx(It,{colSpan:4,className:"text-center text-muted-foreground py-8",children:u?"No workscopes found matching your search.":"No workscopes found. Create your first workscope to get started."})}):T.map(j=>p.jsxs(ys,{children:[p.jsx(It,{className:"font-medium",children:j.wsid}),p.jsx(It,{children:j.name}),p.jsx(It,{className:"text-muted-foreground",children:S(j.description)}),p.jsx(It,{className:"text-right",children:p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p.jsx(Te,{variant:"ghost",size:"icon",onClick:()=>y(j.wsid),children:p.jsx(b0,{className:"h-4 w-4"})}),p.jsx(Te,{variant:"ghost",size:"icon",onClick:()=>g(j.wsid),children:p.jsx(Fc,{className:"h-4 w-4 text-destructive"})})]})})]},j.wsid))})]})}),E>1&&p.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[p.jsx(nb,{className:"justify-start",children:p.jsxs(rb,{children:[p.jsx(qs,{children:p.jsx(go,{onClick:()=>h(1),className:m===1?"pointer-events-none opacity-50":"cursor-pointer",children:p.jsx(FC,{className:"h-4 w-4"})})}),p.jsx(qs,{children:p.jsx(sb,{onClick:()=>h(j=>Math.max(1,j-1)),className:m===1?"pointer-events-none opacity-50":"cursor-pointer"})}),(()=>{let A=Math.max(1,m-Math.floor(2.5)),F=Math.min(E,A+5-1);return F-A+1<5&&(A=Math.max(1,F-5+1)),Array.from({length:F-A+1},(I,H)=>A+H).map(I=>p.jsx(qs,{children:p.jsx(go,{onClick:()=>h(I),isActive:m===I,className:"cursor-pointer",children:I})},I))})(),p.jsx(qs,{children:p.jsx(ob,{onClick:()=>h(j=>Math.min(E,j+1)),className:m===E?"pointer-events-none opacity-50":"cursor-pointer"})}),p.jsx(qs,{children:p.jsx(go,{onClick:()=>h(E),className:m===E?"pointer-events-none opacity-50":"cursor-pointer",children:p.jsx(UC,{className:"h-4 w-4"})})})]})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(me,{htmlFor:"rows-per-page",className:"text-sm whitespace-nowrap",children:"Rows per page:"}),p.jsxs(iu,{value:b.toString(),onValueChange:j=>{v(Number(j)),h(1)},children:[p.jsx(Ta,{id:"rows-per-page",className:"w-20",children:p.jsx(au,{})}),p.jsxs(Ra,{children:[p.jsx(Qn,{value:"10",children:"10"}),p.jsx(Qn,{value:"25",children:"25"}),p.jsx(Qn,{value:"50",children:"50"}),p.jsx(Qn,{value:"100",children:"100"})]})]})]})]})]})})},ua=f.forwardRef(({className:e,...t},n)=>p.jsx("textarea",{className:J("flex min-h-[80px] w-full rounded-md border border-input bg-white px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));ua.displayName="Textarea";var lu="Switch",[EI,Q2]=js(lu),[CI,kI]=EI(lu),tS=f.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:o,required:i,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[m,h]=f.useState(null),b=we(t,y=>h(y)),v=f.useRef(!1),x=m?u||!!m.closest("form"):!0,[w,g]=ta({prop:s,defaultProp:o??!1,onChange:c,caller:lu});return p.jsxs(CI,{scope:n,checked:w,disabled:a,children:[p.jsx(le.button,{type:"button",role:"switch","aria-checked":w,"aria-required":i,"data-state":oS(w),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:b,onClick:te(e.onClick,y=>{g(S=>!S),x&&(v.current=y.isPropagationStopped(),v.current||y.stopPropagation())})}),x&&p.jsx(sS,{control:m,bubbles:!v.current,name:r,value:l,checked:w,required:i,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});tS.displayName=lu;var nS="SwitchThumb",rS=f.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=kI(nS,n);return p.jsx(le.span,{"data-state":oS(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});rS.displayName=nS;var TI="SwitchBubbleInput",sS=f.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...s},o)=>{const i=f.useRef(null),a=we(i,o),l=lb(n),c=V0(t);return f.useEffect(()=>{const u=i.current;if(!u)return;const d=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==n&&h){const b=new Event("click",{bubbles:r});h.call(u,n),u.dispatchEvent(b)}},[l,n,r]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:a,style:{...s.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});sS.displayName=TI;function oS(e){return e?"checked":"unchecked"}var iS=tS,RI=rS;const Tp=f.forwardRef(({className:e,...t},n)=>p.jsx(iS,{className:J("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input 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",e),...t,ref:n,children:p.jsx(RI,{className:J("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Tp.displayName=iS.displayName;function PI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const cu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Jo(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Rp(e){return"nodeType"in e}function jt(e){var t,n;return e?Jo(e)?e:Rp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Pp(e){const{Document:t}=jt(e);return e instanceof t}function Pa(e){return Jo(e)?!1:e instanceof jt(e).HTMLElement}function aS(e){return e instanceof jt(e).SVGElement}function Xo(e){return e?Jo(e)?e.document:Rp(e)?Pp(e)?e:Pa(e)||aS(e)?e.ownerDocument:document:document:document}const $n=cu?f.useLayoutEffect:f.useEffect;function jp(e){const t=f.useRef(e);return $n(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function jI(){const e=f.useRef(null),t=f.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function da(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return $n(()=>{n.current!==e&&(n.current=e)},t),n}function ja(e,t){const n=f.useRef();return f.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function hc(e){const t=jp(e),n=f.useRef(null),r=f.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function Hf(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let vd={};function Na(e,t){return f.useMemo(()=>{if(t)return t;const n=vd[e]==null?0:vd[e]+1;return vd[e]=n,e+"-"+n},[e,t])}function lS(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((o,i)=>{const a=Object.entries(i);for(const[l,c]of a){const u=o[l];u!=null&&(o[l]=u+e*c)}return o},{...t})}}const yo=lS(1),fa=lS(-1);function NI(e){return"clientX"in e&&"clientY"in e}function Np(e){if(!e)return!1;const{KeyboardEvent:t}=jt(e.target);return t&&e instanceof t}function OI(e){if(!e)return!1;const{TouchEvent:t}=jt(e.target);return t&&e instanceof t}function qf(e){if(OI(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return NI(e)?{x:e.clientX,y:e.clientY}:null}const $o=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[$o.Translate.toString(e),$o.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),av="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function AI(e){return e.matches(av)?e:e.querySelector(av)}const II={display:"none"};function DI(e){let{id:t,value:n}=e;return D.createElement("div",{id:t,style:II},n)}function LI(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return D.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function MI(){const[e,t]=f.useState("");return{announce:f.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const cS=f.createContext(null);function $I(e){const t=f.useContext(cS);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function FI(){const[e]=f.useState(()=>new Set),t=f.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[f.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),t]}const UI={draggable:`
    To pick up a draggable item, press the space bar.
    While dragging, use the arrow keys to move the item.
    Press space again to drop the item in its new position, or press escape to cancel.
  `},zI={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function BI(e){let{announcements:t=zI,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=UI}=e;const{announce:o,announcement:i}=MI(),a=Na("DndLiveRegion"),[l,c]=f.useState(!1);if(f.useEffect(()=>{c(!0)},[]),$I(f.useMemo(()=>({onDragStart(d){let{active:m}=d;o(t.onDragStart({active:m}))},onDragMove(d){let{active:m,over:h}=d;t.onDragMove&&o(t.onDragMove({active:m,over:h}))},onDragOver(d){let{active:m,over:h}=d;o(t.onDragOver({active:m,over:h}))},onDragEnd(d){let{active:m,over:h}=d;o(t.onDragEnd({active:m,over:h}))},onDragCancel(d){let{active:m,over:h}=d;o(t.onDragCancel({active:m,over:h}))}}),[o,t])),!l)return null;const u=D.createElement(D.Fragment,null,D.createElement(DI,{id:r,value:s.draggable}),D.createElement(LI,{id:a,announcement:i}));return n?Kt.createPortal(u,n):u}var qe;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(qe||(qe={}));function pc(){}function mc(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function uS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const yn=Object.freeze({x:0,y:0});function dS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function fS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function WI(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function lv(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function hS(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function cv(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const pS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=cv(t,t.left,t.top),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=dS(cv(l),s);o.push({id:a,data:{droppableContainer:i,value:c}})}}return o.sort(fS)},VI=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=lv(t),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=lv(l),u=s.reduce((m,h,b)=>m+dS(c[b],h),0),d=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:d}})}}return o.sort(fS)};function HI(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),i=s-r,a=o-n;if(r<s&&n<o){const l=t.width*t.height,c=e.width*e.height,u=i*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const qI=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const o of r){const{id:i}=o,a=n.get(i);if(a){const l=HI(a,t);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(WI)};function KI(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function mS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:yn}function GI(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s.reduce((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...n})}}const QI=GI(1);function YI(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function JI(e,t,n){const r=YI(t);if(!r)return e;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=e.left-i-(1-s)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=s?e.width/s:e.width,d=o?e.height/o:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const XI={ignoreTransform:!1};function Zo(e,t){t===void 0&&(t=XI);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=jt(e).getComputedStyle(e);c&&(n=JI(n,c,u))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=n;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function uv(e){return Zo(e,{ignoreTransform:!0})}function ZI(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function eD(e,t){return t===void 0&&(t=jt(e).getComputedStyle(e)),t.position==="fixed"}function tD(e,t){t===void 0&&(t=jt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=t[s];return typeof o=="string"?n.test(o):!1})}function uu(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(Pp(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Pa(s)||aS(s)||n.includes(s))return n;const o=jt(e).getComputedStyle(s);return s!==e&&tD(s,o)&&n.push(s),eD(s,o)?n:r(s.parentNode)}return e?r(e):n}function gS(e){const[t]=uu(e,1);return t??null}function yd(e){return!cu||!e?null:Jo(e)?e:Rp(e)?Pp(e)||e===Xo(e).scrollingElement?window:Pa(e)?e:null:null}function vS(e){return Jo(e)?e.scrollX:e.scrollLeft}function yS(e){return Jo(e)?e.scrollY:e.scrollTop}function Kf(e){return{x:vS(e),y:yS(e)}}var Xe;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xe||(Xe={}));function wS(e){return!cu||!e?!1:e===document.scrollingElement}function xS(e){const t={x:0,y:0},n=wS(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:t}}const nD={x:.2,y:.2};function rD(e,t,n,r,s){let{top:o,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=nD);const{isTop:c,isBottom:u,isLeft:d,isRight:m}=xS(e),h={x:0,y:0},b={x:0,y:0},v={height:t.height*s.y,width:t.width*s.x};return!c&&o<=t.top+v.height?(h.y=Xe.Backward,b.y=r*Math.abs((t.top+v.height-o)/v.height)):!u&&l>=t.bottom-v.height&&(h.y=Xe.Forward,b.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!m&&a>=t.right-v.width?(h.x=Xe.Forward,b.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&i<=t.left+v.width&&(h.x=Xe.Backward,b.x=r*Math.abs((t.left+v.width-i)/v.width)),{direction:h,speed:b}}function sD(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function bS(e){return e.reduce((t,n)=>yo(t,Kf(n)),yn)}function oD(e){return e.reduce((t,n)=>t+vS(n),0)}function iD(e){return e.reduce((t,n)=>t+yS(n),0)}function aD(e,t){if(t===void 0&&(t=Zo),!e)return;const{top:n,left:r,bottom:s,right:o}=t(e);gS(e)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const lD=[["x",["left","right"],oD],["y",["top","bottom"],iD]];class Op{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=uu(n),s=bS(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,i,a]of lD)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=s[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Di{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function cD(e){const{EventTarget:t}=jt(e);return e instanceof t?e:Xo(e)}function wd(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Wt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Wt||(Wt={}));function dv(e){e.preventDefault()}function uD(e){e.stopPropagation()}var ue;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(ue||(ue={}));const SS={start:[ue.Space,ue.Enter],cancel:[ue.Esc],end:[ue.Space,ue.Enter,ue.Tab]},dD=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ue.Right:return{...n,x:n.x+25};case ue.Left:return{...n,x:n.x-25};case ue.Down:return{...n,y:n.y+25};case ue.Up:return{...n,y:n.y-25}}};class du{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Di(Xo(n)),this.windowListeners=new Di(jt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Wt.Resize,this.handleCancel),this.windowListeners.add(Wt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Wt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&aD(r),n(yn)}handleKeyDown(t){if(Np(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=SS,coordinateGetter:i=dD,scrollBehavior:a="smooth"}=s,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:yn;this.referenceCoordinates||(this.referenceCoordinates=u);const d=i(t,{active:n,context:r.current,currentCoordinates:u});if(d){const m=fa(d,u),h={x:0,y:0},{scrollableAncestors:b}=r.current;for(const v of b){const x=t.code,{isTop:w,isRight:g,isLeft:y,isBottom:S,maxScroll:_,minScroll:E}=xS(v),C=sD(v),k={x:Math.min(x===ue.Right?C.right-C.width/2:C.right,Math.max(x===ue.Right?C.left:C.left+C.width/2,d.x)),y:Math.min(x===ue.Down?C.bottom-C.height/2:C.bottom,Math.max(x===ue.Down?C.top:C.top+C.height/2,d.y))},T=x===ue.Right&&!g||x===ue.Left&&!y,N=x===ue.Down&&!S||x===ue.Up&&!w;if(T&&k.x!==d.x){const j=v.scrollLeft+m.x,A=x===ue.Right&&j<=_.x||x===ue.Left&&j>=E.x;if(A&&!m.y){v.scrollTo({left:j,behavior:a});return}A?h.x=v.scrollLeft-j:h.x=x===ue.Right?v.scrollLeft-_.x:v.scrollLeft-E.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(N&&k.y!==d.y){const j=v.scrollTop+m.y,A=x===ue.Down&&j<=_.y||x===ue.Up&&j>=E.y;if(A&&!m.x){v.scrollTo({top:j,behavior:a});return}A?h.y=v.scrollTop-j:h.y=x===ue.Down?v.scrollTop-_.y:v.scrollTop-E.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,yo(fa(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}du.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=SS,onActivation:s}=t,{active:o}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function fv(e){return!!(e&&"distance"in e)}function hv(e){return!!(e&&"delay"in e)}class Ap{constructor(t,n,r){var s;r===void 0&&(r=cD(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:i}=o;this.props=t,this.events=n,this.document=Xo(i),this.documentListeners=new Di(this.document),this.listeners=new Di(r),this.windowListeners=new Di(jt(i)),this.initialCoordinates=(s=qf(o))!=null?s:yn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Wt.Resize,this.handleCancel),this.windowListeners.add(Wt.DragStart,dv),this.windowListeners.add(Wt.VisibilityChange,this.handleCancel),this.windowListeners.add(Wt.ContextMenu,dv),this.documentListeners.add(Wt.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(hv(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(fv(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Wt.Click,uD,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Wt.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(n=qf(t))!=null?n:yn,c=fa(s,l);if(!r&&a){if(fv(a)){if(a.tolerance!=null&&wd(c,a.tolerance))return this.handleCancel();if(wd(c,a.distance))return this.handleStart()}if(hv(a)&&wd(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===ue.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const fD={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class fu extends Ap{constructor(t){const{event:n}=t,r=Xo(n.target);super(t,fD,r)}}fu.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const hD={move:{name:"mousemove"},end:{name:"mouseup"}};var Gf;(function(e){e[e.RightClick=2]="RightClick"})(Gf||(Gf={}));class pD extends Ap{constructor(t){super(t,hD,Xo(t.event.target))}}pD.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gf.RightClick?!1:(r==null||r({event:n}),!0)}}];const xd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class mD extends Ap{constructor(t){super(t,xd)}static setup(){return window.addEventListener(xd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(xd.move.name,t)};function t(){}}}mD.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Li;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Li||(Li={}));var gc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(gc||(gc={}));function gD(e){let{acceleration:t,activator:n=Li.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=gc.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:m}=e;const h=yD({delta:d,disabled:!o}),[b,v]=jI(),x=f.useRef({x:0,y:0}),w=f.useRef({x:0,y:0}),g=f.useMemo(()=>{switch(n){case Li.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Li.DraggableRect:return s}},[n,s,l]),y=f.useRef(null),S=f.useCallback(()=>{const E=y.current;if(!E)return;const C=x.current.x*w.current.x,k=x.current.y*w.current.y;E.scrollBy(C,k)},[]),_=f.useMemo(()=>a===gc.TreeOrder?[...c].reverse():c,[a,c]);f.useEffect(()=>{if(!o||!c.length||!g){v();return}for(const E of _){if((r==null?void 0:r(E))===!1)continue;const C=c.indexOf(E),k=u[C];if(!k)continue;const{direction:T,speed:N}=rD(E,k,g,t,m);for(const j of["x","y"])h[j][T[j]]||(N[j]=0,T[j]=0);if(N.x>0||N.y>0){v(),y.current=E,b(S,i),x.current=N,w.current=T;return}}x.current={x:0,y:0},w.current={x:0,y:0},v()},[t,S,r,v,o,i,JSON.stringify(g),JSON.stringify(h),b,c,_,u,JSON.stringify(m)])}const vD={x:{[Xe.Backward]:!1,[Xe.Forward]:!1},y:{[Xe.Backward]:!1,[Xe.Forward]:!1}};function yD(e){let{delta:t,disabled:n}=e;const r=Hf(t);return ja(s=>{if(n||!r||!s)return vD;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xe.Backward]:s.x[Xe.Backward]||o.x===-1,[Xe.Forward]:s.x[Xe.Forward]||o.x===1},y:{[Xe.Backward]:s.y[Xe.Backward]||o.y===-1,[Xe.Forward]:s.y[Xe.Forward]||o.y===1}}},[n,t,r])}function wD(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return ja(s=>{var o;return t==null?null:(o=r??s)!=null?o:null},[r,t])}function xD(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...o]},[]),[e,t])}var ha;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ha||(ha={}));var Qf;(function(e){e.Optimized="optimized"})(Qf||(Qf={}));const pv=new Map;function bD(e,t){let{dragging:n,dependencies:r,config:s}=t;const[o,i]=f.useState(null),{frequency:a,measure:l,strategy:c}=s,u=f.useRef(e),d=x(),m=da(d),h=f.useCallback(function(w){w===void 0&&(w=[]),!m.current&&i(g=>g===null?w:g.concat(w.filter(y=>!g.includes(y))))},[m]),b=f.useRef(null),v=ja(w=>{if(d&&!n)return pv;if(!w||w===pv||u.current!==e||o!=null){const g=new Map;for(let y of e){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){g.set(y.id,y.rect.current);continue}const S=y.node.current,_=S?new Op(l(S),S):null;y.rect.current=_,_&&g.set(y.id,_)}return g}return w},[e,o,n,d,l]);return f.useEffect(()=>{u.current=e},[e]),f.useEffect(()=>{d||h()},[n,d]),f.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),f.useEffect(()=>{d||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{h(),b.current=null},a))},[a,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:o!=null};function x(){switch(c){case ha.Always:return!1;case ha.BeforeDragging:return n;default:return!n}}}function _S(e,t){return ja(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function SD(e,t){return _S(e,t)}function _D(e){let{callback:t,disabled:n}=e;const r=jp(t),s=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return f.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function hu(e){let{callback:t,disabled:n}=e;const r=jp(t),s=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return f.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function ED(e){return new Op(Zo(e),e)}function mv(e,t,n){t===void 0&&(t=ED);const[r,s]=f.useState(null);function o(){s(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const i=_D({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){o();break}}}}),a=hu({callback:o});return $n(()=>{o(),e?(a==null||a.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),i==null||i.disconnect())},[e]),r}function CD(e){const t=_S(e);return mS(e,t)}const gv=[];function kD(e){const t=f.useRef(e),n=ja(r=>e?r&&r!==gv&&e&&t.current&&e.parentNode===t.current.parentNode?r:uu(e):gv,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function TD(e){const[t,n]=f.useState(null),r=f.useRef(e),s=f.useCallback(o=>{const i=yd(o.target);i&&n(a=>a?(a.set(i,Kf(i)),new Map(a)):null)},[]);return f.useEffect(()=>{const o=r.current;if(e!==o){i(o);const a=e.map(l=>{const c=yd(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,Kf(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const c=yd(l);c==null||c.removeEventListener("scroll",s)})}},[s,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>yo(o,i),yn):bS(e):yn,[e,t])}function vv(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==yn;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?fa(e,n.current):yn}function RD(e){f.useEffect(()=>{if(!cu)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function PD(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=i=>{o(i,t)},n},{}),[e,t])}function ES(e){return f.useMemo(()=>e?ZI(e):null,[e])}const yv=[];function jD(e,t){t===void 0&&(t=Zo);const[n]=e,r=ES(n?jt(n):null),[s,o]=f.useState(yv);function i(){o(()=>e.length?e.map(l=>wS(l)?r:new Op(t(l),l)):yv)}const a=hu({callback:i});return $n(()=>{a==null||a.disconnect(),i(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),s}function ND(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Pa(t)?t:e}function OD(e){let{measure:t}=e;const[n,r]=f.useState(null),s=f.useCallback(c=>{for(const{target:u}of c)if(Pa(u)){r(d=>{const m=t(u);return d?{...d,width:m.width,height:m.height}:m});break}},[t]),o=hu({callback:s}),i=f.useCallback(c=>{const u=ND(c);o==null||o.disconnect(),u&&(o==null||o.observe(u)),r(u?t(u):null)},[t,o]),[a,l]=hc(i);return f.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const AD=[{sensor:fu,options:{}},{sensor:du,options:{}}],ID={current:{}},Nl={draggable:{measure:uv},droppable:{measure:uv,strategy:ha.WhileDragging,frequency:Qf.Optimized},dragOverlay:{measure:Zo}};class Mi extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const DD={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Mi,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Nl,measureDroppableContainers:pc,windowRect:null,measuringScheduled:!1},LD={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pc,draggableNodes:new Map,over:null,measureDroppableContainers:pc},pu=f.createContext(LD),CS=f.createContext(DD);function MD(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Mi}}}function $D(e,t){switch(t.type){case qe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case qe.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case qe.DragEnd:case qe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case qe.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new Mi(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case qe.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Mi(e.droppable.containers);return i.set(n,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case qe.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new Mi(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function FD(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=f.useContext(pu),o=Hf(r),i=Hf(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!r&&o&&i!=null){if(!Np(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=AI(u);if(d){d.focus();break}}})}},[r,t,s,i,o]),null}function UD(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),n):n}function zD(e){return f.useMemo(()=>({draggable:{...Nl.draggable,...e==null?void 0:e.draggable},droppable:{...Nl.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Nl.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function BD(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const o=f.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;$n(()=>{if(!i&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=mS(u,r);if(i||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const m=gS(c);m&&m.scrollBy({top:d.y,left:d.x})}},[t,i,a,r,n])}const kS=f.createContext({...yn,scaleX:1,scaleY:1});var wr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(wr||(wr={}));const TS=f.memo(function(t){var n,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:u=AD,collisionDetection:d=qI,measuring:m,modifiers:h,...b}=t;const v=f.useReducer($D,void 0,MD),[x,w]=v,[g,y]=FI(),[S,_]=f.useState(wr.Uninitialized),E=S===wr.Initialized,{draggable:{active:C,nodes:k,translate:T},droppable:{containers:N}}=x,j=C!=null?k.get(C):null,A=f.useRef({initial:null,translated:null}),F=f.useMemo(()=>{var Ue;return C!=null?{id:C,data:(Ue=j==null?void 0:j.data)!=null?Ue:ID,rect:A}:null},[C,j]),I=f.useRef(null),[H,z]=f.useState(null),[B,R]=f.useState(null),P=da(b,Object.values(b)),M=Na("DndDescribedBy",i),q=f.useMemo(()=>N.getEnabled(),[N]),U=zD(m),{droppableRects:Q,measureDroppableContainers:Y,measuringScheduled:ge}=bD(q,{dragging:E,dependencies:[T.x,T.y],config:U.droppable}),ce=wD(k,C),$=f.useMemo(()=>B?qf(B):null,[B]),oe=wu(),he=SD(ce,U.draggable.measure);BD({activeNode:C!=null?k.get(C):null,config:oe.layoutShiftCompensation,initialRect:he,measure:U.draggable.measure});const V=mv(ce,U.draggable.measure,he),se=mv(ce?ce.parentElement:null),Z=f.useRef({activatorEvent:null,active:null,activeNode:ce,collisionRect:null,collisions:null,droppableRects:Q,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Re=N.getNodeFor((n=Z.current.over)==null?void 0:n.id),Oe=OD({measure:U.dragOverlay.measure}),xt=(r=Oe.nodeRef.current)!=null?r:ce,ft=E?(s=Oe.rect)!=null?s:V:null,xn=!!(Oe.nodeRef.current&&Oe.rect),or=CD(xn?null:V),bn=ES(xt?jt(xt):null),Xt=kD(E?Re??ce:null),Sn=jD(Xt),Qr=UD(h,{transform:{x:T.x-or.x,y:T.y-or.y,scaleX:1,scaleY:1},activatorEvent:B,active:F,activeNodeRect:V,containerNodeRect:se,draggingNodeRect:ft,over:Z.current.over,overlayNodeRect:Oe.rect,scrollableAncestors:Xt,scrollableAncestorRects:Sn,windowRect:bn}),_n=$?yo($,T):null,Oa=TD(Xt),vu=vv(Oa),bt=vv(Oa,[V]),Nt=yo(Qr,vu),ir=ft?QI(ft,Qr):null,Yr=F&&ir?d({active:F,collisionRect:ir,droppableRects:Q,droppableContainers:q,pointerCoordinates:_n}):null,Jr=hS(Yr,"id"),[En,ei]=f.useState(null),ti=xn?Qr:yo(Qr,bt),ar=KI(ti,(o=En==null?void 0:En.rect)!=null?o:null,V),As=f.useRef(null),Un=f.useCallback((Ue,Ae)=>{let{sensor:ht,options:K}=Ae;if(I.current==null)return;const ne=k.get(I.current);if(!ne)return;const ie=Ue.nativeEvent,Ie=new ht({active:I.current,activeNode:ne,event:ie,options:K,context:Z,onAbort(xe){if(!k.get(xe))return;const{onDragAbort:De}=P.current,Ye={id:xe};De==null||De(Ye),g({type:"onDragAbort",event:Ye})},onPending(xe,ot,De,Ye){if(!k.get(xe))return;const{onDragPending:ri}=P.current,lr={id:xe,constraint:ot,initialCoordinates:De,offset:Ye};ri==null||ri(lr),g({type:"onDragPending",event:lr})},onStart(xe){const ot=I.current;if(ot==null)return;const De=k.get(ot);if(!De)return;const{onDragStart:Ye}=P.current,ni={activatorEvent:ie,active:{id:ot,data:De.data,rect:A}};Kt.unstable_batchedUpdates(()=>{Ye==null||Ye(ni),_(wr.Initializing),w({type:qe.DragStart,initialCoordinates:xe,active:ot}),g({type:"onDragStart",event:ni}),z(As.current),R(ie)})},onMove(xe){w({type:qe.DragMove,coordinates:xe})},onEnd:Qe(qe.DragEnd),onCancel:Qe(qe.DragCancel)});As.current=Ie;function Qe(xe){return async function(){const{active:De,collisions:Ye,over:ni,scrollAdjustedTranslate:ri}=Z.current;let lr=null;if(De&&ri){const{cancelDrop:si}=P.current;lr={activatorEvent:ie,active:De,collisions:Ye,delta:ri,over:ni},xe===qe.DragEnd&&typeof si=="function"&&await Promise.resolve(si(lr))&&(xe=qe.DragCancel)}I.current=null,Kt.unstable_batchedUpdates(()=>{w({type:xe}),_(wr.Uninitialized),ei(null),z(null),R(null),As.current=null;const si=xe===qe.DragEnd?"onDragEnd":"onDragCancel";if(lr){const xu=P.current[si];xu==null||xu(lr),g({type:si,event:lr})}})}}},[k]),yu=f.useCallback((Ue,Ae)=>(ht,K)=>{const ne=ht.nativeEvent,ie=k.get(K);if(I.current!==null||!ie||ne.dndKit||ne.defaultPrevented)return;const Ie={active:ie};Ue(ht,Ae.options,Ie)===!0&&(ne.dndKit={capturedBy:Ae.sensor},I.current=K,Un(ht,Ae))},[k,Un]),Aa=xD(u,yu);RD(u),$n(()=>{V&&S===wr.Initializing&&_(wr.Initialized)},[V,S]),f.useEffect(()=>{const{onDragMove:Ue}=P.current,{active:Ae,activatorEvent:ht,collisions:K,over:ne}=Z.current;if(!Ae||!ht)return;const ie={active:Ae,activatorEvent:ht,collisions:K,delta:{x:Nt.x,y:Nt.y},over:ne};Kt.unstable_batchedUpdates(()=>{Ue==null||Ue(ie),g({type:"onDragMove",event:ie})})},[Nt.x,Nt.y]),f.useEffect(()=>{const{active:Ue,activatorEvent:Ae,collisions:ht,droppableContainers:K,scrollAdjustedTranslate:ne}=Z.current;if(!Ue||I.current==null||!Ae||!ne)return;const{onDragOver:ie}=P.current,Ie=K.get(Jr),Qe=Ie&&Ie.rect.current?{id:Ie.id,rect:Ie.rect.current,data:Ie.data,disabled:Ie.disabled}:null,xe={active:Ue,activatorEvent:Ae,collisions:ht,delta:{x:ne.x,y:ne.y},over:Qe};Kt.unstable_batchedUpdates(()=>{ei(Qe),ie==null||ie(xe),g({type:"onDragOver",event:xe})})},[Jr]),$n(()=>{Z.current={activatorEvent:B,active:F,activeNode:ce,collisionRect:ir,collisions:Yr,droppableRects:Q,draggableNodes:k,draggingNode:xt,draggingNodeRect:ft,droppableContainers:N,over:En,scrollableAncestors:Xt,scrollAdjustedTranslate:Nt},A.current={initial:ft,translated:ir}},[F,ce,Yr,ir,k,xt,ft,Q,N,En,Xt,Nt]),gD({...oe,delta:T,draggingRect:ir,pointerCoordinates:_n,scrollableAncestors:Xt,scrollableAncestorRects:Sn});const Ia=f.useMemo(()=>({active:F,activeNode:ce,activeNodeRect:V,activatorEvent:B,collisions:Yr,containerNodeRect:se,dragOverlay:Oe,draggableNodes:k,droppableContainers:N,droppableRects:Q,over:En,measureDroppableContainers:Y,scrollableAncestors:Xt,scrollableAncestorRects:Sn,measuringConfiguration:U,measuringScheduled:ge,windowRect:bn}),[F,ce,V,B,Yr,se,Oe,k,N,Q,En,Y,Xt,Sn,U,ge,bn]),Da=f.useMemo(()=>({activatorEvent:B,activators:Aa,active:F,activeNodeRect:V,ariaDescribedById:{draggable:M},dispatch:w,draggableNodes:k,over:En,measureDroppableContainers:Y}),[B,Aa,F,V,w,M,k,En,Y]);return D.createElement(cS.Provider,{value:y},D.createElement(pu.Provider,{value:Da},D.createElement(CS.Provider,{value:Ia},D.createElement(kS.Provider,{value:ar},c)),D.createElement(FD,{disabled:(a==null?void 0:a.restoreFocus)===!1})),D.createElement(BI,{...a,hiddenTextDescribedById:M}));function wu(){const Ue=(H==null?void 0:H.autoScrollEnabled)===!1,Ae=typeof l=="object"?l.enabled===!1:l===!1,ht=E&&!Ue&&!Ae;return typeof l=="object"?{...l,enabled:ht}:{enabled:ht}}}),WD=f.createContext(null),wv="button",VD="Draggable";function HD(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const o=Na(VD),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:m}=f.useContext(pu),{role:h=wv,roleDescription:b="draggable",tabIndex:v=0}=s??{},x=(l==null?void 0:l.id)===t,w=f.useContext(x?kS:WD),[g,y]=hc(),[S,_]=hc(),E=PD(i,t),C=da(n);$n(()=>(d.set(t,{id:t,key:o,node:g,activatorNode:S,data:C}),()=>{const T=d.get(t);T&&T.key===o&&d.delete(t)}),[d,t]);const k=f.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&h===wv?!0:void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[r,h,v,x,b,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:k,isDragging:x,listeners:r?void 0:E,node:g,over:m,setNodeRef:y,setActivatorNodeRef:_,transform:w}}function qD(){return f.useContext(CS)}const KD="Droppable",GD={timeout:25};function QD(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const o=Na(KD),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=f.useContext(pu),u=f.useRef({disabled:n}),d=f.useRef(!1),m=f.useRef(null),h=f.useRef(null),{disabled:b,updateMeasurementsFor:v,timeout:x}={...GD,...s},w=da(v??r),g=f.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{c(Array.isArray(w.current)?w.current:[w.current]),h.current=null},x)},[x]),y=hu({callback:g,disabled:b||!i}),S=f.useCallback((k,T)=>{y&&(T&&(y.unobserve(T),d.current=!1),k&&y.observe(k))},[y]),[_,E]=hc(S),C=da(t);return f.useEffect(()=>{!y||!_.current||(y.disconnect(),d.current=!1,y.observe(_.current))},[_,y]),f.useEffect(()=>(a({type:qe.RegisterDroppable,element:{id:r,key:o,disabled:n,node:_,rect:m,data:C}}),()=>a({type:qe.UnregisterDroppable,key:o,id:r})),[r]),f.useEffect(()=>{n!==u.current.disabled&&(a({type:qe.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:i,rect:m,isOver:(l==null?void 0:l.id)===r,node:_,over:l,setNodeRef:E}}function mu(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function YD(e,t){return e.reduce((n,r,s)=>{const o=t.get(r);return o&&(n[s]=o),n},Array(e.length))}function fl(e){return e!==null&&e>=0}function JD(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function XD(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const RS=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const o=mu(t,r,n),i=t[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},hl={scaleX:1,scaleY:1},PS=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:i}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(s===n){const c=o[i];return c?{x:0,y:n<i?c.top+c.height-(a.top+a.height):c.top-a.top,...hl}:null}const l=ZD(o,s,n);return s>n&&s<=i?{x:0,y:-a.height-l,...hl}:s<n&&s>=i?{x:0,y:a.height+l,...hl}:{x:0,y:0,...hl}};function ZD(e,t,n){const r=e[t],s=e[t-1],o=e[t+1];return r?n<t?s?r.top-(s.top+s.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const jS="Sortable",NS=D.createContext({activeIndex:-1,containerId:jS,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:RS,disabled:{draggable:!1,droppable:!1}});function OS(e){let{children:t,id:n,items:r,strategy:s=RS,disabled:o=!1}=e;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=qD(),d=Na(jS,n),m=a.rect!==null,h=f.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),b=i!=null,v=i?h.indexOf(i.id):-1,x=c?h.indexOf(c.id):-1,w=f.useRef(h),g=!JD(h,w.current),y=x!==-1&&v===-1||g,S=XD(o);$n(()=>{g&&b&&u(h)},[g,h,b,u]),f.useEffect(()=>{w.current=h},[h]);const _=f.useMemo(()=>({activeIndex:v,containerId:d,disabled:S,disableTransforms:y,items:h,overIndex:x,useDragOverlay:m,sortedRects:YD(h,l),strategy:s}),[v,d,S.draggable,S.droppable,y,h,x,l,m,s]);return D.createElement(NS.Provider,{value:_},t)}const e2=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return mu(n,r,s).indexOf(t)},t2=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&s===i?!1:n?!0:i!==s&&t===l},n2={duration:200,easing:"ease"},AS="transform",r2=$o.Transition.toString({property:AS,duration:0,easing:"linear"}),s2={roleDescription:"sortable"};function o2(e){let{disabled:t,index:n,node:r,rect:s}=e;const[o,i]=f.useState(null),a=f.useRef(n);return $n(()=>{if(!t&&n!==a.current&&r.current){const l=s.current;if(l){const c=Zo(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&i(u)}}n!==a.current&&(a.current=n)},[t,n,r,s]),f.useEffect(()=>{o&&i(null)},[o]),o}function IS(e){let{animateLayoutChanges:t=t2,attributes:n,disabled:r,data:s,getNewIndex:o=e2,id:i,strategy:a,resizeObserverConfig:l,transition:c=n2}=e;const{items:u,containerId:d,activeIndex:m,disabled:h,disableTransforms:b,sortedRects:v,overIndex:x,useDragOverlay:w,strategy:g}=f.useContext(NS),y=i2(r,h),S=u.indexOf(i),_=f.useMemo(()=>({sortable:{containerId:d,index:S,items:u},...s}),[d,s,S,u]),E=f.useMemo(()=>u.slice(u.indexOf(i)),[u,i]),{rect:C,node:k,isOver:T,setNodeRef:N}=QD({id:i,data:_,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:j,activatorEvent:A,activeNodeRect:F,attributes:I,setNodeRef:H,listeners:z,isDragging:B,over:R,setActivatorNodeRef:P,transform:M}=HD({id:i,data:_,attributes:{...s2,...n},disabled:y.draggable}),q=PI(N,H),U=!!j,Q=U&&!b&&fl(m)&&fl(x),Y=!w&&B,ge=Y&&Q?M:null,$=Q?ge??(a??g)({rects:v,activeNodeRect:F,activeIndex:m,overIndex:x,index:S}):null,oe=fl(m)&&fl(x)?o({id:i,items:u,activeIndex:m,overIndex:x}):S,he=j==null?void 0:j.id,V=f.useRef({activeId:he,items:u,newIndex:oe,containerId:d}),se=u!==V.current.items,Z=t({active:j,containerId:d,isDragging:B,isSorting:U,id:i,index:S,items:u,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:c,wasDragging:V.current.activeId!=null}),Re=o2({disabled:!Z,index:S,node:k,rect:C});return f.useEffect(()=>{U&&V.current.newIndex!==oe&&(V.current.newIndex=oe),d!==V.current.containerId&&(V.current.containerId=d),u!==V.current.items&&(V.current.items=u)},[U,oe,d,u]),f.useEffect(()=>{if(he===V.current.activeId)return;if(he!=null&&V.current.activeId==null){V.current.activeId=he;return}const xt=setTimeout(()=>{V.current.activeId=he},50);return()=>clearTimeout(xt)},[he]),{active:j,activeIndex:m,attributes:I,data:_,rect:C,index:S,newIndex:oe,items:u,isOver:T,isSorting:U,isDragging:B,listeners:z,node:k,overIndex:x,over:R,setNodeRef:q,setActivatorNodeRef:P,setDroppableNodeRef:N,setDraggableNodeRef:H,transform:Re??$,transition:Oe()};function Oe(){if(Re||se&&V.current.newIndex===S)return r2;if(!(Y&&!Np(A)||!c)&&(U||Z))return $o.Transition.toString({...c,property:AS})}}function i2(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function vc(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const a2=[ue.Down,ue.Right,ue.Up,ue.Left],DS=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:o,over:i,scrollableAncestors:a}}=t;if(a2.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const m=s.get(d.id);if(m)switch(e.code){case ue.Down:r.top<m.top&&l.push(d);break;case ue.Up:r.top>m.top&&l.push(d);break;case ue.Left:r.left>m.left&&l.push(d);break;case ue.Right:r.left<m.left&&l.push(d);break}});const c=VI({active:n,collisionRect:r,droppableRects:s,droppableContainers:l,pointerCoordinates:null});let u=hS(c,"id");if(u===(i==null?void 0:i.id)&&c.length>1&&(u=c[1].id),u!=null){const d=o.get(n.id),m=o.get(u),h=m?s.get(m.id):null,b=m==null?void 0:m.node.current;if(b&&h&&d&&m){const x=uu(b).some((E,C)=>a[C]!==E),w=LS(d,m),g=l2(d,m),y=x||!w?{x:0,y:0}:{x:g?r.width-h.width:0,y:g?r.height-h.height:0},S={x:h.left,y:h.top};return y.x&&y.y?S:fa(S,y)}}}};function LS(e,t){return!vc(e)||!vc(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function l2(e,t){return!vc(e)||!vc(t)||!LS(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function c2({calculation:e,index:t,onUpdate:n,onDelete:r}){const{attributes:s,listeners:o,setNodeRef:i,transform:a,transition:l}=IS({id:e.id||e.tempId||`calc-${t}`}),c={transform:$o.Transform.toString(a),transition:l};return p.jsxs("div",{ref:i,style:c,className:"flex items-start gap-2 p-4 border rounded-lg bg-card",children:[p.jsx("button",{type:"button",className:"mt-2 cursor-grab active:cursor-grabbing",...s,...o,children:p.jsx(x0,{className:"h-5 w-5 text-muted-foreground"})}),p.jsxs("div",{className:"flex-1 flex gap-4",children:[p.jsxs("div",{className:"flex-1",children:[p.jsxs(me,{htmlFor:`calc-name-${t}`,children:["Name ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:`calc-name-${t}`,value:e.name,onChange:u=>n(t,"name",u.target.value),required:!0})]}),p.jsxs("div",{className:"flex-1",children:[p.jsx(me,{htmlFor:`calc-qty-${t}`,children:"Quantity Label"}),p.jsx(Fe,{id:`calc-qty-${t}`,value:e.qty_label,onChange:u=>n(t,"qty_label",u.target.value)})]}),p.jsxs("div",{children:[p.jsxs(me,{htmlFor:`calc-rate-${t}`,children:["Rate ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:`calc-rate-${t}`,type:"number",step:"0.01",value:e.rate,onChange:u=>n(t,"rate",parseFloat(u.target.value)||0),className:"w-[100px]",required:!0})]})]}),p.jsx(Te,{type:"button",variant:"ghost",size:"icon",onClick:()=>r(t),className:"mt-6",children:p.jsx(Fc,{className:"h-4 w-4"})})]})}function u2(){const{wsid:e}=HP(),t=Ko(),[n,r]=f.useState(!0),[s,o]=f.useState(!1),[i,a]=f.useState([]),[l,c]=f.useState({id:"",wsid:"",name:"",cat_id:"",description:"",treatment_notes:"",show_calculator:!1,pdf:""}),[u,d]=f.useState([]),m=uS(mc(fu),mc(du,{coordinateGetter:DS}));f.useEffect(()=>{h()},[e]);const h=async()=>{try{r(!0);const{data:y,error:S}=await ye.from("workscopes").select("*").eq("wsid",e).single();if(S)throw S;c({id:y.id,wsid:y.wsid,name:y.name,cat_id:y.cat_id,description:y.description||"",treatment_notes:y.treatment_notes||"",show_calculator:y.show_calculator||!1,pdf:y.pdf||""});const{data:_,error:E}=await ye.from("workscope_cats").select("*").order("name",{ascending:!0});if(E)throw E;a(_||[]);const{data:C,error:k}=await ye.from("workscope_calculations").select("*").eq("workscope_id",y.id).order("rank",{ascending:!0}).order("name",{ascending:!0});if(k)throw k;d(C||[])}catch(y){de.error("Failed to load workscope: "+y.message)}finally{r(!1)}},b=y=>{const{active:S,over:_}=y;_&&S.id!==_.id&&d(E=>{const C=E.findIndex(T=>(T.id||T.tempId)===S.id),k=E.findIndex(T=>(T.id||T.tempId)===_.id);return mu(E,C,k)})},v=(y,S,_)=>{d(E=>{const C=[...E];return C[y]={...C[y],[S]:_},C})},x=y=>{d(S=>S.filter((_,E)=>E!==y))},w=()=>{d(y=>[...y,{tempId:`temp-${Date.now()}`,name:"",qty_label:"",rate:0,rank:y.length+1}])},g=async y=>{if(y.preventDefault(),u.length===0){de.error("At least one calculation is required");return}if(u.some(S=>!S.name)){de.error("All calculations must have a name");return}try{o(!0);const{error:S}=await ye.from("workscopes").update({wsid:l.wsid,name:l.name,cat_id:l.cat_id,description:l.description,treatment_notes:l.treatment_notes,show_calculator:l.show_calculator,pdf:l.pdf}).eq("id",l.id);if(S)throw S;const _=u.map((N,j)=>({...N,rank:j+1,workscope_id:l.id})),E=u.filter(N=>N.id).map(N=>N.id),{error:C}=await ye.from("workscope_calculations").delete().eq("workscope_id",l.id).not("id","in",`(${E.length>0?E.join(","):"00000000-0000-0000-0000-000000000000"})`);if(C)throw C;const k=_.map(N=>{const{tempId:j,id:A,...F}=N;return A?{id:A,...F}:{id:crypto.randomUUID(),...F}}),{error:T}=await ye.from("workscope_calculations").upsert(k);if(T)throw T;de.success("Workscope updated successfully")}catch(S){de.error("Failed to save workscope: "+S.message)}finally{o(!1)}};return n?p.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:p.jsx(tr,{className:"h-8 w-8 animate-spin text-primary"})}):p.jsx("div",{className:"min-h-screen bg-background p-8",children:p.jsxs("div",{className:"max-w-4xl mx-auto",children:[p.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[p.jsx(Te,{variant:"ghost",size:"icon",onClick:()=>t("/dashboard"),children:p.jsx(Qh,{className:"h-5 w-5"})}),p.jsx("h1",{className:"text-3xl font-bold",children:"Edit Workscope"})]}),p.jsxs("form",{onSubmit:g,className:"space-y-6",children:[p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[p.jsxs("div",{children:[p.jsxs(me,{htmlFor:"wsid",children:["ID ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:"wsid",value:l.wsid,onChange:y=>c({...l,wsid:y.target.value}),required:!0})]}),p.jsxs("div",{children:[p.jsxs(me,{htmlFor:"name",children:["Name ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:"name",value:l.name,onChange:y=>c({...l,name:y.target.value}),required:!0})]}),p.jsxs("div",{children:[p.jsxs(me,{htmlFor:"category",children:["Category ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsxs(iu,{value:l.cat_id||void 0,onValueChange:y=>c({...l,cat_id:y}),required:!0,children:[p.jsx(Ta,{id:"category",children:p.jsx(au,{placeholder:"Select category"})}),p.jsx(Ra,{children:i.map(y=>p.jsx(Qn,{value:y.id,children:y.name},y.id))})]})]}),p.jsxs("div",{children:[p.jsx(me,{htmlFor:"pdf_filename",children:"PDF Filename"}),p.jsx(Fe,{id:"pdf_filename",value:l.pdf,onChange:y=>c({...l,pdf:y.target.value})})]})]}),p.jsxs("div",{children:[p.jsx(me,{htmlFor:"description",children:"Description"}),p.jsx(ua,{id:"description",value:l.description,onChange:y=>c({...l,description:y.target.value}),rows:4})]}),p.jsxs("div",{children:[p.jsx(me,{htmlFor:"treatment_notes",children:"Treatment Notes"}),p.jsx(ua,{id:"treatment_notes",value:l.treatment_notes,onChange:y=>c({...l,treatment_notes:y.target.value}),rows:4})]}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(Tp,{id:"show_board_feet",checked:l.show_calculator,onCheckedChange:y=>c({...l,show_calculator:y})}),p.jsx(me,{htmlFor:"show_board_feet",children:"Show Board Feet Calculator"})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs(me,{className:"text-lg",children:["Calculations (at least 1 required) ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsxs(Te,{type:"button",onClick:w,size:"sm",children:[p.jsx($c,{className:"h-4 w-4 mr-2"}),"Add Calculation"]})]}),p.jsx(TS,{sensors:m,collisionDetection:pS,onDragEnd:b,children:p.jsx(OS,{items:u.map(y=>y.id||y.tempId||""),strategy:PS,children:p.jsx("div",{className:"space-y-2",children:u.map((y,S)=>p.jsx(c2,{calculation:y,index:S,onUpdate:v,onDelete:x},y.id||y.tempId))})})}),u.length===0&&p.jsx("p",{className:"text-sm text-muted-foreground text-center py-8 border rounded-lg",children:'No calculations added. Click "Add Calculation" to get started.'})]}),p.jsxs("div",{className:"flex gap-4",children:[p.jsx(Te,{type:"submit",disabled:s,children:s?p.jsxs(p.Fragment,{children:[p.jsx(tr,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"}),p.jsx(Te,{type:"button",variant:"outline",onClick:()=>t("/dashboard"),children:"Cancel"})]})]})]})})}function d2({calculation:e,index:t,onUpdate:n,onDelete:r}){const{attributes:s,listeners:o,setNodeRef:i,transform:a,transition:l}=IS({id:e.tempId||`calc-${t}`}),c={transform:$o.Transform.toString(a),transition:l};return p.jsxs("div",{ref:i,style:c,className:"flex items-start gap-2 p-4 border rounded-lg bg-card",children:[p.jsx("button",{type:"button",className:"mt-2 cursor-grab active:cursor-grabbing",...s,...o,children:p.jsx(x0,{className:"h-5 w-5 text-muted-foreground"})}),p.jsxs("div",{className:"flex-1 flex gap-4",children:[p.jsxs("div",{className:"flex-1",children:[p.jsxs(me,{htmlFor:`calc-name-${t}`,children:["Name ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:`calc-name-${t}`,value:e.name,onChange:u=>n(t,"name",u.target.value),required:!0})]}),p.jsxs("div",{className:"flex-1",children:[p.jsx(me,{htmlFor:`calc-qty-${t}`,children:"Quantity Label"}),p.jsx(Fe,{id:`calc-qty-${t}`,value:e.qty_label,onChange:u=>n(t,"qty_label",u.target.value)})]}),p.jsxs("div",{children:[p.jsxs(me,{htmlFor:`calc-rate-${t}`,children:["Rate ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:`calc-rate-${t}`,type:"number",step:"0.01",value:e.rate,onChange:u=>n(t,"rate",parseFloat(u.target.value)||0),className:"w-[100px]",required:!0})]})]}),p.jsx(Te,{type:"button",variant:"ghost",size:"icon",onClick:()=>r(t),className:"mt-6",children:p.jsx(Fc,{className:"h-4 w-4"})})]})}function f2(){const e=Ko(),[t,n]=f.useState(!0),[r,s]=f.useState(!1),[o,i]=f.useState([]),[a,l]=f.useState({wsid:"",name:"",cat_id:"",description:"",treatment_notes:"",show_calculator:!1,pdf:""}),[c,u]=f.useState([]),d=uS(mc(fu),mc(du,{coordinateGetter:DS}));f.useEffect(()=>{m()},[]);const m=async()=>{try{n(!0);const{data:g,error:y}=await ye.from("workscope_cats").select("*").order("name",{ascending:!0});if(y)throw y;i(g||[])}catch(g){de.error("Failed to load categories: "+g.message)}finally{n(!1)}},h=g=>{const{active:y,over:S}=g;S&&y.id!==S.id&&u(_=>{const E=_.findIndex(k=>k.tempId===y.id),C=_.findIndex(k=>k.tempId===S.id);return mu(_,E,C)})},b=(g,y,S)=>{u(_=>{const E=[..._];return E[g]={...E[g],[y]:S},E})},v=g=>{u(y=>y.filter((S,_)=>_!==g))},x=()=>{u(g=>[...g,{tempId:`temp-${Date.now()}`,name:"",qty_label:"",rate:0,rank:g.length+1}])},w=async g=>{if(g.preventDefault(),!a.wsid){de.error("ID is required");return}if(!a.name){de.error("Name is required");return}if(!a.cat_id){de.error("Category is required");return}if(c.length===0){de.error("At least one calculation is required");return}if(c.some(y=>!y.name)){de.error("All calculations must have a name");return}try{s(!0);const{data:y,error:S}=await ye.from("workscopes").insert({wsid:a.wsid,name:a.name,cat_id:a.cat_id,description:a.description,treatment_notes:a.treatment_notes,show_calculator:a.show_calculator,pdf:a.pdf}).select().single();if(S)throw S;const E=c.map((k,T)=>({...k,rank:T+1,workscope_id:y.id})).map(k=>{const{tempId:T,...N}=k;return{id:crypto.randomUUID(),...N}}),{error:C}=await ye.from("workscope_calculations").insert(E);if(C)throw C;de.success("Workscope created successfully"),e(`/dashboard/edit-workscope/${a.wsid}`)}catch(y){de.error("Failed to create workscope: "+y.message)}finally{s(!1)}};return t?p.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:p.jsx(tr,{className:"h-8 w-8 animate-spin text-primary"})}):p.jsx("div",{className:"min-h-screen bg-background p-8",children:p.jsxs("div",{className:"max-w-4xl mx-auto",children:[p.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[p.jsx(Te,{variant:"ghost",size:"icon",onClick:()=>e("/dashboard"),children:p.jsx(Qh,{className:"h-5 w-5"})}),p.jsx("h1",{className:"text-3xl font-bold",children:"Create New Workscope"})]}),p.jsxs("form",{onSubmit:w,className:"space-y-6",children:[p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[p.jsxs("div",{children:[p.jsxs(me,{htmlFor:"wsid",children:["ID ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:"wsid",value:a.wsid,onChange:g=>l({...a,wsid:g.target.value}),required:!0})]}),p.jsxs("div",{children:[p.jsxs(me,{htmlFor:"name",children:["Name ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:"name",value:a.name,onChange:g=>l({...a,name:g.target.value}),required:!0})]}),p.jsxs("div",{children:[p.jsxs(me,{htmlFor:"category",children:["Category ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsxs(iu,{value:a.cat_id||void 0,onValueChange:g=>l({...a,cat_id:g}),required:!0,children:[p.jsx(Ta,{id:"category",children:p.jsx(au,{placeholder:"Select category"})}),p.jsx(Ra,{children:o.map(g=>p.jsx(Qn,{value:g.id,children:g.name},g.id))})]})]}),p.jsxs("div",{children:[p.jsx(me,{htmlFor:"pdf_filename",children:"PDF Filename"}),p.jsx(Fe,{id:"pdf_filename",value:a.pdf,onChange:g=>l({...a,pdf:g.target.value})})]})]}),p.jsxs("div",{children:[p.jsx(me,{htmlFor:"description",children:"Description"}),p.jsx(ua,{id:"description",value:a.description,onChange:g=>l({...a,description:g.target.value}),rows:4})]}),p.jsxs("div",{children:[p.jsx(me,{htmlFor:"treatment_notes",children:"Treatment Notes"}),p.jsx(ua,{id:"treatment_notes",value:a.treatment_notes,onChange:g=>l({...a,treatment_notes:g.target.value}),rows:4})]}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(Tp,{id:"show_board_feet",checked:a.show_calculator,onCheckedChange:g=>l({...a,show_calculator:g})}),p.jsx(me,{htmlFor:"show_board_feet",children:"Show Board Feet Calculator"})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs(me,{className:"text-lg",children:["Calculations (at least 1 required) ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsxs(Te,{type:"button",onClick:x,size:"sm",children:[p.jsx($c,{className:"h-4 w-4 mr-2"}),"Add Calculation"]})]}),p.jsx(TS,{sensors:d,collisionDetection:pS,onDragEnd:h,children:p.jsx(OS,{items:c.map(g=>g.tempId||""),strategy:PS,children:p.jsx("div",{className:"space-y-2",children:c.map((g,y)=>p.jsx(d2,{calculation:g,index:y,onUpdate:b,onDelete:v},g.tempId))})})}),c.length===0&&p.jsx("p",{className:"text-sm text-muted-foreground text-center py-8 border rounded-lg",children:'No calculations added. Click "Add Calculation" to get started.'})]}),p.jsxs("div",{className:"flex gap-4",children:[p.jsx(Te,{type:"submit",disabled:r,children:r?p.jsxs(p.Fragment,{children:[p.jsx(tr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workscope"}),p.jsx(Te,{type:"button",variant:"outline",onClick:()=>e("/dashboard"),children:"Cancel"})]})]})]})})}var gu="Dialog",[MS,Y2]=js(gu),[h2,wn]=MS(gu),$S=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=f.useRef(null),l=f.useRef(null),[c,u]=ta({prop:r,defaultProp:s??!1,onChange:o,caller:gu});return p.jsx(h2,{scope:t,triggerRef:a,contentRef:l,contentId:ho(),titleId:ho(),descriptionId:ho(),open:c,onOpenChange:u,onOpenToggle:f.useCallback(()=>u(d=>!d),[u]),modal:i,children:n})};$S.displayName=gu;var FS="DialogTrigger",p2=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wn(FS,n),o=we(t,s.triggerRef);return p.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Lp(s.open),...r,ref:o,onClick:te(e.onClick,s.onOpenToggle)})});p2.displayName=FS;var Ip="DialogPortal",[m2,US]=MS(Ip,{forceMount:void 0}),zS=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=wn(Ip,t);return p.jsx(m2,{scope:t,forceMount:n,children:f.Children.map(r,i=>p.jsx(Bo,{present:n||o.open,children:p.jsx(Dc,{asChild:!0,container:s,children:i})}))})};zS.displayName=Ip;var yc="DialogOverlay",BS=f.forwardRef((e,t)=>{const n=US(yc,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=wn(yc,e.__scopeDialog);return o.modal?p.jsx(Bo,{present:r||o.open,children:p.jsx(v2,{...s,ref:t})}):null});BS.displayName=yc;var g2=Io("DialogOverlay.RemoveScroll"),v2=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wn(yc,n);return p.jsx(Cp,{as:g2,allowPinchZoom:!0,shards:[s.contentRef],children:p.jsx(le.div,{"data-state":Lp(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ts="DialogContent",WS=f.forwardRef((e,t)=>{const n=US(Ts,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=wn(Ts,e.__scopeDialog);return p.jsx(Bo,{present:r||o.open,children:o.modal?p.jsx(y2,{...s,ref:t}):p.jsx(w2,{...s,ref:t})})});WS.displayName=Ts;var y2=f.forwardRef((e,t)=>{const n=wn(Ts,e.__scopeDialog),r=f.useRef(null),s=we(t,n.contentRef,r);return f.useEffect(()=>{const o=r.current;if(o)return ub(o)},[]),p.jsx(VS,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:te(e.onFocusOutside,o=>o.preventDefault())})}),w2=f.forwardRef((e,t)=>{const n=wn(Ts,e.__scopeDialog),r=f.useRef(!1),s=f.useRef(!1);return p.jsx(VS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((c=n.triggerRef.current)==null?void 0:c.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),VS=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=wn(Ts,n),l=f.useRef(null),c=we(t,l);return ib(),p.jsxs(p.Fragment,{children:[p.jsx(Ep,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:p.jsx(ba,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Lp(a.open),...i,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(x2,{titleId:a.titleId}),p.jsx(S2,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Dp="DialogTitle",HS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wn(Dp,n);return p.jsx(le.h2,{id:s.titleId,...r,ref:t})});HS.displayName=Dp;var qS="DialogDescription",KS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wn(qS,n);return p.jsx(le.p,{id:s.descriptionId,...r,ref:t})});KS.displayName=qS;var GS="DialogClose",QS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wn(GS,n);return p.jsx(le.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>s.onOpenChange(!1))})});QS.displayName=GS;function Lp(e){return e?"open":"closed"}var YS="DialogTitleWarning",[J2,JS]=zE(YS,{contentName:Ts,titleName:Dp,docsSlug:"dialog"}),x2=({titleId:e})=>{const t=JS(YS),n=`\`${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 f.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},b2="DialogDescriptionWarning",S2=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${JS(b2).contentName}}.`;return f.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},_2=$S,E2=zS,XS=BS,ZS=WS,e_=HS,t_=KS,C2=QS;const k2=_2,T2=E2,n_=f.forwardRef(({className:e,...t},n)=>p.jsx(XS,{ref:n,className:J("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}));n_.displayName=XS.displayName;const r_=f.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(T2,{children:[p.jsx(n_,{}),p.jsxs(ZS,{ref:r,className:J("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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,p.jsxs(C2,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[p.jsx(Yh,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));r_.displayName=ZS.displayName;const s_=({className:e,...t})=>p.jsx("div",{className:J("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});s_.displayName="DialogHeader";const o_=({className:e,...t})=>p.jsx("div",{className:J("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});o_.displayName="DialogFooter";const i_=f.forwardRef(({className:e,...t},n)=>p.jsx(e_,{ref:n,className:J("text-lg font-semibold leading-none tracking-tight",e),...t}));i_.displayName=e_.displayName;const a_=f.forwardRef(({className:e,...t},n)=>p.jsx(t_,{ref:n,className:J("text-sm text-muted-foreground",e),...t}));a_.displayName=t_.displayName;const R2=()=>{const e=Ko(),[t,n]=f.useState([]),[r,s]=f.useState(!0),[o,i]=f.useState(!1),[a,l]=f.useState(!1),[c,u]=f.useState(!1),[d,m]=f.useState(!1),[h,b]=f.useState(null),[v,x]=f.useState({first:"",last:"",display_name:"",email:"",role:"",password:""});f.useEffect(()=>{w()},[]);const w=async()=>{const{data:{session:k}}=await ye.auth.getSession();if(!k){e("/");return}const{data:T}=await ye.from("agents").select("role").eq("user_id",k.user.id).eq("role","admin").maybeSingle();if(!T){e("/access-denied");return}g()},g=async()=>{try{s(!0);const{data:k,error:T}=await ye.from("users_with_details").select("*").order("last",{ascending:!0});if(T)throw T;n(k||[])}catch(k){de.error("Failed to load users: "+k.message)}finally{s(!1)}},y=()=>{l(!0),b(null),x({first:"",last:"",display_name:"",email:"",role:"agent",password:""}),m(!0),i(!0)},S=k=>{l(!1),b(k),x({first:k.first||"",last:k.last||"",display_name:k.display_name||"",email:k.email||"",role:k.role||"agent",password:""}),m(!1),i(!0)},_=()=>{i(!1),l(!1),b(null),m(!1),x({first:"",last:"",display_name:"",email:"",role:"",password:""})},E=async()=>{if(!v.email.trim()){de.error("Email is required");return}if(a&&!v.password){de.error("Password is required for new users");return}try{if(u(!0),a){const{data:k,error:T}=await ye.rpc("admin_create_user",{new_email:v.email,new_password:v.password,new_first:v.first||null,new_last:v.last||null,new_display_name:v.display_name||null,new_role:v.role||"agent"});if(T)throw T;de.success("User created successfully")}else if(h){const{error:k}=await ye.from("agents").update({first:v.first,last:v.last,display_name:v.display_name,role:v.role}).eq("user_id",h.user_id);if(k)throw k;if(v.email!==h.email){const{error:T}=await ye.rpc("admin_update_user_email",{target_user_id:h.user_id,new_email:v.email});if(T)throw T}if(d&&v.password){const{error:T}=await ye.rpc("admin_update_user_password",{target_user_id:h.user_id,new_password:v.password});if(T)throw T}de.success("User updated successfully")}_(),g()}catch(k){de.error("Failed to update user: "+k.message)}finally{u(!1)}},C=async k=>{if(confirm("Are you sure you want to delete this user? This action cannot be undone."))try{const{error:T}=await ye.rpc("admin_delete_user",{target_user_id:k});if(T)throw T;de.success("User deleted successfully"),g()}catch(T){de.error("Failed to delete user: "+T.message)}};return p.jsx("div",{className:"min-h-screen bg-background p-6",children:p.jsxs("div",{className:"max-w-7xl mx-auto",children:[p.jsxs("div",{className:"flex items-center justify-between mb-8",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx(Te,{variant:"ghost",size:"icon",onClick:()=>e("/dashboard"),children:p.jsx(Qh,{className:"h-5 w-5"})}),p.jsx("h1",{className:"text-4xl font-bold text-foreground",children:"Manage Users"})]}),p.jsxs(Te,{onClick:y,children:[p.jsx($c,{className:"mr-2 h-4 w-4"}),"Create New User"]})]}),p.jsx("div",{className:"bg-card rounded-lg border",children:r?p.jsx("div",{className:"flex items-center justify-center p-12",children:p.jsx(tr,{className:"h-8 w-8 animate-spin text-primary"})}):p.jsxs(bp,{children:[p.jsx(Sp,{children:p.jsxs(ys,{children:[p.jsx(dn,{children:"Last Name"}),p.jsx(dn,{children:"First Name"}),p.jsx(dn,{children:"Display Name"}),p.jsx(dn,{children:"Email"}),p.jsx(dn,{children:"Role"}),p.jsx(dn,{className:"w-24 text-right",children:"Actions"})]})}),p.jsx(_p,{children:t.length===0?p.jsx(ys,{children:p.jsx(It,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No users found"})}):t.map(k=>p.jsxs(ys,{children:[p.jsx(It,{children:k.last||"-"}),p.jsx(It,{children:k.first||"-"}),p.jsx(It,{children:k.display_name||"-"}),p.jsx(It,{children:k.email||"-"}),p.jsx(It,{className:"capitalize",children:k.role||"-"}),p.jsx(It,{children:p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p.jsx(Te,{variant:"ghost",size:"icon",onClick:()=>S(k),children:p.jsx(b0,{className:"h-4 w-4"})}),p.jsx(Te,{variant:"ghost",size:"icon",onClick:()=>C(k.user_id),children:p.jsx(Fc,{className:"h-4 w-4 text-destructive"})})]})})]},k.user_id))})]})}),p.jsx(k2,{open:o,onOpenChange:i,children:p.jsxs(r_,{children:[p.jsxs(s_,{children:[p.jsx(i_,{children:a?"Create New User":"Edit User"}),p.jsx(a_,{children:a?"Add a new user to the system.":"Update user information and permissions."})]}),p.jsxs("div",{className:"space-y-4 py-4",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(me,{htmlFor:"first",children:"First Name"}),p.jsx(Fe,{id:"first",value:v.first,onChange:k=>x({...v,first:k.target.value})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(me,{htmlFor:"last",children:"Last Name"}),p.jsx(Fe,{id:"last",value:v.last,onChange:k=>x({...v,last:k.target.value})})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(me,{htmlFor:"display_name",children:"Display Name"}),p.jsx(Fe,{id:"display_name",value:v.display_name,onChange:k=>x({...v,display_name:k.target.value})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs(me,{htmlFor:"email",children:["Email ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Fe,{id:"email",type:"email",value:v.email,onChange:k=>x({...v,email:k.target.value}),required:!0})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs(me,{htmlFor:"role",children:["Role ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsxs(iu,{value:v.role,onValueChange:k=>x({...v,role:k}),children:[p.jsx(Ta,{id:"role",children:p.jsx(au,{placeholder:"Select role"})}),p.jsxs(Ra,{children:[p.jsx(Qn,{value:"agent",children:"Agent"}),p.jsx(Qn,{value:"admin",children:"Admin"})]})]})]}),p.jsxs("div",{className:"space-y-2",children:[!a&&p.jsx("button",{type:"button",onClick:()=>m(!d),className:"text-sm text-primary hover:underline",children:d?"Hide Password Field":"Set Password"}),(d||a)&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs(me,{htmlFor:"password",children:[a?"Password":"New Password",a&&p.jsx("span",{className:"text-destructive",children:" *"})]}),p.jsx(Fe,{id:"password",type:"password",value:v.password,onChange:k=>x({...v,password:k.target.value}),placeholder:a?"Enter password":"Enter new password",required:a})]})]})]}),p.jsxs(o_,{children:[p.jsx(Te,{variant:"outline",onClick:_,children:"Cancel"}),p.jsx(Te,{onClick:E,disabled:c,children:c?p.jsxs(p.Fragment,{children:[p.jsx(tr,{className:"mr-2 h-4 w-4 animate-spin"}),a?"Creating...":"Saving..."]}):a?"Create User":"Save Changes"})]})]})})]})})},P2=()=>{const e=Ko(),t=async()=>{const{error:n}=await ye.auth.signOut();n?de.error("Error logging out"):e("/")};return p.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:p.jsxs(fp,{className:"w-full max-w-md shadow-lg border-destructive/20",children:[p.jsxs(hp,{className:"space-y-4 text-center",children:[p.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center",children:p.jsx(WC,{className:"h-8 w-8 text-destructive"})}),p.jsx(pp,{className:"text-3xl font-bold text-foreground",children:"Access Denied"}),p.jsx(mp,{className:"text-base",children:"You do not have administrator privileges to access this panel."})]}),p.jsx(gp,{children:p.jsx(Te,{onClick:t,className:"w-full",variant:"outline",children:"Return to Login"})})]})})},j2=()=>{const e=dp();return f.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),p.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gray-100",children:p.jsxs("div",{className:"text-center",children:[p.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),p.jsx("p",{className:"mb-4 text-xl text-gray-600",children:"Oops! Page not found"}),p.jsx("a",{href:"/",className:"text-blue-500 underline hover:text-blue-700",children:"Return to Home"})]})})},N2=new hP,O2=()=>p.jsx(mP,{client:N2,children:p.jsxs(WR,{children:[p.jsx(kk,{}),p.jsx(sT,{}),p.jsx(cj,{children:p.jsxs(ij,{children:[p.jsx(pr,{path:"/",element:p.jsx(QO,{})}),p.jsx(pr,{path:"/dashboard",element:p.jsx(_I,{})}),p.jsx(pr,{path:"/dashboard/edit-workscope/:wsid",element:p.jsx(u2,{})}),p.jsx(pr,{path:"/dashboard/create-workscope",element:p.jsx(f2,{})}),p.jsx(pr,{path:"/dashboard/manage-users",element:p.jsx(R2,{})}),p.jsx(pr,{path:"/access-denied",element:p.jsx(P2,{})}),p.jsx(pr,{path:"*",element:p.jsx(j2,{})})]})})]})});Bw(document.getElementById("root")).render(p.jsx(O2,{}));