albert-cashflow-pages/assets/index-CeD4zjmz.js
2026-02-17 15:44:12 +00:00

123 lines
329 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(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 i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function _h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wu={exports:{}},oi={},Vu={exports:{}},I={};/**
* @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 Wr=Symbol.for("react.element"),kh=Symbol.for("react.portal"),Sh=Symbol.for("react.fragment"),Eh=Symbol.for("react.strict_mode"),xh=Symbol.for("react.profiler"),Th=Symbol.for("react.provider"),bh=Symbol.for("react.context"),Ch=Symbol.for("react.forward_ref"),Oh=Symbol.for("react.suspense"),jh=Symbol.for("react.memo"),Rh=Symbol.for("react.lazy"),ul=Symbol.iterator;function Ph(e){return e===null||typeof e!="object"?null:(e=ul&&e[ul]||e["@@iterator"],typeof e=="function"?e:null)}var Hu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qu=Object.assign,Ku={};function Bn(e,t,n){this.props=e,this.context=t,this.refs=Ku,this.updater=n||Hu}Bn.prototype.isReactComponent={};Bn.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")};Bn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gu(){}Gu.prototype=Bn.prototype;function ha(e,t,n){this.props=e,this.context=t,this.refs=Ku,this.updater=n||Hu}var fa=ha.prototype=new Gu;fa.constructor=ha;qu(fa,Bn.prototype);fa.isPureReactComponent=!0;var cl=Array.isArray,Ju=Object.prototype.hasOwnProperty,pa={current:null},Qu={key:!0,ref:!0,__self:!0,__source:!0};function Yu(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Ju.call(t,r)&&!Qu.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),u=0;u<a;u++)l[u]=arguments[u+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:Wr,type:e,key:i,ref:o,props:s,_owner:pa.current}}function Ah(e,t){return{$$typeof:Wr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ga(e){return typeof e=="object"&&e!==null&&e.$$typeof===Wr}function Nh(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var dl=/\/+/g;function ji(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Nh(""+e.key):t.toString(36)}function ks(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Wr:case kh:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+ji(o,0):r,cl(s)?(n="",e!=null&&(n=e.replace(dl,"$&/")+"/"),ks(s,t,n,"",function(u){return u})):s!=null&&(ga(s)&&(s=Ah(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(dl,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",cl(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+ji(i,a);o+=ks(i,t,n,l,s)}else if(l=Ph(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+ji(i,a++),o+=ks(i,t,n,l,s);else if(i==="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 o}function Yr(e,t,n){if(e==null)return e;var r=[],s=0;return ks(e,r,"","",function(i){return t.call(n,i,s++)}),r}function Ih(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 ve={current:null},Ss={transition:null},Lh={ReactCurrentDispatcher:ve,ReactCurrentBatchConfig:Ss,ReactCurrentOwner:pa};function Xu(){throw Error("act(...) is not supported in production builds of React.")}I.Children={map:Yr,forEach:function(e,t,n){Yr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Yr(e,function(){t++}),t},toArray:function(e){return Yr(e,function(t){return t})||[]},only:function(e){if(!ga(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};I.Component=Bn;I.Fragment=Sh;I.Profiler=xh;I.PureComponent=ha;I.StrictMode=Eh;I.Suspense=Oh;I.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Lh;I.act=Xu;I.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=qu({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=pa.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Ju.call(t,l)&&!Qu.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 u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Wr,type:e.type,key:s,ref:i,props:r,_owner:o}};I.createContext=function(e){return e={$$typeof:bh,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Th,_context:e},e.Consumer=e};I.createElement=Yu;I.createFactory=function(e){var t=Yu.bind(null,e);return t.type=e,t};I.createRef=function(){return{current:null}};I.forwardRef=function(e){return{$$typeof:Ch,render:e}};I.isValidElement=ga;I.lazy=function(e){return{$$typeof:Rh,_payload:{_status:-1,_result:e},_init:Ih}};I.memo=function(e,t){return{$$typeof:jh,type:e,compare:t===void 0?null:t}};I.startTransition=function(e){var t=Ss.transition;Ss.transition={};try{e()}finally{Ss.transition=t}};I.unstable_act=Xu;I.useCallback=function(e,t){return ve.current.useCallback(e,t)};I.useContext=function(e){return ve.current.useContext(e)};I.useDebugValue=function(){};I.useDeferredValue=function(e){return ve.current.useDeferredValue(e)};I.useEffect=function(e,t){return ve.current.useEffect(e,t)};I.useId=function(){return ve.current.useId()};I.useImperativeHandle=function(e,t,n){return ve.current.useImperativeHandle(e,t,n)};I.useInsertionEffect=function(e,t){return ve.current.useInsertionEffect(e,t)};I.useLayoutEffect=function(e,t){return ve.current.useLayoutEffect(e,t)};I.useMemo=function(e,t){return ve.current.useMemo(e,t)};I.useReducer=function(e,t,n){return ve.current.useReducer(e,t,n)};I.useRef=function(e){return ve.current.useRef(e)};I.useState=function(e){return ve.current.useState(e)};I.useSyncExternalStore=function(e,t,n){return ve.current.useSyncExternalStore(e,t,n)};I.useTransition=function(){return ve.current.useTransition()};I.version="18.3.1";Vu.exports=I;var z=Vu.exports;const Zu=_h(z);/**
* @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 $h=z,Uh=Symbol.for("react.element"),Dh=Symbol.for("react.fragment"),zh=Object.prototype.hasOwnProperty,Mh=$h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Bh={key:!0,ref:!0,__self:!0,__source:!0};function ec(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)zh.call(t,r)&&!Bh.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:Uh,type:e,key:i,ref:o,props:s,_owner:Mh.current}}oi.Fragment=Dh;oi.jsx=ec;oi.jsxs=ec;Wu.exports=oi;var v=Wu.exports,lo={},tc={exports:{}},Re={},nc={exports:{}},rc={};/**
* @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(C,A){var N=C.length;C.push(A);e:for(;0<N;){var Q=N-1>>>1,re=C[Q];if(0<s(re,A))C[Q]=A,C[N]=re,N=Q;else break e}}function n(C){return C.length===0?null:C[0]}function r(C){if(C.length===0)return null;var A=C[0],N=C.pop();if(N!==A){C[0]=N;e:for(var Q=0,re=C.length,Jr=re>>>1;Q<Jr;){var Lt=2*(Q+1)-1,Oi=C[Lt],$t=Lt+1,Qr=C[$t];if(0>s(Oi,N))$t<re&&0>s(Qr,Oi)?(C[Q]=Qr,C[$t]=N,Q=$t):(C[Q]=Oi,C[Lt]=N,Q=Lt);else if($t<re&&0>s(Qr,N))C[Q]=Qr,C[$t]=N,Q=$t;else break e}}return A}function s(C,A){var N=C.sortIndex-A.sortIndex;return N!==0?N:C.id-A.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,p=null,h=3,m=!1,y=!1,w=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(C){for(var A=n(u);A!==null;){if(A.callback===null)r(u);else if(A.startTime<=C)r(u),A.sortIndex=A.expirationTime,t(l,A);else break;A=n(u)}}function _(C){if(w=!1,f(C),!y)if(n(l)!==null)y=!0,bi(x);else{var A=n(u);A!==null&&Ci(_,A.startTime-C)}}function x(C,A){y=!1,w&&(w=!1,g(O),O=-1),m=!0;var N=h;try{for(f(A),p=n(l);p!==null&&(!(p.expirationTime>A)||C&&!De());){var Q=p.callback;if(typeof Q=="function"){p.callback=null,h=p.priorityLevel;var re=Q(p.expirationTime<=A);A=e.unstable_now(),typeof re=="function"?p.callback=re:p===n(l)&&r(l),f(A)}else r(l);p=n(l)}if(p!==null)var Jr=!0;else{var Lt=n(u);Lt!==null&&Ci(_,Lt.startTime-A),Jr=!1}return Jr}finally{p=null,h=N,m=!1}}var E=!1,T=null,O=-1,U=5,L=-1;function De(){return!(e.unstable_now()-L<U)}function qn(){if(T!==null){var C=e.unstable_now();L=C;var A=!0;try{A=T(!0,C)}finally{A?Kn():(E=!1,T=null)}}else E=!1}var Kn;if(typeof d=="function")Kn=function(){d(qn)};else if(typeof MessageChannel<"u"){var ll=new MessageChannel,wh=ll.port2;ll.port1.onmessage=qn,Kn=function(){wh.postMessage(null)}}else Kn=function(){k(qn,0)};function bi(C){T=C,E||(E=!0,Kn())}function Ci(C,A){O=k(function(){C(e.unstable_now())},A)}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(C){C.callback=null},e.unstable_continueExecution=function(){y||m||(y=!0,bi(x))},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(C){switch(h){case 1:case 2:case 3:var A=3;break;default:A=h}var N=h;h=A;try{return C()}finally{h=N}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(C,A){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var N=h;h=C;try{return A()}finally{h=N}},e.unstable_scheduleCallback=function(C,A,N){var Q=e.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?Q+N:Q):N=Q,C){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=N+re,C={id:c++,callback:A,priorityLevel:C,startTime:N,expirationTime:re,sortIndex:-1},N>Q?(C.sortIndex=N,t(u,C),n(l)===null&&C===n(u)&&(w?(g(O),O=-1):w=!0,Ci(_,N-Q))):(C.sortIndex=re,t(l,C),y||m||(y=!0,bi(x))),C},e.unstable_shouldYield=De,e.unstable_wrapCallback=function(C){var A=h;return function(){var N=h;h=A;try{return C.apply(this,arguments)}finally{h=N}}}})(rc);nc.exports=rc;var Fh=nc.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 Wh=z,je=Fh;function S(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 sc=new Set,wr={};function tn(e,t){In(e,t),In(e+"Capture",t)}function In(e,t){for(wr[e]=t,e=0;e<t.length;e++)sc.add(t[e])}var at=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uo=Object.prototype.hasOwnProperty,Vh=/^[: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]*$/,hl={},fl={};function Hh(e){return uo.call(fl,e)?!0:uo.call(hl,e)?!1:Vh.test(e)?fl[e]=!0:(hl[e]=!0,!1)}function qh(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 Kh(e,t,n,r){if(t===null||typeof t>"u"||qh(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 ye(e,t,n,r,s,i,o){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=i,this.removeEmptyString=o}var ce={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ce[e]=new ye(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ce[t]=new ye(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ce[e]=new ye(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ce[e]=new ye(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){ce[e]=new ye(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ce[e]=new ye(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ce[e]=new ye(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ce[e]=new ye(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ce[e]=new ye(e,5,!1,e.toLowerCase(),null,!1,!1)});var ma=/[\-:]([a-z])/g;function va(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(ma,va);ce[t]=new ye(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(ma,va);ce[t]=new ye(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(ma,va);ce[t]=new ye(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ce[e]=new ye(e,1,!1,e.toLowerCase(),null,!1,!1)});ce.xlinkHref=new ye("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ce[e]=new ye(e,1,!1,e.toLowerCase(),null,!0,!0)});function ya(e,t,n,r){var s=ce.hasOwnProperty(t)?ce[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Kh(t,n,s,r)&&(n=null),r||s===null?Hh(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 dt=Wh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Xr=Symbol.for("react.element"),pn=Symbol.for("react.portal"),gn=Symbol.for("react.fragment"),wa=Symbol.for("react.strict_mode"),co=Symbol.for("react.profiler"),ic=Symbol.for("react.provider"),oc=Symbol.for("react.context"),_a=Symbol.for("react.forward_ref"),ho=Symbol.for("react.suspense"),fo=Symbol.for("react.suspense_list"),ka=Symbol.for("react.memo"),pt=Symbol.for("react.lazy"),ac=Symbol.for("react.offscreen"),pl=Symbol.iterator;function Gn(e){return e===null||typeof e!="object"?null:(e=pl&&e[pl]||e["@@iterator"],typeof e=="function"?e:null)}var K=Object.assign,Ri;function rr(e){if(Ri===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ri=t&&t[1]||""}return`
`+Ri+e}var Pi=!1;function Ai(e,t){if(!e||Pi)return"";Pi=!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(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),i=r.stack.split(`
`),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var l=`
`+s[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Pi=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?rr(e):""}function Gh(e){switch(e.tag){case 5:return rr(e.type);case 16:return rr("Lazy");case 13:return rr("Suspense");case 19:return rr("SuspenseList");case 0:case 2:case 15:return e=Ai(e.type,!1),e;case 11:return e=Ai(e.type.render,!1),e;case 1:return e=Ai(e.type,!0),e;default:return""}}function po(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 gn:return"Fragment";case pn:return"Portal";case co:return"Profiler";case wa:return"StrictMode";case ho:return"Suspense";case fo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case oc:return(e.displayName||"Context")+".Consumer";case ic:return(e._context.displayName||"Context")+".Provider";case _a:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ka:return t=e.displayName||null,t!==null?t:po(e.type)||"Memo";case pt:t=e._payload,e=e._init;try{return po(e(t))}catch{}}return null}function Jh(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 po(t);case 8:return t===wa?"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 Rt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Qh(e){var t=lc(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,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zr(e){e._valueTracker||(e._valueTracker=Qh(e))}function uc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=lc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ns(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 go(e,t){var n=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function gl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Rt(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 cc(e,t){t=t.checked,t!=null&&ya(e,"checked",t,!1)}function mo(e,t){cc(e,t);var n=Rt(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")?vo(e,t.type,n):t.hasOwnProperty("defaultValue")&&vo(e,t.type,Rt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ml(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 vo(e,t,n){(t!=="number"||Ns(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var sr=Array.isArray;function Cn(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=""+Rt(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 yo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(S(91));return K({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function vl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(S(92));if(sr(n)){if(1<n.length)throw Error(S(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Rt(n)}}function dc(e,t){var n=Rt(t.value),r=Rt(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 yl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function hc(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 wo(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?hc(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var es,fc=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(es=es||document.createElement("div"),es.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=es.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function _r(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var lr={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},Yh=["Webkit","ms","Moz","O"];Object.keys(lr).forEach(function(e){Yh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),lr[t]=lr[e]})});function pc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||lr.hasOwnProperty(e)&&lr[e]?(""+t).trim():t+"px"}function gc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=pc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var Xh=K({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 _o(e,t){if(t){if(Xh[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function ko(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 So=null;function Sa(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Eo=null,On=null,jn=null;function wl(e){if(e=qr(e)){if(typeof Eo!="function")throw Error(S(280));var t=e.stateNode;t&&(t=di(t),Eo(e.stateNode,e.type,t))}}function mc(e){On?jn?jn.push(e):jn=[e]:On=e}function vc(){if(On){var e=On,t=jn;if(jn=On=null,wl(e),t)for(e=0;e<t.length;e++)wl(t[e])}}function yc(e,t){return e(t)}function wc(){}var Ni=!1;function _c(e,t,n){if(Ni)return e(t,n);Ni=!0;try{return yc(e,t,n)}finally{Ni=!1,(On!==null||jn!==null)&&(wc(),vc())}}function kr(e,t){var n=e.stateNode;if(n===null)return null;var r=di(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(S(231,t,typeof n));return n}var xo=!1;if(at)try{var Jn={};Object.defineProperty(Jn,"passive",{get:function(){xo=!0}}),window.addEventListener("test",Jn,Jn),window.removeEventListener("test",Jn,Jn)}catch{xo=!1}function Zh(e,t,n,r,s,i,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(c){this.onError(c)}}var ur=!1,Is=null,Ls=!1,To=null,ef={onError:function(e){ur=!0,Is=e}};function tf(e,t,n,r,s,i,o,a,l){ur=!1,Is=null,Zh.apply(ef,arguments)}function nf(e,t,n,r,s,i,o,a,l){if(tf.apply(this,arguments),ur){if(ur){var u=Is;ur=!1,Is=null}else throw Error(S(198));Ls||(Ls=!0,To=u)}}function nn(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 kc(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 _l(e){if(nn(e)!==e)throw Error(S(188))}function rf(e){var t=e.alternate;if(!t){if(t=nn(e),t===null)throw Error(S(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return _l(s),e;if(i===r)return _l(s),t;i=i.sibling}throw Error(S(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(S(189))}}if(n.alternate!==r)throw Error(S(190))}if(n.tag!==3)throw Error(S(188));return n.stateNode.current===n?e:t}function Sc(e){return e=rf(e),e!==null?Ec(e):null}function Ec(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Ec(e);if(t!==null)return t;e=e.sibling}return null}var xc=je.unstable_scheduleCallback,kl=je.unstable_cancelCallback,sf=je.unstable_shouldYield,of=je.unstable_requestPaint,Y=je.unstable_now,af=je.unstable_getCurrentPriorityLevel,Ea=je.unstable_ImmediatePriority,Tc=je.unstable_UserBlockingPriority,$s=je.unstable_NormalPriority,lf=je.unstable_LowPriority,bc=je.unstable_IdlePriority,ai=null,Xe=null;function uf(e){if(Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(ai,e,void 0,(e.current.flags&128)===128)}catch{}}var qe=Math.clz32?Math.clz32:hf,cf=Math.log,df=Math.LN2;function hf(e){return e>>>=0,e===0?32:31-(cf(e)/df|0)|0}var ts=64,ns=4194304;function ir(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 Us(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=ir(a):(i&=o,i!==0&&(r=ir(i)))}else o=n&~s,o!==0?r=ir(o):i!==0&&(r=ir(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&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-qe(t),s=1<<n,r|=e[n],t&=~s;return r}function ff(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 pf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-qe(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=ff(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function bo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Cc(){var e=ts;return ts<<=1,!(ts&4194240)&&(ts=64),e}function Ii(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Vr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-qe(t),e[t]=n}function gf(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-qe(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function xa(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-qe(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var D=0;function Oc(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var jc,Ta,Rc,Pc,Ac,Co=!1,rs=[],St=null,Et=null,xt=null,Sr=new Map,Er=new Map,vt=[],mf="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 Sl(e,t){switch(e){case"focusin":case"focusout":St=null;break;case"dragenter":case"dragleave":Et=null;break;case"mouseover":case"mouseout":xt=null;break;case"pointerover":case"pointerout":Sr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Er.delete(t.pointerId)}}function Qn(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=qr(t),t!==null&&Ta(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function vf(e,t,n,r,s){switch(t){case"focusin":return St=Qn(St,e,t,n,r,s),!0;case"dragenter":return Et=Qn(Et,e,t,n,r,s),!0;case"mouseover":return xt=Qn(xt,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Sr.set(i,Qn(Sr.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Er.set(i,Qn(Er.get(i)||null,e,t,n,r,s)),!0}return!1}function Nc(e){var t=Vt(e.target);if(t!==null){var n=nn(t);if(n!==null){if(t=n.tag,t===13){if(t=kc(n),t!==null){e.blockedOn=t,Ac(e.priority,function(){Rc(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 Es(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Oo(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);So=r,n.target.dispatchEvent(r),So=null}else return t=qr(n),t!==null&&Ta(t),e.blockedOn=n,!1;t.shift()}return!0}function El(e,t,n){Es(e)&&n.delete(t)}function yf(){Co=!1,St!==null&&Es(St)&&(St=null),Et!==null&&Es(Et)&&(Et=null),xt!==null&&Es(xt)&&(xt=null),Sr.forEach(El),Er.forEach(El)}function Yn(e,t){e.blockedOn===t&&(e.blockedOn=null,Co||(Co=!0,je.unstable_scheduleCallback(je.unstable_NormalPriority,yf)))}function xr(e){function t(s){return Yn(s,e)}if(0<rs.length){Yn(rs[0],e);for(var n=1;n<rs.length;n++){var r=rs[n];r.blockedOn===e&&(r.blockedOn=null)}}for(St!==null&&Yn(St,e),Et!==null&&Yn(Et,e),xt!==null&&Yn(xt,e),Sr.forEach(t),Er.forEach(t),n=0;n<vt.length;n++)r=vt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<vt.length&&(n=vt[0],n.blockedOn===null);)Nc(n),n.blockedOn===null&&vt.shift()}var Rn=dt.ReactCurrentBatchConfig,Ds=!0;function wf(e,t,n,r){var s=D,i=Rn.transition;Rn.transition=null;try{D=1,ba(e,t,n,r)}finally{D=s,Rn.transition=i}}function _f(e,t,n,r){var s=D,i=Rn.transition;Rn.transition=null;try{D=4,ba(e,t,n,r)}finally{D=s,Rn.transition=i}}function ba(e,t,n,r){if(Ds){var s=Oo(e,t,n,r);if(s===null)Vi(e,t,r,zs,n),Sl(e,r);else if(vf(s,e,t,n,r))r.stopPropagation();else if(Sl(e,r),t&4&&-1<mf.indexOf(e)){for(;s!==null;){var i=qr(s);if(i!==null&&jc(i),i=Oo(e,t,n,r),i===null&&Vi(e,t,r,zs,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Vi(e,t,r,null,n)}}var zs=null;function Oo(e,t,n,r){if(zs=null,e=Sa(r),e=Vt(e),e!==null)if(t=nn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=kc(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 zs=e,null}function Ic(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(af()){case Ea:return 1;case Tc:return 4;case $s:case lf:return 16;case bc:return 536870912;default:return 16}default:return 16}}var _t=null,Ca=null,xs=null;function Lc(){if(xs)return xs;var e,t=Ca,n=t.length,r,s="value"in _t?_t.value:_t.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return xs=s.slice(e,1<r?1-r:void 0)}function Ts(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 ss(){return!0}function xl(){return!1}function Pe(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ss:xl,this.isPropagationStopped=xl,this}return K(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=ss)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ss)},persist:function(){},isPersistent:ss}),t}var Fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Oa=Pe(Fn),Hr=K({},Fn,{view:0,detail:0}),kf=Pe(Hr),Li,$i,Xn,li=K({},Hr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ja,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!==Xn&&(Xn&&e.type==="mousemove"?(Li=e.screenX-Xn.screenX,$i=e.screenY-Xn.screenY):$i=Li=0,Xn=e),Li)},movementY:function(e){return"movementY"in e?e.movementY:$i}}),Tl=Pe(li),Sf=K({},li,{dataTransfer:0}),Ef=Pe(Sf),xf=K({},Hr,{relatedTarget:0}),Ui=Pe(xf),Tf=K({},Fn,{animationName:0,elapsedTime:0,pseudoElement:0}),bf=Pe(Tf),Cf=K({},Fn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Of=Pe(Cf),jf=K({},Fn,{data:0}),bl=Pe(jf),Rf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pf={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"},Af={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nf(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Af[e])?!!t[e]:!1}function ja(){return Nf}var If=K({},Hr,{key:function(e){if(e.key){var t=Rf[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ts(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Pf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ja,charCode:function(e){return e.type==="keypress"?Ts(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ts(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Lf=Pe(If),$f=K({},li,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cl=Pe($f),Uf=K({},Hr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ja}),Df=Pe(Uf),zf=K({},Fn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Mf=Pe(zf),Bf=K({},li,{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}),Ff=Pe(Bf),Wf=[9,13,27,32],Ra=at&&"CompositionEvent"in window,cr=null;at&&"documentMode"in document&&(cr=document.documentMode);var Vf=at&&"TextEvent"in window&&!cr,$c=at&&(!Ra||cr&&8<cr&&11>=cr),Ol=" ",jl=!1;function Uc(e,t){switch(e){case"keyup":return Wf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mn=!1;function Hf(e,t){switch(e){case"compositionend":return Dc(t);case"keypress":return t.which!==32?null:(jl=!0,Ol);case"textInput":return e=t.data,e===Ol&&jl?null:e;default:return null}}function qf(e,t){if(mn)return e==="compositionend"||!Ra&&Uc(e,t)?(e=Lc(),xs=Ca=_t=null,mn=!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 $c&&t.locale!=="ko"?null:t.data;default:return null}}var Kf={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 Rl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Kf[e.type]:t==="textarea"}function zc(e,t,n,r){mc(r),t=Ms(t,"onChange"),0<t.length&&(n=new Oa("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var dr=null,Tr=null;function Gf(e){Qc(e,0)}function ui(e){var t=wn(e);if(uc(t))return e}function Jf(e,t){if(e==="change")return t}var Mc=!1;if(at){var Di;if(at){var zi="oninput"in document;if(!zi){var Pl=document.createElement("div");Pl.setAttribute("oninput","return;"),zi=typeof Pl.oninput=="function"}Di=zi}else Di=!1;Mc=Di&&(!document.documentMode||9<document.documentMode)}function Al(){dr&&(dr.detachEvent("onpropertychange",Bc),Tr=dr=null)}function Bc(e){if(e.propertyName==="value"&&ui(Tr)){var t=[];zc(t,Tr,e,Sa(e)),_c(Gf,t)}}function Qf(e,t,n){e==="focusin"?(Al(),dr=t,Tr=n,dr.attachEvent("onpropertychange",Bc)):e==="focusout"&&Al()}function Yf(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ui(Tr)}function Xf(e,t){if(e==="click")return ui(t)}function Zf(e,t){if(e==="input"||e==="change")return ui(t)}function ep(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ge=typeof Object.is=="function"?Object.is:ep;function br(e,t){if(Ge(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(!uo.call(t,s)||!Ge(e[s],t[s]))return!1}return!0}function Nl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Il(e,t){var n=Nl(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=Nl(n)}}function Fc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wc(){for(var e=window,t=Ns();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ns(e.document)}return t}function Pa(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 tp(e){var t=Wc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Fc(n.ownerDocument.documentElement,n)){if(r!==null&&Pa(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,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Il(n,i);var o=Il(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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 np=at&&"documentMode"in document&&11>=document.documentMode,vn=null,jo=null,hr=null,Ro=!1;function Ll(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ro||vn==null||vn!==Ns(r)||(r=vn,"selectionStart"in r&&Pa(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}),hr&&br(hr,r)||(hr=r,r=Ms(jo,"onSelect"),0<r.length&&(t=new Oa("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=vn)))}function is(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var yn={animationend:is("Animation","AnimationEnd"),animationiteration:is("Animation","AnimationIteration"),animationstart:is("Animation","AnimationStart"),transitionend:is("Transition","TransitionEnd")},Mi={},Vc={};at&&(Vc=document.createElement("div").style,"AnimationEvent"in window||(delete yn.animationend.animation,delete yn.animationiteration.animation,delete yn.animationstart.animation),"TransitionEvent"in window||delete yn.transitionend.transition);function ci(e){if(Mi[e])return Mi[e];if(!yn[e])return e;var t=yn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vc)return Mi[e]=t[n];return e}var Hc=ci("animationend"),qc=ci("animationiteration"),Kc=ci("animationstart"),Gc=ci("transitionend"),Jc=new Map,$l="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 At(e,t){Jc.set(e,t),tn(t,[e])}for(var Bi=0;Bi<$l.length;Bi++){var Fi=$l[Bi],rp=Fi.toLowerCase(),sp=Fi[0].toUpperCase()+Fi.slice(1);At(rp,"on"+sp)}At(Hc,"onAnimationEnd");At(qc,"onAnimationIteration");At(Kc,"onAnimationStart");At("dblclick","onDoubleClick");At("focusin","onFocus");At("focusout","onBlur");At(Gc,"onTransitionEnd");In("onMouseEnter",["mouseout","mouseover"]);In("onMouseLeave",["mouseout","mouseover"]);In("onPointerEnter",["pointerout","pointerover"]);In("onPointerLeave",["pointerout","pointerover"]);tn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));tn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));tn("onBeforeInput",["compositionend","keypress","textInput","paste"]);tn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));tn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));tn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var or="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(" "),ip=new Set("cancel close invalid load scroll toggle".split(" ").concat(or));function Ul(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,nf(r,t,void 0,e),e.currentTarget=null}function Qc(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 i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;Ul(s,a,u),i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;Ul(s,a,u),i=l}}}if(Ls)throw e=To,Ls=!1,To=null,e}function F(e,t){var n=t[Lo];n===void 0&&(n=t[Lo]=new Set);var r=e+"__bubble";n.has(r)||(Yc(t,e,2,!1),n.add(r))}function Wi(e,t,n){var r=0;t&&(r|=4),Yc(n,e,r,t)}var os="_reactListening"+Math.random().toString(36).slice(2);function Cr(e){if(!e[os]){e[os]=!0,sc.forEach(function(n){n!=="selectionchange"&&(ip.has(n)||Wi(n,!1,e),Wi(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[os]||(t[os]=!0,Wi("selectionchange",!1,t))}}function Yc(e,t,n,r){switch(Ic(t)){case 1:var s=wf;break;case 4:s=_f;break;default:s=ba}n=s.bind(null,t,n,e),s=void 0,!xo||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 Vi(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;o=o.return}for(;a!==null;){if(o=Vt(a),o===null)return;if(l=o.tag,l===5||l===6){r=i=o;continue e}a=a.parentNode}}r=r.return}_c(function(){var u=i,c=Sa(n),p=[];e:{var h=Jc.get(e);if(h!==void 0){var m=Oa,y=e;switch(e){case"keypress":if(Ts(n)===0)break e;case"keydown":case"keyup":m=Lf;break;case"focusin":y="focus",m=Ui;break;case"focusout":y="blur",m=Ui;break;case"beforeblur":case"afterblur":m=Ui;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":m=Tl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=Ef;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Df;break;case Hc:case qc:case Kc:m=bf;break;case Gc:m=Mf;break;case"scroll":m=kf;break;case"wheel":m=Ff;break;case"copy":case"cut":case"paste":m=Of;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Cl}var w=(t&4)!==0,k=!w&&e==="scroll",g=w?h!==null?h+"Capture":null:h;w=[];for(var d=u,f;d!==null;){f=d;var _=f.stateNode;if(f.tag===5&&_!==null&&(f=_,g!==null&&(_=kr(d,g),_!=null&&w.push(Or(d,_,f)))),k)break;d=d.return}0<w.length&&(h=new m(h,y,null,n,c),p.push({event:h,listeners:w}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&n!==So&&(y=n.relatedTarget||n.fromElement)&&(Vt(y)||y[lt]))break e;if((m||h)&&(h=c.window===c?c:(h=c.ownerDocument)?h.defaultView||h.parentWindow:window,m?(y=n.relatedTarget||n.toElement,m=u,y=y?Vt(y):null,y!==null&&(k=nn(y),y!==k||y.tag!==5&&y.tag!==6)&&(y=null)):(m=null,y=u),m!==y)){if(w=Tl,_="onMouseLeave",g="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(w=Cl,_="onPointerLeave",g="onPointerEnter",d="pointer"),k=m==null?h:wn(m),f=y==null?h:wn(y),h=new w(_,d+"leave",m,n,c),h.target=k,h.relatedTarget=f,_=null,Vt(c)===u&&(w=new w(g,d+"enter",y,n,c),w.target=f,w.relatedTarget=k,_=w),k=_,m&&y)t:{for(w=m,g=y,d=0,f=w;f;f=rn(f))d++;for(f=0,_=g;_;_=rn(_))f++;for(;0<d-f;)w=rn(w),d--;for(;0<f-d;)g=rn(g),f--;for(;d--;){if(w===g||g!==null&&w===g.alternate)break t;w=rn(w),g=rn(g)}w=null}else w=null;m!==null&&Dl(p,h,m,w,!1),y!==null&&k!==null&&Dl(p,k,y,w,!0)}}e:{if(h=u?wn(u):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var x=Jf;else if(Rl(h))if(Mc)x=Zf;else{x=Yf;var E=Qf}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(x=Xf);if(x&&(x=x(e,u))){zc(p,x,n,c);break e}E&&E(e,h,u),e==="focusout"&&(E=h._wrapperState)&&E.controlled&&h.type==="number"&&vo(h,"number",h.value)}switch(E=u?wn(u):window,e){case"focusin":(Rl(E)||E.contentEditable==="true")&&(vn=E,jo=u,hr=null);break;case"focusout":hr=jo=vn=null;break;case"mousedown":Ro=!0;break;case"contextmenu":case"mouseup":case"dragend":Ro=!1,Ll(p,n,c);break;case"selectionchange":if(np)break;case"keydown":case"keyup":Ll(p,n,c)}var T;if(Ra)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else mn?Uc(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&($c&&n.locale!=="ko"&&(mn||O!=="onCompositionStart"?O==="onCompositionEnd"&&mn&&(T=Lc()):(_t=c,Ca="value"in _t?_t.value:_t.textContent,mn=!0)),E=Ms(u,O),0<E.length&&(O=new bl(O,e,null,n,c),p.push({event:O,listeners:E}),T?O.data=T:(T=Dc(n),T!==null&&(O.data=T)))),(T=Vf?Hf(e,n):qf(e,n))&&(u=Ms(u,"onBeforeInput"),0<u.length&&(c=new bl("onBeforeInput","beforeinput",null,n,c),p.push({event:c,listeners:u}),c.data=T))}Qc(p,t)})}function Or(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ms(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=kr(e,n),i!=null&&r.unshift(Or(e,i,s)),i=kr(e,t),i!=null&&r.push(Or(e,i,s))),e=e.return}return r}function rn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Dl(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,s?(l=kr(n,i),l!=null&&o.unshift(Or(n,l,a))):s||(l=kr(n,i),l!=null&&o.push(Or(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var op=/\r\n?/g,ap=/\u0000|\uFFFD/g;function zl(e){return(typeof e=="string"?e:""+e).replace(op,`
`).replace(ap,"")}function as(e,t,n){if(t=zl(t),zl(e)!==t&&n)throw Error(S(425))}function Bs(){}var Po=null,Ao=null;function No(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 Io=typeof setTimeout=="function"?setTimeout:void 0,lp=typeof clearTimeout=="function"?clearTimeout:void 0,Ml=typeof Promise=="function"?Promise:void 0,up=typeof queueMicrotask=="function"?queueMicrotask:typeof Ml<"u"?function(e){return Ml.resolve(null).then(e).catch(cp)}:Io;function cp(e){setTimeout(function(){throw e})}function Hi(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),xr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);xr(t)}function Tt(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 Bl(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 Wn=Math.random().toString(36).slice(2),Ye="__reactFiber$"+Wn,jr="__reactProps$"+Wn,lt="__reactContainer$"+Wn,Lo="__reactEvents$"+Wn,dp="__reactListeners$"+Wn,hp="__reactHandles$"+Wn;function Vt(e){var t=e[Ye];if(t)return t;for(var n=e.parentNode;n;){if(t=n[lt]||n[Ye]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Bl(e);e!==null;){if(n=e[Ye])return n;e=Bl(e)}return t}e=n,n=e.parentNode}return null}function qr(e){return e=e[Ye]||e[lt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function wn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(S(33))}function di(e){return e[jr]||null}var $o=[],_n=-1;function Nt(e){return{current:e}}function W(e){0>_n||(e.current=$o[_n],$o[_n]=null,_n--)}function B(e,t){_n++,$o[_n]=e.current,e.current=t}var Pt={},pe=Nt(Pt),ke=Nt(!1),Qt=Pt;function Ln(e,t){var n=e.type.contextTypes;if(!n)return Pt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Se(e){return e=e.childContextTypes,e!=null}function Fs(){W(ke),W(pe)}function Fl(e,t,n){if(pe.current!==Pt)throw Error(S(168));B(pe,t),B(ke,n)}function Xc(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(S(108,Jh(e)||"Unknown",s));return K({},n,r)}function Ws(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Pt,Qt=pe.current,B(pe,e),B(ke,ke.current),!0}function Wl(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=Xc(e,t,Qt),r.__reactInternalMemoizedMergedChildContext=e,W(ke),W(pe),B(pe,e)):W(ke),B(ke,n)}var nt=null,hi=!1,qi=!1;function Zc(e){nt===null?nt=[e]:nt.push(e)}function fp(e){hi=!0,Zc(e)}function It(){if(!qi&&nt!==null){qi=!0;var e=0,t=D;try{var n=nt;for(D=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}nt=null,hi=!1}catch(s){throw nt!==null&&(nt=nt.slice(e+1)),xc(Ea,It),s}finally{D=t,qi=!1}}return null}var kn=[],Sn=0,Vs=null,Hs=0,Ae=[],Ne=0,Yt=null,rt=1,st="";function zt(e,t){kn[Sn++]=Hs,kn[Sn++]=Vs,Vs=e,Hs=t}function ed(e,t,n){Ae[Ne++]=rt,Ae[Ne++]=st,Ae[Ne++]=Yt,Yt=e;var r=rt;e=st;var s=32-qe(r)-1;r&=~(1<<s),n+=1;var i=32-qe(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,rt=1<<32-qe(t)+s|n<<s|r,st=i+e}else rt=1<<i|n<<s|r,st=e}function Aa(e){e.return!==null&&(zt(e,1),ed(e,1,0))}function Na(e){for(;e===Vs;)Vs=kn[--Sn],kn[Sn]=null,Hs=kn[--Sn],kn[Sn]=null;for(;e===Yt;)Yt=Ae[--Ne],Ae[Ne]=null,st=Ae[--Ne],Ae[Ne]=null,rt=Ae[--Ne],Ae[Ne]=null}var Oe=null,Ce=null,V=!1,He=null;function td(e,t){var n=Ie(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 Vl(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,Oe=e,Ce=Tt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Oe=e,Ce=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Yt!==null?{id:rt,overflow:st}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ie(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Oe=e,Ce=null,!0):!1;default:return!1}}function Uo(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Do(e){if(V){var t=Ce;if(t){var n=t;if(!Vl(e,t)){if(Uo(e))throw Error(S(418));t=Tt(n.nextSibling);var r=Oe;t&&Vl(e,t)?td(r,n):(e.flags=e.flags&-4097|2,V=!1,Oe=e)}}else{if(Uo(e))throw Error(S(418));e.flags=e.flags&-4097|2,V=!1,Oe=e}}}function Hl(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Oe=e}function ls(e){if(e!==Oe)return!1;if(!V)return Hl(e),V=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!No(e.type,e.memoizedProps)),t&&(t=Ce)){if(Uo(e))throw nd(),Error(S(418));for(;t;)td(e,t),t=Tt(t.nextSibling)}if(Hl(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(S(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ce=Tt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ce=null}}else Ce=Oe?Tt(e.stateNode.nextSibling):null;return!0}function nd(){for(var e=Ce;e;)e=Tt(e.nextSibling)}function $n(){Ce=Oe=null,V=!1}function Ia(e){He===null?He=[e]:He.push(e)}var pp=dt.ReactCurrentBatchConfig;function Zn(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(S(309));var r=n.stateNode}if(!r)throw Error(S(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(S(284));if(!n._owner)throw Error(S(290,e))}return e}function us(e,t){throw e=Object.prototype.toString.call(t),Error(S(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ql(e){var t=e._init;return t(e._payload)}function rd(e){function t(g,d){if(e){var f=g.deletions;f===null?(g.deletions=[d],g.flags|=16):f.push(d)}}function n(g,d){if(!e)return null;for(;d!==null;)t(g,d),d=d.sibling;return null}function r(g,d){for(g=new Map;d!==null;)d.key!==null?g.set(d.key,d):g.set(d.index,d),d=d.sibling;return g}function s(g,d){return g=jt(g,d),g.index=0,g.sibling=null,g}function i(g,d,f){return g.index=f,e?(f=g.alternate,f!==null?(f=f.index,f<d?(g.flags|=2,d):f):(g.flags|=2,d)):(g.flags|=1048576,d)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function a(g,d,f,_){return d===null||d.tag!==6?(d=Zi(f,g.mode,_),d.return=g,d):(d=s(d,f),d.return=g,d)}function l(g,d,f,_){var x=f.type;return x===gn?c(g,d,f.props.children,_,f.key):d!==null&&(d.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===pt&&ql(x)===d.type)?(_=s(d,f.props),_.ref=Zn(g,d,f),_.return=g,_):(_=As(f.type,f.key,f.props,null,g.mode,_),_.ref=Zn(g,d,f),_.return=g,_)}function u(g,d,f,_){return d===null||d.tag!==4||d.stateNode.containerInfo!==f.containerInfo||d.stateNode.implementation!==f.implementation?(d=eo(f,g.mode,_),d.return=g,d):(d=s(d,f.children||[]),d.return=g,d)}function c(g,d,f,_,x){return d===null||d.tag!==7?(d=Jt(f,g.mode,_,x),d.return=g,d):(d=s(d,f),d.return=g,d)}function p(g,d,f){if(typeof d=="string"&&d!==""||typeof d=="number")return d=Zi(""+d,g.mode,f),d.return=g,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case Xr:return f=As(d.type,d.key,d.props,null,g.mode,f),f.ref=Zn(g,null,d),f.return=g,f;case pn:return d=eo(d,g.mode,f),d.return=g,d;case pt:var _=d._init;return p(g,_(d._payload),f)}if(sr(d)||Gn(d))return d=Jt(d,g.mode,f,null),d.return=g,d;us(g,d)}return null}function h(g,d,f,_){var x=d!==null?d.key:null;if(typeof f=="string"&&f!==""||typeof f=="number")return x!==null?null:a(g,d,""+f,_);if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Xr:return f.key===x?l(g,d,f,_):null;case pn:return f.key===x?u(g,d,f,_):null;case pt:return x=f._init,h(g,d,x(f._payload),_)}if(sr(f)||Gn(f))return x!==null?null:c(g,d,f,_,null);us(g,f)}return null}function m(g,d,f,_,x){if(typeof _=="string"&&_!==""||typeof _=="number")return g=g.get(f)||null,a(d,g,""+_,x);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Xr:return g=g.get(_.key===null?f:_.key)||null,l(d,g,_,x);case pn:return g=g.get(_.key===null?f:_.key)||null,u(d,g,_,x);case pt:var E=_._init;return m(g,d,f,E(_._payload),x)}if(sr(_)||Gn(_))return g=g.get(f)||null,c(d,g,_,x,null);us(d,_)}return null}function y(g,d,f,_){for(var x=null,E=null,T=d,O=d=0,U=null;T!==null&&O<f.length;O++){T.index>O?(U=T,T=null):U=T.sibling;var L=h(g,T,f[O],_);if(L===null){T===null&&(T=U);break}e&&T&&L.alternate===null&&t(g,T),d=i(L,d,O),E===null?x=L:E.sibling=L,E=L,T=U}if(O===f.length)return n(g,T),V&&zt(g,O),x;if(T===null){for(;O<f.length;O++)T=p(g,f[O],_),T!==null&&(d=i(T,d,O),E===null?x=T:E.sibling=T,E=T);return V&&zt(g,O),x}for(T=r(g,T);O<f.length;O++)U=m(T,g,O,f[O],_),U!==null&&(e&&U.alternate!==null&&T.delete(U.key===null?O:U.key),d=i(U,d,O),E===null?x=U:E.sibling=U,E=U);return e&&T.forEach(function(De){return t(g,De)}),V&&zt(g,O),x}function w(g,d,f,_){var x=Gn(f);if(typeof x!="function")throw Error(S(150));if(f=x.call(f),f==null)throw Error(S(151));for(var E=x=null,T=d,O=d=0,U=null,L=f.next();T!==null&&!L.done;O++,L=f.next()){T.index>O?(U=T,T=null):U=T.sibling;var De=h(g,T,L.value,_);if(De===null){T===null&&(T=U);break}e&&T&&De.alternate===null&&t(g,T),d=i(De,d,O),E===null?x=De:E.sibling=De,E=De,T=U}if(L.done)return n(g,T),V&&zt(g,O),x;if(T===null){for(;!L.done;O++,L=f.next())L=p(g,L.value,_),L!==null&&(d=i(L,d,O),E===null?x=L:E.sibling=L,E=L);return V&&zt(g,O),x}for(T=r(g,T);!L.done;O++,L=f.next())L=m(T,g,O,L.value,_),L!==null&&(e&&L.alternate!==null&&T.delete(L.key===null?O:L.key),d=i(L,d,O),E===null?x=L:E.sibling=L,E=L);return e&&T.forEach(function(qn){return t(g,qn)}),V&&zt(g,O),x}function k(g,d,f,_){if(typeof f=="object"&&f!==null&&f.type===gn&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case Xr:e:{for(var x=f.key,E=d;E!==null;){if(E.key===x){if(x=f.type,x===gn){if(E.tag===7){n(g,E.sibling),d=s(E,f.props.children),d.return=g,g=d;break e}}else if(E.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===pt&&ql(x)===E.type){n(g,E.sibling),d=s(E,f.props),d.ref=Zn(g,E,f),d.return=g,g=d;break e}n(g,E);break}else t(g,E);E=E.sibling}f.type===gn?(d=Jt(f.props.children,g.mode,_,f.key),d.return=g,g=d):(_=As(f.type,f.key,f.props,null,g.mode,_),_.ref=Zn(g,d,f),_.return=g,g=_)}return o(g);case pn:e:{for(E=f.key;d!==null;){if(d.key===E)if(d.tag===4&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){n(g,d.sibling),d=s(d,f.children||[]),d.return=g,g=d;break e}else{n(g,d);break}else t(g,d);d=d.sibling}d=eo(f,g.mode,_),d.return=g,g=d}return o(g);case pt:return E=f._init,k(g,d,E(f._payload),_)}if(sr(f))return y(g,d,f,_);if(Gn(f))return w(g,d,f,_);us(g,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,d!==null&&d.tag===6?(n(g,d.sibling),d=s(d,f),d.return=g,g=d):(n(g,d),d=Zi(f,g.mode,_),d.return=g,g=d),o(g)):n(g,d)}return k}var Un=rd(!0),sd=rd(!1),qs=Nt(null),Ks=null,En=null,La=null;function $a(){La=En=Ks=null}function Ua(e){var t=qs.current;W(qs),e._currentValue=t}function zo(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 Pn(e,t){Ks=e,La=En=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(_e=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if(La!==e)if(e={context:e,memoizedValue:t,next:null},En===null){if(Ks===null)throw Error(S(308));En=e,Ks.dependencies={lanes:0,firstContext:e}}else En=En.next=e;return t}var Ht=null;function Da(e){Ht===null?Ht=[e]:Ht.push(e)}function id(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Da(t)):(n.next=s.next,s.next=n),t.interleaved=n,ut(e,r)}function ut(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 gt=!1;function za(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function od(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 it(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function bt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ut(e,n)}return s=r.interleaved,s===null?(t.next=t,Da(r)):(t.next=s.next,s.next=t),r.interleaved=t,ut(e,n)}function bs(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,xa(e,n)}}function Kl(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,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 Gs(e,t,n,r){var s=e.updateQueue;gt=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(i!==null){var p=s.baseState;o=0,c=u=l=null,a=i;do{var h=a.lane,m=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,w=a;switch(h=t,m=n,w.tag){case 1:if(y=w.payload,typeof y=="function"){p=y.call(m,p,h);break e}p=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=w.payload,h=typeof y=="function"?y.call(m,p,h):y,h==null)break e;p=K({},p,h);break e;case 2:gt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[a]:h.push(a))}else m={eventTime:m,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=m,l=p):c=c.next=m,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;h=a,a=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(c===null&&(l=p),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=c,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Zt|=o,e.lanes=o,e.memoizedState=p}}function Gl(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(S(191,s));s.call(r)}}}var Kr={},Ze=Nt(Kr),Rr=Nt(Kr),Pr=Nt(Kr);function qt(e){if(e===Kr)throw Error(S(174));return e}function Ma(e,t){switch(B(Pr,t),B(Rr,e),B(Ze,Kr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:wo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=wo(t,e)}W(Ze),B(Ze,t)}function Dn(){W(Ze),W(Rr),W(Pr)}function ad(e){qt(Pr.current);var t=qt(Ze.current),n=wo(t,e.type);t!==n&&(B(Rr,e),B(Ze,n))}function Ba(e){Rr.current===e&&(W(Ze),W(Rr))}var H=Nt(0);function Js(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 Ki=[];function Fa(){for(var e=0;e<Ki.length;e++)Ki[e]._workInProgressVersionPrimary=null;Ki.length=0}var Cs=dt.ReactCurrentDispatcher,Gi=dt.ReactCurrentBatchConfig,Xt=0,q=null,te=null,se=null,Qs=!1,fr=!1,Ar=0,gp=0;function de(){throw Error(S(321))}function Wa(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ge(e[n],t[n]))return!1;return!0}function Va(e,t,n,r,s,i){if(Xt=i,q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Cs.current=e===null||e.memoizedState===null?wp:_p,e=n(r,s),fr){i=0;do{if(fr=!1,Ar=0,25<=i)throw Error(S(301));i+=1,se=te=null,t.updateQueue=null,Cs.current=kp,e=n(r,s)}while(fr)}if(Cs.current=Ys,t=te!==null&&te.next!==null,Xt=0,se=te=q=null,Qs=!1,t)throw Error(S(300));return e}function Ha(){var e=Ar!==0;return Ar=0,e}function Qe(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return se===null?q.memoizedState=se=e:se=se.next=e,se}function Ue(){if(te===null){var e=q.alternate;e=e!==null?e.memoizedState:null}else e=te.next;var t=se===null?q.memoizedState:se.next;if(t!==null)se=t,te=e;else{if(e===null)throw Error(S(310));te=e,e={memoizedState:te.memoizedState,baseState:te.baseState,baseQueue:te.baseQueue,queue:te.queue,next:null},se===null?q.memoizedState=se=e:se=se.next=e}return se}function Nr(e,t){return typeof t=="function"?t(e):t}function Ji(e){var t=Ue(),n=t.queue;if(n===null)throw Error(S(311));n.lastRenderedReducer=e;var r=te,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var a=o=null,l=null,u=i;do{var c=u.lane;if((Xt&c)===c)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var p={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=p,o=r):l=l.next=p,q.lanes|=c,Zt|=c}u=u.next}while(u!==null&&u!==i);l===null?o=r:l.next=a,Ge(r,t.memoizedState)||(_e=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,q.lanes|=i,Zt|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Qi(e){var t=Ue(),n=t.queue;if(n===null)throw Error(S(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);Ge(i,t.memoizedState)||(_e=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function ld(){}function ud(e,t){var n=q,r=Ue(),s=t(),i=!Ge(r.memoizedState,s);if(i&&(r.memoizedState=s,_e=!0),r=r.queue,qa(hd.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||se!==null&&se.memoizedState.tag&1){if(n.flags|=2048,Ir(9,dd.bind(null,n,r,s,t),void 0,null),ie===null)throw Error(S(349));Xt&30||cd(n,t,s)}return s}function cd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=q.updateQueue,t===null?(t={lastEffect:null,stores:null},q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function dd(e,t,n,r){t.value=n,t.getSnapshot=r,fd(t)&&pd(e)}function hd(e,t,n){return n(function(){fd(t)&&pd(e)})}function fd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ge(e,n)}catch{return!0}}function pd(e){var t=ut(e,1);t!==null&&Ke(t,e,1,-1)}function Jl(e){var t=Qe();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:e},t.queue=e,e=e.dispatch=yp.bind(null,q,e),[t.memoizedState,e]}function Ir(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=q.updateQueue,t===null?(t={lastEffect:null,stores:null},q.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 gd(){return Ue().memoizedState}function Os(e,t,n,r){var s=Qe();q.flags|=e,s.memoizedState=Ir(1|t,n,void 0,r===void 0?null:r)}function fi(e,t,n,r){var s=Ue();r=r===void 0?null:r;var i=void 0;if(te!==null){var o=te.memoizedState;if(i=o.destroy,r!==null&&Wa(r,o.deps)){s.memoizedState=Ir(t,n,i,r);return}}q.flags|=e,s.memoizedState=Ir(1|t,n,i,r)}function Ql(e,t){return Os(8390656,8,e,t)}function qa(e,t){return fi(2048,8,e,t)}function md(e,t){return fi(4,2,e,t)}function vd(e,t){return fi(4,4,e,t)}function yd(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 wd(e,t,n){return n=n!=null?n.concat([e]):null,fi(4,4,yd.bind(null,t,e),n)}function Ka(){}function _d(e,t){var n=Ue();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Wa(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function kd(e,t){var n=Ue();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Wa(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Sd(e,t,n){return Xt&21?(Ge(n,t)||(n=Cc(),q.lanes|=n,Zt|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,_e=!0),e.memoizedState=n)}function mp(e,t){var n=D;D=n!==0&&4>n?n:4,e(!0);var r=Gi.transition;Gi.transition={};try{e(!1),t()}finally{D=n,Gi.transition=r}}function Ed(){return Ue().memoizedState}function vp(e,t,n){var r=Ot(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},xd(e))Td(t,n);else if(n=id(e,t,n,r),n!==null){var s=me();Ke(n,e,r,s),bd(n,t,r)}}function yp(e,t,n){var r=Ot(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(xd(e))Td(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,Ge(a,o)){var l=t.interleaved;l===null?(s.next=s,Da(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=id(e,t,s,r),n!==null&&(s=me(),Ke(n,e,r,s),bd(n,t,r))}}function xd(e){var t=e.alternate;return e===q||t!==null&&t===q}function Td(e,t){fr=Qs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xa(e,n)}}var Ys={readContext:$e,useCallback:de,useContext:de,useEffect:de,useImperativeHandle:de,useInsertionEffect:de,useLayoutEffect:de,useMemo:de,useReducer:de,useRef:de,useState:de,useDebugValue:de,useDeferredValue:de,useTransition:de,useMutableSource:de,useSyncExternalStore:de,useId:de,unstable_isNewReconciler:!1},wp={readContext:$e,useCallback:function(e,t){return Qe().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:Ql,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Os(4194308,4,yd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Os(4194308,4,e,t)},useInsertionEffect:function(e,t){return Os(4,2,e,t)},useMemo:function(e,t){var n=Qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qe();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=vp.bind(null,q,e),[r.memoizedState,e]},useRef:function(e){var t=Qe();return e={current:e},t.memoizedState=e},useState:Jl,useDebugValue:Ka,useDeferredValue:function(e){return Qe().memoizedState=e},useTransition:function(){var e=Jl(!1),t=e[0];return e=mp.bind(null,e[1]),Qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=q,s=Qe();if(V){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),ie===null)throw Error(S(349));Xt&30||cd(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Ql(hd.bind(null,r,i,e),[e]),r.flags|=2048,Ir(9,dd.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Qe(),t=ie.identifierPrefix;if(V){var n=st,r=rt;n=(r&~(1<<32-qe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ar++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=gp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},_p={readContext:$e,useCallback:_d,useContext:$e,useEffect:qa,useImperativeHandle:wd,useInsertionEffect:md,useLayoutEffect:vd,useMemo:kd,useReducer:Ji,useRef:gd,useState:function(){return Ji(Nr)},useDebugValue:Ka,useDeferredValue:function(e){var t=Ue();return Sd(t,te.memoizedState,e)},useTransition:function(){var e=Ji(Nr)[0],t=Ue().memoizedState;return[e,t]},useMutableSource:ld,useSyncExternalStore:ud,useId:Ed,unstable_isNewReconciler:!1},kp={readContext:$e,useCallback:_d,useContext:$e,useEffect:qa,useImperativeHandle:wd,useInsertionEffect:md,useLayoutEffect:vd,useMemo:kd,useReducer:Qi,useRef:gd,useState:function(){return Qi(Nr)},useDebugValue:Ka,useDeferredValue:function(e){var t=Ue();return te===null?t.memoizedState=e:Sd(t,te.memoizedState,e)},useTransition:function(){var e=Qi(Nr)[0],t=Ue().memoizedState;return[e,t]},useMutableSource:ld,useSyncExternalStore:ud,useId:Ed,unstable_isNewReconciler:!1};function Be(e,t){if(e&&e.defaultProps){t=K({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Mo(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:K({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var pi={isMounted:function(e){return(e=e._reactInternals)?nn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=me(),s=Ot(e),i=it(r,s);i.payload=t,n!=null&&(i.callback=n),t=bt(e,i,s),t!==null&&(Ke(t,e,s,r),bs(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=me(),s=Ot(e),i=it(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=bt(e,i,s),t!==null&&(Ke(t,e,s,r),bs(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=me(),r=Ot(e),s=it(n,r);s.tag=2,t!=null&&(s.callback=t),t=bt(e,s,r),t!==null&&(Ke(t,e,r,n),bs(t,e,r))}};function Yl(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!br(n,r)||!br(s,i):!0}function Cd(e,t,n){var r=!1,s=Pt,i=t.contextType;return typeof i=="object"&&i!==null?i=$e(i):(s=Se(t)?Qt:pe.current,r=t.contextTypes,i=(r=r!=null)?Ln(e,s):Pt),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=pi,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Xl(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&&pi.enqueueReplaceState(t,t.state,null)}function Bo(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},za(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=$e(i):(i=Se(t)?Qt:pe.current,s.context=Ln(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Mo(e,t,i,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&&pi.enqueueReplaceState(s,s.state,null),Gs(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function zn(e,t){try{var n="",r=t;do n+=Gh(r),r=r.return;while(r);var s=n}catch(i){s=`
Error generating stack: `+i.message+`
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function Yi(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Fo(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Sp=typeof WeakMap=="function"?WeakMap:Map;function Od(e,t,n){n=it(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Zs||(Zs=!0,Xo=r),Fo(e,t)},n}function jd(e,t,n){n=it(-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(){Fo(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Fo(e,t),typeof r!="function"&&(Ct===null?Ct=new Set([this]):Ct.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Zl(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Sp;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=$p.bind(null,e,t,n),t.then(e,e))}function eu(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 tu(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=it(-1,1),t.tag=2,bt(n,t,1))),n.lanes|=1),e)}var Ep=dt.ReactCurrentOwner,_e=!1;function ge(e,t,n,r){t.child=e===null?sd(t,null,n,r):Un(t,e.child,n,r)}function nu(e,t,n,r,s){n=n.render;var i=t.ref;return Pn(t,s),r=Va(e,t,n,r,i,s),n=Ha(),e!==null&&!_e?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ct(e,t,s)):(V&&n&&Aa(t),t.flags|=1,ge(e,t,r,s),t.child)}function ru(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!tl(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Rd(e,t,i,r,s)):(e=As(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:br,n(o,r)&&e.ref===t.ref)return ct(e,t,s)}return t.flags|=1,e=jt(i,r),e.ref=t.ref,e.return=t,t.child=e}function Rd(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(br(i,r)&&e.ref===t.ref)if(_e=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(_e=!0);else return t.lanes=e.lanes,ct(e,t,s)}return Wo(e,t,n,r,s)}function Pd(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},B(Tn,Te),Te|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,B(Tn,Te),Te|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,B(Tn,Te),Te|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,B(Tn,Te),Te|=r;return ge(e,t,s,n),t.child}function Ad(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Wo(e,t,n,r,s){var i=Se(n)?Qt:pe.current;return i=Ln(t,i),Pn(t,s),n=Va(e,t,n,r,i,s),r=Ha(),e!==null&&!_e?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ct(e,t,s)):(V&&r&&Aa(t),t.flags|=1,ge(e,t,n,s),t.child)}function su(e,t,n,r,s){if(Se(n)){var i=!0;Ws(t)}else i=!1;if(Pn(t,s),t.stateNode===null)js(e,t),Cd(t,n,r),Bo(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=$e(u):(u=Se(n)?Qt:pe.current,u=Ln(t,u));var c=n.getDerivedStateFromProps,p=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";p||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&Xl(t,o,r,u),gt=!1;var h=t.memoizedState;o.state=h,Gs(t,r,o,s),l=t.memoizedState,a!==r||h!==l||ke.current||gt?(typeof c=="function"&&(Mo(t,n,c,r),l=t.memoizedState),(a=gt||Yl(t,n,a,r,h,l,u))?(p||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,od(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Be(t.type,a),o.props=u,p=t.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=$e(l):(l=Se(n)?Qt:pe.current,l=Ln(t,l));var m=n.getDerivedStateFromProps;(c=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==p||h!==l)&&Xl(t,o,r,l),gt=!1,h=t.memoizedState,o.state=h,Gs(t,r,o,s);var y=t.memoizedState;a!==p||h!==y||ke.current||gt?(typeof m=="function"&&(Mo(t,n,m,r),y=t.memoizedState),(u=gt||Yl(t,n,u,r,h,y,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,y,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,y,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),o.props=r,o.state=y,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Vo(e,t,n,r,i,s)}function Vo(e,t,n,r,s,i){Ad(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&Wl(t,n,!1),ct(e,t,i);r=t.stateNode,Ep.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Un(t,e.child,null,i),t.child=Un(t,null,a,i)):ge(e,t,a,i),t.memoizedState=r.state,s&&Wl(t,n,!0),t.child}function Nd(e){var t=e.stateNode;t.pendingContext?Fl(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Fl(e,t.context,!1),Ma(e,t.containerInfo)}function iu(e,t,n,r,s){return $n(),Ia(s),t.flags|=256,ge(e,t,n,r),t.child}var Ho={dehydrated:null,treeContext:null,retryLane:0};function qo(e){return{baseLanes:e,cachePool:null,transitions:null}}function Id(e,t,n){var r=t.pendingProps,s=H.current,i=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(s&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),B(H,s&1),e===null)return Do(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):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=vi(o,r,0,null),e=Jt(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=qo(n),t.memoizedState=Ho,e):Ga(t,o));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return xp(e,t,o,r,a,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,a=s.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=jt(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=jt(a,i):(i=Jt(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?qo(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Ho,r}return i=e.child,e=i.sibling,r=jt(i,{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 Ga(e,t){return t=vi({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function cs(e,t,n,r){return r!==null&&Ia(r),Un(t,e.child,null,n),e=Ga(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xp(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=Yi(Error(S(422))),cs(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=vi({mode:"visible",children:r.children},s,0,null),i=Jt(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Un(t,e.child,null,o),t.child.memoizedState=qo(o),t.memoizedState=Ho,i);if(!(t.mode&1))return cs(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(S(419)),r=Yi(i,r,void 0),cs(e,t,o,r)}if(a=(o&e.childLanes)!==0,_e||a){if(r=ie,r!==null){switch(o&-o){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|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,ut(e,s),Ke(r,e,s,-1))}return el(),r=Yi(Error(S(421))),cs(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=Up.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Ce=Tt(s.nextSibling),Oe=t,V=!0,He=null,e!==null&&(Ae[Ne++]=rt,Ae[Ne++]=st,Ae[Ne++]=Yt,rt=e.id,st=e.overflow,Yt=t),t=Ga(t,r.children),t.flags|=4096,t)}function ou(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),zo(e.return,t,n)}function Xi(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function Ld(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(ge(e,t,r.children,n),r=H.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&&ou(e,n,t);else if(e.tag===19)ou(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(B(H,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&&Js(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Xi(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Js(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Xi(t,!0,n,null,i);break;case"together":Xi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function js(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ct(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Zt|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(S(153));if(t.child!==null){for(e=t.child,n=jt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=jt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tp(e,t,n){switch(t.tag){case 3:Nd(t),$n();break;case 5:ad(t);break;case 1:Se(t.type)&&Ws(t);break;case 4:Ma(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;B(qs,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(B(H,H.current&1),t.flags|=128,null):n&t.child.childLanes?Id(e,t,n):(B(H,H.current&1),e=ct(e,t,n),e!==null?e.sibling:null);B(H,H.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ld(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),B(H,H.current),r)break;return null;case 22:case 23:return t.lanes=0,Pd(e,t,n)}return ct(e,t,n)}var $d,Ko,Ud,Dd;$d=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}};Ko=function(){};Ud=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,qt(Ze.current);var i=null;switch(n){case"input":s=go(e,s),r=go(e,r),i=[];break;case"select":s=K({},s,{value:void 0}),r=K({},r,{value:void 0}),i=[];break;case"textarea":s=yo(e,s),r=yo(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Bs)}_o(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(wr.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(a=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(wr.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&F("scroll",e),i||a===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Dd=function(e,t,n,r){n!==r&&(t.flags|=4)};function er(e,t){if(!V)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 he(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 bp(e,t,n){var r=t.pendingProps;switch(Na(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return he(t),null;case 1:return Se(t.type)&&Fs(),he(t),null;case 3:return r=t.stateNode,Dn(),W(ke),W(pe),Fa(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ls(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,He!==null&&(ta(He),He=null))),Ko(e,t),he(t),null;case 5:Ba(t);var s=qt(Pr.current);if(n=t.type,e!==null&&t.stateNode!=null)Ud(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(S(166));return he(t),null}if(e=qt(Ze.current),ls(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Ye]=t,r[jr]=i,e=(t.mode&1)!==0,n){case"dialog":F("cancel",r),F("close",r);break;case"iframe":case"object":case"embed":F("load",r);break;case"video":case"audio":for(s=0;s<or.length;s++)F(or[s],r);break;case"source":F("error",r);break;case"img":case"image":case"link":F("error",r),F("load",r);break;case"details":F("toggle",r);break;case"input":gl(r,i),F("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},F("invalid",r);break;case"textarea":vl(r,i),F("invalid",r)}_o(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&as(r.textContent,a,e),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&as(r.textContent,a,e),s=["children",""+a]):wr.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&F("scroll",r)}switch(n){case"input":Zr(r),ml(r,i,!0);break;case"textarea":Zr(r),yl(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Bs)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=hc(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ye]=t,e[jr]=r,$d(e,t,!1,!1),t.stateNode=e;e:{switch(o=ko(n,r),n){case"dialog":F("cancel",e),F("close",e),s=r;break;case"iframe":case"object":case"embed":F("load",e),s=r;break;case"video":case"audio":for(s=0;s<or.length;s++)F(or[s],e);s=r;break;case"source":F("error",e),s=r;break;case"img":case"image":case"link":F("error",e),F("load",e),s=r;break;case"details":F("toggle",e),s=r;break;case"input":gl(e,r),s=go(e,r),F("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=K({},r,{value:void 0}),F("invalid",e);break;case"textarea":vl(e,r),s=yo(e,r),F("invalid",e);break;default:s=r}_o(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?gc(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&fc(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&_r(e,l):typeof l=="number"&&_r(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(wr.hasOwnProperty(i)?l!=null&&i==="onScroll"&&F("scroll",e):l!=null&&ya(e,i,l,o))}switch(n){case"input":Zr(e),ml(e,r,!1);break;case"textarea":Zr(e),yl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Rt(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Cn(e,!!r.multiple,i,!1):r.defaultValue!=null&&Cn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Bs)}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 he(t),null;case 6:if(e&&t.stateNode!=null)Dd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(S(166));if(n=qt(Pr.current),qt(Ze.current),ls(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ye]=t,(i=r.nodeValue!==n)&&(e=Oe,e!==null))switch(e.tag){case 3:as(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&as(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ye]=t,t.stateNode=r}return he(t),null;case 13:if(W(H),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(V&&Ce!==null&&t.mode&1&&!(t.flags&128))nd(),$n(),t.flags|=98560,i=!1;else if(i=ls(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(S(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(S(317));i[Ye]=t}else $n(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;he(t),i=!1}else He!==null&&(ta(He),He=null),i=!0;if(!i)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||H.current&1?ne===0&&(ne=3):el())),t.updateQueue!==null&&(t.flags|=4),he(t),null);case 4:return Dn(),Ko(e,t),e===null&&Cr(t.stateNode.containerInfo),he(t),null;case 10:return Ua(t.type._context),he(t),null;case 17:return Se(t.type)&&Fs(),he(t),null;case 19:if(W(H),i=t.memoizedState,i===null)return he(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)er(i,!1);else{if(ne!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Js(e),o!==null){for(t.flags|=128,er(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return B(H,H.current&1|2),t.child}e=e.sibling}i.tail!==null&&Y()>Mn&&(t.flags|=128,r=!0,er(i,!1),t.lanes=4194304)}else{if(!r)if(e=Js(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),er(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!V)return he(t),null}else 2*Y()-i.renderingStartTime>Mn&&n!==1073741824&&(t.flags|=128,r=!0,er(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Y(),t.sibling=null,n=H.current,B(H,r?n&1|2:n&1),t):(he(t),null);case 22:case 23:return Za(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Te&1073741824&&(he(t),t.subtreeFlags&6&&(t.flags|=8192)):he(t),null;case 24:return null;case 25:return null}throw Error(S(156,t.tag))}function Cp(e,t){switch(Na(t),t.tag){case 1:return Se(t.type)&&Fs(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Dn(),W(ke),W(pe),Fa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ba(t),null;case 13:if(W(H),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));$n()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(H),null;case 4:return Dn(),null;case 10:return Ua(t.type._context),null;case 22:case 23:return Za(),null;case 24:return null;default:return null}}var ds=!1,fe=!1,Op=typeof WeakSet=="function"?WeakSet:Set,b=null;function xn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){J(e,t,r)}else n.current=null}function Go(e,t,n){try{n()}catch(r){J(e,t,r)}}var au=!1;function jp(e,t){if(Po=Ds,e=Wc(),Pa(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,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,p=e,h=null;t:for(;;){for(var m;p!==n||s!==0&&p.nodeType!==3||(a=o+s),p!==i||r!==0&&p.nodeType!==3||(l=o+r),p.nodeType===3&&(o+=p.nodeValue.length),(m=p.firstChild)!==null;)h=p,p=m;for(;;){if(p===e)break t;if(h===n&&++u===s&&(a=o),h===i&&++c===r&&(l=o),(m=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ao={focusedElem:e,selectionRange:n},Ds=!1,b=t;b!==null;)if(t=b,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,b=e;else for(;b!==null;){t=b;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,k=y.memoizedState,g=t.stateNode,d=g.getSnapshotBeforeUpdate(t.elementType===t.type?w:Be(t.type,w),k);g.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var f=t.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(S(163))}}catch(_){J(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,b=e;break}b=t.return}return y=au,au=!1,y}function pr(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 i=s.destroy;s.destroy=void 0,i!==void 0&&Go(t,n,i)}s=s.next}while(s!==r)}}function gi(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 Jo(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 zd(e){var t=e.alternate;t!==null&&(e.alternate=null,zd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ye],delete t[jr],delete t[Lo],delete t[dp],delete t[hp])),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 Md(e){return e.tag===5||e.tag===3||e.tag===4}function lu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Md(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 Qo(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=Bs));else if(r!==4&&(e=e.child,e!==null))for(Qo(e,t,n),e=e.sibling;e!==null;)Qo(e,t,n),e=e.sibling}function Yo(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(Yo(e,t,n),e=e.sibling;e!==null;)Yo(e,t,n),e=e.sibling}var le=null,We=!1;function ft(e,t,n){for(n=n.child;n!==null;)Bd(e,t,n),n=n.sibling}function Bd(e,t,n){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(ai,n)}catch{}switch(n.tag){case 5:fe||xn(n,t);case 6:var r=le,s=We;le=null,ft(e,t,n),le=r,We=s,le!==null&&(We?(e=le,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):le.removeChild(n.stateNode));break;case 18:le!==null&&(We?(e=le,n=n.stateNode,e.nodeType===8?Hi(e.parentNode,n):e.nodeType===1&&Hi(e,n),xr(e)):Hi(le,n.stateNode));break;case 4:r=le,s=We,le=n.stateNode.containerInfo,We=!0,ft(e,t,n),le=r,We=s;break;case 0:case 11:case 14:case 15:if(!fe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Go(n,t,o),s=s.next}while(s!==r)}ft(e,t,n);break;case 1:if(!fe&&(xn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){J(n,t,a)}ft(e,t,n);break;case 21:ft(e,t,n);break;case 22:n.mode&1?(fe=(r=fe)||n.memoizedState!==null,ft(e,t,n),fe=r):ft(e,t,n);break;default:ft(e,t,n)}}function uu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Op),t.forEach(function(r){var s=Dp.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function ze(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:le=a.stateNode,We=!1;break e;case 3:le=a.stateNode.containerInfo,We=!0;break e;case 4:le=a.stateNode.containerInfo,We=!0;break e}a=a.return}if(le===null)throw Error(S(160));Bd(i,o,s),le=null,We=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(u){J(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fd(t,e),t=t.sibling}function Fd(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ze(t,e),Je(e),r&4){try{pr(3,e,e.return),gi(3,e)}catch(w){J(e,e.return,w)}try{pr(5,e,e.return)}catch(w){J(e,e.return,w)}}break;case 1:ze(t,e),Je(e),r&512&&n!==null&&xn(n,n.return);break;case 5:if(ze(t,e),Je(e),r&512&&n!==null&&xn(n,n.return),e.flags&32){var s=e.stateNode;try{_r(s,"")}catch(w){J(e,e.return,w)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&cc(s,i),ko(a,o);var u=ko(a,i);for(o=0;o<l.length;o+=2){var c=l[o],p=l[o+1];c==="style"?gc(s,p):c==="dangerouslySetInnerHTML"?fc(s,p):c==="children"?_r(s,p):ya(s,c,p,u)}switch(a){case"input":mo(s,i);break;case"textarea":dc(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?Cn(s,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?Cn(s,!!i.multiple,i.defaultValue,!0):Cn(s,!!i.multiple,i.multiple?[]:"",!1))}s[jr]=i}catch(w){J(e,e.return,w)}}break;case 6:if(ze(t,e),Je(e),r&4){if(e.stateNode===null)throw Error(S(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(w){J(e,e.return,w)}}break;case 3:if(ze(t,e),Je(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{xr(t.containerInfo)}catch(w){J(e,e.return,w)}break;case 4:ze(t,e),Je(e);break;case 13:ze(t,e),Je(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Ya=Y())),r&4&&uu(e);break;case 22:if(c=n!==null&&n.memoizedState!==null,e.mode&1?(fe=(u=fe)||c,ze(t,e),fe=u):ze(t,e),Je(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!c&&e.mode&1)for(b=e,c=e.child;c!==null;){for(p=b=c;b!==null;){switch(h=b,m=h.child,h.tag){case 0:case 11:case 14:case 15:pr(4,h,h.return);break;case 1:xn(h,h.return);var y=h.stateNode;if(typeof y.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(w){J(r,n,w)}}break;case 5:xn(h,h.return);break;case 22:if(h.memoizedState!==null){du(p);continue}}m!==null?(m.return=h,b=m):du(p)}c=c.sibling}e:for(c=null,p=e;;){if(p.tag===5){if(c===null){c=p;try{s=p.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=p.stateNode,l=p.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=pc("display",o))}catch(w){J(e,e.return,w)}}}else if(p.tag===6){if(c===null)try{p.stateNode.nodeValue=u?"":p.memoizedProps}catch(w){J(e,e.return,w)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;c===p&&(c=null),p=p.return}c===p&&(c=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:ze(t,e),Je(e),r&4&&uu(e);break;case 21:break;default:ze(t,e),Je(e)}}function Je(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Md(n)){var r=n;break e}n=n.return}throw Error(S(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(_r(s,""),r.flags&=-33);var i=lu(e);Yo(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=lu(e);Qo(e,a,o);break;default:throw Error(S(161))}}catch(l){J(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rp(e,t,n){b=e,Wd(e)}function Wd(e,t,n){for(var r=(e.mode&1)!==0;b!==null;){var s=b,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||ds;if(!o){var a=s.alternate,l=a!==null&&a.memoizedState!==null||fe;a=ds;var u=fe;if(ds=o,(fe=l)&&!u)for(b=s;b!==null;)o=b,l=o.child,o.tag===22&&o.memoizedState!==null?hu(s):l!==null?(l.return=o,b=l):hu(s);for(;i!==null;)b=i,Wd(i),i=i.sibling;b=s,ds=a,fe=u}cu(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,b=i):cu(e)}}function cu(e){for(;b!==null;){var t=b;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:fe||gi(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!fe)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Be(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Gl(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Gl(t,o,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 u=t.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var p=c.dehydrated;p!==null&&xr(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(S(163))}fe||t.flags&512&&Jo(t)}catch(h){J(t,t.return,h)}}if(t===e){b=null;break}if(n=t.sibling,n!==null){n.return=t.return,b=n;break}b=t.return}}function du(e){for(;b!==null;){var t=b;if(t===e){b=null;break}var n=t.sibling;if(n!==null){n.return=t.return,b=n;break}b=t.return}}function hu(e){for(;b!==null;){var t=b;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{gi(4,t)}catch(l){J(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(l){J(t,s,l)}}var i=t.return;try{Jo(t)}catch(l){J(t,i,l)}break;case 5:var o=t.return;try{Jo(t)}catch(l){J(t,o,l)}}}catch(l){J(t,t.return,l)}if(t===e){b=null;break}var a=t.sibling;if(a!==null){a.return=t.return,b=a;break}b=t.return}}var Pp=Math.ceil,Xs=dt.ReactCurrentDispatcher,Ja=dt.ReactCurrentOwner,Le=dt.ReactCurrentBatchConfig,$=0,ie=null,Z=null,ue=0,Te=0,Tn=Nt(0),ne=0,Lr=null,Zt=0,mi=0,Qa=0,gr=null,we=null,Ya=0,Mn=1/0,et=null,Zs=!1,Xo=null,Ct=null,hs=!1,kt=null,ei=0,mr=0,Zo=null,Rs=-1,Ps=0;function me(){return $&6?Y():Rs!==-1?Rs:Rs=Y()}function Ot(e){return e.mode&1?$&2&&ue!==0?ue&-ue:pp.transition!==null?(Ps===0&&(Ps=Cc()),Ps):(e=D,e!==0||(e=window.event,e=e===void 0?16:Ic(e.type)),e):1}function Ke(e,t,n,r){if(50<mr)throw mr=0,Zo=null,Error(S(185));Vr(e,n,r),(!($&2)||e!==ie)&&(e===ie&&(!($&2)&&(mi|=n),ne===4&&yt(e,ue)),Ee(e,r),n===1&&$===0&&!(t.mode&1)&&(Mn=Y()+500,hi&&It()))}function Ee(e,t){var n=e.callbackNode;pf(e,t);var r=Us(e,e===ie?ue:0);if(r===0)n!==null&&kl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&kl(n),t===1)e.tag===0?fp(fu.bind(null,e)):Zc(fu.bind(null,e)),up(function(){!($&6)&&It()}),n=null;else{switch(Oc(r)){case 1:n=Ea;break;case 4:n=Tc;break;case 16:n=$s;break;case 536870912:n=bc;break;default:n=$s}n=Yd(n,Vd.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Vd(e,t){if(Rs=-1,Ps=0,$&6)throw Error(S(327));var n=e.callbackNode;if(An()&&e.callbackNode!==n)return null;var r=Us(e,e===ie?ue:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ti(e,r);else{t=r;var s=$;$|=2;var i=qd();(ie!==e||ue!==t)&&(et=null,Mn=Y()+500,Gt(e,t));do try{Ip();break}catch(a){Hd(e,a)}while(!0);$a(),Xs.current=i,$=s,Z!==null?t=0:(ie=null,ue=0,t=ne)}if(t!==0){if(t===2&&(s=bo(e),s!==0&&(r=s,t=ea(e,s))),t===1)throw n=Lr,Gt(e,0),yt(e,r),Ee(e,Y()),n;if(t===6)yt(e,r);else{if(s=e.current.alternate,!(r&30)&&!Ap(s)&&(t=ti(e,r),t===2&&(i=bo(e),i!==0&&(r=i,t=ea(e,i))),t===1))throw n=Lr,Gt(e,0),yt(e,r),Ee(e,Y()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(S(345));case 2:Mt(e,we,et);break;case 3:if(yt(e,r),(r&130023424)===r&&(t=Ya+500-Y(),10<t)){if(Us(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){me(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Io(Mt.bind(null,e,we,et),t);break}Mt(e,we,et);break;case 4:if(yt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-qe(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=Y()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Pp(r/1960))-r,10<r){e.timeoutHandle=Io(Mt.bind(null,e,we,et),r);break}Mt(e,we,et);break;case 5:Mt(e,we,et);break;default:throw Error(S(329))}}}return Ee(e,Y()),e.callbackNode===n?Vd.bind(null,e):null}function ea(e,t){var n=gr;return e.current.memoizedState.isDehydrated&&(Gt(e,t).flags|=256),e=ti(e,t),e!==2&&(t=we,we=n,t!==null&&ta(t)),e}function ta(e){we===null?we=e:we.push.apply(we,e)}function Ap(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],i=s.getSnapshot;s=s.value;try{if(!Ge(i(),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 yt(e,t){for(t&=~Qa,t&=~mi,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-qe(t),r=1<<n;e[n]=-1,t&=~r}}function fu(e){if($&6)throw Error(S(327));An();var t=Us(e,0);if(!(t&1))return Ee(e,Y()),null;var n=ti(e,t);if(e.tag!==0&&n===2){var r=bo(e);r!==0&&(t=r,n=ea(e,r))}if(n===1)throw n=Lr,Gt(e,0),yt(e,t),Ee(e,Y()),n;if(n===6)throw Error(S(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Mt(e,we,et),Ee(e,Y()),null}function Xa(e,t){var n=$;$|=1;try{return e(t)}finally{$=n,$===0&&(Mn=Y()+500,hi&&It())}}function en(e){kt!==null&&kt.tag===0&&!($&6)&&An();var t=$;$|=1;var n=Le.transition,r=D;try{if(Le.transition=null,D=1,e)return e()}finally{D=r,Le.transition=n,$=t,!($&6)&&It()}}function Za(){Te=Tn.current,W(Tn)}function Gt(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,lp(n)),Z!==null)for(n=Z.return;n!==null;){var r=n;switch(Na(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Fs();break;case 3:Dn(),W(ke),W(pe),Fa();break;case 5:Ba(r);break;case 4:Dn();break;case 13:W(H);break;case 19:W(H);break;case 10:Ua(r.type._context);break;case 22:case 23:Za()}n=n.return}if(ie=e,Z=e=jt(e.current,null),ue=Te=t,ne=0,Lr=null,Qa=mi=Zt=0,we=gr=null,Ht!==null){for(t=0;t<Ht.length;t++)if(n=Ht[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Ht=null}return e}function Hd(e,t){do{var n=Z;try{if($a(),Cs.current=Ys,Qs){for(var r=q.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Qs=!1}if(Xt=0,se=te=q=null,fr=!1,Ar=0,Ja.current=null,n===null||n.return===null){ne=1,Lr=t,Z=null;break}e:{var i=e,o=n.return,a=n,l=t;if(t=ue,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,c=a,p=c.tag;if(!(c.mode&1)&&(p===0||p===11||p===15)){var h=c.alternate;h?(c.updateQueue=h.updateQueue,c.memoizedState=h.memoizedState,c.lanes=h.lanes):(c.updateQueue=null,c.memoizedState=null)}var m=eu(o);if(m!==null){m.flags&=-257,tu(m,o,a,i,t),m.mode&1&&Zl(i,u,t),t=m,l=u;var y=t.updateQueue;if(y===null){var w=new Set;w.add(l),t.updateQueue=w}else y.add(l);break e}else{if(!(t&1)){Zl(i,u,t),el();break e}l=Error(S(426))}}else if(V&&a.mode&1){var k=eu(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),tu(k,o,a,i,t),Ia(zn(l,a));break e}}i=l=zn(l,a),ne!==4&&(ne=2),gr===null?gr=[i]:gr.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=Od(i,l,t);Kl(i,g);break e;case 1:a=l;var d=i.type,f=i.stateNode;if(!(i.flags&128)&&(typeof d.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Ct===null||!Ct.has(f)))){i.flags|=65536,t&=-t,i.lanes|=t;var _=jd(i,a,t);Kl(i,_);break e}}i=i.return}while(i!==null)}Gd(n)}catch(x){t=x,Z===n&&n!==null&&(Z=n=n.return);continue}break}while(!0)}function qd(){var e=Xs.current;return Xs.current=Ys,e===null?Ys:e}function el(){(ne===0||ne===3||ne===2)&&(ne=4),ie===null||!(Zt&268435455)&&!(mi&268435455)||yt(ie,ue)}function ti(e,t){var n=$;$|=2;var r=qd();(ie!==e||ue!==t)&&(et=null,Gt(e,t));do try{Np();break}catch(s){Hd(e,s)}while(!0);if($a(),$=n,Xs.current=r,Z!==null)throw Error(S(261));return ie=null,ue=0,ne}function Np(){for(;Z!==null;)Kd(Z)}function Ip(){for(;Z!==null&&!sf();)Kd(Z)}function Kd(e){var t=Qd(e.alternate,e,Te);e.memoizedProps=e.pendingProps,t===null?Gd(e):Z=t,Ja.current=null}function Gd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Cp(n,t),n!==null){n.flags&=32767,Z=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ne=6,Z=null;return}}else if(n=bp(n,t,Te),n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);ne===0&&(ne=5)}function Mt(e,t,n){var r=D,s=Le.transition;try{Le.transition=null,D=1,Lp(e,t,n,r)}finally{Le.transition=s,D=r}return null}function Lp(e,t,n,r){do An();while(kt!==null);if($&6)throw Error(S(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(S(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(gf(e,i),e===ie&&(Z=ie=null,ue=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||hs||(hs=!0,Yd($s,function(){return An(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Le.transition,Le.transition=null;var o=D;D=1;var a=$;$|=4,Ja.current=null,jp(e,n),Fd(n,e),tp(Ao),Ds=!!Po,Ao=Po=null,e.current=n,Rp(n),of(),$=a,D=o,Le.transition=i}else e.current=n;if(hs&&(hs=!1,kt=e,ei=s),i=e.pendingLanes,i===0&&(Ct=null),uf(n.stateNode),Ee(e,Y()),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(Zs)throw Zs=!1,e=Xo,Xo=null,e;return ei&1&&e.tag!==0&&An(),i=e.pendingLanes,i&1?e===Zo?mr++:(mr=0,Zo=e):mr=0,It(),null}function An(){if(kt!==null){var e=Oc(ei),t=Le.transition,n=D;try{if(Le.transition=null,D=16>e?16:e,kt===null)var r=!1;else{if(e=kt,kt=null,ei=0,$&6)throw Error(S(331));var s=$;for($|=4,b=e.current;b!==null;){var i=b,o=i.child;if(b.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(b=u;b!==null;){var c=b;switch(c.tag){case 0:case 11:case 15:pr(8,c,i)}var p=c.child;if(p!==null)p.return=c,b=p;else for(;b!==null;){c=b;var h=c.sibling,m=c.return;if(zd(c),c===u){b=null;break}if(h!==null){h.return=m,b=h;break}b=m}}}var y=i.alternate;if(y!==null){var w=y.child;if(w!==null){y.child=null;do{var k=w.sibling;w.sibling=null,w=k}while(w!==null)}}b=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,b=o;else e:for(;b!==null;){if(i=b,i.flags&2048)switch(i.tag){case 0:case 11:case 15:pr(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,b=g;break e}b=i.return}}var d=e.current;for(b=d;b!==null;){o=b;var f=o.child;if(o.subtreeFlags&2064&&f!==null)f.return=o,b=f;else e:for(o=d;b!==null;){if(a=b,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:gi(9,a)}}catch(x){J(a,a.return,x)}if(a===o){b=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,b=_;break e}b=a.return}}if($=s,It(),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(ai,e)}catch{}r=!0}return r}finally{D=n,Le.transition=t}}return!1}function pu(e,t,n){t=zn(n,t),t=Od(e,t,1),e=bt(e,t,1),t=me(),e!==null&&(Vr(e,1,t),Ee(e,t))}function J(e,t,n){if(e.tag===3)pu(e,e,n);else for(;t!==null;){if(t.tag===3){pu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ct===null||!Ct.has(r))){e=zn(n,e),e=jd(t,e,1),t=bt(t,e,1),e=me(),t!==null&&(Vr(t,1,e),Ee(t,e));break}}t=t.return}}function $p(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=me(),e.pingedLanes|=e.suspendedLanes&n,ie===e&&(ue&n)===n&&(ne===4||ne===3&&(ue&130023424)===ue&&500>Y()-Ya?Gt(e,0):Qa|=n),Ee(e,t)}function Jd(e,t){t===0&&(e.mode&1?(t=ns,ns<<=1,!(ns&130023424)&&(ns=4194304)):t=1);var n=me();e=ut(e,t),e!==null&&(Vr(e,t,n),Ee(e,n))}function Up(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Jd(e,n)}function Dp(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(S(314))}r!==null&&r.delete(t),Jd(e,n)}var Qd;Qd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ke.current)_e=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return _e=!1,Tp(e,t,n);_e=!!(e.flags&131072)}else _e=!1,V&&t.flags&1048576&&ed(t,Hs,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;js(e,t),e=t.pendingProps;var s=Ln(t,pe.current);Pn(t,n),s=Va(null,t,r,e,s,n);var i=Ha();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,Se(r)?(i=!0,Ws(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,za(t),s.updater=pi,t.stateNode=s,s._reactInternals=t,Bo(t,r,e,n),t=Vo(null,t,r,!0,i,n)):(t.tag=0,V&&i&&Aa(t),ge(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(js(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=Mp(r),e=Be(r,e),s){case 0:t=Wo(null,t,r,e,n);break e;case 1:t=su(null,t,r,e,n);break e;case 11:t=nu(null,t,r,e,n);break e;case 14:t=ru(null,t,r,Be(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Be(r,s),Wo(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Be(r,s),su(e,t,r,s,n);case 3:e:{if(Nd(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,s=i.element,od(e,t),Gs(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=zn(Error(S(423)),t),t=iu(e,t,r,n,s);break e}else if(r!==s){s=zn(Error(S(424)),t),t=iu(e,t,r,n,s);break e}else for(Ce=Tt(t.stateNode.containerInfo.firstChild),Oe=t,V=!0,He=null,n=sd(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if($n(),r===s){t=ct(e,t,n);break e}ge(e,t,r,n)}t=t.child}return t;case 5:return ad(t),e===null&&Do(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,No(r,s)?o=null:i!==null&&No(r,i)&&(t.flags|=32),Ad(e,t),ge(e,t,o,n),t.child;case 6:return e===null&&Do(t),null;case 13:return Id(e,t,n);case 4:return Ma(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Un(t,null,r,n):ge(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Be(r,s),nu(e,t,r,s,n);case 7:return ge(e,t,t.pendingProps,n),t.child;case 8:return ge(e,t,t.pendingProps.children,n),t.child;case 12:return ge(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,B(qs,r._currentValue),r._currentValue=o,i!==null)if(Ge(i.value,o)){if(i.children===s.children&&!ke.current){t=ct(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=it(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),zo(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(S(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),zo(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ge(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Pn(t,n),s=$e(s),r=r(s),t.flags|=1,ge(e,t,r,n),t.child;case 14:return r=t.type,s=Be(r,t.pendingProps),s=Be(r.type,s),ru(e,t,r,s,n);case 15:return Rd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Be(r,s),js(e,t),t.tag=1,Se(r)?(e=!0,Ws(t)):e=!1,Pn(t,n),Cd(t,r,s),Bo(t,r,s,n),Vo(null,t,r,!0,e,n);case 19:return Ld(e,t,n);case 22:return Pd(e,t,n)}throw Error(S(156,t.tag))};function Yd(e,t){return xc(e,t)}function zp(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 Ie(e,t,n,r){return new zp(e,t,n,r)}function tl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Mp(e){if(typeof e=="function")return tl(e)?1:0;if(e!=null){if(e=e.$$typeof,e===_a)return 11;if(e===ka)return 14}return 2}function jt(e,t){var n=e.alternate;return n===null?(n=Ie(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 As(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")tl(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case gn:return Jt(n.children,s,i,t);case wa:o=8,s|=8;break;case co:return e=Ie(12,n,t,s|2),e.elementType=co,e.lanes=i,e;case ho:return e=Ie(13,n,t,s),e.elementType=ho,e.lanes=i,e;case fo:return e=Ie(19,n,t,s),e.elementType=fo,e.lanes=i,e;case ac:return vi(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ic:o=10;break e;case oc:o=9;break e;case _a:o=11;break e;case ka:o=14;break e;case pt:o=16,r=null;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=Ie(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Jt(e,t,n,r){return e=Ie(7,e,r,t),e.lanes=n,e}function vi(e,t,n,r){return e=Ie(22,e,r,t),e.elementType=ac,e.lanes=n,e.stateNode={isHidden:!1},e}function Zi(e,t,n){return e=Ie(6,e,null,t),e.lanes=n,e}function eo(e,t,n){return t=Ie(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bp(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=Ii(0),this.expirationTimes=Ii(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ii(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function nl(e,t,n,r,s,i,o,a,l){return e=new Bp(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ie(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},za(i),e}function Fp(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:pn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Xd(e){if(!e)return Pt;e=e._reactInternals;e:{if(nn(e)!==e||e.tag!==1)throw Error(S(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Se(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(S(171))}if(e.tag===1){var n=e.type;if(Se(n))return Xc(e,n,t)}return t}function Zd(e,t,n,r,s,i,o,a,l){return e=nl(n,r,!0,e,s,i,o,a,l),e.context=Xd(null),n=e.current,r=me(),s=Ot(n),i=it(r,s),i.callback=t??null,bt(n,i,s),e.current.lanes=s,Vr(e,s,r),Ee(e,r),e}function yi(e,t,n,r){var s=t.current,i=me(),o=Ot(s);return n=Xd(n),t.context===null?t.context=n:t.pendingContext=n,t=it(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=bt(s,t,o),e!==null&&(Ke(e,s,o,i),bs(e,s,o)),o}function ni(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 gu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function rl(e,t){gu(e,t),(e=e.alternate)&&gu(e,t)}function Wp(){return null}var eh=typeof reportError=="function"?reportError:function(e){console.error(e)};function sl(e){this._internalRoot=e}wi.prototype.render=sl.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(S(409));yi(e,t,null,null)};wi.prototype.unmount=sl.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;en(function(){yi(null,e,null,null)}),t[lt]=null}};function wi(e){this._internalRoot=e}wi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Pc();e={blockedOn:null,target:e,priority:t};for(var n=0;n<vt.length&&t!==0&&t<vt[n].priority;n++);vt.splice(n,0,e),n===0&&Nc(e)}};function il(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _i(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function mu(){}function Vp(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=ni(o);i.call(u)}}var o=Zd(t,r,e,0,null,!1,!1,"",mu);return e._reactRootContainer=o,e[lt]=o.current,Cr(e.nodeType===8?e.parentNode:e),en(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var u=ni(l);a.call(u)}}var l=nl(e,0,!1,null,null,!1,!1,"",mu);return e._reactRootContainer=l,e[lt]=l.current,Cr(e.nodeType===8?e.parentNode:e),en(function(){yi(t,l,n,r)}),l}function ki(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var l=ni(o);a.call(l)}}yi(t,o,e,s)}else o=Vp(n,t,e,s,r);return ni(o)}jc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ir(t.pendingLanes);n!==0&&(xa(t,n|1),Ee(t,Y()),!($&6)&&(Mn=Y()+500,It()))}break;case 13:en(function(){var r=ut(e,1);if(r!==null){var s=me();Ke(r,e,1,s)}}),rl(e,1)}};Ta=function(e){if(e.tag===13){var t=ut(e,134217728);if(t!==null){var n=me();Ke(t,e,134217728,n)}rl(e,134217728)}};Rc=function(e){if(e.tag===13){var t=Ot(e),n=ut(e,t);if(n!==null){var r=me();Ke(n,e,t,r)}rl(e,t)}};Pc=function(){return D};Ac=function(e,t){var n=D;try{return D=e,t()}finally{D=n}};Eo=function(e,t,n){switch(t){case"input":if(mo(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=di(r);if(!s)throw Error(S(90));uc(r),mo(r,s)}}}break;case"textarea":dc(e,n);break;case"select":t=n.value,t!=null&&Cn(e,!!n.multiple,t,!1)}};yc=Xa;wc=en;var Hp={usingClientEntryPoint:!1,Events:[qr,wn,di,mc,vc,Xa]},tr={findFiberByHostInstance:Vt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},qp={bundleType:tr.bundleType,version:tr.version,rendererPackageName:tr.rendererPackageName,rendererConfig:tr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:dt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Sc(e),e===null?null:e.stateNode},findFiberByHostInstance:tr.findFiberByHostInstance||Wp,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 fs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fs.isDisabled&&fs.supportsFiber)try{ai=fs.inject(qp),Xe=fs}catch{}}Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hp;Re.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!il(t))throw Error(S(200));return Fp(e,t,null,n)};Re.createRoot=function(e,t){if(!il(e))throw Error(S(299));var n=!1,r="",s=eh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=nl(e,1,!1,null,null,n,!1,r,s),e[lt]=t.current,Cr(e.nodeType===8?e.parentNode:e),new sl(t)};Re.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(S(188)):(e=Object.keys(e).join(","),Error(S(268,e)));return e=Sc(t),e=e===null?null:e.stateNode,e};Re.flushSync=function(e){return en(e)};Re.hydrate=function(e,t,n){if(!_i(t))throw Error(S(200));return ki(null,e,t,!0,n)};Re.hydrateRoot=function(e,t,n){if(!il(e))throw Error(S(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=eh;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=Zd(t,null,e,1,n??null,s,!1,i,o),e[lt]=t.current,Cr(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 wi(t)};Re.render=function(e,t,n){if(!_i(t))throw Error(S(200));return ki(null,e,t,!1,n)};Re.unmountComponentAtNode=function(e){if(!_i(e))throw Error(S(40));return e._reactRootContainer?(en(function(){ki(null,null,e,!1,function(){e._reactRootContainer=null,e[lt]=null})}),!0):!1};Re.unstable_batchedUpdates=Xa;Re.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!_i(n))throw Error(S(200));if(e==null||e._reactInternals===void 0)throw Error(S(38));return ki(e,t,n,!1,r)};Re.version="18.3.1-next-f1338f8080-20240426";function th(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(th)}catch(e){console.error(e)}}th(),tc.exports=Re;var Kp=tc.exports,vu=Kp;lo.createRoot=vu.createRoot,lo.hydrateRoot=vu.hydrateRoot;/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var Gp={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.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jp=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Vn=(e,t)=>{const n=z.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:l,...u},c)=>z.createElement("svg",{ref:c,...Gp,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${Jp(e)}`,a].join(" "),...u},[...t.map(([p,h])=>z.createElement(p,h)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qp=Vn("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yp=Vn("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xp=Vn("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zp=Vn("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eg=Vn("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tg=Vn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ng({activeView:e="mission",onChangeView:t=()=>{}}){const n=[{icon:Zp,label:"Mission Control",key:"mission"},{icon:Xp,label:"Fluxo de Caixa",key:"cashflow"},{icon:Qp,label:"Knowledge Base",active:!1,status:"Em breve"},{icon:eg,label:"Squad Settings",active:!1,status:"Em breve"}];return v.jsxs("aside",{className:"area sidebar",children:[v.jsx("div",{className:"sidebar-brand",children:v.jsx("h3",{children:"Mission Control"})}),v.jsx("nav",{children:v.jsx("ul",{children:n.map(r=>v.jsxs("li",{className:`${r.key&&e===r.key?"active":""} ${r.status?"disabled":""}`,onClick:()=>{r.key&&t(r.key)},children:[v.jsx(r.icon,{size:18}),v.jsxs("div",{className:"menu-label-container",children:[v.jsx("span",{children:r.label}),r.status&&v.jsx("span",{className:"status-badge-inline",children:r.status})]})]},r.label))})})]})}function rg({title:e="Global Operations",status:t="System Online"}){return v.jsx("header",{className:"area header",children:v.jsxs("div",{className:"header-content",children:[v.jsx("h1",{children:e}),v.jsxs("div",{className:"system-status",children:[v.jsx("span",{className:"status-dot"})," ",t]})]})})}function sg({task:e,onClose:t}){if(!e)return null;const n=s=>{if(!s)return"-";try{return new Date(s).toLocaleString("pt-BR",{hour:"2-digit",minute:"2-digit",day:"2-digit",month:"2-digit"})}catch{return"-"}},r=(s,i)=>{if(!s||!i)return null;try{const o=new Date(i)-new Date(s);if(isNaN(o))return null;const a=Math.floor(o/6e4),l=Math.floor(o%6e4/1e3);return`${a}m ${l}s`}catch{return null}};return v.jsx("div",{className:"modal-overlay",onClick:t,children:v.jsxs("div",{className:"modal-content",onClick:s=>s.stopPropagation(),children:[v.jsx("button",{className:"close-btn",onClick:t,children:v.jsx(tg,{size:20})}),v.jsxs("div",{className:"modal-header",children:[v.jsx("span",{className:`priority-tag ${(e.priority||"medium").toLowerCase()}`,children:e.priority||"Medium"}),v.jsx("h2",{children:e.title}),v.jsxs("div",{className:"meta-info",children:[v.jsxs("span",{children:["Agente: ",v.jsxs("strong",{children:["@",e.assigned_to||"unassigned"]})]}),v.jsxs("span",{children:["Status: ",v.jsx("strong",{children:e.status})]})]})]}),v.jsxs("div",{className:"modal-body",children:[v.jsxs("section",{children:[v.jsx("h3",{children:"Descrição"}),v.jsx("p",{children:e.description||"Sem descrição."})]}),v.jsxs("section",{className:"timeline-section",children:[v.jsxs("h3",{children:[v.jsx(Yp,{size:16})," Linha do Tempo"]}),v.jsxs("div",{className:"timeline",children:[v.jsxs("div",{className:"timeline-item",children:[v.jsx("span",{className:"time",children:n(e.created_at)}),v.jsxs("span",{className:"label",children:["Criado por ",e.created_by||"Sistema"]})]}),e.started_at&&v.jsxs("div",{className:"timeline-item highlight",children:[v.jsx("span",{className:"time",children:n(e.started_at)}),v.jsx("span",{className:"label",children:"Início do processamento"})]}),Array.isArray(e.status_history)&&e.status_history.map((s,i)=>{const o=i===0?e.created_at:e.status_history[i-1].at,a=r(o,s.at);return v.jsxs("div",{className:"timeline-item",children:[v.jsx("span",{className:"time",children:n(s.at)}),v.jsxs("span",{className:"label",children:["Movido para ",v.jsx("strong",{children:s.to})]}),a&&v.jsxs("span",{className:"duration",children:["Duração: ",a]})]},i)})]})]})]})]})})}function ig({task:e,onClick:t}){const n=(e.priority||"medium").toLowerCase();return v.jsxs("div",{className:"task-card",onClick:()=>t(e),children:[v.jsx("div",{className:"task-header",children:v.jsx("span",{className:`priority-tag ${n}`,children:e.priority||"Medium"})}),v.jsx("h4",{children:e.title}),v.jsx("p",{children:e.description}),v.jsx("div",{className:"task-footer",children:v.jsxs("span",{className:"assigned-to",children:["@",e.assigned_to]})})]})}function og({tasks:e=[]}){const[t,n]=z.useState(null),r=["Inbox","Assigned","In Progress","Review","Done"],s=i=>{const a={Inbox:"pending",Assigned:"assigned","In Progress":"in_progress",Review:"review",Done:"done"}[i]||i.toLowerCase().replace(" ","_");return(e||[]).filter(l=>l.status===a)};return v.jsxs(Zu.Fragment,{children:[v.jsx("div",{className:"kanban-board",children:r.map(i=>v.jsxs("div",{className:"kanban-column",children:[v.jsxs("div",{className:"column-header",children:[i," ",v.jsx("span",{className:"count",children:s(i).length})]}),v.jsx("div",{className:"column-content",children:s(i).map(o=>v.jsx(ig,{task:o,onClick:n},o.id))})]},i))}),t&&v.jsx(sg,{task:t,onClose:()=>n(null)})]})}function ag({logs:e=[]}){const t=n=>new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return v.jsxs("section",{className:"area activity-ticker",children:[v.jsx("div",{className:"ticker-header",children:v.jsx("h4",{children:"Live Activity Feed"})}),v.jsx("div",{className:"ticker-content",children:e.length>0?e.map(n=>v.jsxs("div",{className:"activity-item",children:[v.jsx("span",{className:"time",children:t(n.created_at)}),v.jsx("span",{className:"divider",children:" - "}),v.jsxs("span",{className:"agent-name",children:["Agent ",n.agent_id]}),v.jsxs("span",{className:"action",children:[" ",n.action]}),n.details&&v.jsxs("span",{className:"details",children:[": ",n.details]})]},n.id)):v.jsx("p",{className:"empty-state",children:"No activity yet..."})})]})}function lg({agent:e}){const t=e.status==="active"||e.status==="busy"||e.status==="idle";return v.jsxs("div",{className:`agent-card ${t?"":"offline"}`,children:[v.jsxs("div",{className:"agent-portrait",children:[v.jsx("img",{src:`/${e.img}`,alt:e.name}),v.jsxs("div",{className:`status-badge ${e.status}`,children:[v.jsx("span",{className:"dot"}),e.status==="offline"?"Offline":"Ativo"]})]}),v.jsxs("div",{className:"agent-info",children:[v.jsxs("div",{className:"agent-header-row",children:[v.jsx("h3",{children:e.name}),v.jsx("span",{className:"load-badge",children:e.load||"0%"})]}),v.jsx("p",{className:"role",children:e.role}),v.jsx("div",{className:"agent-stats",children:Object.entries(e.powers).map(([n,r])=>v.jsxs("div",{className:"stat-item",children:[v.jsx("span",{className:"stat-label",children:n}),v.jsx("span",{className:"stat-value",children:r})]},n))})]})]})}function ug({agents:e=[]}){return v.jsx("footer",{className:"area agent-footer",children:e.map(t=>v.jsx(lg,{agent:t},t.name))})}function cg(e){return Number(e||0).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})}function dg({summary:e,snapshotDate:t}){return e?v.jsxs("section",{className:"cashflow-summary-grid",children:[v.jsxs("article",{className:"cashflow-card",children:[v.jsx("span",{children:"Data"}),v.jsx("strong",{children:t||"-"})]}),v.jsxs("article",{className:"cashflow-card",children:[v.jsx("span",{children:"Saldo consolidado"}),v.jsx("strong",{children:cg(e.consolidated_balance)})]}),v.jsxs("article",{className:"cashflow-card",children:[v.jsx("span",{children:"Unidades em risco"}),v.jsx("strong",{children:e.risk_units||0})]}),v.jsxs("article",{className:"cashflow-card",children:[v.jsxs("span",{children:["Desatualizadas (",e.stale_threshold_days||2,"+ dias)"]}),v.jsx("strong",{children:e.stale_units||0})]}),v.jsxs("article",{className:"cashflow-card",children:[v.jsx("span",{children:"Contas negativas"}),v.jsx("strong",{children:e.units_with_negative_accounts||0})]}),v.jsxs("article",{className:"cashflow-card",children:[v.jsx("span",{children:"Total de unidades"}),v.jsx("strong",{children:e.total_units||0})]})]}):null}function hg(e){return Number(e||0).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})}function fg({units:e=[],onSelectUnit:t,selectedUnitId:n}){return v.jsxs("section",{className:"cashflow-ranking",children:[v.jsxs("div",{className:"cashflow-ranking-header",children:[v.jsx("h3",{children:"Ranking de Caixa (Maior → Menor)"}),v.jsxs("span",{children:[e.length," unidades"]})]}),v.jsx("div",{className:"cashflow-table-wrapper",children:v.jsxs("table",{className:"cashflow-table",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{children:"#"}),v.jsx("th",{children:"Unidade"}),v.jsx("th",{children:"Saldo Total"}),v.jsx("th",{children:"Contas Negativas"}),v.jsx("th",{children:"Dias sem input"}),v.jsx("th",{children:"Status"})]})}),v.jsx("tbody",{children:e.map((r,s)=>{const i=[n===r.unit_id?"selected":"",Number(r.total_balance)<0?"risk":"",Number(r.days_since_last_input||0)>=2?"stale":""].filter(Boolean).join(" "),o=r.is_up_to_date?"Atualizado":"Desatualizado";return v.jsxs("tr",{className:i,children:[v.jsx("td",{children:s+1}),v.jsx("td",{children:v.jsx("button",{type:"button",onClick:()=>t(r),children:r.unit_name})}),v.jsx("td",{children:hg(r.total_balance)}),v.jsx("td",{children:r.negative_accounts_count||0}),v.jsx("td",{children:r.days_since_last_input||0}),v.jsx("td",{children:o})]},r.unit_id||`${r.unit_name}-${s}`)})})]})})]})}function pg({selectedDate:e,onDateChange:t,onRefresh:n}){return v.jsxs("section",{className:"cashflow-filter",children:[v.jsxs("div",{className:"cashflow-filter-left",children:[v.jsx("h3",{children:"Fluxo de Caixa por Data"}),v.jsx("p",{children:"Selecione uma data retroativa para comparar o histórico."})]}),v.jsxs("div",{className:"cashflow-filter-controls",children:[v.jsx("label",{htmlFor:"snapshot-date",children:"Data de referência"}),v.jsx("input",{id:"snapshot-date",type:"date",value:e,onChange:r=>t(r.target.value)}),v.jsx("button",{type:"button",onClick:n,children:"Atualizar"})]})]})}function yu(e){return Number(e||0).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})}function gg({unit:e}){if(!e)return v.jsxs("section",{className:"cashflow-unit-detail empty",children:[v.jsx("h3",{children:"Detalhe da Unidade"}),v.jsx("p",{children:"Selecione uma unidade no ranking para ver as contas."})]});const t=Array.isArray(e.accounts)?e.accounts:[];return v.jsxs("section",{className:"cashflow-unit-detail",children:[v.jsxs("div",{className:"cashflow-unit-header",children:[v.jsx("h3",{children:e.unit_name}),v.jsx("span",{children:yu(e.total_balance)})]}),v.jsxs("div",{className:"cashflow-unit-meta",children:[v.jsxs("span",{children:["Dias sem input: ",e.days_since_last_input||0]}),v.jsxs("span",{children:["Status: ",e.is_up_to_date?"Atualizado":"Desatualizado"]})]}),v.jsx("div",{className:"cashflow-table-wrapper",children:v.jsxs("table",{className:"cashflow-table",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{children:"Conta"}),v.jsx("th",{children:"Saldo"})]})}),v.jsx("tbody",{children:t.map(n=>{const r=Number(n.balance||0)<0;return v.jsxs("tr",{className:r?"risk":"",children:[v.jsx("td",{children:n.name}),v.jsx("td",{children:yu(n.balance)})]},n.bank_account_id||n.name)})})]})})]})}function mg(e){return Number(e||0).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})}function vg({history:e=[]}){return v.jsxs("section",{className:"cashflow-history",children:[v.jsxs("div",{className:"cashflow-ranking-header",children:[v.jsx("h3",{children:"Historico Diario"}),v.jsxs("span",{children:[e.length," snapshots"]})]}),v.jsx("div",{className:"cashflow-table-wrapper",children:v.jsxs("table",{className:"cashflow-table",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{children:"Data"}),v.jsx("th",{children:"Saldo consolidado"}),v.jsx("th",{children:"Risco"}),v.jsx("th",{children:"Desatualizadas"}),v.jsx("th",{children:"Contas negativas"})]})}),v.jsx("tbody",{children:e.map((t,n)=>{const r=t.summary||{};return v.jsxs("tr",{children:[v.jsx("td",{children:t.snapshot_date}),v.jsx("td",{children:mg(r.consolidated_balance)}),v.jsx("td",{children:r.risk_units||0}),v.jsx("td",{children:r.stale_units||0}),v.jsx("td",{children:r.units_with_negative_accounts||0})]},`${t.snapshot_date}-${n}`)})})]})})]})}function Si(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 yg(e,t,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(p){o(p)}}function l(c){try{u(r.throw(c))}catch(p){o(p)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(e,t||[])).next())})}const wg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class ol extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class _g extends ol{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class wu extends ol{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class _u extends ol{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var na;(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"})(na||(na={}));class kg{constructor(t,{headers:n={},customFetch:r,region:s=na.Any}={}){this.url=t,this.headers=n,this.region=s,this.fetch=wg(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return yg(this,arguments,void 0,function*(n,r={}){var s;let i,o;try{const{headers:a,method:l,body:u,signal:c,timeout:p}=r;let h={},{region:m}=r;m||(m=this.region);const y=new URL(`${this.url}/${n}`);m&&m!=="any"&&(h["x-region"]=m,y.searchParams.set("forceFunctionRegion",m));let w;u&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",w=u):typeof u=="string"?(h["Content-Type"]="text/plain",w=u):typeof FormData<"u"&&u instanceof FormData?w=u:(h["Content-Type"]="application/json",w=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?w=JSON.stringify(u):w=u;let k=c;p&&(o=new AbortController,i=setTimeout(()=>o.abort(),p),c?(k=o.signal,c.addEventListener("abort",()=>o.abort())):k=o.signal);const g=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),a),body:w,signal:k}).catch(x=>{throw new _g(x)}),d=g.headers.get("x-relay-error");if(d&&d==="true")throw new wu(g);if(!g.ok)throw new _u(g);let f=((s=g.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),_;return f==="application/json"?_=yield g.json():f==="application/octet-stream"||f==="application/pdf"?_=yield g.blob():f==="text/event-stream"?_=g:f==="multipart/form-data"?_=yield g.formData():_=yield g.text(),{data:_,error:null,response:g}}catch(a){return{data:null,error:a,response:a instanceof _u||a instanceof wu?a.context:void 0}}finally{i&&clearTimeout(i)}})}}var Sg=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},Eg=class{constructor(e){var t,n,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(r=e.urlLengthLimit)!==null&&r!==void 0?r:8e3,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var n=this;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 i=>{let o=null,a=null,l=null,u=i.status,c=i.statusText;if(i.ok){var p,h;if(n.method!=="HEAD"){var m;const g=await i.text();g===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((m=n.headers.get("Accept"))===null||m===void 0)&&m.includes("application/vnd.pgrst.plan+text"))?a=g:a=JSON.parse(g))}const w=(p=n.headers.get("Prefer"))===null||p===void 0?void 0:p.match(/count=(exact|planned|estimated)/),k=(h=i.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");w&&k&&k.length>1&&(l=parseInt(k[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(a)&&(a.length>1?(o={code:"PGRST116",details:`Results contain ${a.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},a=null,l=null,u=406,c="Not Acceptable"):a.length===1?a=a[0]:a=null)}else{var y;const w=await i.text();try{o=JSON.parse(w),Array.isArray(o)&&i.status===404&&(a=[],o=null,u=200,c="OK")}catch{i.status===404&&w===""?(u=204,c="No Content"):o={message:w}}if(o&&n.isMaybeSingle&&(!(o==null||(y=o.details)===null||y===void 0)&&y.includes("0 rows"))&&(o=null,u=200,c="OK"),o&&n.shouldThrowOnError)throw new Sg(o)}return{error:o,data:a,count:l,status:u,statusText:c}});return this.shouldThrowOnError||(s=s.catch(i=>{var o;let a="",l="",u="";const c=i==null?void 0:i.cause;if(c){var p,h,m,y;const g=(p=c==null?void 0:c.message)!==null&&p!==void 0?p:"",d=(h=c==null?void 0:c.code)!==null&&h!==void 0?h:"";a=`${(m=i==null?void 0:i.name)!==null&&m!==void 0?m:"FetchError"}: ${i==null?void 0:i.message}`,a+=`
Caused by: ${(y=c==null?void 0:c.name)!==null&&y!==void 0?y:"Error"}: ${g}`,d&&(a+=` (${d})`),c!=null&&c.stack&&(a+=`
${c.stack}`)}else{var w;a=(w=i==null?void 0:i.stack)!==null&&w!==void 0?w:""}const k=this.url.toString().length;return(i==null?void 0:i.name)==="AbortError"||(i==null?void 0:i.code)==="ABORT_ERR"?(u="",l="Request was aborted (timeout or manual cancellation)",k>this.urlLengthLimit&&(l+=`. Note: Your request URL is ${k} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((c==null?void 0:c.name)==="HeadersOverflowError"||(c==null?void 0:c.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",l="HTTP headers exceeded server limits (typically 16KB)",k>this.urlLengthLimit&&(l+=`. Your request URL is ${k} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:a,hint:l,code:u},data:null,count:null,status:0,statusText:""}})),s.then(e,t)}returns(){return this}overrideTypes(){return this}},xg=class extends Eg{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:s=r}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.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:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:s=!1,format:i="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const ku=new RegExp("[,()]");var dn=class extends xg{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&ku.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&ku.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},Tg=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:s=8e3}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},s=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),r&&l.append("Prefer",`count=${r}`),new dn({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const a=e.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(a.length>0){const l=[...new Set(a)].map(u=>`"${u}"`);i.searchParams.set("columns",l.join(","))}}return new dn({method:s,url:i,headers:o,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&a.searchParams.set("on_conflict",t),r&&l.append("Prefer",`count=${r}`),s||l.append("Prefer","missing=default"),Array.isArray(e)){const u=e.reduce((c,p)=>c.concat(Object.keys(p)),[]);if(u.length>0){const c=[...new Set(u)].map(p=>`"${p}"`);a.searchParams.set("columns",c.join(","))}}return new dn({method:o,url:a,headers:l,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit})}update(e,{count:t}={}){var n;const r="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new dn({method:r,url:s,headers:i,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new dn({method:n,url:r,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit})}};function $r(e){"@babel/helpers - typeof";return $r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$r(e)}function bg(e,t){if($r(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if($r(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Cg(e){var t=bg(e,"string");return $r(t)=="symbol"?t:t+""}function Og(e,t,n){return(t=Cg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ps(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Su(Object(n),!0).forEach(function(r){Og(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var jg=class nh{constructor(t,{headers:n={},schema:r,fetch:s,timeout:i,urlLengthLimit:o=8e3}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const a=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(l,u)=>{const c=new AbortController,p=setTimeout(()=>c.abort(),i),h=u==null?void 0:u.signal;if(h){if(h.aborted)return clearTimeout(p),a(l,u);const m=()=>{clearTimeout(p),c.abort()};return h.addEventListener("abort",m,{once:!0}),a(l,ps(ps({},u),{},{signal:c.signal})).finally(()=>{clearTimeout(p),h.removeEventListener("abort",m)})}return a(l,ps(ps({},u),{},{signal:c.signal})).finally(()=>clearTimeout(p))}:this.fetch=a}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Tg(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(t){return new nh(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(t,n={},{head:r=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${t}`);let u;const c=m=>m!==null&&typeof m=="object"&&(!Array.isArray(m)||m.some(c)),p=r&&Object.values(n).some(c);p?(a="POST",u=n):r||s?(a=r?"HEAD":"GET",Object.entries(n).filter(([m,y])=>y!==void 0).map(([m,y])=>[m,Array.isArray(y)?`{${y.join(",")}}`:`${y}`]).forEach(([m,y])=>{l.searchParams.append(m,y)})):(a="POST",u=n);const h=new Headers(this.headers);return p?h.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&h.set("Prefer",`count=${i}`),new dn({method:a,url:l,headers:h,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};class Rg{constructor(){}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."};const n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const s=r.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} 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 Pg="2.95.3",Ag=`realtime-js/${Pg}`,Ng="1.0.0",rh="2.0.0",Eu=rh,ra=1e4,Ig=1e3,Lg=100;var mt;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(mt||(mt={}));var ee;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(ee||(ee={}));var Ve;(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"})(Ve||(Ve={}));var sa;(function(e){e.websocket="websocket"})(sa||(sa={}));var Ft;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Ft||(Ft={}));class $g{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,r){var s,i;const o=t.topic,a=(s=t.ref)!==null&&s!==void 0?s:"",l=(i=t.join_ref)!==null&&i!==void 0?i:"",u=t.payload.event,c=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},p=Object.keys(c).length===0?"":JSON.stringify(c);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`metadata length ${p.length} exceeds maximum of 255`);const h=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+u.length+p.length,m=new ArrayBuffer(this.HEADER_LENGTH+h);let y=new DataView(m),w=0;y.setUint8(w++,this.KINDS.userBroadcastPush),y.setUint8(w++,l.length),y.setUint8(w++,a.length),y.setUint8(w++,o.length),y.setUint8(w++,u.length),y.setUint8(w++,p.length),y.setUint8(w++,n),Array.from(l,g=>y.setUint8(w++,g.charCodeAt(0))),Array.from(a,g=>y.setUint8(w++,g.charCodeAt(0))),Array.from(o,g=>y.setUint8(w++,g.charCodeAt(0))),Array.from(u,g=>y.setUint8(w++,g.charCodeAt(0))),Array.from(p,g=>y.setUint8(w++,g.charCodeAt(0)));var k=new Uint8Array(m.byteLength+r.byteLength);return k.set(new Uint8Array(m),0),k.set(new Uint8Array(r),m.byteLength),k.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[s,i,o,a,l]=r;return n({join_ref:s,ref:i,topic:o,event:a,payload:l})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,n,s)}}_decodeUserBroadcast(t,n,r){const s=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),a=n.getUint8(4);let l=this.HEADER_LENGTH+4;const u=r.decode(t.slice(l,l+s));l=l+s;const c=r.decode(t.slice(l,l+i));l=l+i;const p=r.decode(t.slice(l,l+o));l=l+o;const h=t.slice(l,t.byteLength),m=a===this.JSON_ENCODING?JSON.parse(r.decode(h)):h,y={type:this.BROADCAST_EVENT,event:c,payload:m};return o>0&&(y.meta=JSON.parse(p)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:y}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}class sh{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 M;(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"})(M||(M={}));const xu=(e,t,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=Ug(o,e,t,s),i),{}):{}},Ug=(e,t,n,r)=>{const s=t.find(a=>a.name===e),i=s==null?void 0:s.type,o=n[e];return i&&!r.includes(i)?ih(i,o):ia(o)},ih=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Bg(t,n)}switch(e){case M.bool:return Dg(t);case M.float4:case M.float8:case M.int2:case M.int4:case M.int8:case M.numeric:case M.oid:return zg(t);case M.json:case M.jsonb:return Mg(t);case M.timestamp:return Fg(t);case M.abstime:case M.date:case M.daterange:case M.int4range:case M.int8range:case M.money:case M.reltime:case M.text:case M.time:case M.timestamptz:case M.timetz:case M.tsrange:case M.tstzrange:return ia(t);default:return ia(t)}},ia=e=>e,Dg=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},zg=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Mg=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Bg=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>ih(t,a))}return e},Fg=e=>typeof e=="string"?e.replace(" ","T"):e,oh=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class to{constructor(t,n,r={},s=ra){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 Tu;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Tu||(Tu={}));class vr{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:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=vr.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=vr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel._on(r.diff,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=vr.syncDiff(this.state,s,i,o),a())}),this.onJoin((s,i,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:o})}),this.onLeave((s,i,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,s){const i=this.cloneDeep(t),o=this.transformState(n),a={},l={};return this.map(i,(u,c)=>{o[u]||(l[u]=c)}),this.map(o,(u,c)=>{const p=i[u];if(p){const h=c.map(k=>k.presence_ref),m=p.map(k=>k.presence_ref),y=c.filter(k=>m.indexOf(k.presence_ref)<0),w=p.filter(k=>h.indexOf(k.presence_ref)<0);y.length>0&&(a[u]=y),w.length>0&&(l[u]=w)}else a[u]=c}),this.syncDiff(i,{joins:a,leaves:l},r,s)}static syncDiff(t,n,r,s){const{joins:i,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(a,l)=>{var u;const c=(u=t[a])!==null&&u!==void 0?u:[];if(t[a]=this.cloneDeep(l),c.length>0){const p=t[a].map(m=>m.presence_ref),h=c.filter(m=>p.indexOf(m.presence_ref)<0);t[a].unshift(...h)}r(a,c,l)}),this.map(o,(a,l)=>{let u=t[a];if(!u)return;const c=l.map(p=>p.presence_ref);u=u.filter(p=>c.indexOf(p.presence_ref)<0),t[a]=u,s(a,u,l),u.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(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):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 bu;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(bu||(bu={}));var yr;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(yr||(yr={}));var tt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(tt||(tt={}));class bn{constructor(t,n={config:{}},r){var s,i;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=ee.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 to(this,Ve.join,this.params,this.timeout),this.rejoinTimer=new sh(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ee.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=ee.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=ee.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ee.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=ee.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ve.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new vr(this),this.broadcastEndpointURL=oh(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.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,i;if(this.socket.isConnected()||this.socket.connect(),this.state==ee.closed){const{config:{broadcast:o,presence:a,private:l}}=this.params,u=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(m=>m.filter))!==null&&s!==void 0?s:[],c=!!this.bindings[yr.PRESENCE]&&this.bindings[yr.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,p={},h={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:c}),postgres_changes:u,private:l};this.socket.accessTokenValue&&(p.access_token=this.socket.accessTokenValue),this._onError(m=>t==null?void 0:t(tt.CHANNEL_ERROR,m)),this._onClose(()=>t==null?void 0:t(tt.CLOSED)),this.updateJoinPayload(Object.assign({config:h},p)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:m})=>{var y;if(this.socket._isManualToken()||this.socket.setAuth(),m===void 0){t==null||t(tt.SUBSCRIBED);return}else{const w=this.bindings.postgres_changes,k=(y=w==null?void 0:w.length)!==null&&y!==void 0?y:0,g=[];for(let d=0;d<k;d++){const f=w[d],{filter:{event:_,schema:x,table:E,filter:T}}=f,O=m&&m[d];if(O&&O.event===_&&bn.isFilterValueEqual(O.schema,x)&&bn.isFilterValueEqual(O.table,E)&&bn.isFilterValueEqual(O.filter,T))g.push(Object.assign(Object.assign({},f),{id:O.id}));else{this.unsubscribe(),this.state=ee.errored,t==null||t(tt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=g,t&&t(tt.SUBSCRIBED);return}}).receive("error",m=>{this.state=ee.errored,t==null||t(tt.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(m).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(tt.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===ee.joined&&t===yr.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,n,r)}async httpSend(t,n,r={}){var s;if(n==null)return Promise.reject("Payload is required for httpSend()");const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const u=await a.json();l=u.error||u.message||l}catch{}return Promise.reject(new Error(l))}async send(t,n={}){var r,s;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=t,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const u=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=ee.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ve.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new to(this,Ve.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=ee.closed,this.bindings={}}async _fetchWithTimeout(t,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_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 to(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>Lg){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,i;const o=t.toLocaleLowerCase(),{close:a,error:l,leave:u,join:c}=Ve;if(r&&[a,l,u,c].indexOf(o)>=0&&r!==this._joinRef())return;let h=this._onMessage(o,n,r);if(n&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(m=>{var y,w,k;return((y=m.filter)===null||y===void 0?void 0:y.event)==="*"||((k=(w=m.filter)===null||w===void 0?void 0:w.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===o}).map(m=>m.callback(h,r)):(i=this.bindings[o])===null||i===void 0||i.filter(m=>{var y,w,k,g,d,f;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in m){const _=m.id,x=(y=m.filter)===null||y===void 0?void 0:y.event;return _&&((w=n.ids)===null||w===void 0?void 0:w.includes(_))&&(x==="*"||(x==null?void 0:x.toLocaleLowerCase())===((k=n.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))}else{const _=(d=(g=m==null?void 0:m.filter)===null||g===void 0?void 0:g.event)===null||d===void 0?void 0:d.toLocaleLowerCase();return _==="*"||_===((f=n==null?void 0:n.event)===null||f===void 0?void 0:f.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===o}).map(m=>{if(typeof h=="object"&&"ids"in h){const y=h.data,{schema:w,table:k,commit_timestamp:g,type:d,errors:f}=y;h=Object.assign(Object.assign({},{schema:w,table:k,commit_timestamp:g,eventType:d,new:{},old:{},errors:f}),this._getPayloadRecords(y))}m.callback(h,r)})}_isClosed(){return this.state===ee.closed}_isJoined(){return this.state===ee.joined}_isJoining(){return this.state===ee.joining}_isLeaving(){return this.state===ee.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const s=t.toLocaleLowerCase(),i={type:s,filter:n,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===r&&bn.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}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(Ve.close,{},t)}_onError(t){this._on(Ve.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ee.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=xu(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=xu(t.columns,t.old_record)),n}}const no=()=>{},gs={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Wg=[1e3,2e3,5e3,1e4],Vg=1e4,Hg=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class qg{constructor(t,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=ra,this.transport=null,this.heartbeatIntervalMs=gs.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=no,this.ref=0,this.reconnectTimer=null,this.vsn=Eu,this.logger=no,this.conn=null,this.sendBuffer=[],this.serializer=new $g,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=s=>s?(...i)=>s(...i):(...i)=>fetch(...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}/${sa.websocket}`,this.httpEndpoint=oh(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.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Rg.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:this.vsn}))}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")},typeof this.conn.close=="function"&&(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 n==="ok"&&this._remove(t),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 mt.connecting:return Ft.Connecting;case mt.open:return Ft.Open;case mt.closing:return Ft.Closing;default:return Ft.Closed}}isConnected(){return this.connectionState()===Ft.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const r=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new bn(`realtime:${t}`,n,this);return this.channels.push(i),i}}push(t){const{topic:n,event:r,payload:s,ref:i}=t,o=()=>{this.encode(t,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${n} ${r} (${i})`,s),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}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._heartbeatSentAt=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(Ig,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},gs.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),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"&&n.ref&&n.ref===this.pendingHeartbeatRef){const u=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",u)}catch(c){this.log("error","error in heartbeat callback",c)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:s,payload:i,ref:o}=n,a=o?`(${o})`:"",l=i.status||"";this.log("receive",`${l} ${r} ${s} ${a}`.trim(),i),this.channels.filter(u=>u._isMember(r)).forEach(u=>u._trigger(s,i,o)),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),this.conn.readyState===mt.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===mt.open||this.conn.readyState===mt.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),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._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_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);try{this.heartbeatCallback("error")}catch(n){this.log("error","error in heartbeat callback",n)}}_triggerChanError(){this.channels.forEach(t=>t._trigger(Ve.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([Hg],{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,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:Ag};n&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push(Ve.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||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 sh(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},gs.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,r,s,i,o,a,l,u,c,p,h,m;switch(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:ra,this.heartbeatIntervalMs=(s=t==null?void 0:t.heartbeatIntervalMs)!==null&&s!==void 0?s:gs.HEARTBEAT_INTERVAL,this.worker=(i=t==null?void 0:t.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=t==null?void 0:t.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=t==null?void 0:t.heartbeatCallback)!==null&&a!==void 0?a:no,this.vsn=(l=t==null?void 0:t.vsn)!==null&&l!==void 0?l:Eu,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=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:y=>Wg[y-1]||Vg,this.vsn){case Ng:this.encode=(c=t==null?void 0:t.encode)!==null&&c!==void 0?c:(y,w)=>w(JSON.stringify(y)),this.decode=(p=t==null?void 0:t.decode)!==null&&p!==void 0?p:(y,w)=>w(JSON.parse(y));break;case rh:this.encode=(h=t==null?void 0:t.encode)!==null&&h!==void 0?h:this.serializer.encode.bind(this.serializer),this.decode=(m=t==null?void 0:t.decode)!==null&&m!==void 0?m:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl}}}var Ur=class extends Error{constructor(e,t){var n;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((n=t.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Kg(e,t,n){const r=new URL(t,e);if(n)for(const[s,i]of Object.entries(n))i!==void 0&&r.searchParams.set(s,i);return r.toString()}async function Gg(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function Jg(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:i,headers:o}){const a=Kg(e.baseUrl,r,s),l=await Gg(e.auth),u=await t(a,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),c=await u.text(),p=(u.headers.get("content-type")||"").includes("application/json"),h=p&&c?JSON.parse(c):c;if(!u.ok){const m=p?h:void 0,y=m==null?void 0:m.error;throw new Ur((y==null?void 0:y.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:y==null?void 0:y.type,icebergCode:y==null?void 0:y.code,details:m})}return{status:u.status,headers:u.headers,data:h}}}}function ms(e){return e.join("")}var Qg=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:ms(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ms(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ms(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ms(e.namespace)}`}),!0}catch(t){if(t instanceof Ur&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof Ur&&n.status===409)return;throw n}}};function sn(e){return e.join("")}var Yg=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${sn(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${sn(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${sn(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${sn(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${sn(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${sn(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof Ur&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof Ur&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Xg=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Jg({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new Qg(this.client,t),this.tableOps=new Yg(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},Ei=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}};function xi(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var vs=class extends Ei{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},ah=class extends Ei{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};const Zg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),em=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)},oa=e=>{if(Array.isArray(e))return e.map(n=>oa(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,i=>i.toUpperCase().replace(/[-_]/g,""));t[s]=oa(r)}),t},tm=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function Dr(e){"@babel/helpers - typeof";return Dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dr(e)}function nm(e,t){if(Dr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Dr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rm(e){var t=nm(e,"string");return Dr(t)=="symbol"?t:t+""}function sm(e,t,n){return(t=rm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cu(Object(n),!0).forEach(function(r){sm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const Ou=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},im=async(e,t,n,r)=>{if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!(n!=null&&n.noResolveJson)){const s=e,i=s.status||500;if(typeof s.json=="function")s.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";t(new vs(Ou(o),i,a,r))}).catch(()=>{if(r==="vectors"){const o=i+"";t(new vs(s.statusText||`HTTP ${i} error`,i,o,r))}else{const o=i+"";t(new vs(s.statusText||`HTTP ${i} error`,i,o,r))}});else{const o=i+"";t(new vs(s.statusText||`HTTP ${i} error`,i,o,r))}}else t(new ah(Ou(e),e,r))},om=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||e==="HEAD"||!r?P(P({},s),n):(em(r)?(s.headers=P({"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),P(P({},s),n))};async function nr(e,t,n,r,s,i,o){return new Promise((a,l)=>{e(n,om(t,r,s,i)).then(u=>{if(!u.ok)throw u;if(r!=null&&r.noResolveJson)return u;if(o==="vectors"){const c=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};if(!c||!c.includes("application/json"))return{}}return u.json()}).then(u=>a(u)).catch(u=>im(u,l,r,o))})}function lh(e="storage"){return{get:async(t,n,r,s)=>nr(t,"GET",n,r,s,void 0,e),post:async(t,n,r,s,i)=>nr(t,"POST",n,s,i,r,e),put:async(t,n,r,s,i)=>nr(t,"PUT",n,s,i,r,e),head:async(t,n,r,s)=>nr(t,"HEAD",n,P(P({},r),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,n,r,s,i)=>nr(t,"DELETE",n,s,i,r,e)}}const am=lh("storage"),{get:zr,post:Fe,put:aa,head:lm,remove:al}=am,be=lh("vectors");var Hn=class{constructor(e,t={},n,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.fetch=Zg(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(xi(n))return{data:null,error:n};throw n}}},um=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(xi(t))return{data:null,error:t};throw t}}};let uh;uh=Symbol.toStringTag;var cm=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[uh]="BlobDownloadBuilder",this.promise=null}asStream(){return new um(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(xi(t))return{data:null,error:t};throw t}}};const dm={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ju={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var hm=class extends Hn{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var s=this;return s.handleOperation(async()=>{let i;const o=P(P({},ju),r);let a=P(P({},s.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers&&(a=P(P({},a),r.headers));const u=s._removeEmptyFolders(t),c=s._getFinalPath(u),p=await(e=="PUT"?aa:Fe)(s.fetch,`${s.url}/object/${c}`,i,P({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:u,id:p.Id,fullPath:p.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var s=this;const i=s._removeEmptyFolders(e),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",t),s.handleOperation(async()=>{let l;const u=P({upsert:ju.upsert},r),c=P(P({},s.headers),{"x-upsert":String(u.upsert)});return typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.append("cacheControl",u.cacheControl)):(l=n,c["cache-control"]=`max-age=${u.cacheControl}`,c["content-type"]=u.contentType),{path:i,fullPath:(await aa(s.fetch,a.toString(),l,{headers:c})).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const s=P({},n.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await Fe(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(n.url+i.url),a=o.searchParams.get("token");if(!a)throw new Ei("No token returned by API");return{signedUrl:o.toString(),path:e,token:a}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await Fe(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await Fe(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e),i=await Fe(r.fetch,`${r.url}/object/sign/${s}`,P({expiresIn:t},n!=null&&n.transform?{transform:n.transform}:{}),{headers:r.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{signedUrl:encodeURI(`${r.url}${i.signedURL}${o}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const s=await Fe(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),i=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return s.map(o=>P(P({},o),{},{signedUrl:o.signedURL?encodeURI(`${r.url}${o.signedURL}${i}`):null}))})}download(e,t,n){const r=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),i=s?`?${s}`:"",o=this._getFinalPath(e),a=()=>zr(this.fetch,`${this.url}/${r}/${o}${i}`,{headers:this.headers,noResolveJson:!0},n);return new cm(a,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>oa(await zr(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await lm(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(xi(r)&&r instanceof ah){const s=r.originalError;if([400,404].includes(s==null?void 0:s.status))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=[],s=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";s!==""&&r.push(s);const i=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",o=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});o!==""&&r.push(o);let a=r.join("&");return a!==""&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}${a}`)}}}async remove(e){var t=this;return t.handleOperation(async()=>await al(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const s=P(P(P({},dm),t),{},{prefix:e||""});return await Fe(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=P({},e);return await Fe(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const fm="2.95.3",Gr={"X-Client-Info":`storage-js/${fm}`};var pm=class extends Hn{constructor(e,t={},n,r){const s=new URL(e);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),o=P(P({},Gr),t);super(i,o,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await zr(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await zr(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await Fe(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await aa(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await Fe(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await al(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},gm=class extends Hn{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=P(P({},Gr),t);super(r,s,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Fe(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const r=n.toString(),s=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await zr(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await al(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!tm(e))throw new Ei("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new Xg({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},mm=class extends Hn{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=P(P({},Gr),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await be.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await be.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},vm=class extends Hn{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=P(P({},Gr),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},ym=class extends Hn{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=P(P({},Gr),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await be.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},wm=class extends ym{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new _m(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},_m=class extends mm{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,P(P({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,P(P({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new km(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},km=class extends vm{constructor(e,t,n,r,s){super(e,t,s),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,P(P({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,P(P({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,P(P({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,P(P({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,P(P({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},Sm=class extends pm{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new hm(this.url,this.headers,e,this.fetch)}get vectors(){return new wm(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new gm(this.url+"/iceberg",this.headers,this.fetch)}};const ch="2.95.3",hn=30*1e3,la=3,ro=la*hn,Em="http://localhost:9999",xm="supabase.auth.token",Tm={"X-Client-Info":`gotrue-js/${ch}`},ua="X-Supabase-Api-Version",dh={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},bm=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Cm=10*60*1e3;class Mr extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function j(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Om extends Mr{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function jm(e){return j(e)&&e.name==="AuthApiError"}class Wt extends Mr{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class ht extends Mr{constructor(t,n,r,s){super(t,r,s),this.name=n,this.status=r}}class xe extends ht{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function so(e){return j(e)&&e.name==="AuthSessionMissingError"}class on extends ht{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ys extends ht{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ws extends ht{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 Rm(e){return j(e)&&e.name==="AuthImplicitGrantRedirectError"}class Ru extends ht{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 Pm extends ht{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class ca extends ht{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function io(e){return j(e)&&e.name==="AuthRetryableFetchError"}class Pu extends ht{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class da extends ht{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const ri="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Au=`
\r=`.split(""),Am=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Au.length;t+=1)e[Au[t].charCodeAt(0)]=-2;for(let t=0;t<ri.length;t+=1)e[ri[t].charCodeAt(0)]=t;return e})();function Nu(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(ri[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(ri[r]),t.queuedBits-=6}}function hh(e,t,n){const r=Am[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 Iu(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{Lm(o,r,n)};for(let o=0;o<e.length;o+=1)hh(e.charCodeAt(o),s,i);return t.join("")}function Nm(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 Im(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}Nm(r,t)}}function Lm(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 Nn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)hh(e.charCodeAt(s),n,r);return new Uint8Array(t)}function $m(e){const t=[];return Im(e,n=>t.push(n)),new Uint8Array(t)}function Kt(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};return e.forEach(s=>Nu(s,n,r)),Nu(null,n,r),t.join("")}function Um(e){return Math.round(Date.now()/1e3)+e}function Dm(){return Symbol("auth-callback")}const ae=()=>typeof window<"u"&&typeof document<"u",Ut={tested:!1,writable:!1},fh=()=>{if(!ae())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ut.tested)return Ut.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Ut.tested=!0,Ut.writable=!0}catch{Ut.tested=!0,Ut.writable=!1}return Ut.writable};function zm(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,i)=>{t[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{t[s]=r}),t}const ph=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Mm=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",fn=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Dt=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},oe=async(e,t)=>{await e.removeItem(t)};class Ti{constructor(){this.promise=new Ti.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}Ti.promiseConstructor=Promise;function _s(e){const t=e.split(".");if(t.length!==3)throw new da("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!bm.test(t[r]))throw new da("JWT not in base64url format");return{header:JSON.parse(Iu(t[0])),payload:JSON.parse(Iu(t[1])),signature:Nn(t[2]),raw:{header:t[0],payload:t[1]}}}async function Bm(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function Fm(e,t){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){r(o);return}}catch(o){if(!t(i,o)){s(o);return}}})()})}function Wm(e){return("0"+e.toString(16)).substr(-2)}function Vm(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(t),Array.from(t,Wm).join("")}async function Hm(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function qm(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 Hm(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function an(e,t,n=!1){const r=Vm();let s=r;n&&(s+="/PASSWORD_RECOVERY"),await fn(e,`${t}-code-verifier`,s);const i=await qm(r);return[i,r===i?"plain":"s256"]}const Km=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Gm(e){const t=e.headers.get(ua);if(!t||!t.match(Km))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Jm(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 Qm(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 Ym=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ln(e){if(!Ym.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function oo(){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 Xm(e,t){return new Proxy(e,{get:(n,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,s)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,s)}})}function Lu(e){return JSON.parse(JSON.stringify(e))}const Bt=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Zm=[502,503,504];async function $u(e){var t;if(!Mm(e))throw new ca(Bt(e),0);if(Zm.includes(e.status))throw new ca(Bt(e),e.status);let n;try{n=await e.json()}catch(i){throw new Wt(Bt(i),i)}let r;const s=Gm(e);if(s&&s.getTime()>=dh["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 Pu(Bt(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new xe}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((i,o)=>i&&typeof o=="string",!0))throw new Pu(Bt(n),e.status,n.weak_password.reasons);throw new Om(Bt(n),e.status||500,r)}const ev=(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 R(e,t,n,r){var s;const i=Object.assign({},r==null?void 0:r.headers);i[ua]||(i[ua]=dh["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await tv(e,t,n+a,{headers:i,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 tv(e,t,n,r,s,i){const o=ev(t,r,s,i);let a;try{a=await e(n,Object.assign({},o))}catch(l){throw console.error(l),new ca(Bt(l),0)}if(a.ok||await $u(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await $u(l)}}function Me(e){var t;let n=null;sv(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Um(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function Uu(e){const t=Me(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 wt(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function nv(e){return{data:e,error:null}}function rv(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=e,o=Si(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:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function Du(e){return e}function sv(e){return e.access_token&&e.refresh_token&&e.expires_in}const ao=["global","local","others"];class iv{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=ph(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),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(t,n=ao[0]){if(ao.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${ao.join(", ")}`);try{return await R(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(j(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await R(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:wt})}catch(r){if(j(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=Si(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 R(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:rv,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(j(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await R(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:wt})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,s,i,o,a,l;try{const u={nextPage:null,lastPage:0,total:0},c=await R(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:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Du});if(c.error)throw c.error;const p=await c.json(),h=(o=c.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(l=(a=c.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return m.length>0&&(m.forEach(y=>{const w=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(y.split(";")[1].split("=")[1]);u[`${k}Page`]=w}),u.total=parseInt(h)),{data:Object.assign(Object.assign({},p),u),error:null}}catch(u){if(j(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){ln(t);try{return await R(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:wt})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){ln(t);try{return await R(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:wt})}catch(r){if(j(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){ln(t);try{return await R(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:wt})}catch(r){if(j(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){ln(t.userId);try{const{data:n,error:r}=await R(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(j(n))return{data:null,error:n};throw n}}async _deleteFactor(t){ln(t.userId),ln(t.id);try{return{data:await R(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(j(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,s,i,o,a,l;try{const u={nextPage:null,lastPage:0,total:0},c=await R(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:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Du});if(c.error)throw c.error;const p=await c.json(),h=(o=c.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(l=(a=c.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return m.length>0&&(m.forEach(y=>{const w=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(y.split(";")[1].split("=")[1]);u[`${k}Page`]=w}),u.total=parseInt(h)),{data:Object.assign(Object.assign({},p),u),error:null}}catch(u){if(j(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await R(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await R(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await R(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(j(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await R(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(j(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await R(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(j(n))return{data:null,error:n};throw n}}}function zu(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const un={debug:!!(globalThis&&fh()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class gh extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class ov extends gh{}async function av(e,t,n){un.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout(()=>{r.abort(),un.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){un.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await n()}finally{un.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}else{if(t===0)throw un.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new ov(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(un.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}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 lv(){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 mh(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function uv(e){return parseInt(e,16)}function cv(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function dv(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:u,scheme:c,uri:p,version:h}=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(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!p)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);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 m=mh(e.address),y=c?`${c}://${r}`:r,w=e.statement?`${e.statement}
`:"",k=`${y} wants you to sign in with your Ethereum account:
${m}
${w}`;let g=`URI: ${p}
Version: ${h}
Chain ID: ${n}${o?`
Nonce: ${o}`:""}
Issued At: ${i.toISOString()}`;if(s&&(g+=`
Expiration Time: ${s.toISOString()}`),a&&(g+=`
Not Before: ${a.toISOString()}`),l&&(g+=`
Request ID: ${l}`),u){let d=`
Resources:`;for(const f of u){if(!f||typeof f!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${f}`);d+=`
- ${f}`}g+=d}return`${k}
${g}`}class X extends Error{constructor({message:t,code:n,cause:r,name:s}){var i;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}}class si extends X{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function hv({error:e,options:t}){var n,r,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new X({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new X({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=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new X({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=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new X({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 X({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new X({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new X({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new X({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 o=window.location.hostname;if(vh(o)){if(i.rp.id!==o)return new X({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new X({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new X({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 X({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 X({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function fv({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 X({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new X({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(vh(r)){if(n.rpId!==r)return new X({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new X({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new X({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 X({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class pv{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 gv=new pv;function mv(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=Si(e,["challenge","user","excludeCredentials"]),i=Nn(t).buffer,o=Object.assign(Object.assign({},n),{id:Nn(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const u=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},u),{id:Nn(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return a}function vv(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=Si(e,["challenge","allowCredentials"]),s=Nn(t).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Nn(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function yv(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:Kt(new Uint8Array(e.response.attestationObject)),clientDataJSON:Kt(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function wv(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:Kt(new Uint8Array(s.authenticatorData)),clientDataJSON:Kt(new Uint8Array(s.clientDataJSON)),signature:Kt(new Uint8Array(s.signature)),userHandle:s.userHandle?Kt(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function vh(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Mu(){var e,t;return!!(ae()&&"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 _v(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new si("Browser returned unexpected credential type",t)}:{data:null,error:new si("Empty credential response",t)}}catch(t){return{data:null,error:hv({error:t,options:e})}}}async function kv(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new si("Browser returned unexpected credential type",t)}:{data:null,error:new si("Empty credential response",t)}}catch(t){return{data:null,error:fv({error:t,options:e})}}}const Sv={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Ev={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function ii(...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 i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(t(o)){const a=r[i];t(a)?r[i]=ii(a,o):r[i]=ii(o)}else r[i]=o}return r}function xv(e,t){return ii(Sv,e,t||{})}function Tv(e,t){return ii(Ev,e,t||{})}class bv{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},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!a)return{data:null,error:l};const u=s??gv.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:c}=a.webauthn.credential_options.publicKey;if(!c.name){const p=r;if(p)c.name=`${c.id}:${p}`;else{const m=(await this.client.getUser()).data.user,y=((o=m==null?void 0:m.user_metadata)===null||o===void 0?void 0:o.name)||(m==null?void 0:m.email)||(m==null?void 0:m.id)||"User";c.name=`${c.id}:${y}`}}c.displayName||(c.displayName=c.name)}switch(a.webauthn.type){case"create":{const c=xv(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:p,error:h}=await _v({publicKey:c,signal:u});return p?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:p}},error:null}:{data:null,error:h}}case"request":{const c=Tv(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:p,error:h}=await kv(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:c,signal:u}));return p?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:p}},error:null}:{data:null,error:h}}}}catch(a){return j(a)?{data:null,error:a}:{data:null,error:new Wt("Unexpected error in challenge",a)}}}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}={}},i){if(!n)return{data:null,error:new Mr("rpId is required for WebAuthn authentication")};try{if(!Mu())return{data:null,error:new Wt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return j(o)?{data:null,error:o}:{data:null,error:new Wt("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new Mr("rpId is required for WebAuthn registration")};try{if(!Mu())return{data:null,error:new Wt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(c=>{var p;return(p=c.data)===null||p===void 0?void 0:p.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===t&&h.status!=="unverified")}).then(c=>c?this.client.mfa.unenroll({factorId:c==null?void 0:c.id}):void 0),{data:null,error:a};const{data:l,error:u}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:u}}catch(o){return j(o)?{data:null,error:o}:{data:null,error:new Wt("Unexpected error in register",o)}}}}lv();const Cv={url:Em,storageKey:xm,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Tm,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Bu(e,t,n){return await n()}const cn={};class Br{get jwks(){var t,n;return(n=(t=cn[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){cn[this.storageKey]=Object.assign(Object.assign({},cn[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=cn[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){cn[this.storageKey]=Object.assign(Object.assign({},cn[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},Cv),t);if(this.storageKey=i.storageKey,this.instanceID=(n=Br.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Br.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&ae()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new iv({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=ph(i.fetch),this.lock=i.lock||Bu,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock?this.lock=i.lock:this.persistSession&&ae()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=av:this.lock=Bu,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 bv(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:fh()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=zu(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=zu(this.memoryStorage)),ae()&&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)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(a){this._debug("#broadcastChannel","error",a)}})}this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${ch}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},r="none";if(ae()&&(n=zm(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),ae()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Rm(i)){const l=(t=i.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:i}}return{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return j(n)?this._returnResult({error:n}):this._returnResult({error:new Wt("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,s;try{const i=await R(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:Me}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(i){if(j(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var n,r,s;try{let i;if("email"in t){const{email:c,password:p,options:h}=t;let m=null,y=null;this.flowType==="pkce"&&([m,y]=await an(this.storage,this.storageKey)),i=await R(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:c,password:p,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:m,code_challenge_method:y},xform:Me})}else if("phone"in t){const{phone:c,password:p,options:h}=t;i=await R(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:p,data:(r=h==null?void 0:h.data)!==null&&r!==void 0?r:{},channel:(s=h==null?void 0:h.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:Me})}else throw new ys("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await oe(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(i){if(await oe(this.storage,`${this.storageKey}-code-verifier`),j(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:a}=t;n=await R(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Uu})}else if("phone"in t){const{phone:i,password:o,options:a}=t;n=await R(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Uu})}else throw new ys("You must provide either an email or phone number and a password");const{data:r,error:s}=n;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const i=new on;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(j(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,s,i;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:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,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,i,o,a,l,u,c,p,h;let m,y;if("message"in t)m=t.message,y=t.signature;else{const{chain:w,wallet:k,statement:g,options:d}=t;let f;if(ae())if(typeof k=="object")f=k;else{const U=window;if("ethereum"in U&&typeof U.ethereum=="object"&&"request"in U.ethereum&&typeof U.ethereum.request=="function")f=U.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 k!="object"||!(d!=null&&d.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");f=k}const _=new URL((n=d==null?void 0:d.url)!==null&&n!==void 0?n:window.location.href),x=await f.request({method:"eth_requestAccounts"}).then(U=>U).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!x||x.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const E=mh(x[0]);let T=(r=d==null?void 0:d.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!T){const U=await f.request({method:"eth_chainId"});T=uv(U)}const O={domain:_.host,address:E,statement:g,uri:_.href,version:"1",chainId:T,nonce:(s=d==null?void 0:d.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=d==null?void 0:d.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=d==null?void 0:d.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=d==null?void 0:d.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(u=d==null?void 0:d.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(c=d==null?void 0:d.signInWithEthereum)===null||c===void 0?void 0:c.resources};m=dv(O),y=await f.request({method:"personal_sign",params:[cv(m),E]})}try{const{data:w,error:k}=await R(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:m,signature:y},!((p=t.options)===null||p===void 0)&&p.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:Me});if(k)throw k;if(!w||!w.session||!w.user){const g=new on;return this._returnResult({data:{user:null,session:null},error:g})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:k})}catch(w){if(j(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async signInWithSolana(t){var n,r,s,i,o,a,l,u,c,p,h,m;let y,w;if("message"in t)y=t.message,w=t.signature;else{const{chain:k,wallet:g,statement:d,options:f}=t;let _;if(ae())if(typeof g=="object")_=g;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"))_=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 g!="object"||!(f!=null&&f.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=g}const x=new URL((n=f==null?void 0:f.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in _&&_.signIn){const E=await _.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},f==null?void 0:f.signInWithSolana),{version:"1",domain:x.host,uri:x.href}),d?{statement:d}:null));let T;if(Array.isArray(E)&&E[0]&&typeof E[0]=="object")T=E[0];else if(E&&typeof E=="object"&&"signedMessage"in E&&"signature"in E)T=E;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in T&&"signature"in T&&(typeof T.signedMessage=="string"||T.signedMessage instanceof Uint8Array)&&T.signature instanceof Uint8Array)y=typeof T.signedMessage=="string"?T.signedMessage:new TextDecoder().decode(T.signedMessage),w=T.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in _)||typeof _.signMessage!="function"||!("publicKey"in _)||typeof _!="object"||!_.publicKey||!("toBase58"in _.publicKey)||typeof _.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");y=[`${x.host} wants you to sign in with your Solana account:`,_.publicKey.toBase58(),...d?["",d,""]:[""],"Version: 1",`URI: ${x.href}`,`Issued At: ${(s=(r=f==null?void 0:f.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=f==null?void 0:f.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${f.signInWithSolana.notBefore}`]:[],...!((o=f==null?void 0:f.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${f.signInWithSolana.expirationTime}`]:[],...!((a=f==null?void 0:f.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${f.signInWithSolana.chainId}`]:[],...!((l=f==null?void 0:f.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${f.signInWithSolana.nonce}`]:[],...!((u=f==null?void 0:f.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${f.signInWithSolana.requestId}`]:[],...!((p=(c=f==null?void 0:f.signInWithSolana)===null||c===void 0?void 0:c.resources)===null||p===void 0)&&p.length?["Resources",...f.signInWithSolana.resources.map(T=>`- ${T}`)]:[]].join(`
`);const E=await _.signMessage(new TextEncoder().encode(y),"utf8");if(!E||!(E instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");w=E}}try{const{data:k,error:g}=await R(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:y,signature:Kt(w)},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:Me});if(g)throw g;if(!k||!k.session||!k.user){const d=new on;return this._returnResult({data:{user:null,session:null},error:d})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:g})}catch(k){if(j(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(t){const n=await Dt(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new Pm;const{data:i,error:o}=await R(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:Me});if(await oe(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new on;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(await oe(this.storage,`${this.storageKey}-code-verifier`),j(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=t,a=await R(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Me}),{data:l,error:u}=a;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!l||!l.session||!l.user){const c=new on;return this._returnResult({data:{user:null,session:null},error:c})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:u})}catch(n){if(j(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,s,i,o;try{if("email"in t){const{email:a,options:l}=t;let u=null,c=null;this.flowType==="pkce"&&([u,c]=await an(this.storage,this.storageKey));const{error:p}=await R(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:u,code_challenge_method:c},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:p})}if("phone"in t){const{phone:a,options:l}=t,{data:u,error:c}=await R(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:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:c})}throw new ys("You must provide either an email or phone number.")}catch(a){if(await oe(this.storage,`${this.storageKey}-code-verifier`),j(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(t){var n,r;try{let s,i;"options"in t&&(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await R(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Me});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,u=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:u,session:l},error:null})}catch(s){if(j(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var n,r,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await an(this.storage,this.storageKey));const u=await R(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:a,code_challenge_method:l}),headers:this.headers,xform:nv});return!((i=u.data)===null||i===void 0)&&i.url&&ae()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(a){if(await oe(this.storage,`${this.storageKey}-code-verifier`),j(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new xe;const{error:s}=await R(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(j(t))return this._returnResult({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:i}=t,{error:o}=await R(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:r,type:s,options:i}=t,{data:o,error:a}=await R(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new ys("You must provide either an email or phone number and a type")}catch(n){if(j(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,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 Dt(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()<ro:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const o=await Dt(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=oo()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=Xm(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await R(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:wt}):await this._useSession(async n=>{var r,s,i;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new xe}:await R(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:wt})})}catch(n){if(j(n))return so(n)&&(await this._removeSession(),await oe(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new xe;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&t.email!=null&&([a,l]=await an(this.storage,this.storageKey));const{data:u,error:c}=await R(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:o.access_token,xform:wt});if(c)throw c;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await oe(this.storage,`${this.storageKey}-code-verifier`),j(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new xe;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=_s(t.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{data:a,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(t.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={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(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(j(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:o,error:a}=n;if(a)throw a;t=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new xe;const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(j(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){try{if(!ae())throw new ws("No browser detected.");if(t.error||t.error_description||t.error_code)throw new ws(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 Ru("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ws("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 Ru("No code detected.");const{data:d,error:f}=await this._exchangeCodeForSession(t.code);if(f)throw f;const _=new URL(window.location.href);return _.searchParams.delete("code"),window.history.replaceState(window.history.state,"",_.toString()),{data:{session:d.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:a,expires_at:l,token_type:u}=t;if(!i||!a||!o||!u)throw new ws("No session defined in URL");const c=Math.round(Date.now()/1e3),p=parseInt(a);let h=c+p;l&&(h=parseInt(l));const m=h-c;m*1e3<=hn&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${p}s`);const y=h-p;c-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,h,c):c-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,h,c);const{data:w,error:k}=await this._getUser(i);if(k)throw k;const g={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:p,expires_at:h,refresh_token:o,token_type:u,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:g,redirectType:t.type},error:null})}catch(r){if(j(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await Dt(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i&&!so(i))return this._returnResult({error:i});const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,t);if(a&&!(jm(a)&&(a.status===404||a.status===401||a.status===403)||so(a)))return this._returnResult({error:a})}return t!=="others"&&(await this._removeSession(),await oe(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=Dm(),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(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){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",i),console.error(i)}})}async resetPasswordForEmail(t,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await an(this.storage,this.storageKey,!0));try{return await R(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(i){if(await oe(this.storage,`${this.storageKey}-code-verifier`),j(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(j(n))return this._returnResult({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 i=>{var o,a,l,u,c;const{data:p,error:h}=i;if(h)throw h;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.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 R(this.fetch,"GET",m,{headers:this.headers,jwt:(c=(u=p.session)===null||u===void 0?void 0:u.access_token)!==null&&c!==void 0?c:void 0})});if(s)throw s;return ae()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:t.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(j(r))return this._returnResult({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:i}}=n;if(s)throw s;const{options:o,provider:a,token:l,access_token:u,nonce:c}=t,p=await R(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:u,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Me}),{data:h,error:m}=p;return m?this._returnResult({data:{user:null,session:null},error:m}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new on}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:m}))}catch(s){if(await oe(this.storage,`${this.storageKey}-code-verifier`),j(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)throw o;return await R(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(j(n))return this._returnResult({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 Fm(async s=>(s>0&&await Bm(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await R(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Me})),(s,i)=>{const o=200*Math.pow(2,s);return i&&io(i)&&Date.now()+o-r<hn})}catch(r){if(this._debug(n,"error",r),j(r))return this._returnResult({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),ae()&&!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 Dt(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Dt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await fn(this.userStorage,this.storageKey+"-user",o)),s.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:oo()}else if(s&&!s.user&&!s.user){const o=await Dt(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await oe(this.storage,this.storageKey+"-user"),await fn(this.storage,this.storageKey,s)):s.user=oo()}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 i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<ro;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${ro}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),io(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}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 xe;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new Ti;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new xe;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(s,"error",i),j(i)){const o={data:null,error:i};return io(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}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 i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(t,n)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await oe(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await fn(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=Lu(s);await fn(this.storage,this.storageKey,i)}else{const s=Lu(n);await fn(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await oe(this.storage,this.storageKey),await oe(this.storage,this.storageKey+"-code-verifier"),await oe(this.storage,this.storageKey+"-user"),this.userStorage&&await oe(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&ae()&&(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(),hn);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}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)/hn);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${hn}ms, refresh threshold is ${la} ticks`),s<=la&&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 gh)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ae()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(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[i,o]=await an(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.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:i}=n;return i?this._returnResult({data:null,error:i}):await R(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(j(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});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:u}=await R(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(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}`),this._returnResult({data:l,error:null}))})}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?yv(t.webauthn.credential_response):wv(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:l}=await R(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({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),this._returnResult({data:a,error:l}))})}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=await R(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(o.error)return o;const{data:a}=o;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:mv(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:vv(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({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 i of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,r,s,i;if(t)try{const{payload:m}=_s(t);let y=null;m.aal&&(y=m.aal);let w=y;const{data:{user:k},error:g}=await this.getUser(t);if(g)return this._returnResult({data:null,error:g});((r=(n=k==null?void 0:k.factors)===null||n===void 0?void 0:n.filter(_=>_.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(w="aal2");const f=m.amr||[];return{data:{currentLevel:y,nextLevel:w,currentAuthenticationMethods:f},error:null}}catch(m){if(j(m))return this._returnResult({data:null,error:m});throw m}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=_s(o.access_token);let u=null;l.aal&&(u=l.aal);let c=u;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(m=>m.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(c="aal2");const h=l.amr||[];return{data:{currentLevel:u,nextLevel:c,currentAuthenticationMethods:h},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?await R(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new xe})})}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new xe});const o=await R(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&ae()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new xe});const o=await R(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&ae()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await R(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new xe})})}catch(t){if(j(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?(await R(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new xe})})}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}}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+Cm>s)return r;const{data:i,error:o}=await R(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(a=>a.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:m,error:y}=await this.getSession();if(y||!m.session)return this._returnResult({data:null,error:y});r=m.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=_s(r);n!=null&&n.allowExpired||Jm(i.exp);const u=!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(!u){const{error:m}=await this.getUser(r);if(m)throw m;return{data:{claims:i,header:s,signature:o},error:null}}const c=Qm(s.alg),p=await crypto.subtle.importKey("jwk",u,c,!0,["verify"]);if(!await crypto.subtle.verify(c,p,o,$m(`${a}.${l}`)))throw new da("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}}Br.nextInstanceID={};const Ov=Br,jv="2.95.3";let ar="";typeof Deno<"u"?ar="deno":typeof document<"u"?ar="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ar="react-native":ar="node";const Rv={"X-Client-Info":`supabase-js-${ar}/${jv}`},Pv={headers:Rv},Av={schema:"public"},Nv={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Iv={};function Fr(e){"@babel/helpers - typeof";return Fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fr(e)}function Lv(e,t){if(Fr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Fr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $v(e){var t=Lv(e,"string");return Fr(t)=="symbol"?t:t+""}function Uv(e,t,n){return(t=$v(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fu(Object(n),!0).forEach(function(r){Uv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const Dv=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),zv=()=>Headers,Mv=(e,t,n)=>{const r=Dv(n),s=zv();return async(i,o)=>{var a;const l=(a=await t())!==null&&a!==void 0?a:e;let u=new s(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${l}`),r(i,G(G({},o),{},{headers:u}))}};function Bv(e){return e.endsWith("/")?e:e+"/"}function Fv(e,t){var n,r;const{db:s,auth:i,realtime:o,global:a}=e,{db:l,auth:u,realtime:c,global:p}=t,h={db:G(G({},l),s),auth:G(G({},u),i),realtime:G(G({},c),o),storage:{},global:G(G(G({},p),a),{},{headers:G(G({},(n=p==null?void 0:p.headers)!==null&&n!==void 0?n:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}function Wv(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(Bv(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Vv=class extends Ov{constructor(e){super(e)}},Hv=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const i=Wv(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Av,realtime:Iv,auth:G(G({},Nv),{},{storageKey:o}),global:Pv},l=Fv(n??{},a);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(c,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=l.auth)!==null&&u!==void 0?u:{},this.headers,l.global.fetch)}this.fetch=Mv(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(G({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(c=>this.realtime.setAuth(c)).catch(c=>console.warn("Failed to set initial Realtime auth token:",c)),this.rest=new jg(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new Sm(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new kg(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:u},c,p){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Vv({url:this.authUrl.href,headers:G(G({},h),c),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:u,fetch:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new qg(this.realtimeUrl.href,G(G({},e),{},{params:G(G({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const qv=(e,t,n)=>new Hv(e,t,n);function Kv(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}Kv()&&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 yh="https://tnurlgbvfsxwqgwxamni.supabase.co",Gv="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRudXJsZ2J2ZnN4d3Fnd3hhbW5pIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDQ5MTQ1OTksImV4cCI6MjA2MDQ5MDU5OX0.9__EQiZDJ954SmeeJIDTQjOYDjiiRcppai1e8UpuOl4";console.log("Initializing Supabase client with URL:",yh);const ot=qv(yh,Gv,{db:{schema:"public"}});console.log("Supabase client initialized for schema: openclaw");function Jv(){const[e,t]=z.useState([]),[n,r]=z.useState(!0);return z.useEffect(()=>{(async()=>{console.log("Fetching tasks...");const{data:o,error:a}=await ot.from("agent_tasks").select("*").order("updated_at",{ascending:!1});a&&console.error("Error fetching tasks:",a),o&&(console.log("Tasks fetched:",o.length),t(o)),r(!1)})();const i=ot.channel("tasks-changes").on("postgres_changes",{event:"*",schema:"public",table:"agent_tasks"},o=>{o.eventType==="INSERT"?t(a=>[o.new,...a]):o.eventType==="UPDATE"?t(a=>a.map(l=>l.id===o.new.id?o.new:l)):o.eventType==="DELETE"&&t(a=>a.filter(l=>l.id===o.old.id))}).subscribe();return()=>{ot.removeChannel(i)}},[]),{tasks:e,loading:n}}function Qv(e=20){const[t,n]=z.useState([]),[r,s]=z.useState(!0);return z.useEffect(()=>{(async()=>{console.log("Fetching logs...");const{data:a,error:l}=await ot.from("agent_logs").select("*").order("created_at",{ascending:!1}).limit(e);l&&console.error("Error fetching logs:",l),a&&(console.log("Logs fetched:",a.length),n(a)),s(!1)})();const o=ot.channel("logs-changes").on("postgres_changes",{event:"INSERT",schema:"public",table:"agent_logs"},a=>{n(l=>[a.new,...l.slice(0,e-1)])}).subscribe();return()=>{ot.removeChannel(o)}},[e]),{logs:t,loading:r}}const Yv=[{name:"Jasmine",id:"Jasmine",role:"Atendimento ao Cliente",desc:"Especialista em recepção e suporte via Telegram/WhatsApp.",powers:{Simpatia:"10/10",Resolução:"8/10"},img:"jasmine_3d.png"},{name:"Shuri",id:"Shuri",role:"Arquitetura e Dev",desc:"Gênio técnica focada em infraestrutura e lógica central.",powers:{Inteligência:"10/10",Lógica:"9/10"},img:"shuri_3d.png"},{name:"Atlas",id:"Atlas",role:"Estrategista de Dados",desc:"Análise detalhada de mercado e inteligência competitiva.",powers:{Análise:"10/10",Estratégia:"9/10"},img:"atlas_3d.png"},{name:"Orion",id:"Orion",role:"Monitor de Marketing",desc:"Vigilância constante de tendências e campanhas.",powers:{Ads:"9/10",Criatividade:"8/10"},img:"orion_3d.png"},{name:"Quill",id:"Quill",role:"Monitor de Competidores",desc:"Especialista em monitoramento de concorrência e social.",powers:{Espionagem:"9/10",Copy:"9/10"},img:"quill_3d.png"}];function Xv(){const[e,t]=z.useState(Yv.map(n=>({...n,status:"offline",load:"0%"})));return z.useEffect(()=>{(async()=>{console.log("Fetching presence...");const{data:s,error:i}=await ot.from("agent_presence").select("*");i&&console.error("Error fetching presence:",i),s&&(console.log("Presence fetched:",s.length),t(o=>o.map(a=>{const l=s.find(u=>u.agent_id===a.id);return l?{...a,status:l.status,load:"Em operação"}:a})))})();const r=ot.channel("presence-changes").on("postgres_changes",{event:"*",schema:"public",table:"agent_presence"},s=>{t(i=>i.map(o=>{var a,l;return o.id===((a=s.new)==null?void 0:a.agent_id)||o.id===((l=s.old)==null?void 0:l.agent_id)?{...o,...s.new}:o}))}).subscribe();return()=>{ot.removeChannel(r)}},[]),{agents:e}}function Zv(){const[e,t]=z.useState(new Date().toISOString().slice(0,10)),[n,r]=z.useState(!0),[s,i]=z.useState(null),[o,a]=z.useState({units:[],summary:null,snapshot_date:null}),[l,u]=z.useState([]),c=z.useCallback(async m=>{{i("VITE_ORGANIZATION_ID não configurado no dashboard/.env"),a({units:[],summary:null,snapshot_date:m}),r(!1);return}},[]),p=z.useCallback(async m=>{{u([]);return}},[]);z.useEffect(()=>{c(e),p(e)},[e,c,p]);const h=z.useMemo(()=>o.units.slice(0,5),[o.units]);return{loading:n,error:s,selectedDate:e,setSelectedDate:t,snapshot:o,history:l,topFive:h,refresh:()=>c(e)}}function ey(){const[e,t]=z.useState("mission"),[n,r]=z.useState(null),{tasks:s,loading:i}=Jv(),{logs:o,loading:a}=Qv(),{agents:l}=Xv(),{loading:u,error:c,selectedDate:p,setSelectedDate:h,snapshot:m,history:y,topFive:w,refresh:k}=Zv(),g=z.useMemo(()=>e==="cashflow"?"Albert Finance - Fluxo de Caixa":"Global Operations",[e]),d=e==="cashflow"?"Finance Monitor Online":"System Online";return z.useEffect(()=>{if(!m.units.length){r(null);return}const f=n?m.units.some(_=>_.unit_id===n.unit_id):!1;if(!f&&!n){r(m.units[0]);return}!f&&n&&r(m.units[0])},[m.units,n]),v.jsxs("div",{className:"dashboard-container",children:[v.jsx(ng,{activeView:e,onChangeView:t}),v.jsx(rg,{title:g,status:d}),v.jsx("main",{className:"area main-content",children:e==="mission"?i?v.jsx("div",{className:"loading-state",children:"Conectando ao terminal de missões..."}):v.jsx(og,{tasks:s}):v.jsxs("section",{className:"cashflow-layout",children:[v.jsx(pg,{selectedDate:p,onDateChange:h,onRefresh:k}),c&&v.jsx("div",{className:"cashflow-error",children:c}),u?v.jsx("div",{className:"loading-state",children:"Carregando fluxo de caixa..."}):v.jsxs(v.Fragment,{children:[v.jsx(dg,{summary:m.summary,snapshotDate:m.snapshot_date||p}),v.jsx(fg,{units:m.units,onSelectUnit:r,selectedUnitId:n==null?void 0:n.unit_id}),v.jsx(gg,{unit:n||w[0]}),v.jsx(vg,{history:y})]})]})}),v.jsx(ag,{logs:o,loading:a}),v.jsx(ug,{agents:l})]})}lo.createRoot(document.getElementById("root")).render(v.jsx(Zu.StrictMode,{children:v.jsx(ey,{})}));