@realtimex/realtimex-alchemy 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function cy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qu={exports:{}},li={},Wu={exports:{}},we={};var Kp;function Ix(){if(Kp)return we;Kp=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.iterator;function w(j){return j===null||typeof j!="object"?null:(j=v&&j[v]||j["@@iterator"],typeof j=="function"?j:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,S={};function k(j,D,se){this.props=j,this.context=D,this.refs=S,this.updater=se||_}k.prototype.isReactComponent={},k.prototype.setState=function(j,D){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,D,"setState")},k.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function E(){}E.prototype=k.prototype;function P(j,D,se){this.props=j,this.context=D,this.refs=S,this.updater=se||_}var N=P.prototype=new E;N.constructor=P,b(N,k.prototype),N.isPureReactComponent=!0;var U=Array.isArray,V=Object.prototype.hasOwnProperty,z={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function B(j,D,se){var ue,fe={},ie=null,Ee=null;if(D!=null)for(ue in D.ref!==void 0&&(Ee=D.ref),D.key!==void 0&&(ie=""+D.key),D)V.call(D,ue)&&!$.hasOwnProperty(ue)&&(fe[ue]=D[ue]);var ke=arguments.length-2;if(ke===1)fe.children=se;else if(1<ke){for(var Me=Array(ke),Et=0;Et<ke;Et++)Me[Et]=arguments[Et+2];fe.children=Me}if(j&&j.defaultProps)for(ue in ke=j.defaultProps,ke)fe[ue]===void 0&&(fe[ue]=ke[ue]);return{$$typeof:t,type:j,key:ie,ref:Ee,props:fe,_owner:z.current}}function Y(j,D){return{$$typeof:t,type:j.type,key:D,ref:j.ref,props:j.props,_owner:j._owner}}function oe(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function Te(j){var D={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(se){return D[se]})}var ve=/\/+/g;function je(j,D){return typeof j=="object"&&j!==null&&j.key!=null?Te(""+j.key):D.toString(36)}function xe(j,D,se,ue,fe){var ie=typeof j;(ie==="undefined"||ie==="boolean")&&(j=null);var Ee=!1;if(j===null)Ee=!0;else switch(ie){case"string":case"number":Ee=!0;break;case"object":switch(j.$$typeof){case t:case e:Ee=!0}}if(Ee)return Ee=j,fe=fe(Ee),j=ue===""?"."+je(Ee,0):ue,U(fe)?(se="",j!=null&&(se=j.replace(ve,"$&/")+"/"),xe(fe,D,se,"",function(Et){return Et})):fe!=null&&(oe(fe)&&(fe=Y(fe,se+(!fe.key||Ee&&Ee.key===fe.key?"":(""+fe.key).replace(ve,"$&/")+"/")+j)),D.push(fe)),1;if(Ee=0,ue=ue===""?".":ue+":",U(j))for(var ke=0;ke<j.length;ke++){ie=j[ke];var Me=ue+je(ie,ke);Ee+=xe(ie,D,se,Me,fe)}else if(Me=w(j),typeof Me=="function")for(j=Me.call(j),ke=0;!(ie=j.next()).done;)ie=ie.value,Me=ue+je(ie,ke++),Ee+=xe(ie,D,se,Me,fe);else if(ie==="object")throw D=String(j),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.");return Ee}function Oe(j,D,se){if(j==null)return j;var ue=[],fe=0;return xe(j,ue,"","",function(ie){return D.call(se,ie,fe++)}),ue}function be(j){if(j._status===-1){var D=j._result;D=D(),D.then(function(se){(j._status===0||j._status===-1)&&(j._status=1,j._result=se)},function(se){(j._status===0||j._status===-1)&&(j._status=2,j._result=se)}),j._status===-1&&(j._status=0,j._result=D)}if(j._status===1)return j._result.default;throw j._result}var pe={current:null},F={transition:null},J={ReactCurrentDispatcher:pe,ReactCurrentBatchConfig:F,ReactCurrentOwner:z};function K(){throw Error("act(...) is not supported in production builds of React.")}return we.Children={map:Oe,forEach:function(j,D,se){Oe(j,function(){D.apply(this,arguments)},se)},count:function(j){var D=0;return Oe(j,function(){D++}),D},toArray:function(j){return Oe(j,function(D){return D})||[]},only:function(j){if(!oe(j))throw Error("React.Children.only expected to receive a single React element child.");return j}},we.Component=k,we.Fragment=n,we.Profiler=o,we.PureComponent=P,we.StrictMode=i,we.Suspense=h,we.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,we.act=K,we.cloneElement=function(j,D,se){if(j==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+j+".");var ue=b({},j.props),fe=j.key,ie=j.ref,Ee=j._owner;if(D!=null){if(D.ref!==void 0&&(ie=D.ref,Ee=z.current),D.key!==void 0&&(fe=""+D.key),j.type&&j.type.defaultProps)var ke=j.type.defaultProps;for(Me in D)V.call(D,Me)&&!$.hasOwnProperty(Me)&&(ue[Me]=D[Me]===void 0&&ke!==void 0?ke[Me]:D[Me])}var Me=arguments.length-2;if(Me===1)ue.children=se;else if(1<Me){ke=Array(Me);for(var Et=0;Et<Me;Et++)ke[Et]=arguments[Et+2];ue.children=ke}return{$$typeof:t,type:j.type,key:fe,ref:ie,props:ue,_owner:Ee}},we.createContext=function(j){return j={$$typeof:u,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},j.Provider={$$typeof:l,_context:j},j.Consumer=j},we.createElement=B,we.createFactory=function(j){var D=B.bind(null,j);return D.type=j,D},we.createRef=function(){return{current:null}},we.forwardRef=function(j){return{$$typeof:d,render:j}},we.isValidElement=oe,we.lazy=function(j){return{$$typeof:y,_payload:{_status:-1,_result:j},_init:be}},we.memo=function(j,D){return{$$typeof:m,type:j,compare:D===void 0?null:D}},we.startTransition=function(j){var D=F.transition;F.transition={};try{j()}finally{F.transition=D}},we.unstable_act=K,we.useCallback=function(j,D){return pe.current.useCallback(j,D)},we.useContext=function(j){return pe.current.useContext(j)},we.useDebugValue=function(){},we.useDeferredValue=function(j){return pe.current.useDeferredValue(j)},we.useEffect=function(j,D){return pe.current.useEffect(j,D)},we.useId=function(){return pe.current.useId()},we.useImperativeHandle=function(j,D,se){return pe.current.useImperativeHandle(j,D,se)},we.useInsertionEffect=function(j,D){return pe.current.useInsertionEffect(j,D)},we.useLayoutEffect=function(j,D){return pe.current.useLayoutEffect(j,D)},we.useMemo=function(j,D){return pe.current.useMemo(j,D)},we.useReducer=function(j,D,se){return pe.current.useReducer(j,D,se)},we.useRef=function(j){return pe.current.useRef(j)},we.useState=function(j){return pe.current.useState(j)},we.useSyncExternalStore=function(j,D,se){return pe.current.useSyncExternalStore(j,D,se)},we.useTransition=function(){return pe.current.useTransition()},we.version="18.3.1",we}var Gp;function nd(){return Gp||(Gp=1,Wu.exports=Ix()),Wu.exports}var Jp;function Dx(){if(Jp)return li;Jp=1;var t=nd(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(d,h,m){var y,v={},w=null,_=null;m!==void 0&&(w=""+m),h.key!==void 0&&(w=""+h.key),h.ref!==void 0&&(_=h.ref);for(y in h)i.call(h,y)&&!l.hasOwnProperty(y)&&(v[y]=h[y]);if(d&&d.defaultProps)for(y in h=d.defaultProps,h)v[y]===void 0&&(v[y]=h[y]);return{$$typeof:e,type:d,key:w,ref:_,props:v,_owner:o.current}}return li.Fragment=n,li.jsx=u,li.jsxs=u,li}var Yp;function Lx(){return Yp||(Yp=1,qu.exports=Dx()),qu.exports}var p=Lx(),R=nd();const _i=cy(R);var ra={},Hu={exports:{}},_t={},Ku={exports:{}},Gu={};var Qp;function Mx(){return Qp||(Qp=1,(function(t){function e(F,J){var K=F.length;F.push(J);e:for(;0<K;){var j=K-1>>>1,D=F[j];if(0<o(D,J))F[j]=J,F[K]=D,K=j;else break e}}function n(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var J=F[0],K=F.pop();if(K!==J){F[0]=K;e:for(var j=0,D=F.length,se=D>>>1;j<se;){var ue=2*(j+1)-1,fe=F[ue],ie=ue+1,Ee=F[ie];if(0>o(fe,K))ie<D&&0>o(Ee,fe)?(F[j]=Ee,F[ie]=K,j=ie):(F[j]=fe,F[ue]=K,j=ue);else if(ie<D&&0>o(Ee,K))F[j]=Ee,F[ie]=K,j=ie;else break e}}return J}function o(F,J){var K=F.sortIndex-J.sortIndex;return K!==0?K:F.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var h=[],m=[],y=1,v=null,w=3,_=!1,b=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(F){for(var J=n(m);J!==null;){if(J.callback===null)i(m);else if(J.startTime<=F)i(m),J.sortIndex=J.expirationTime,e(h,J);else break;J=n(m)}}function U(F){if(S=!1,N(F),!b)if(n(h)!==null)b=!0,be(V);else{var J=n(m);J!==null&&pe(U,J.startTime-F)}}function V(F,J){b=!1,S&&(S=!1,E(B),B=-1),_=!0;var K=w;try{for(N(J),v=n(h);v!==null&&(!(v.expirationTime>J)||F&&!Te());){var j=v.callback;if(typeof j=="function"){v.callback=null,w=v.priorityLevel;var D=j(v.expirationTime<=J);J=t.unstable_now(),typeof D=="function"?v.callback=D:v===n(h)&&i(h),N(J)}else i(h);v=n(h)}if(v!==null)var se=!0;else{var ue=n(m);ue!==null&&pe(U,ue.startTime-J),se=!1}return se}finally{v=null,w=K,_=!1}}var z=!1,$=null,B=-1,Y=5,oe=-1;function Te(){return!(t.unstable_now()-oe<Y)}function ve(){if($!==null){var F=t.unstable_now();oe=F;var J=!0;try{J=$(!0,F)}finally{J?je():(z=!1,$=null)}}else z=!1}var je;if(typeof P=="function")je=function(){P(ve)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,Oe=xe.port2;xe.port1.onmessage=ve,je=function(){Oe.postMessage(null)}}else je=function(){k(ve,0)};function be(F){$=F,z||(z=!0,je())}function pe(F,J){B=k(function(){F(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_continueExecution=function(){b||_||(b=!0,be(V))},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return w},t.unstable_getFirstCallbackNode=function(){return n(h)},t.unstable_next=function(F){switch(w){case 1:case 2:case 3:var J=3;break;default:J=w}var K=w;w=J;try{return F()}finally{w=K}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,J){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var K=w;w=F;try{return J()}finally{w=K}},t.unstable_scheduleCallback=function(F,J,K){var j=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?j+K:j):K=j,F){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=K+D,F={id:y++,callback:J,priorityLevel:F,startTime:K,expirationTime:D,sortIndex:-1},K>j?(F.sortIndex=K,e(m,F),n(h)===null&&F===n(m)&&(S?(E(B),B=-1):S=!0,pe(U,K-j))):(F.sortIndex=D,e(h,F),b||_||(b=!0,be(V))),F},t.unstable_shouldYield=Te,t.unstable_wrapCallback=function(F){var J=w;return function(){var K=w;w=J;try{return F.apply(this,arguments)}finally{w=K}}}})(Gu)),Gu}var Xp;function Ux(){return Xp||(Xp=1,Ku.exports=Mx()),Ku.exports}var Zp;function $x(){if(Zp)return _t;Zp=1;var t=nd(),e=Ux();function n(r){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+r,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(r,s){u(r,s),u(r+"Capture",s)}function u(r,s){for(o[r]=s,r=0;r<s.length;r++)i.add(s[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[: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]*$/,y={},v={};function w(r){return h.call(v,r)?!0:h.call(y,r)?!1:m.test(r)?v[r]=!0:(y[r]=!0,!1)}function _(r,s,a,c){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return c?!1:a!==null?!a.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function b(r,s,a,c){if(s===null||typeof s>"u"||_(r,s,a,c))return!0;if(c)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function S(r,s,a,c,f,g,x){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=f,this.mustUseProperty=a,this.propertyName=r,this.type=s,this.sanitizeURL=g,this.removeEmptyString=x}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){k[r]=new S(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var s=r[0];k[s]=new S(s,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){k[r]=new S(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){k[r]=new S(r,2,!1,r,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(r){k[r]=new S(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){k[r]=new S(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){k[r]=new S(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){k[r]=new S(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){k[r]=new S(r,5,!1,r.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function P(r){return r[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(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){k[r]=new S(r,1,!1,r.toLowerCase(),null,!1,!1)}),k.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){k[r]=new S(r,1,!1,r.toLowerCase(),null,!0,!0)});function N(r,s,a,c){var f=k.hasOwnProperty(s)?k[s]:null;(f!==null?f.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(b(s,a,f,c)&&(a=null),c||f===null?w(s)&&(a===null?r.removeAttribute(s):r.setAttribute(s,""+a)):f.mustUseProperty?r[f.propertyName]=a===null?f.type===3?!1:"":a:(s=f.attributeName,c=f.attributeNamespace,a===null?r.removeAttribute(s):(f=f.type,a=f===3||f===4&&a===!0?"":""+a,c?r.setAttributeNS(c,s,a):r.setAttribute(s,a))))}var U=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,V=Symbol.for("react.element"),z=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),oe=Symbol.for("react.provider"),Te=Symbol.for("react.context"),ve=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),xe=Symbol.for("react.suspense_list"),Oe=Symbol.for("react.memo"),be=Symbol.for("react.lazy"),pe=Symbol.for("react.offscreen"),F=Symbol.iterator;function J(r){return r===null||typeof r!="object"?null:(r=F&&r[F]||r["@@iterator"],typeof r=="function"?r:null)}var K=Object.assign,j;function D(r){if(j===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);j=s&&s[1]||""}return`
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function dy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qu={exports:{}},li={},Wu={exports:{}},we={};var Gp;function Dx(){if(Gp)return we;Gp=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.iterator;function w(j){return j===null||typeof j!="object"?null:(j=v&&j[v]||j["@@iterator"],typeof j=="function"?j:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,S={};function k(j,D,se){this.props=j,this.context=D,this.refs=S,this.updater=se||_}k.prototype.isReactComponent={},k.prototype.setState=function(j,D){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,D,"setState")},k.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function E(){}E.prototype=k.prototype;function P(j,D,se){this.props=j,this.context=D,this.refs=S,this.updater=se||_}var N=P.prototype=new E;N.constructor=P,b(N,k.prototype),N.isPureReactComponent=!0;var U=Array.isArray,V=Object.prototype.hasOwnProperty,z={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function B(j,D,se){var ue,fe={},ie=null,Ee=null;if(D!=null)for(ue in D.ref!==void 0&&(Ee=D.ref),D.key!==void 0&&(ie=""+D.key),D)V.call(D,ue)&&!$.hasOwnProperty(ue)&&(fe[ue]=D[ue]);var ke=arguments.length-2;if(ke===1)fe.children=se;else if(1<ke){for(var Me=Array(ke),Et=0;Et<ke;Et++)Me[Et]=arguments[Et+2];fe.children=Me}if(j&&j.defaultProps)for(ue in ke=j.defaultProps,ke)fe[ue]===void 0&&(fe[ue]=ke[ue]);return{$$typeof:t,type:j,key:ie,ref:Ee,props:fe,_owner:z.current}}function Y(j,D){return{$$typeof:t,type:j.type,key:D,ref:j.ref,props:j.props,_owner:j._owner}}function oe(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function Te(j){var D={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(se){return D[se]})}var ve=/\/+/g;function je(j,D){return typeof j=="object"&&j!==null&&j.key!=null?Te(""+j.key):D.toString(36)}function xe(j,D,se,ue,fe){var ie=typeof j;(ie==="undefined"||ie==="boolean")&&(j=null);var Ee=!1;if(j===null)Ee=!0;else switch(ie){case"string":case"number":Ee=!0;break;case"object":switch(j.$$typeof){case t:case e:Ee=!0}}if(Ee)return Ee=j,fe=fe(Ee),j=ue===""?"."+je(Ee,0):ue,U(fe)?(se="",j!=null&&(se=j.replace(ve,"$&/")+"/"),xe(fe,D,se,"",function(Et){return Et})):fe!=null&&(oe(fe)&&(fe=Y(fe,se+(!fe.key||Ee&&Ee.key===fe.key?"":(""+fe.key).replace(ve,"$&/")+"/")+j)),D.push(fe)),1;if(Ee=0,ue=ue===""?".":ue+":",U(j))for(var ke=0;ke<j.length;ke++){ie=j[ke];var Me=ue+je(ie,ke);Ee+=xe(ie,D,se,Me,fe)}else if(Me=w(j),typeof Me=="function")for(j=Me.call(j),ke=0;!(ie=j.next()).done;)ie=ie.value,Me=ue+je(ie,ke++),Ee+=xe(ie,D,se,Me,fe);else if(ie==="object")throw D=String(j),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.");return Ee}function Oe(j,D,se){if(j==null)return j;var ue=[],fe=0;return xe(j,ue,"","",function(ie){return D.call(se,ie,fe++)}),ue}function be(j){if(j._status===-1){var D=j._result;D=D(),D.then(function(se){(j._status===0||j._status===-1)&&(j._status=1,j._result=se)},function(se){(j._status===0||j._status===-1)&&(j._status=2,j._result=se)}),j._status===-1&&(j._status=0,j._result=D)}if(j._status===1)return j._result.default;throw j._result}var pe={current:null},F={transition:null},J={ReactCurrentDispatcher:pe,ReactCurrentBatchConfig:F,ReactCurrentOwner:z};function K(){throw Error("act(...) is not supported in production builds of React.")}return we.Children={map:Oe,forEach:function(j,D,se){Oe(j,function(){D.apply(this,arguments)},se)},count:function(j){var D=0;return Oe(j,function(){D++}),D},toArray:function(j){return Oe(j,function(D){return D})||[]},only:function(j){if(!oe(j))throw Error("React.Children.only expected to receive a single React element child.");return j}},we.Component=k,we.Fragment=n,we.Profiler=o,we.PureComponent=P,we.StrictMode=i,we.Suspense=h,we.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,we.act=K,we.cloneElement=function(j,D,se){if(j==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+j+".");var ue=b({},j.props),fe=j.key,ie=j.ref,Ee=j._owner;if(D!=null){if(D.ref!==void 0&&(ie=D.ref,Ee=z.current),D.key!==void 0&&(fe=""+D.key),j.type&&j.type.defaultProps)var ke=j.type.defaultProps;for(Me in D)V.call(D,Me)&&!$.hasOwnProperty(Me)&&(ue[Me]=D[Me]===void 0&&ke!==void 0?ke[Me]:D[Me])}var Me=arguments.length-2;if(Me===1)ue.children=se;else if(1<Me){ke=Array(Me);for(var Et=0;Et<Me;Et++)ke[Et]=arguments[Et+2];ue.children=ke}return{$$typeof:t,type:j.type,key:fe,ref:ie,props:ue,_owner:Ee}},we.createContext=function(j){return j={$$typeof:u,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},j.Provider={$$typeof:l,_context:j},j.Consumer=j},we.createElement=B,we.createFactory=function(j){var D=B.bind(null,j);return D.type=j,D},we.createRef=function(){return{current:null}},we.forwardRef=function(j){return{$$typeof:d,render:j}},we.isValidElement=oe,we.lazy=function(j){return{$$typeof:y,_payload:{_status:-1,_result:j},_init:be}},we.memo=function(j,D){return{$$typeof:m,type:j,compare:D===void 0?null:D}},we.startTransition=function(j){var D=F.transition;F.transition={};try{j()}finally{F.transition=D}},we.unstable_act=K,we.useCallback=function(j,D){return pe.current.useCallback(j,D)},we.useContext=function(j){return pe.current.useContext(j)},we.useDebugValue=function(){},we.useDeferredValue=function(j){return pe.current.useDeferredValue(j)},we.useEffect=function(j,D){return pe.current.useEffect(j,D)},we.useId=function(){return pe.current.useId()},we.useImperativeHandle=function(j,D,se){return pe.current.useImperativeHandle(j,D,se)},we.useInsertionEffect=function(j,D){return pe.current.useInsertionEffect(j,D)},we.useLayoutEffect=function(j,D){return pe.current.useLayoutEffect(j,D)},we.useMemo=function(j,D){return pe.current.useMemo(j,D)},we.useReducer=function(j,D,se){return pe.current.useReducer(j,D,se)},we.useRef=function(j){return pe.current.useRef(j)},we.useState=function(j){return pe.current.useState(j)},we.useSyncExternalStore=function(j,D,se){return pe.current.useSyncExternalStore(j,D,se)},we.useTransition=function(){return pe.current.useTransition()},we.version="18.3.1",we}var Jp;function nd(){return Jp||(Jp=1,Wu.exports=Dx()),Wu.exports}var Yp;function Lx(){if(Yp)return li;Yp=1;var t=nd(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(d,h,m){var y,v={},w=null,_=null;m!==void 0&&(w=""+m),h.key!==void 0&&(w=""+h.key),h.ref!==void 0&&(_=h.ref);for(y in h)i.call(h,y)&&!l.hasOwnProperty(y)&&(v[y]=h[y]);if(d&&d.defaultProps)for(y in h=d.defaultProps,h)v[y]===void 0&&(v[y]=h[y]);return{$$typeof:e,type:d,key:w,ref:_,props:v,_owner:o.current}}return li.Fragment=n,li.jsx=u,li.jsxs=u,li}var Qp;function Mx(){return Qp||(Qp=1,qu.exports=Lx()),qu.exports}var p=Mx(),R=nd();const _i=dy(R);var sa={},Hu={exports:{}},_t={},Ku={exports:{}},Gu={};var Xp;function Ux(){return Xp||(Xp=1,(function(t){function e(F,J){var K=F.length;F.push(J);e:for(;0<K;){var j=K-1>>>1,D=F[j];if(0<o(D,J))F[j]=J,F[K]=D,K=j;else break e}}function n(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var J=F[0],K=F.pop();if(K!==J){F[0]=K;e:for(var j=0,D=F.length,se=D>>>1;j<se;){var ue=2*(j+1)-1,fe=F[ue],ie=ue+1,Ee=F[ie];if(0>o(fe,K))ie<D&&0>o(Ee,fe)?(F[j]=Ee,F[ie]=K,j=ie):(F[j]=fe,F[ue]=K,j=ue);else if(ie<D&&0>o(Ee,K))F[j]=Ee,F[ie]=K,j=ie;else break e}}return J}function o(F,J){var K=F.sortIndex-J.sortIndex;return K!==0?K:F.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var h=[],m=[],y=1,v=null,w=3,_=!1,b=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(F){for(var J=n(m);J!==null;){if(J.callback===null)i(m);else if(J.startTime<=F)i(m),J.sortIndex=J.expirationTime,e(h,J);else break;J=n(m)}}function U(F){if(S=!1,N(F),!b)if(n(h)!==null)b=!0,be(V);else{var J=n(m);J!==null&&pe(U,J.startTime-F)}}function V(F,J){b=!1,S&&(S=!1,E(B),B=-1),_=!0;var K=w;try{for(N(J),v=n(h);v!==null&&(!(v.expirationTime>J)||F&&!Te());){var j=v.callback;if(typeof j=="function"){v.callback=null,w=v.priorityLevel;var D=j(v.expirationTime<=J);J=t.unstable_now(),typeof D=="function"?v.callback=D:v===n(h)&&i(h),N(J)}else i(h);v=n(h)}if(v!==null)var se=!0;else{var ue=n(m);ue!==null&&pe(U,ue.startTime-J),se=!1}return se}finally{v=null,w=K,_=!1}}var z=!1,$=null,B=-1,Y=5,oe=-1;function Te(){return!(t.unstable_now()-oe<Y)}function ve(){if($!==null){var F=t.unstable_now();oe=F;var J=!0;try{J=$(!0,F)}finally{J?je():(z=!1,$=null)}}else z=!1}var je;if(typeof P=="function")je=function(){P(ve)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,Oe=xe.port2;xe.port1.onmessage=ve,je=function(){Oe.postMessage(null)}}else je=function(){k(ve,0)};function be(F){$=F,z||(z=!0,je())}function pe(F,J){B=k(function(){F(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_continueExecution=function(){b||_||(b=!0,be(V))},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return w},t.unstable_getFirstCallbackNode=function(){return n(h)},t.unstable_next=function(F){switch(w){case 1:case 2:case 3:var J=3;break;default:J=w}var K=w;w=J;try{return F()}finally{w=K}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,J){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var K=w;w=F;try{return J()}finally{w=K}},t.unstable_scheduleCallback=function(F,J,K){var j=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?j+K:j):K=j,F){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=K+D,F={id:y++,callback:J,priorityLevel:F,startTime:K,expirationTime:D,sortIndex:-1},K>j?(F.sortIndex=K,e(m,F),n(h)===null&&F===n(m)&&(S?(E(B),B=-1):S=!0,pe(U,K-j))):(F.sortIndex=D,e(h,F),b||_||(b=!0,be(V))),F},t.unstable_shouldYield=Te,t.unstable_wrapCallback=function(F){var J=w;return function(){var K=w;w=J;try{return F.apply(this,arguments)}finally{w=K}}}})(Gu)),Gu}var Zp;function $x(){return Zp||(Zp=1,Ku.exports=Ux()),Ku.exports}var em;function Vx(){if(em)return _t;em=1;var t=nd(),e=$x();function n(r){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+r,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(r,s){u(r,s),u(r+"Capture",s)}function u(r,s){for(o[r]=s,r=0;r<s.length;r++)i.add(s[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[: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]*$/,y={},v={};function w(r){return h.call(v,r)?!0:h.call(y,r)?!1:m.test(r)?v[r]=!0:(y[r]=!0,!1)}function _(r,s,a,c){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return c?!1:a!==null?!a.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function b(r,s,a,c){if(s===null||typeof s>"u"||_(r,s,a,c))return!0;if(c)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function S(r,s,a,c,f,g,x){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=f,this.mustUseProperty=a,this.propertyName=r,this.type=s,this.sanitizeURL=g,this.removeEmptyString=x}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){k[r]=new S(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var s=r[0];k[s]=new S(s,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){k[r]=new S(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){k[r]=new S(r,2,!1,r,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(r){k[r]=new S(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){k[r]=new S(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){k[r]=new S(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){k[r]=new S(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){k[r]=new S(r,5,!1,r.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function P(r){return r[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(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var s=r.replace(E,P);k[s]=new S(s,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){k[r]=new S(r,1,!1,r.toLowerCase(),null,!1,!1)}),k.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){k[r]=new S(r,1,!1,r.toLowerCase(),null,!0,!0)});function N(r,s,a,c){var f=k.hasOwnProperty(s)?k[s]:null;(f!==null?f.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(b(s,a,f,c)&&(a=null),c||f===null?w(s)&&(a===null?r.removeAttribute(s):r.setAttribute(s,""+a)):f.mustUseProperty?r[f.propertyName]=a===null?f.type===3?!1:"":a:(s=f.attributeName,c=f.attributeNamespace,a===null?r.removeAttribute(s):(f=f.type,a=f===3||f===4&&a===!0?"":""+a,c?r.setAttributeNS(c,s,a):r.setAttribute(s,a))))}var U=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,V=Symbol.for("react.element"),z=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),oe=Symbol.for("react.provider"),Te=Symbol.for("react.context"),ve=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),xe=Symbol.for("react.suspense_list"),Oe=Symbol.for("react.memo"),be=Symbol.for("react.lazy"),pe=Symbol.for("react.offscreen"),F=Symbol.iterator;function J(r){return r===null||typeof r!="object"?null:(r=F&&r[F]||r["@@iterator"],typeof r=="function"?r:null)}var K=Object.assign,j;function D(r){if(j===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);j=s&&s[1]||""}return`
2
2
  `+j+r}var se=!1;function ue(r,s){if(!r||se)return"";se=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(L){var c=L}Reflect.construct(r,[],s)}else{try{s.call()}catch(L){c=L}r.call(s.prototype)}else{try{throw Error()}catch(L){c=L}r()}}catch(L){if(L&&c&&typeof L.stack=="string"){for(var f=L.stack.split(`
3
3
  `),g=c.stack.split(`
4
4
  `),x=f.length-1,T=g.length-1;1<=x&&0<=T&&f[x]!==g[T];)T--;for(;1<=x&&0<=T;x--,T--)if(f[x]!==g[T]){if(x!==1||T!==1)do if(x--,T--,0>T||f[x]!==g[T]){var C=`
5
- `+f[x].replace(" at new "," at ");return r.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",r.displayName)),C}while(1<=x&&0<=T);break}}}finally{se=!1,Error.prepareStackTrace=a}return(r=r?r.displayName||r.name:"")?D(r):""}function fe(r){switch(r.tag){case 5:return D(r.type);case 16:return D("Lazy");case 13:return D("Suspense");case 19:return D("SuspenseList");case 0:case 2:case 15:return r=ue(r.type,!1),r;case 11:return r=ue(r.type.render,!1),r;case 1:return r=ue(r.type,!0),r;default:return""}}function ie(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case $:return"Fragment";case z:return"Portal";case Y:return"Profiler";case B:return"StrictMode";case je:return"Suspense";case xe:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case Te:return(r.displayName||"Context")+".Consumer";case oe:return(r._context.displayName||"Context")+".Provider";case ve:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Oe:return s=r.displayName||null,s!==null?s:ie(r.type)||"Memo";case be:s=r._payload,r=r._init;try{return ie(r(s))}catch{}}return null}function Ee(r){var s=r.type;switch(r.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=s.render,r=r.displayName||r.name||"",s.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(s);case 8:return s===B?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function ke(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Me(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Et(r){var s=Me(r)?"checked":"value",a=Object.getOwnPropertyDescriptor(r.constructor.prototype,s),c=""+r[s];if(!r.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,g=a.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return f.call(this)},set:function(x){c=""+x,g.call(this,x)}}),Object.defineProperty(r,s,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(x){c=""+x},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Hi(r){r._valueTracker||(r._valueTracker=Et(r))}function Xd(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var a=s.getValue(),c="";return r&&(c=Me(r)?r.checked?"true":"false":r.value),r=c,r!==a?(s.setValue(r),!0):!1}function Ki(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Qa(r,s){var a=s.checked;return K({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??r._wrapperState.initialChecked})}function Zd(r,s){var a=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;a=ke(s.value!=null?s.value:a),r._wrapperState={initialChecked:c,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function eh(r,s){s=s.checked,s!=null&&N(r,"checked",s,!1)}function Xa(r,s){eh(r,s);var a=ke(s.value),c=s.type;if(a!=null)c==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+a):r.value!==""+a&&(r.value=""+a);else if(c==="submit"||c==="reset"){r.removeAttribute("value");return}s.hasOwnProperty("value")?Za(r,s.type,a):s.hasOwnProperty("defaultValue")&&Za(r,s.type,ke(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(r.defaultChecked=!!s.defaultChecked)}function th(r,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var c=s.type;if(!(c!=="submit"&&c!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+r._wrapperState.initialValue,a||s===r.value||(r.value=s),r.defaultValue=s}a=r.name,a!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,a!==""&&(r.name=a)}function Za(r,s,a){(s!=="number"||Ki(r.ownerDocument)!==r)&&(a==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+a&&(r.defaultValue=""+a))}var Ss=Array.isArray;function jr(r,s,a,c){if(r=r.options,s){s={};for(var f=0;f<a.length;f++)s["$"+a[f]]=!0;for(a=0;a<r.length;a++)f=s.hasOwnProperty("$"+r[a].value),r[a].selected!==f&&(r[a].selected=f),f&&c&&(r[a].defaultSelected=!0)}else{for(a=""+ke(a),s=null,f=0;f<r.length;f++){if(r[f].value===a){r[f].selected=!0,c&&(r[f].defaultSelected=!0);return}s!==null||r[f].disabled||(s=r[f])}s!==null&&(s.selected=!0)}}function el(r,s){if(s.dangerouslySetInnerHTML!=null)throw Error(n(91));return K({},s,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function nh(r,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(n(92));if(Ss(a)){if(1<a.length)throw Error(n(93));a=a[0]}s=a}s==null&&(s=""),a=s}r._wrapperState={initialValue:ke(a)}}function rh(r,s){var a=ke(s.value),c=ke(s.defaultValue);a!=null&&(a=""+a,a!==r.value&&(r.value=a),s.defaultValue==null&&r.defaultValue!==a&&(r.defaultValue=a)),c!=null&&(r.defaultValue=""+c)}function sh(r){var s=r.textContent;s===r._wrapperState.initialValue&&s!==""&&s!==null&&(r.value=s)}function ih(r){switch(r){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 tl(r,s){return r==null||r==="http://www.w3.org/1999/xhtml"?ih(s):r==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Gi,oh=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,c,f){MSApp.execUnsafeLocalFunction(function(){return r(s,a,c,f)})}:r})(function(r,s){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=s;else{for(Gi=Gi||document.createElement("div"),Gi.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Gi.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;s.firstChild;)r.appendChild(s.firstChild)}});function ks(r,s){if(s){var a=r.firstChild;if(a&&a===r.lastChild&&a.nodeType===3){a.nodeValue=s;return}}r.textContent=s}var Es={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},Uv=["Webkit","ms","Moz","O"];Object.keys(Es).forEach(function(r){Uv.forEach(function(s){s=s+r.charAt(0).toUpperCase()+r.substring(1),Es[s]=Es[r]})});function ah(r,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||Es.hasOwnProperty(r)&&Es[r]?(""+s).trim():s+"px"}function lh(r,s){r=r.style;for(var a in s)if(s.hasOwnProperty(a)){var c=a.indexOf("--")===0,f=ah(a,s[a],c);a==="float"&&(a="cssFloat"),c?r.setProperty(a,f):r[a]=f}}var $v=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 nl(r,s){if(s){if($v[r]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(n(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(n(61))}if(s.style!=null&&typeof s.style!="object")throw Error(n(62))}}function rl(r,s){if(r.indexOf("-")===-1)return typeof s.is=="string";switch(r){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 sl=null;function il(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ol=null,Cr=null,Nr=null;function uh(r){if(r=Ks(r)){if(typeof ol!="function")throw Error(n(280));var s=r.stateNode;s&&(s=vo(s),ol(r.stateNode,r.type,s))}}function ch(r){Cr?Nr?Nr.push(r):Nr=[r]:Cr=r}function dh(){if(Cr){var r=Cr,s=Nr;if(Nr=Cr=null,uh(r),s)for(r=0;r<s.length;r++)uh(s[r])}}function hh(r,s){return r(s)}function fh(){}var al=!1;function ph(r,s,a){if(al)return r(s,a);al=!0;try{return hh(r,s,a)}finally{al=!1,(Cr!==null||Nr!==null)&&(fh(),dh())}}function Ts(r,s){var a=r.stateNode;if(a===null)return null;var c=vo(a);if(c===null)return null;a=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(r=r.type,c=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!c;break e;default:r=!1}if(r)return null;if(a&&typeof a!="function")throw Error(n(231,s,typeof a));return a}var ll=!1;if(d)try{var js={};Object.defineProperty(js,"passive",{get:function(){ll=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{ll=!1}function Vv(r,s,a,c,f,g,x,T,C){var L=Array.prototype.slice.call(arguments,3);try{s.apply(a,L)}catch(W){this.onError(W)}}var Cs=!1,Ji=null,Yi=!1,ul=null,Fv={onError:function(r){Cs=!0,Ji=r}};function Bv(r,s,a,c,f,g,x,T,C){Cs=!1,Ji=null,Vv.apply(Fv,arguments)}function zv(r,s,a,c,f,g,x,T,C){if(Bv.apply(this,arguments),Cs){if(Cs){var L=Ji;Cs=!1,Ji=null}else throw Error(n(198));Yi||(Yi=!0,ul=L)}}function Qn(r){var s=r,a=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(a=s.return),r=s.return;while(r)}return s.tag===3?a:null}function mh(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function gh(r){if(Qn(r)!==r)throw Error(n(188))}function qv(r){var s=r.alternate;if(!s){if(s=Qn(r),s===null)throw Error(n(188));return s!==r?null:r}for(var a=r,c=s;;){var f=a.return;if(f===null)break;var g=f.alternate;if(g===null){if(c=f.return,c!==null){a=c;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===a)return gh(f),r;if(g===c)return gh(f),s;g=g.sibling}throw Error(n(188))}if(a.return!==c.return)a=f,c=g;else{for(var x=!1,T=f.child;T;){if(T===a){x=!0,a=f,c=g;break}if(T===c){x=!0,c=f,a=g;break}T=T.sibling}if(!x){for(T=g.child;T;){if(T===a){x=!0,a=g,c=f;break}if(T===c){x=!0,c=g,a=f;break}T=T.sibling}if(!x)throw Error(n(189))}}if(a.alternate!==c)throw Error(n(190))}if(a.tag!==3)throw Error(n(188));return a.stateNode.current===a?r:s}function yh(r){return r=qv(r),r!==null?vh(r):null}function vh(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var s=vh(r);if(s!==null)return s;r=r.sibling}return null}var wh=e.unstable_scheduleCallback,xh=e.unstable_cancelCallback,Wv=e.unstable_shouldYield,Hv=e.unstable_requestPaint,He=e.unstable_now,Kv=e.unstable_getCurrentPriorityLevel,cl=e.unstable_ImmediatePriority,bh=e.unstable_UserBlockingPriority,Qi=e.unstable_NormalPriority,Gv=e.unstable_LowPriority,_h=e.unstable_IdlePriority,Xi=null,tn=null;function Jv(r){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Xi,r,void 0,(r.current.flags&128)===128)}catch{}}var zt=Math.clz32?Math.clz32:Xv,Yv=Math.log,Qv=Math.LN2;function Xv(r){return r>>>=0,r===0?32:31-(Yv(r)/Qv|0)|0}var Zi=64,eo=4194304;function Ns(r){switch(r&-r){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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function to(r,s){var a=r.pendingLanes;if(a===0)return 0;var c=0,f=r.suspendedLanes,g=r.pingedLanes,x=a&268435455;if(x!==0){var T=x&~f;T!==0?c=Ns(T):(g&=x,g!==0&&(c=Ns(g)))}else x=a&~f,x!==0?c=Ns(x):g!==0&&(c=Ns(g));if(c===0)return 0;if(s!==0&&s!==c&&(s&f)===0&&(f=c&-c,g=s&-s,f>=g||f===16&&(g&4194240)!==0))return s;if((c&4)!==0&&(c|=a&16),s=r.entangledLanes,s!==0)for(r=r.entanglements,s&=c;0<s;)a=31-zt(s),f=1<<a,c|=r[a],s&=~f;return c}function Zv(r,s){switch(r){case 1:case 2:case 4:return s+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 s+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 ew(r,s){for(var a=r.suspendedLanes,c=r.pingedLanes,f=r.expirationTimes,g=r.pendingLanes;0<g;){var x=31-zt(g),T=1<<x,C=f[x];C===-1?((T&a)===0||(T&c)!==0)&&(f[x]=Zv(T,s)):C<=s&&(r.expiredLanes|=T),g&=~T}}function dl(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Sh(){var r=Zi;return Zi<<=1,(Zi&4194240)===0&&(Zi=64),r}function hl(r){for(var s=[],a=0;31>a;a++)s.push(r);return s}function As(r,s,a){r.pendingLanes|=s,s!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,s=31-zt(s),r[s]=a}function tw(r,s){var a=r.pendingLanes&~s;r.pendingLanes=s,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=s,r.mutableReadLanes&=s,r.entangledLanes&=s,s=r.entanglements;var c=r.eventTimes;for(r=r.expirationTimes;0<a;){var f=31-zt(a),g=1<<f;s[f]=0,c[f]=-1,r[f]=-1,a&=~g}}function fl(r,s){var a=r.entangledLanes|=s;for(r=r.entanglements;a;){var c=31-zt(a),f=1<<c;f&s|r[c]&s&&(r[c]|=s),a&=~f}}var Ce=0;function kh(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Eh,pl,Th,jh,Ch,ml=!1,no=[],En=null,Tn=null,jn=null,Ps=new Map,Rs=new Map,Cn=[],nw="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 Nh(r,s){switch(r){case"focusin":case"focusout":En=null;break;case"dragenter":case"dragleave":Tn=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":Ps.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rs.delete(s.pointerId)}}function Os(r,s,a,c,f,g){return r===null||r.nativeEvent!==g?(r={blockedOn:s,domEventName:a,eventSystemFlags:c,nativeEvent:g,targetContainers:[f]},s!==null&&(s=Ks(s),s!==null&&pl(s)),r):(r.eventSystemFlags|=c,s=r.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),r)}function rw(r,s,a,c,f){switch(s){case"focusin":return En=Os(En,r,s,a,c,f),!0;case"dragenter":return Tn=Os(Tn,r,s,a,c,f),!0;case"mouseover":return jn=Os(jn,r,s,a,c,f),!0;case"pointerover":var g=f.pointerId;return Ps.set(g,Os(Ps.get(g)||null,r,s,a,c,f)),!0;case"gotpointercapture":return g=f.pointerId,Rs.set(g,Os(Rs.get(g)||null,r,s,a,c,f)),!0}return!1}function Ah(r){var s=Xn(r.target);if(s!==null){var a=Qn(s);if(a!==null){if(s=a.tag,s===13){if(s=mh(a),s!==null){r.blockedOn=s,Ch(r.priority,function(){Th(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){r.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}r.blockedOn=null}function ro(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var a=yl(r.domEventName,r.eventSystemFlags,s[0],r.nativeEvent);if(a===null){a=r.nativeEvent;var c=new a.constructor(a.type,a);sl=c,a.target.dispatchEvent(c),sl=null}else return s=Ks(a),s!==null&&pl(s),r.blockedOn=a,!1;s.shift()}return!0}function Ph(r,s,a){ro(r)&&a.delete(s)}function sw(){ml=!1,En!==null&&ro(En)&&(En=null),Tn!==null&&ro(Tn)&&(Tn=null),jn!==null&&ro(jn)&&(jn=null),Ps.forEach(Ph),Rs.forEach(Ph)}function Is(r,s){r.blockedOn===s&&(r.blockedOn=null,ml||(ml=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,sw)))}function Ds(r){function s(f){return Is(f,r)}if(0<no.length){Is(no[0],r);for(var a=1;a<no.length;a++){var c=no[a];c.blockedOn===r&&(c.blockedOn=null)}}for(En!==null&&Is(En,r),Tn!==null&&Is(Tn,r),jn!==null&&Is(jn,r),Ps.forEach(s),Rs.forEach(s),a=0;a<Cn.length;a++)c=Cn[a],c.blockedOn===r&&(c.blockedOn=null);for(;0<Cn.length&&(a=Cn[0],a.blockedOn===null);)Ah(a),a.blockedOn===null&&Cn.shift()}var Ar=U.ReactCurrentBatchConfig,so=!0;function iw(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=1,gl(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function ow(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=4,gl(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function gl(r,s,a,c){if(so){var f=yl(r,s,a,c);if(f===null)Il(r,s,c,io,a),Nh(r,c);else if(rw(f,r,s,a,c))c.stopPropagation();else if(Nh(r,c),s&4&&-1<nw.indexOf(r)){for(;f!==null;){var g=Ks(f);if(g!==null&&Eh(g),g=yl(r,s,a,c),g===null&&Il(r,s,c,io,a),g===f)break;f=g}f!==null&&c.stopPropagation()}else Il(r,s,c,null,a)}}var io=null;function yl(r,s,a,c){if(io=null,r=il(c),r=Xn(r),r!==null)if(s=Qn(r),s===null)r=null;else if(a=s.tag,a===13){if(r=mh(s),r!==null)return r;r=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null);return io=r,null}function Rh(r){switch(r){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(Kv()){case cl:return 1;case bh:return 4;case Qi:case Gv:return 16;case _h:return 536870912;default:return 16}default:return 16}}var Nn=null,vl=null,oo=null;function Oh(){if(oo)return oo;var r,s=vl,a=s.length,c,f="value"in Nn?Nn.value:Nn.textContent,g=f.length;for(r=0;r<a&&s[r]===f[r];r++);var x=a-r;for(c=1;c<=x&&s[a-c]===f[g-c];c++);return oo=f.slice(r,1<c?1-c:void 0)}function ao(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function lo(){return!0}function Ih(){return!1}function Tt(r){function s(a,c,f,g,x){this._reactName=a,this._targetInst=f,this.type=c,this.nativeEvent=g,this.target=x,this.currentTarget=null;for(var T in r)r.hasOwnProperty(T)&&(a=r[T],this[T]=a?a(g):g[T]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?lo:Ih,this.isPropagationStopped=Ih,this}return K(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=lo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=lo)},persist:function(){},isPersistent:lo}),s}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wl=Tt(Pr),Ls=K({},Pr,{view:0,detail:0}),aw=Tt(Ls),xl,bl,Ms,uo=K({},Ls,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sl,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ms&&(Ms&&r.type==="mousemove"?(xl=r.screenX-Ms.screenX,bl=r.screenY-Ms.screenY):bl=xl=0,Ms=r),xl)},movementY:function(r){return"movementY"in r?r.movementY:bl}}),Dh=Tt(uo),lw=K({},uo,{dataTransfer:0}),uw=Tt(lw),cw=K({},Ls,{relatedTarget:0}),_l=Tt(cw),dw=K({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),hw=Tt(dw),fw=K({},Pr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),pw=Tt(fw),mw=K({},Pr,{data:0}),Lh=Tt(mw),gw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yw={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"},vw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ww(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=vw[r])?!!s[r]:!1}function Sl(){return ww}var xw=K({},Ls,{key:function(r){if(r.key){var s=gw[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=ao(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?yw[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sl,charCode:function(r){return r.type==="keypress"?ao(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ao(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),bw=Tt(xw),_w=K({},uo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mh=Tt(_w),Sw=K({},Ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sl}),kw=Tt(Sw),Ew=K({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Tw=Tt(Ew),jw=K({},uo,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Cw=Tt(jw),Nw=[9,13,27,32],kl=d&&"CompositionEvent"in window,Us=null;d&&"documentMode"in document&&(Us=document.documentMode);var Aw=d&&"TextEvent"in window&&!Us,Uh=d&&(!kl||Us&&8<Us&&11>=Us),$h=" ",Vh=!1;function Fh(r,s){switch(r){case"keyup":return Nw.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bh(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Rr=!1;function Pw(r,s){switch(r){case"compositionend":return Bh(s);case"keypress":return s.which!==32?null:(Vh=!0,$h);case"textInput":return r=s.data,r===$h&&Vh?null:r;default:return null}}function Rw(r,s){if(Rr)return r==="compositionend"||!kl&&Fh(r,s)?(r=Oh(),oo=vl=Nn=null,Rr=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Uh&&s.locale!=="ko"?null:s.data;default:return null}}var Ow={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 zh(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Ow[r.type]:s==="textarea"}function qh(r,s,a,c){ch(c),s=mo(s,"onChange"),0<s.length&&(a=new wl("onChange","change",null,a,c),r.push({event:a,listeners:s}))}var $s=null,Vs=null;function Iw(r){uf(r,0)}function co(r){var s=Mr(r);if(Xd(s))return r}function Dw(r,s){if(r==="change")return s}var Wh=!1;if(d){var El;if(d){var Tl="oninput"in document;if(!Tl){var Hh=document.createElement("div");Hh.setAttribute("oninput","return;"),Tl=typeof Hh.oninput=="function"}El=Tl}else El=!1;Wh=El&&(!document.documentMode||9<document.documentMode)}function Kh(){$s&&($s.detachEvent("onpropertychange",Gh),Vs=$s=null)}function Gh(r){if(r.propertyName==="value"&&co(Vs)){var s=[];qh(s,Vs,r,il(r)),ph(Iw,s)}}function Lw(r,s,a){r==="focusin"?(Kh(),$s=s,Vs=a,$s.attachEvent("onpropertychange",Gh)):r==="focusout"&&Kh()}function Mw(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return co(Vs)}function Uw(r,s){if(r==="click")return co(s)}function $w(r,s){if(r==="input"||r==="change")return co(s)}function Vw(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var qt=typeof Object.is=="function"?Object.is:Vw;function Fs(r,s){if(qt(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var a=Object.keys(r),c=Object.keys(s);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var f=a[c];if(!h.call(s,f)||!qt(r[f],s[f]))return!1}return!0}function Jh(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Yh(r,s){var a=Jh(r);r=0;for(var c;a;){if(a.nodeType===3){if(c=r+a.textContent.length,r<=s&&c>=s)return{node:a,offset:s-r};r=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Jh(a)}}function Qh(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Qh(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Xh(){for(var r=window,s=Ki();s instanceof r.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)r=s.contentWindow;else break;s=Ki(r.document)}return s}function jl(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}function Fw(r){var s=Xh(),a=r.focusedElem,c=r.selectionRange;if(s!==a&&a&&a.ownerDocument&&Qh(a.ownerDocument.documentElement,a)){if(c!==null&&jl(a)){if(s=c.start,r=c.end,r===void 0&&(r=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(r,a.value.length);else if(r=(s=a.ownerDocument||document)&&s.defaultView||window,r.getSelection){r=r.getSelection();var f=a.textContent.length,g=Math.min(c.start,f);c=c.end===void 0?g:Math.min(c.end,f),!r.extend&&g>c&&(f=c,c=g,g=f),f=Yh(a,g);var x=Yh(a,c);f&&x&&(r.rangeCount!==1||r.anchorNode!==f.node||r.anchorOffset!==f.offset||r.focusNode!==x.node||r.focusOffset!==x.offset)&&(s=s.createRange(),s.setStart(f.node,f.offset),r.removeAllRanges(),g>c?(r.addRange(s),r.extend(x.node,x.offset)):(s.setEnd(x.node,x.offset),r.addRange(s)))}}for(s=[],r=a;r=r.parentNode;)r.nodeType===1&&s.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)r=s[a],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Bw=d&&"documentMode"in document&&11>=document.documentMode,Or=null,Cl=null,Bs=null,Nl=!1;function Zh(r,s,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nl||Or==null||Or!==Ki(c)||(c=Or,"selectionStart"in c&&jl(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Bs&&Fs(Bs,c)||(Bs=c,c=mo(Cl,"onSelect"),0<c.length&&(s=new wl("onSelect","select",null,s,a),r.push({event:s,listeners:c}),s.target=Or)))}function ho(r,s){var a={};return a[r.toLowerCase()]=s.toLowerCase(),a["Webkit"+r]="webkit"+s,a["Moz"+r]="moz"+s,a}var Ir={animationend:ho("Animation","AnimationEnd"),animationiteration:ho("Animation","AnimationIteration"),animationstart:ho("Animation","AnimationStart"),transitionend:ho("Transition","TransitionEnd")},Al={},ef={};d&&(ef=document.createElement("div").style,"AnimationEvent"in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),"TransitionEvent"in window||delete Ir.transitionend.transition);function fo(r){if(Al[r])return Al[r];if(!Ir[r])return r;var s=Ir[r],a;for(a in s)if(s.hasOwnProperty(a)&&a in ef)return Al[r]=s[a];return r}var tf=fo("animationend"),nf=fo("animationiteration"),rf=fo("animationstart"),sf=fo("transitionend"),of=new Map,af="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 An(r,s){of.set(r,s),l(s,[r])}for(var Pl=0;Pl<af.length;Pl++){var Rl=af[Pl],zw=Rl.toLowerCase(),qw=Rl[0].toUpperCase()+Rl.slice(1);An(zw,"on"+qw)}An(tf,"onAnimationEnd"),An(nf,"onAnimationIteration"),An(rf,"onAnimationStart"),An("dblclick","onDoubleClick"),An("focusin","onFocus"),An("focusout","onBlur"),An(sf,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zs="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(" "),Ww=new Set("cancel close invalid load scroll toggle".split(" ").concat(zs));function lf(r,s,a){var c=r.type||"unknown-event";r.currentTarget=a,zv(c,s,void 0,r),r.currentTarget=null}function uf(r,s){s=(s&4)!==0;for(var a=0;a<r.length;a++){var c=r[a],f=c.event;c=c.listeners;e:{var g=void 0;if(s)for(var x=c.length-1;0<=x;x--){var T=c[x],C=T.instance,L=T.currentTarget;if(T=T.listener,C!==g&&f.isPropagationStopped())break e;lf(f,T,L),g=C}else for(x=0;x<c.length;x++){if(T=c[x],C=T.instance,L=T.currentTarget,T=T.listener,C!==g&&f.isPropagationStopped())break e;lf(f,T,L),g=C}}}if(Yi)throw r=ul,Yi=!1,ul=null,r}function Ie(r,s){var a=s[Vl];a===void 0&&(a=s[Vl]=new Set);var c=r+"__bubble";a.has(c)||(cf(s,r,2,!1),a.add(c))}function Ol(r,s,a){var c=0;s&&(c|=4),cf(a,r,c,s)}var po="_reactListening"+Math.random().toString(36).slice(2);function qs(r){if(!r[po]){r[po]=!0,i.forEach(function(a){a!=="selectionchange"&&(Ww.has(a)||Ol(a,!1,r),Ol(a,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[po]||(s[po]=!0,Ol("selectionchange",!1,s))}}function cf(r,s,a,c){switch(Rh(s)){case 1:var f=iw;break;case 4:f=ow;break;default:f=gl}a=f.bind(null,s,a,r),f=void 0,!ll||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),c?f!==void 0?r.addEventListener(s,a,{capture:!0,passive:f}):r.addEventListener(s,a,!0):f!==void 0?r.addEventListener(s,a,{passive:f}):r.addEventListener(s,a,!1)}function Il(r,s,a,c,f){var g=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var T=c.stateNode.containerInfo;if(T===f||T.nodeType===8&&T.parentNode===f)break;if(x===4)for(x=c.return;x!==null;){var C=x.tag;if((C===3||C===4)&&(C=x.stateNode.containerInfo,C===f||C.nodeType===8&&C.parentNode===f))return;x=x.return}for(;T!==null;){if(x=Xn(T),x===null)return;if(C=x.tag,C===5||C===6){c=g=x;continue e}T=T.parentNode}}c=c.return}ph(function(){var L=g,W=il(a),H=[];e:{var q=of.get(r);if(q!==void 0){var Q=wl,ee=r;switch(r){case"keypress":if(ao(a)===0)break e;case"keydown":case"keyup":Q=bw;break;case"focusin":ee="focus",Q=_l;break;case"focusout":ee="blur",Q=_l;break;case"beforeblur":case"afterblur":Q=_l;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=Dh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=uw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=kw;break;case tf:case nf:case rf:Q=hw;break;case sf:Q=Tw;break;case"scroll":Q=aw;break;case"wheel":Q=Cw;break;case"copy":case"cut":case"paste":Q=pw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Mh}var te=(s&4)!==0,Ke=!te&&r==="scroll",O=te?q!==null?q+"Capture":null:q;te=[];for(var A=L,I;A!==null;){I=A;var G=I.stateNode;if(I.tag===5&&G!==null&&(I=G,O!==null&&(G=Ts(A,O),G!=null&&te.push(Ws(A,G,I)))),Ke)break;A=A.return}0<te.length&&(q=new Q(q,ee,null,a,W),H.push({event:q,listeners:te}))}}if((s&7)===0){e:{if(q=r==="mouseover"||r==="pointerover",Q=r==="mouseout"||r==="pointerout",q&&a!==sl&&(ee=a.relatedTarget||a.fromElement)&&(Xn(ee)||ee[dn]))break e;if((Q||q)&&(q=W.window===W?W:(q=W.ownerDocument)?q.defaultView||q.parentWindow:window,Q?(ee=a.relatedTarget||a.toElement,Q=L,ee=ee?Xn(ee):null,ee!==null&&(Ke=Qn(ee),ee!==Ke||ee.tag!==5&&ee.tag!==6)&&(ee=null)):(Q=null,ee=L),Q!==ee)){if(te=Dh,G="onMouseLeave",O="onMouseEnter",A="mouse",(r==="pointerout"||r==="pointerover")&&(te=Mh,G="onPointerLeave",O="onPointerEnter",A="pointer"),Ke=Q==null?q:Mr(Q),I=ee==null?q:Mr(ee),q=new te(G,A+"leave",Q,a,W),q.target=Ke,q.relatedTarget=I,G=null,Xn(W)===L&&(te=new te(O,A+"enter",ee,a,W),te.target=I,te.relatedTarget=Ke,G=te),Ke=G,Q&&ee)t:{for(te=Q,O=ee,A=0,I=te;I;I=Dr(I))A++;for(I=0,G=O;G;G=Dr(G))I++;for(;0<A-I;)te=Dr(te),A--;for(;0<I-A;)O=Dr(O),I--;for(;A--;){if(te===O||O!==null&&te===O.alternate)break t;te=Dr(te),O=Dr(O)}te=null}else te=null;Q!==null&&df(H,q,Q,te,!1),ee!==null&&Ke!==null&&df(H,Ke,ee,te,!0)}}e:{if(q=L?Mr(L):window,Q=q.nodeName&&q.nodeName.toLowerCase(),Q==="select"||Q==="input"&&q.type==="file")var ne=Dw;else if(zh(q))if(Wh)ne=$w;else{ne=Mw;var ae=Lw}else(Q=q.nodeName)&&Q.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(ne=Uw);if(ne&&(ne=ne(r,L))){qh(H,ne,a,W);break e}ae&&ae(r,q,L),r==="focusout"&&(ae=q._wrapperState)&&ae.controlled&&q.type==="number"&&Za(q,"number",q.value)}switch(ae=L?Mr(L):window,r){case"focusin":(zh(ae)||ae.contentEditable==="true")&&(Or=ae,Cl=L,Bs=null);break;case"focusout":Bs=Cl=Or=null;break;case"mousedown":Nl=!0;break;case"contextmenu":case"mouseup":case"dragend":Nl=!1,Zh(H,a,W);break;case"selectionchange":if(Bw)break;case"keydown":case"keyup":Zh(H,a,W)}var le;if(kl)e:{switch(r){case"compositionstart":var ge="onCompositionStart";break e;case"compositionend":ge="onCompositionEnd";break e;case"compositionupdate":ge="onCompositionUpdate";break e}ge=void 0}else Rr?Fh(r,a)&&(ge="onCompositionEnd"):r==="keydown"&&a.keyCode===229&&(ge="onCompositionStart");ge&&(Uh&&a.locale!=="ko"&&(Rr||ge!=="onCompositionStart"?ge==="onCompositionEnd"&&Rr&&(le=Oh()):(Nn=W,vl="value"in Nn?Nn.value:Nn.textContent,Rr=!0)),ae=mo(L,ge),0<ae.length&&(ge=new Lh(ge,r,null,a,W),H.push({event:ge,listeners:ae}),le?ge.data=le:(le=Bh(a),le!==null&&(ge.data=le)))),(le=Aw?Pw(r,a):Rw(r,a))&&(L=mo(L,"onBeforeInput"),0<L.length&&(W=new Lh("onBeforeInput","beforeinput",null,a,W),H.push({event:W,listeners:L}),W.data=le))}uf(H,s)})}function Ws(r,s,a){return{instance:r,listener:s,currentTarget:a}}function mo(r,s){for(var a=s+"Capture",c=[];r!==null;){var f=r,g=f.stateNode;f.tag===5&&g!==null&&(f=g,g=Ts(r,a),g!=null&&c.unshift(Ws(r,g,f)),g=Ts(r,s),g!=null&&c.push(Ws(r,g,f))),r=r.return}return c}function Dr(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function df(r,s,a,c,f){for(var g=s._reactName,x=[];a!==null&&a!==c;){var T=a,C=T.alternate,L=T.stateNode;if(C!==null&&C===c)break;T.tag===5&&L!==null&&(T=L,f?(C=Ts(a,g),C!=null&&x.unshift(Ws(a,C,T))):f||(C=Ts(a,g),C!=null&&x.push(Ws(a,C,T)))),a=a.return}x.length!==0&&r.push({event:s,listeners:x})}var Hw=/\r\n?/g,Kw=/\u0000|\uFFFD/g;function hf(r){return(typeof r=="string"?r:""+r).replace(Hw,`
6
- `).replace(Kw,"")}function go(r,s,a){if(s=hf(s),hf(r)!==s&&a)throw Error(n(425))}function yo(){}var Dl=null,Ll=null;function Ml(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ul=typeof setTimeout=="function"?setTimeout:void 0,Gw=typeof clearTimeout=="function"?clearTimeout:void 0,ff=typeof Promise=="function"?Promise:void 0,Jw=typeof queueMicrotask=="function"?queueMicrotask:typeof ff<"u"?function(r){return ff.resolve(null).then(r).catch(Yw)}:Ul;function Yw(r){setTimeout(function(){throw r})}function $l(r,s){var a=s,c=0;do{var f=a.nextSibling;if(r.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(c===0){r.removeChild(f),Ds(s);return}c--}else a!=="$"&&a!=="$?"&&a!=="$!"||c++;a=f}while(a);Ds(s)}function Pn(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return r}function pf(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var a=r.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return r;s--}else a==="/$"&&s++}r=r.previousSibling}return null}var Lr=Math.random().toString(36).slice(2),nn="__reactFiber$"+Lr,Hs="__reactProps$"+Lr,dn="__reactContainer$"+Lr,Vl="__reactEvents$"+Lr,Qw="__reactListeners$"+Lr,Xw="__reactHandles$"+Lr;function Xn(r){var s=r[nn];if(s)return s;for(var a=r.parentNode;a;){if(s=a[dn]||a[nn]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(r=pf(r);r!==null;){if(a=r[nn])return a;r=pf(r)}return s}r=a,a=r.parentNode}return null}function Ks(r){return r=r[nn]||r[dn],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Mr(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function vo(r){return r[Hs]||null}var Fl=[],Ur=-1;function Rn(r){return{current:r}}function De(r){0>Ur||(r.current=Fl[Ur],Fl[Ur]=null,Ur--)}function Ae(r,s){Ur++,Fl[Ur]=r.current,r.current=s}var On={},lt=Rn(On),yt=Rn(!1),Zn=On;function $r(r,s){var a=r.type.contextTypes;if(!a)return On;var c=r.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in a)f[g]=s[g];return c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=s,r.__reactInternalMemoizedMaskedChildContext=f),f}function vt(r){return r=r.childContextTypes,r!=null}function wo(){De(yt),De(lt)}function mf(r,s,a){if(lt.current!==On)throw Error(n(168));Ae(lt,s),Ae(yt,a)}function gf(r,s,a){var c=r.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return a;c=c.getChildContext();for(var f in c)if(!(f in s))throw Error(n(108,Ee(r)||"Unknown",f));return K({},a,c)}function xo(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||On,Zn=lt.current,Ae(lt,r),Ae(yt,yt.current),!0}function yf(r,s,a){var c=r.stateNode;if(!c)throw Error(n(169));a?(r=gf(r,s,Zn),c.__reactInternalMemoizedMergedChildContext=r,De(yt),De(lt),Ae(lt,r)):De(yt),Ae(yt,a)}var hn=null,bo=!1,Bl=!1;function vf(r){hn===null?hn=[r]:hn.push(r)}function Zw(r){bo=!0,vf(r)}function In(){if(!Bl&&hn!==null){Bl=!0;var r=0,s=Ce;try{var a=hn;for(Ce=1;r<a.length;r++){var c=a[r];do c=c(!0);while(c!==null)}hn=null,bo=!1}catch(f){throw hn!==null&&(hn=hn.slice(r+1)),wh(cl,In),f}finally{Ce=s,Bl=!1}}return null}var Vr=[],Fr=0,_o=null,So=0,Dt=[],Lt=0,er=null,fn=1,pn="";function tr(r,s){Vr[Fr++]=So,Vr[Fr++]=_o,_o=r,So=s}function wf(r,s,a){Dt[Lt++]=fn,Dt[Lt++]=pn,Dt[Lt++]=er,er=r;var c=fn;r=pn;var f=32-zt(c)-1;c&=~(1<<f),a+=1;var g=32-zt(s)+f;if(30<g){var x=f-f%5;g=(c&(1<<x)-1).toString(32),c>>=x,f-=x,fn=1<<32-zt(s)+f|a<<f|c,pn=g+r}else fn=1<<g|a<<f|c,pn=r}function zl(r){r.return!==null&&(tr(r,1),wf(r,1,0))}function ql(r){for(;r===_o;)_o=Vr[--Fr],Vr[Fr]=null,So=Vr[--Fr],Vr[Fr]=null;for(;r===er;)er=Dt[--Lt],Dt[Lt]=null,pn=Dt[--Lt],Dt[Lt]=null,fn=Dt[--Lt],Dt[Lt]=null}var jt=null,Ct=null,Ue=!1,Wt=null;function xf(r,s){var a=Vt(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=r,s=r.deletions,s===null?(r.deletions=[a],r.flags|=16):s.push(a)}function bf(r,s){switch(r.tag){case 5:var a=r.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(r.stateNode=s,jt=r,Ct=Pn(s.firstChild),!0):!1;case 6:return s=r.pendingProps===""||s.nodeType!==3?null:s,s!==null?(r.stateNode=s,jt=r,Ct=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=er!==null?{id:fn,overflow:pn}:null,r.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=Vt(18,null,null,0),a.stateNode=s,a.return=r,r.child=a,jt=r,Ct=null,!0):!1;default:return!1}}function Wl(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Hl(r){if(Ue){var s=Ct;if(s){var a=s;if(!bf(r,s)){if(Wl(r))throw Error(n(418));s=Pn(a.nextSibling);var c=jt;s&&bf(r,s)?xf(c,a):(r.flags=r.flags&-4097|2,Ue=!1,jt=r)}}else{if(Wl(r))throw Error(n(418));r.flags=r.flags&-4097|2,Ue=!1,jt=r}}}function _f(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jt=r}function ko(r){if(r!==jt)return!1;if(!Ue)return _f(r),Ue=!0,!1;var s;if((s=r.tag!==3)&&!(s=r.tag!==5)&&(s=r.type,s=s!=="head"&&s!=="body"&&!Ml(r.type,r.memoizedProps)),s&&(s=Ct)){if(Wl(r))throw Sf(),Error(n(418));for(;s;)xf(r,s),s=Pn(s.nextSibling)}if(_f(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,s=0;r;){if(r.nodeType===8){var a=r.data;if(a==="/$"){if(s===0){Ct=Pn(r.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}r=r.nextSibling}Ct=null}}else Ct=jt?Pn(r.stateNode.nextSibling):null;return!0}function Sf(){for(var r=Ct;r;)r=Pn(r.nextSibling)}function Br(){Ct=jt=null,Ue=!1}function Kl(r){Wt===null?Wt=[r]:Wt.push(r)}var ex=U.ReactCurrentBatchConfig;function Gs(r,s,a){if(r=a.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(n(309));var c=a.stateNode}if(!c)throw Error(n(147,r));var f=c,g=""+r;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(x){var T=f.refs;x===null?delete T[g]:T[g]=x},s._stringRef=g,s)}if(typeof r!="string")throw Error(n(284));if(!a._owner)throw Error(n(290,r))}return r}function Eo(r,s){throw r=Object.prototype.toString.call(s),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r))}function kf(r){var s=r._init;return s(r._payload)}function Ef(r){function s(O,A){if(r){var I=O.deletions;I===null?(O.deletions=[A],O.flags|=16):I.push(A)}}function a(O,A){if(!r)return null;for(;A!==null;)s(O,A),A=A.sibling;return null}function c(O,A){for(O=new Map;A!==null;)A.key!==null?O.set(A.key,A):O.set(A.index,A),A=A.sibling;return O}function f(O,A){return O=Bn(O,A),O.index=0,O.sibling=null,O}function g(O,A,I){return O.index=I,r?(I=O.alternate,I!==null?(I=I.index,I<A?(O.flags|=2,A):I):(O.flags|=2,A)):(O.flags|=1048576,A)}function x(O){return r&&O.alternate===null&&(O.flags|=2),O}function T(O,A,I,G){return A===null||A.tag!==6?(A=Uu(I,O.mode,G),A.return=O,A):(A=f(A,I),A.return=O,A)}function C(O,A,I,G){var ne=I.type;return ne===$?W(O,A,I.props.children,G,I.key):A!==null&&(A.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===be&&kf(ne)===A.type)?(G=f(A,I.props),G.ref=Gs(O,A,I),G.return=O,G):(G=Jo(I.type,I.key,I.props,null,O.mode,G),G.ref=Gs(O,A,I),G.return=O,G)}function L(O,A,I,G){return A===null||A.tag!==4||A.stateNode.containerInfo!==I.containerInfo||A.stateNode.implementation!==I.implementation?(A=$u(I,O.mode,G),A.return=O,A):(A=f(A,I.children||[]),A.return=O,A)}function W(O,A,I,G,ne){return A===null||A.tag!==7?(A=ur(I,O.mode,G,ne),A.return=O,A):(A=f(A,I),A.return=O,A)}function H(O,A,I){if(typeof A=="string"&&A!==""||typeof A=="number")return A=Uu(""+A,O.mode,I),A.return=O,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case V:return I=Jo(A.type,A.key,A.props,null,O.mode,I),I.ref=Gs(O,null,A),I.return=O,I;case z:return A=$u(A,O.mode,I),A.return=O,A;case be:var G=A._init;return H(O,G(A._payload),I)}if(Ss(A)||J(A))return A=ur(A,O.mode,I,null),A.return=O,A;Eo(O,A)}return null}function q(O,A,I,G){var ne=A!==null?A.key:null;if(typeof I=="string"&&I!==""||typeof I=="number")return ne!==null?null:T(O,A,""+I,G);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case V:return I.key===ne?C(O,A,I,G):null;case z:return I.key===ne?L(O,A,I,G):null;case be:return ne=I._init,q(O,A,ne(I._payload),G)}if(Ss(I)||J(I))return ne!==null?null:W(O,A,I,G,null);Eo(O,I)}return null}function Q(O,A,I,G,ne){if(typeof G=="string"&&G!==""||typeof G=="number")return O=O.get(I)||null,T(A,O,""+G,ne);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case V:return O=O.get(G.key===null?I:G.key)||null,C(A,O,G,ne);case z:return O=O.get(G.key===null?I:G.key)||null,L(A,O,G,ne);case be:var ae=G._init;return Q(O,A,I,ae(G._payload),ne)}if(Ss(G)||J(G))return O=O.get(I)||null,W(A,O,G,ne,null);Eo(A,G)}return null}function ee(O,A,I,G){for(var ne=null,ae=null,le=A,ge=A=0,nt=null;le!==null&&ge<I.length;ge++){le.index>ge?(nt=le,le=null):nt=le.sibling;var Se=q(O,le,I[ge],G);if(Se===null){le===null&&(le=nt);break}r&&le&&Se.alternate===null&&s(O,le),A=g(Se,A,ge),ae===null?ne=Se:ae.sibling=Se,ae=Se,le=nt}if(ge===I.length)return a(O,le),Ue&&tr(O,ge),ne;if(le===null){for(;ge<I.length;ge++)le=H(O,I[ge],G),le!==null&&(A=g(le,A,ge),ae===null?ne=le:ae.sibling=le,ae=le);return Ue&&tr(O,ge),ne}for(le=c(O,le);ge<I.length;ge++)nt=Q(le,O,ge,I[ge],G),nt!==null&&(r&&nt.alternate!==null&&le.delete(nt.key===null?ge:nt.key),A=g(nt,A,ge),ae===null?ne=nt:ae.sibling=nt,ae=nt);return r&&le.forEach(function(zn){return s(O,zn)}),Ue&&tr(O,ge),ne}function te(O,A,I,G){var ne=J(I);if(typeof ne!="function")throw Error(n(150));if(I=ne.call(I),I==null)throw Error(n(151));for(var ae=ne=null,le=A,ge=A=0,nt=null,Se=I.next();le!==null&&!Se.done;ge++,Se=I.next()){le.index>ge?(nt=le,le=null):nt=le.sibling;var zn=q(O,le,Se.value,G);if(zn===null){le===null&&(le=nt);break}r&&le&&zn.alternate===null&&s(O,le),A=g(zn,A,ge),ae===null?ne=zn:ae.sibling=zn,ae=zn,le=nt}if(Se.done)return a(O,le),Ue&&tr(O,ge),ne;if(le===null){for(;!Se.done;ge++,Se=I.next())Se=H(O,Se.value,G),Se!==null&&(A=g(Se,A,ge),ae===null?ne=Se:ae.sibling=Se,ae=Se);return Ue&&tr(O,ge),ne}for(le=c(O,le);!Se.done;ge++,Se=I.next())Se=Q(le,O,ge,Se.value,G),Se!==null&&(r&&Se.alternate!==null&&le.delete(Se.key===null?ge:Se.key),A=g(Se,A,ge),ae===null?ne=Se:ae.sibling=Se,ae=Se);return r&&le.forEach(function(Ox){return s(O,Ox)}),Ue&&tr(O,ge),ne}function Ke(O,A,I,G){if(typeof I=="object"&&I!==null&&I.type===$&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case V:e:{for(var ne=I.key,ae=A;ae!==null;){if(ae.key===ne){if(ne=I.type,ne===$){if(ae.tag===7){a(O,ae.sibling),A=f(ae,I.props.children),A.return=O,O=A;break e}}else if(ae.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===be&&kf(ne)===ae.type){a(O,ae.sibling),A=f(ae,I.props),A.ref=Gs(O,ae,I),A.return=O,O=A;break e}a(O,ae);break}else s(O,ae);ae=ae.sibling}I.type===$?(A=ur(I.props.children,O.mode,G,I.key),A.return=O,O=A):(G=Jo(I.type,I.key,I.props,null,O.mode,G),G.ref=Gs(O,A,I),G.return=O,O=G)}return x(O);case z:e:{for(ae=I.key;A!==null;){if(A.key===ae)if(A.tag===4&&A.stateNode.containerInfo===I.containerInfo&&A.stateNode.implementation===I.implementation){a(O,A.sibling),A=f(A,I.children||[]),A.return=O,O=A;break e}else{a(O,A);break}else s(O,A);A=A.sibling}A=$u(I,O.mode,G),A.return=O,O=A}return x(O);case be:return ae=I._init,Ke(O,A,ae(I._payload),G)}if(Ss(I))return ee(O,A,I,G);if(J(I))return te(O,A,I,G);Eo(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,A!==null&&A.tag===6?(a(O,A.sibling),A=f(A,I),A.return=O,O=A):(a(O,A),A=Uu(I,O.mode,G),A.return=O,O=A),x(O)):a(O,A)}return Ke}var zr=Ef(!0),Tf=Ef(!1),To=Rn(null),jo=null,qr=null,Gl=null;function Jl(){Gl=qr=jo=null}function Yl(r){var s=To.current;De(To),r._currentValue=s}function Ql(r,s,a){for(;r!==null;){var c=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),r===a)break;r=r.return}}function Wr(r,s){jo=r,Gl=qr=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&s)!==0&&(wt=!0),r.firstContext=null)}function Mt(r){var s=r._currentValue;if(Gl!==r)if(r={context:r,memoizedValue:s,next:null},qr===null){if(jo===null)throw Error(n(308));qr=r,jo.dependencies={lanes:0,firstContext:r}}else qr=qr.next=r;return s}var nr=null;function Xl(r){nr===null?nr=[r]:nr.push(r)}function jf(r,s,a,c){var f=s.interleaved;return f===null?(a.next=a,Xl(s)):(a.next=f.next,f.next=a),s.interleaved=a,mn(r,c)}function mn(r,s){r.lanes|=s;var a=r.alternate;for(a!==null&&(a.lanes|=s),a=r,r=r.return;r!==null;)r.childLanes|=s,a=r.alternate,a!==null&&(a.childLanes|=s),a=r,r=r.return;return a.tag===3?a.stateNode:null}var Dn=!1;function Zl(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cf(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function gn(r,s){return{eventTime:r,lane:s,tag:0,payload:null,callback:null,next:null}}function Ln(r,s,a){var c=r.updateQueue;if(c===null)return null;if(c=c.shared,(_e&2)!==0){var f=c.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),c.pending=s,mn(r,a)}return f=c.interleaved,f===null?(s.next=s,Xl(c)):(s.next=f.next,f.next=s),c.interleaved=s,mn(r,a)}function Co(r,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var c=s.lanes;c&=r.pendingLanes,a|=c,s.lanes=a,fl(r,a)}}function Nf(r,s){var a=r.updateQueue,c=r.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var f=null,g=null;if(a=a.firstBaseUpdate,a!==null){do{var x={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};g===null?f=g=x:g=g.next=x,a=a.next}while(a!==null);g===null?f=g=s:g=g.next=s}else f=g=s;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:c.shared,effects:c.effects},r.updateQueue=a;return}r=a.lastBaseUpdate,r===null?a.firstBaseUpdate=s:r.next=s,a.lastBaseUpdate=s}function No(r,s,a,c){var f=r.updateQueue;Dn=!1;var g=f.firstBaseUpdate,x=f.lastBaseUpdate,T=f.shared.pending;if(T!==null){f.shared.pending=null;var C=T,L=C.next;C.next=null,x===null?g=L:x.next=L,x=C;var W=r.alternate;W!==null&&(W=W.updateQueue,T=W.lastBaseUpdate,T!==x&&(T===null?W.firstBaseUpdate=L:T.next=L,W.lastBaseUpdate=C))}if(g!==null){var H=f.baseState;x=0,W=L=C=null,T=g;do{var q=T.lane,Q=T.eventTime;if((c&q)===q){W!==null&&(W=W.next={eventTime:Q,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var ee=r,te=T;switch(q=s,Q=a,te.tag){case 1:if(ee=te.payload,typeof ee=="function"){H=ee.call(Q,H,q);break e}H=ee;break e;case 3:ee.flags=ee.flags&-65537|128;case 0:if(ee=te.payload,q=typeof ee=="function"?ee.call(Q,H,q):ee,q==null)break e;H=K({},H,q);break e;case 2:Dn=!0}}T.callback!==null&&T.lane!==0&&(r.flags|=64,q=f.effects,q===null?f.effects=[T]:q.push(T))}else Q={eventTime:Q,lane:q,tag:T.tag,payload:T.payload,callback:T.callback,next:null},W===null?(L=W=Q,C=H):W=W.next=Q,x|=q;if(T=T.next,T===null){if(T=f.shared.pending,T===null)break;q=T,T=q.next,q.next=null,f.lastBaseUpdate=q,f.shared.pending=null}}while(!0);if(W===null&&(C=H),f.baseState=C,f.firstBaseUpdate=L,f.lastBaseUpdate=W,s=f.shared.interleaved,s!==null){f=s;do x|=f.lane,f=f.next;while(f!==s)}else g===null&&(f.shared.lanes=0);ir|=x,r.lanes=x,r.memoizedState=H}}function Af(r,s,a){if(r=s.effects,s.effects=null,r!==null)for(s=0;s<r.length;s++){var c=r[s],f=c.callback;if(f!==null){if(c.callback=null,c=a,typeof f!="function")throw Error(n(191,f));f.call(c)}}}var Js={},rn=Rn(Js),Ys=Rn(Js),Qs=Rn(Js);function rr(r){if(r===Js)throw Error(n(174));return r}function eu(r,s){switch(Ae(Qs,s),Ae(Ys,r),Ae(rn,Js),r=s.nodeType,r){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:tl(null,"");break;default:r=r===8?s.parentNode:s,s=r.namespaceURI||null,r=r.tagName,s=tl(s,r)}De(rn),Ae(rn,s)}function Hr(){De(rn),De(Ys),De(Qs)}function Pf(r){rr(Qs.current);var s=rr(rn.current),a=tl(s,r.type);s!==a&&(Ae(Ys,r),Ae(rn,a))}function tu(r){Ys.current===r&&(De(rn),De(Ys))}var $e=Rn(0);function Ao(r){for(var s=r;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var nu=[];function ru(){for(var r=0;r<nu.length;r++)nu[r]._workInProgressVersionPrimary=null;nu.length=0}var Po=U.ReactCurrentDispatcher,su=U.ReactCurrentBatchConfig,sr=0,Ve=null,Qe=null,et=null,Ro=!1,Xs=!1,Zs=0,tx=0;function ut(){throw Error(n(321))}function iu(r,s){if(s===null)return!1;for(var a=0;a<s.length&&a<r.length;a++)if(!qt(r[a],s[a]))return!1;return!0}function ou(r,s,a,c,f,g){if(sr=g,Ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Po.current=r===null||r.memoizedState===null?ix:ox,r=a(c,f),Xs){g=0;do{if(Xs=!1,Zs=0,25<=g)throw Error(n(301));g+=1,et=Qe=null,s.updateQueue=null,Po.current=ax,r=a(c,f)}while(Xs)}if(Po.current=Do,s=Qe!==null&&Qe.next!==null,sr=0,et=Qe=Ve=null,Ro=!1,s)throw Error(n(300));return r}function au(){var r=Zs!==0;return Zs=0,r}function sn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return et===null?Ve.memoizedState=et=r:et=et.next=r,et}function Ut(){if(Qe===null){var r=Ve.alternate;r=r!==null?r.memoizedState:null}else r=Qe.next;var s=et===null?Ve.memoizedState:et.next;if(s!==null)et=s,Qe=r;else{if(r===null)throw Error(n(310));Qe=r,r={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},et===null?Ve.memoizedState=et=r:et=et.next=r}return et}function ei(r,s){return typeof s=="function"?s(r):s}function lu(r){var s=Ut(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var c=Qe,f=c.baseQueue,g=a.pending;if(g!==null){if(f!==null){var x=f.next;f.next=g.next,g.next=x}c.baseQueue=f=g,a.pending=null}if(f!==null){g=f.next,c=c.baseState;var T=x=null,C=null,L=g;do{var W=L.lane;if((sr&W)===W)C!==null&&(C=C.next={lane:0,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),c=L.hasEagerState?L.eagerState:r(c,L.action);else{var H={lane:W,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null};C===null?(T=C=H,x=c):C=C.next=H,Ve.lanes|=W,ir|=W}L=L.next}while(L!==null&&L!==g);C===null?x=c:C.next=T,qt(c,s.memoizedState)||(wt=!0),s.memoizedState=c,s.baseState=x,s.baseQueue=C,a.lastRenderedState=c}if(r=a.interleaved,r!==null){f=r;do g=f.lane,Ve.lanes|=g,ir|=g,f=f.next;while(f!==r)}else f===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function uu(r){var s=Ut(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var c=a.dispatch,f=a.pending,g=s.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do g=r(g,x.action),x=x.next;while(x!==f);qt(g,s.memoizedState)||(wt=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),a.lastRenderedState=g}return[g,c]}function Rf(){}function Of(r,s){var a=Ve,c=Ut(),f=s(),g=!qt(c.memoizedState,f);if(g&&(c.memoizedState=f,wt=!0),c=c.queue,cu(Lf.bind(null,a,c,r),[r]),c.getSnapshot!==s||g||et!==null&&et.memoizedState.tag&1){if(a.flags|=2048,ti(9,Df.bind(null,a,c,f,s),void 0,null),tt===null)throw Error(n(349));(sr&30)!==0||If(a,s,f)}return f}function If(r,s,a){r.flags|=16384,r={getSnapshot:s,value:a},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.stores=[r]):(a=s.stores,a===null?s.stores=[r]:a.push(r))}function Df(r,s,a,c){s.value=a,s.getSnapshot=c,Mf(s)&&Uf(r)}function Lf(r,s,a){return a(function(){Mf(s)&&Uf(r)})}function Mf(r){var s=r.getSnapshot;r=r.value;try{var a=s();return!qt(r,a)}catch{return!0}}function Uf(r){var s=mn(r,1);s!==null&&Jt(s,r,1,-1)}function $f(r){var s=sn();return typeof r=="function"&&(r=r()),s.memoizedState=s.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:r},s.queue=r,r=r.dispatch=sx.bind(null,Ve,r),[s.memoizedState,r]}function ti(r,s,a,c){return r={tag:r,create:s,destroy:a,deps:c,next:null},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.lastEffect=r.next=r):(a=s.lastEffect,a===null?s.lastEffect=r.next=r:(c=a.next,a.next=r,r.next=c,s.lastEffect=r)),r}function Vf(){return Ut().memoizedState}function Oo(r,s,a,c){var f=sn();Ve.flags|=r,f.memoizedState=ti(1|s,a,void 0,c===void 0?null:c)}function Io(r,s,a,c){var f=Ut();c=c===void 0?null:c;var g=void 0;if(Qe!==null){var x=Qe.memoizedState;if(g=x.destroy,c!==null&&iu(c,x.deps)){f.memoizedState=ti(s,a,g,c);return}}Ve.flags|=r,f.memoizedState=ti(1|s,a,g,c)}function Ff(r,s){return Oo(8390656,8,r,s)}function cu(r,s){return Io(2048,8,r,s)}function Bf(r,s){return Io(4,2,r,s)}function zf(r,s){return Io(4,4,r,s)}function qf(r,s){if(typeof s=="function")return r=r(),s(r),function(){s(null)};if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function Wf(r,s,a){return a=a!=null?a.concat([r]):null,Io(4,4,qf.bind(null,s,r),a)}function du(){}function Hf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&iu(s,c[1])?c[0]:(a.memoizedState=[r,s],r)}function Kf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&iu(s,c[1])?c[0]:(r=r(),a.memoizedState=[r,s],r)}function Gf(r,s,a){return(sr&21)===0?(r.baseState&&(r.baseState=!1,wt=!0),r.memoizedState=a):(qt(a,s)||(a=Sh(),Ve.lanes|=a,ir|=a,r.baseState=!0),s)}function nx(r,s){var a=Ce;Ce=a!==0&&4>a?a:4,r(!0);var c=su.transition;su.transition={};try{r(!1),s()}finally{Ce=a,su.transition=c}}function Jf(){return Ut().memoizedState}function rx(r,s,a){var c=Vn(r);if(a={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null},Yf(r))Qf(s,a);else if(a=jf(r,s,a,c),a!==null){var f=gt();Jt(a,r,c,f),Xf(a,s,c)}}function sx(r,s,a){var c=Vn(r),f={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null};if(Yf(r))Qf(s,f);else{var g=r.alternate;if(r.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var x=s.lastRenderedState,T=g(x,a);if(f.hasEagerState=!0,f.eagerState=T,qt(T,x)){var C=s.interleaved;C===null?(f.next=f,Xl(s)):(f.next=C.next,C.next=f),s.interleaved=f;return}}catch{}a=jf(r,s,f,c),a!==null&&(f=gt(),Jt(a,r,c,f),Xf(a,s,c))}}function Yf(r){var s=r.alternate;return r===Ve||s!==null&&s===Ve}function Qf(r,s){Xs=Ro=!0;var a=r.pending;a===null?s.next=s:(s.next=a.next,a.next=s),r.pending=s}function Xf(r,s,a){if((a&4194240)!==0){var c=s.lanes;c&=r.pendingLanes,a|=c,s.lanes=a,fl(r,a)}}var Do={readContext:Mt,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},ix={readContext:Mt,useCallback:function(r,s){return sn().memoizedState=[r,s===void 0?null:s],r},useContext:Mt,useEffect:Ff,useImperativeHandle:function(r,s,a){return a=a!=null?a.concat([r]):null,Oo(4194308,4,qf.bind(null,s,r),a)},useLayoutEffect:function(r,s){return Oo(4194308,4,r,s)},useInsertionEffect:function(r,s){return Oo(4,2,r,s)},useMemo:function(r,s){var a=sn();return s=s===void 0?null:s,r=r(),a.memoizedState=[r,s],r},useReducer:function(r,s,a){var c=sn();return s=a!==void 0?a(s):s,c.memoizedState=c.baseState=s,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:s},c.queue=r,r=r.dispatch=rx.bind(null,Ve,r),[c.memoizedState,r]},useRef:function(r){var s=sn();return r={current:r},s.memoizedState=r},useState:$f,useDebugValue:du,useDeferredValue:function(r){return sn().memoizedState=r},useTransition:function(){var r=$f(!1),s=r[0];return r=nx.bind(null,r[1]),sn().memoizedState=r,[s,r]},useMutableSource:function(){},useSyncExternalStore:function(r,s,a){var c=Ve,f=sn();if(Ue){if(a===void 0)throw Error(n(407));a=a()}else{if(a=s(),tt===null)throw Error(n(349));(sr&30)!==0||If(c,s,a)}f.memoizedState=a;var g={value:a,getSnapshot:s};return f.queue=g,Ff(Lf.bind(null,c,g,r),[r]),c.flags|=2048,ti(9,Df.bind(null,c,g,a,s),void 0,null),a},useId:function(){var r=sn(),s=tt.identifierPrefix;if(Ue){var a=pn,c=fn;a=(c&~(1<<32-zt(c)-1)).toString(32)+a,s=":"+s+"R"+a,a=Zs++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=tx++,s=":"+s+"r"+a.toString(32)+":";return r.memoizedState=s},unstable_isNewReconciler:!1},ox={readContext:Mt,useCallback:Hf,useContext:Mt,useEffect:cu,useImperativeHandle:Wf,useInsertionEffect:Bf,useLayoutEffect:zf,useMemo:Kf,useReducer:lu,useRef:Vf,useState:function(){return lu(ei)},useDebugValue:du,useDeferredValue:function(r){var s=Ut();return Gf(s,Qe.memoizedState,r)},useTransition:function(){var r=lu(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Rf,useSyncExternalStore:Of,useId:Jf,unstable_isNewReconciler:!1},ax={readContext:Mt,useCallback:Hf,useContext:Mt,useEffect:cu,useImperativeHandle:Wf,useInsertionEffect:Bf,useLayoutEffect:zf,useMemo:Kf,useReducer:uu,useRef:Vf,useState:function(){return uu(ei)},useDebugValue:du,useDeferredValue:function(r){var s=Ut();return Qe===null?s.memoizedState=r:Gf(s,Qe.memoizedState,r)},useTransition:function(){var r=uu(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Rf,useSyncExternalStore:Of,useId:Jf,unstable_isNewReconciler:!1};function Ht(r,s){if(r&&r.defaultProps){s=K({},s),r=r.defaultProps;for(var a in r)s[a]===void 0&&(s[a]=r[a]);return s}return s}function hu(r,s,a,c){s=r.memoizedState,a=a(c,s),a=a==null?s:K({},s,a),r.memoizedState=a,r.lanes===0&&(r.updateQueue.baseState=a)}var Lo={isMounted:function(r){return(r=r._reactInternals)?Qn(r)===r:!1},enqueueSetState:function(r,s,a){r=r._reactInternals;var c=gt(),f=Vn(r),g=gn(c,f);g.payload=s,a!=null&&(g.callback=a),s=Ln(r,g,f),s!==null&&(Jt(s,r,f,c),Co(s,r,f))},enqueueReplaceState:function(r,s,a){r=r._reactInternals;var c=gt(),f=Vn(r),g=gn(c,f);g.tag=1,g.payload=s,a!=null&&(g.callback=a),s=Ln(r,g,f),s!==null&&(Jt(s,r,f,c),Co(s,r,f))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var a=gt(),c=Vn(r),f=gn(a,c);f.tag=2,s!=null&&(f.callback=s),s=Ln(r,f,c),s!==null&&(Jt(s,r,c,a),Co(s,r,c))}};function Zf(r,s,a,c,f,g,x){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,g,x):s.prototype&&s.prototype.isPureReactComponent?!Fs(a,c)||!Fs(f,g):!0}function ep(r,s,a){var c=!1,f=On,g=s.contextType;return typeof g=="object"&&g!==null?g=Mt(g):(f=vt(s)?Zn:lt.current,c=s.contextTypes,g=(c=c!=null)?$r(r,f):On),s=new s(a,g),r.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Lo,r.stateNode=s,s._reactInternals=r,c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=f,r.__reactInternalMemoizedMaskedChildContext=g),s}function tp(r,s,a,c){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,c),s.state!==r&&Lo.enqueueReplaceState(s,s.state,null)}function fu(r,s,a,c){var f=r.stateNode;f.props=a,f.state=r.memoizedState,f.refs={},Zl(r);var g=s.contextType;typeof g=="object"&&g!==null?f.context=Mt(g):(g=vt(s)?Zn:lt.current,f.context=$r(r,g)),f.state=r.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(hu(r,s,g,a),f.state=r.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(s=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),s!==f.state&&Lo.enqueueReplaceState(f,f.state,null),No(r,a,f,c),f.state=r.memoizedState),typeof f.componentDidMount=="function"&&(r.flags|=4194308)}function Kr(r,s){try{var a="",c=s;do a+=fe(c),c=c.return;while(c);var f=a}catch(g){f=`
5
+ `+f[x].replace(" at new "," at ");return r.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",r.displayName)),C}while(1<=x&&0<=T);break}}}finally{se=!1,Error.prepareStackTrace=a}return(r=r?r.displayName||r.name:"")?D(r):""}function fe(r){switch(r.tag){case 5:return D(r.type);case 16:return D("Lazy");case 13:return D("Suspense");case 19:return D("SuspenseList");case 0:case 2:case 15:return r=ue(r.type,!1),r;case 11:return r=ue(r.type.render,!1),r;case 1:return r=ue(r.type,!0),r;default:return""}}function ie(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case $:return"Fragment";case z:return"Portal";case Y:return"Profiler";case B:return"StrictMode";case je:return"Suspense";case xe:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case Te:return(r.displayName||"Context")+".Consumer";case oe:return(r._context.displayName||"Context")+".Provider";case ve:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Oe:return s=r.displayName||null,s!==null?s:ie(r.type)||"Memo";case be:s=r._payload,r=r._init;try{return ie(r(s))}catch{}}return null}function Ee(r){var s=r.type;switch(r.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=s.render,r=r.displayName||r.name||"",s.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(s);case 8:return s===B?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function ke(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Me(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Et(r){var s=Me(r)?"checked":"value",a=Object.getOwnPropertyDescriptor(r.constructor.prototype,s),c=""+r[s];if(!r.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,g=a.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return f.call(this)},set:function(x){c=""+x,g.call(this,x)}}),Object.defineProperty(r,s,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(x){c=""+x},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Ki(r){r._valueTracker||(r._valueTracker=Et(r))}function Zd(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var a=s.getValue(),c="";return r&&(c=Me(r)?r.checked?"true":"false":r.value),r=c,r!==a?(s.setValue(r),!0):!1}function Gi(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Qa(r,s){var a=s.checked;return K({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??r._wrapperState.initialChecked})}function eh(r,s){var a=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;a=ke(s.value!=null?s.value:a),r._wrapperState={initialChecked:c,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function th(r,s){s=s.checked,s!=null&&N(r,"checked",s,!1)}function Xa(r,s){th(r,s);var a=ke(s.value),c=s.type;if(a!=null)c==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+a):r.value!==""+a&&(r.value=""+a);else if(c==="submit"||c==="reset"){r.removeAttribute("value");return}s.hasOwnProperty("value")?Za(r,s.type,a):s.hasOwnProperty("defaultValue")&&Za(r,s.type,ke(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(r.defaultChecked=!!s.defaultChecked)}function nh(r,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var c=s.type;if(!(c!=="submit"&&c!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+r._wrapperState.initialValue,a||s===r.value||(r.value=s),r.defaultValue=s}a=r.name,a!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,a!==""&&(r.name=a)}function Za(r,s,a){(s!=="number"||Gi(r.ownerDocument)!==r)&&(a==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+a&&(r.defaultValue=""+a))}var Ss=Array.isArray;function jr(r,s,a,c){if(r=r.options,s){s={};for(var f=0;f<a.length;f++)s["$"+a[f]]=!0;for(a=0;a<r.length;a++)f=s.hasOwnProperty("$"+r[a].value),r[a].selected!==f&&(r[a].selected=f),f&&c&&(r[a].defaultSelected=!0)}else{for(a=""+ke(a),s=null,f=0;f<r.length;f++){if(r[f].value===a){r[f].selected=!0,c&&(r[f].defaultSelected=!0);return}s!==null||r[f].disabled||(s=r[f])}s!==null&&(s.selected=!0)}}function el(r,s){if(s.dangerouslySetInnerHTML!=null)throw Error(n(91));return K({},s,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function rh(r,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(n(92));if(Ss(a)){if(1<a.length)throw Error(n(93));a=a[0]}s=a}s==null&&(s=""),a=s}r._wrapperState={initialValue:ke(a)}}function sh(r,s){var a=ke(s.value),c=ke(s.defaultValue);a!=null&&(a=""+a,a!==r.value&&(r.value=a),s.defaultValue==null&&r.defaultValue!==a&&(r.defaultValue=a)),c!=null&&(r.defaultValue=""+c)}function ih(r){var s=r.textContent;s===r._wrapperState.initialValue&&s!==""&&s!==null&&(r.value=s)}function oh(r){switch(r){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 tl(r,s){return r==null||r==="http://www.w3.org/1999/xhtml"?oh(s):r==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Ji,ah=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,c,f){MSApp.execUnsafeLocalFunction(function(){return r(s,a,c,f)})}:r})(function(r,s){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=s;else{for(Ji=Ji||document.createElement("div"),Ji.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Ji.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;s.firstChild;)r.appendChild(s.firstChild)}});function ks(r,s){if(s){var a=r.firstChild;if(a&&a===r.lastChild&&a.nodeType===3){a.nodeValue=s;return}}r.textContent=s}var Es={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},$v=["Webkit","ms","Moz","O"];Object.keys(Es).forEach(function(r){$v.forEach(function(s){s=s+r.charAt(0).toUpperCase()+r.substring(1),Es[s]=Es[r]})});function lh(r,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||Es.hasOwnProperty(r)&&Es[r]?(""+s).trim():s+"px"}function uh(r,s){r=r.style;for(var a in s)if(s.hasOwnProperty(a)){var c=a.indexOf("--")===0,f=lh(a,s[a],c);a==="float"&&(a="cssFloat"),c?r.setProperty(a,f):r[a]=f}}var Vv=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 nl(r,s){if(s){if(Vv[r]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(n(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(n(61))}if(s.style!=null&&typeof s.style!="object")throw Error(n(62))}}function rl(r,s){if(r.indexOf("-")===-1)return typeof s.is=="string";switch(r){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 sl=null;function il(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ol=null,Cr=null,Nr=null;function ch(r){if(r=Ks(r)){if(typeof ol!="function")throw Error(n(280));var s=r.stateNode;s&&(s=wo(s),ol(r.stateNode,r.type,s))}}function dh(r){Cr?Nr?Nr.push(r):Nr=[r]:Cr=r}function hh(){if(Cr){var r=Cr,s=Nr;if(Nr=Cr=null,ch(r),s)for(r=0;r<s.length;r++)ch(s[r])}}function fh(r,s){return r(s)}function ph(){}var al=!1;function mh(r,s,a){if(al)return r(s,a);al=!0;try{return fh(r,s,a)}finally{al=!1,(Cr!==null||Nr!==null)&&(ph(),hh())}}function Ts(r,s){var a=r.stateNode;if(a===null)return null;var c=wo(a);if(c===null)return null;a=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(r=r.type,c=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!c;break e;default:r=!1}if(r)return null;if(a&&typeof a!="function")throw Error(n(231,s,typeof a));return a}var ll=!1;if(d)try{var js={};Object.defineProperty(js,"passive",{get:function(){ll=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{ll=!1}function Fv(r,s,a,c,f,g,x,T,C){var L=Array.prototype.slice.call(arguments,3);try{s.apply(a,L)}catch(W){this.onError(W)}}var Cs=!1,Yi=null,Qi=!1,ul=null,Bv={onError:function(r){Cs=!0,Yi=r}};function zv(r,s,a,c,f,g,x,T,C){Cs=!1,Yi=null,Fv.apply(Bv,arguments)}function qv(r,s,a,c,f,g,x,T,C){if(zv.apply(this,arguments),Cs){if(Cs){var L=Yi;Cs=!1,Yi=null}else throw Error(n(198));Qi||(Qi=!0,ul=L)}}function Qn(r){var s=r,a=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(a=s.return),r=s.return;while(r)}return s.tag===3?a:null}function gh(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function yh(r){if(Qn(r)!==r)throw Error(n(188))}function Wv(r){var s=r.alternate;if(!s){if(s=Qn(r),s===null)throw Error(n(188));return s!==r?null:r}for(var a=r,c=s;;){var f=a.return;if(f===null)break;var g=f.alternate;if(g===null){if(c=f.return,c!==null){a=c;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===a)return yh(f),r;if(g===c)return yh(f),s;g=g.sibling}throw Error(n(188))}if(a.return!==c.return)a=f,c=g;else{for(var x=!1,T=f.child;T;){if(T===a){x=!0,a=f,c=g;break}if(T===c){x=!0,c=f,a=g;break}T=T.sibling}if(!x){for(T=g.child;T;){if(T===a){x=!0,a=g,c=f;break}if(T===c){x=!0,c=g,a=f;break}T=T.sibling}if(!x)throw Error(n(189))}}if(a.alternate!==c)throw Error(n(190))}if(a.tag!==3)throw Error(n(188));return a.stateNode.current===a?r:s}function vh(r){return r=Wv(r),r!==null?wh(r):null}function wh(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var s=wh(r);if(s!==null)return s;r=r.sibling}return null}var xh=e.unstable_scheduleCallback,bh=e.unstable_cancelCallback,Hv=e.unstable_shouldYield,Kv=e.unstable_requestPaint,He=e.unstable_now,Gv=e.unstable_getCurrentPriorityLevel,cl=e.unstable_ImmediatePriority,_h=e.unstable_UserBlockingPriority,Xi=e.unstable_NormalPriority,Jv=e.unstable_LowPriority,Sh=e.unstable_IdlePriority,Zi=null,tn=null;function Yv(r){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Zi,r,void 0,(r.current.flags&128)===128)}catch{}}var zt=Math.clz32?Math.clz32:Zv,Qv=Math.log,Xv=Math.LN2;function Zv(r){return r>>>=0,r===0?32:31-(Qv(r)/Xv|0)|0}var eo=64,to=4194304;function Ns(r){switch(r&-r){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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function no(r,s){var a=r.pendingLanes;if(a===0)return 0;var c=0,f=r.suspendedLanes,g=r.pingedLanes,x=a&268435455;if(x!==0){var T=x&~f;T!==0?c=Ns(T):(g&=x,g!==0&&(c=Ns(g)))}else x=a&~f,x!==0?c=Ns(x):g!==0&&(c=Ns(g));if(c===0)return 0;if(s!==0&&s!==c&&(s&f)===0&&(f=c&-c,g=s&-s,f>=g||f===16&&(g&4194240)!==0))return s;if((c&4)!==0&&(c|=a&16),s=r.entangledLanes,s!==0)for(r=r.entanglements,s&=c;0<s;)a=31-zt(s),f=1<<a,c|=r[a],s&=~f;return c}function ew(r,s){switch(r){case 1:case 2:case 4:return s+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 s+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 tw(r,s){for(var a=r.suspendedLanes,c=r.pingedLanes,f=r.expirationTimes,g=r.pendingLanes;0<g;){var x=31-zt(g),T=1<<x,C=f[x];C===-1?((T&a)===0||(T&c)!==0)&&(f[x]=ew(T,s)):C<=s&&(r.expiredLanes|=T),g&=~T}}function dl(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function kh(){var r=eo;return eo<<=1,(eo&4194240)===0&&(eo=64),r}function hl(r){for(var s=[],a=0;31>a;a++)s.push(r);return s}function As(r,s,a){r.pendingLanes|=s,s!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,s=31-zt(s),r[s]=a}function nw(r,s){var a=r.pendingLanes&~s;r.pendingLanes=s,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=s,r.mutableReadLanes&=s,r.entangledLanes&=s,s=r.entanglements;var c=r.eventTimes;for(r=r.expirationTimes;0<a;){var f=31-zt(a),g=1<<f;s[f]=0,c[f]=-1,r[f]=-1,a&=~g}}function fl(r,s){var a=r.entangledLanes|=s;for(r=r.entanglements;a;){var c=31-zt(a),f=1<<c;f&s|r[c]&s&&(r[c]|=s),a&=~f}}var Ce=0;function Eh(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Th,pl,jh,Ch,Nh,ml=!1,ro=[],En=null,Tn=null,jn=null,Ps=new Map,Rs=new Map,Cn=[],rw="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 Ah(r,s){switch(r){case"focusin":case"focusout":En=null;break;case"dragenter":case"dragleave":Tn=null;break;case"mouseover":case"mouseout":jn=null;break;case"pointerover":case"pointerout":Ps.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rs.delete(s.pointerId)}}function Os(r,s,a,c,f,g){return r===null||r.nativeEvent!==g?(r={blockedOn:s,domEventName:a,eventSystemFlags:c,nativeEvent:g,targetContainers:[f]},s!==null&&(s=Ks(s),s!==null&&pl(s)),r):(r.eventSystemFlags|=c,s=r.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),r)}function sw(r,s,a,c,f){switch(s){case"focusin":return En=Os(En,r,s,a,c,f),!0;case"dragenter":return Tn=Os(Tn,r,s,a,c,f),!0;case"mouseover":return jn=Os(jn,r,s,a,c,f),!0;case"pointerover":var g=f.pointerId;return Ps.set(g,Os(Ps.get(g)||null,r,s,a,c,f)),!0;case"gotpointercapture":return g=f.pointerId,Rs.set(g,Os(Rs.get(g)||null,r,s,a,c,f)),!0}return!1}function Ph(r){var s=Xn(r.target);if(s!==null){var a=Qn(s);if(a!==null){if(s=a.tag,s===13){if(s=gh(a),s!==null){r.blockedOn=s,Nh(r.priority,function(){jh(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){r.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}r.blockedOn=null}function so(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var a=yl(r.domEventName,r.eventSystemFlags,s[0],r.nativeEvent);if(a===null){a=r.nativeEvent;var c=new a.constructor(a.type,a);sl=c,a.target.dispatchEvent(c),sl=null}else return s=Ks(a),s!==null&&pl(s),r.blockedOn=a,!1;s.shift()}return!0}function Rh(r,s,a){so(r)&&a.delete(s)}function iw(){ml=!1,En!==null&&so(En)&&(En=null),Tn!==null&&so(Tn)&&(Tn=null),jn!==null&&so(jn)&&(jn=null),Ps.forEach(Rh),Rs.forEach(Rh)}function Is(r,s){r.blockedOn===s&&(r.blockedOn=null,ml||(ml=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,iw)))}function Ds(r){function s(f){return Is(f,r)}if(0<ro.length){Is(ro[0],r);for(var a=1;a<ro.length;a++){var c=ro[a];c.blockedOn===r&&(c.blockedOn=null)}}for(En!==null&&Is(En,r),Tn!==null&&Is(Tn,r),jn!==null&&Is(jn,r),Ps.forEach(s),Rs.forEach(s),a=0;a<Cn.length;a++)c=Cn[a],c.blockedOn===r&&(c.blockedOn=null);for(;0<Cn.length&&(a=Cn[0],a.blockedOn===null);)Ph(a),a.blockedOn===null&&Cn.shift()}var Ar=U.ReactCurrentBatchConfig,io=!0;function ow(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=1,gl(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function aw(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=4,gl(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function gl(r,s,a,c){if(io){var f=yl(r,s,a,c);if(f===null)Il(r,s,c,oo,a),Ah(r,c);else if(sw(f,r,s,a,c))c.stopPropagation();else if(Ah(r,c),s&4&&-1<rw.indexOf(r)){for(;f!==null;){var g=Ks(f);if(g!==null&&Th(g),g=yl(r,s,a,c),g===null&&Il(r,s,c,oo,a),g===f)break;f=g}f!==null&&c.stopPropagation()}else Il(r,s,c,null,a)}}var oo=null;function yl(r,s,a,c){if(oo=null,r=il(c),r=Xn(r),r!==null)if(s=Qn(r),s===null)r=null;else if(a=s.tag,a===13){if(r=gh(s),r!==null)return r;r=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null);return oo=r,null}function Oh(r){switch(r){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(Gv()){case cl:return 1;case _h:return 4;case Xi:case Jv:return 16;case Sh:return 536870912;default:return 16}default:return 16}}var Nn=null,vl=null,ao=null;function Ih(){if(ao)return ao;var r,s=vl,a=s.length,c,f="value"in Nn?Nn.value:Nn.textContent,g=f.length;for(r=0;r<a&&s[r]===f[r];r++);var x=a-r;for(c=1;c<=x&&s[a-c]===f[g-c];c++);return ao=f.slice(r,1<c?1-c:void 0)}function lo(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function uo(){return!0}function Dh(){return!1}function Tt(r){function s(a,c,f,g,x){this._reactName=a,this._targetInst=f,this.type=c,this.nativeEvent=g,this.target=x,this.currentTarget=null;for(var T in r)r.hasOwnProperty(T)&&(a=r[T],this[T]=a?a(g):g[T]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?uo:Dh,this.isPropagationStopped=Dh,this}return K(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=uo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=uo)},persist:function(){},isPersistent:uo}),s}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wl=Tt(Pr),Ls=K({},Pr,{view:0,detail:0}),lw=Tt(Ls),xl,bl,Ms,co=K({},Ls,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sl,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ms&&(Ms&&r.type==="mousemove"?(xl=r.screenX-Ms.screenX,bl=r.screenY-Ms.screenY):bl=xl=0,Ms=r),xl)},movementY:function(r){return"movementY"in r?r.movementY:bl}}),Lh=Tt(co),uw=K({},co,{dataTransfer:0}),cw=Tt(uw),dw=K({},Ls,{relatedTarget:0}),_l=Tt(dw),hw=K({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),fw=Tt(hw),pw=K({},Pr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),mw=Tt(pw),gw=K({},Pr,{data:0}),Mh=Tt(gw),yw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vw={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"},ww={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xw(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=ww[r])?!!s[r]:!1}function Sl(){return xw}var bw=K({},Ls,{key:function(r){if(r.key){var s=yw[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=lo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?vw[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sl,charCode:function(r){return r.type==="keypress"?lo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?lo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),_w=Tt(bw),Sw=K({},co,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Uh=Tt(Sw),kw=K({},Ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sl}),Ew=Tt(kw),Tw=K({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),jw=Tt(Tw),Cw=K({},co,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Nw=Tt(Cw),Aw=[9,13,27,32],kl=d&&"CompositionEvent"in window,Us=null;d&&"documentMode"in document&&(Us=document.documentMode);var Pw=d&&"TextEvent"in window&&!Us,$h=d&&(!kl||Us&&8<Us&&11>=Us),Vh=" ",Fh=!1;function Bh(r,s){switch(r){case"keyup":return Aw.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zh(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Rr=!1;function Rw(r,s){switch(r){case"compositionend":return zh(s);case"keypress":return s.which!==32?null:(Fh=!0,Vh);case"textInput":return r=s.data,r===Vh&&Fh?null:r;default:return null}}function Ow(r,s){if(Rr)return r==="compositionend"||!kl&&Bh(r,s)?(r=Ih(),ao=vl=Nn=null,Rr=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return $h&&s.locale!=="ko"?null:s.data;default:return null}}var Iw={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 qh(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Iw[r.type]:s==="textarea"}function Wh(r,s,a,c){dh(c),s=go(s,"onChange"),0<s.length&&(a=new wl("onChange","change",null,a,c),r.push({event:a,listeners:s}))}var $s=null,Vs=null;function Dw(r){cf(r,0)}function ho(r){var s=Mr(r);if(Zd(s))return r}function Lw(r,s){if(r==="change")return s}var Hh=!1;if(d){var El;if(d){var Tl="oninput"in document;if(!Tl){var Kh=document.createElement("div");Kh.setAttribute("oninput","return;"),Tl=typeof Kh.oninput=="function"}El=Tl}else El=!1;Hh=El&&(!document.documentMode||9<document.documentMode)}function Gh(){$s&&($s.detachEvent("onpropertychange",Jh),Vs=$s=null)}function Jh(r){if(r.propertyName==="value"&&ho(Vs)){var s=[];Wh(s,Vs,r,il(r)),mh(Dw,s)}}function Mw(r,s,a){r==="focusin"?(Gh(),$s=s,Vs=a,$s.attachEvent("onpropertychange",Jh)):r==="focusout"&&Gh()}function Uw(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ho(Vs)}function $w(r,s){if(r==="click")return ho(s)}function Vw(r,s){if(r==="input"||r==="change")return ho(s)}function Fw(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var qt=typeof Object.is=="function"?Object.is:Fw;function Fs(r,s){if(qt(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var a=Object.keys(r),c=Object.keys(s);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var f=a[c];if(!h.call(s,f)||!qt(r[f],s[f]))return!1}return!0}function Yh(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Qh(r,s){var a=Yh(r);r=0;for(var c;a;){if(a.nodeType===3){if(c=r+a.textContent.length,r<=s&&c>=s)return{node:a,offset:s-r};r=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Yh(a)}}function Xh(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Xh(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Zh(){for(var r=window,s=Gi();s instanceof r.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)r=s.contentWindow;else break;s=Gi(r.document)}return s}function jl(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}function Bw(r){var s=Zh(),a=r.focusedElem,c=r.selectionRange;if(s!==a&&a&&a.ownerDocument&&Xh(a.ownerDocument.documentElement,a)){if(c!==null&&jl(a)){if(s=c.start,r=c.end,r===void 0&&(r=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(r,a.value.length);else if(r=(s=a.ownerDocument||document)&&s.defaultView||window,r.getSelection){r=r.getSelection();var f=a.textContent.length,g=Math.min(c.start,f);c=c.end===void 0?g:Math.min(c.end,f),!r.extend&&g>c&&(f=c,c=g,g=f),f=Qh(a,g);var x=Qh(a,c);f&&x&&(r.rangeCount!==1||r.anchorNode!==f.node||r.anchorOffset!==f.offset||r.focusNode!==x.node||r.focusOffset!==x.offset)&&(s=s.createRange(),s.setStart(f.node,f.offset),r.removeAllRanges(),g>c?(r.addRange(s),r.extend(x.node,x.offset)):(s.setEnd(x.node,x.offset),r.addRange(s)))}}for(s=[],r=a;r=r.parentNode;)r.nodeType===1&&s.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)r=s[a],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var zw=d&&"documentMode"in document&&11>=document.documentMode,Or=null,Cl=null,Bs=null,Nl=!1;function ef(r,s,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nl||Or==null||Or!==Gi(c)||(c=Or,"selectionStart"in c&&jl(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Bs&&Fs(Bs,c)||(Bs=c,c=go(Cl,"onSelect"),0<c.length&&(s=new wl("onSelect","select",null,s,a),r.push({event:s,listeners:c}),s.target=Or)))}function fo(r,s){var a={};return a[r.toLowerCase()]=s.toLowerCase(),a["Webkit"+r]="webkit"+s,a["Moz"+r]="moz"+s,a}var Ir={animationend:fo("Animation","AnimationEnd"),animationiteration:fo("Animation","AnimationIteration"),animationstart:fo("Animation","AnimationStart"),transitionend:fo("Transition","TransitionEnd")},Al={},tf={};d&&(tf=document.createElement("div").style,"AnimationEvent"in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),"TransitionEvent"in window||delete Ir.transitionend.transition);function po(r){if(Al[r])return Al[r];if(!Ir[r])return r;var s=Ir[r],a;for(a in s)if(s.hasOwnProperty(a)&&a in tf)return Al[r]=s[a];return r}var nf=po("animationend"),rf=po("animationiteration"),sf=po("animationstart"),of=po("transitionend"),af=new Map,lf="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 An(r,s){af.set(r,s),l(s,[r])}for(var Pl=0;Pl<lf.length;Pl++){var Rl=lf[Pl],qw=Rl.toLowerCase(),Ww=Rl[0].toUpperCase()+Rl.slice(1);An(qw,"on"+Ww)}An(nf,"onAnimationEnd"),An(rf,"onAnimationIteration"),An(sf,"onAnimationStart"),An("dblclick","onDoubleClick"),An("focusin","onFocus"),An("focusout","onBlur"),An(of,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zs="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(" "),Hw=new Set("cancel close invalid load scroll toggle".split(" ").concat(zs));function uf(r,s,a){var c=r.type||"unknown-event";r.currentTarget=a,qv(c,s,void 0,r),r.currentTarget=null}function cf(r,s){s=(s&4)!==0;for(var a=0;a<r.length;a++){var c=r[a],f=c.event;c=c.listeners;e:{var g=void 0;if(s)for(var x=c.length-1;0<=x;x--){var T=c[x],C=T.instance,L=T.currentTarget;if(T=T.listener,C!==g&&f.isPropagationStopped())break e;uf(f,T,L),g=C}else for(x=0;x<c.length;x++){if(T=c[x],C=T.instance,L=T.currentTarget,T=T.listener,C!==g&&f.isPropagationStopped())break e;uf(f,T,L),g=C}}}if(Qi)throw r=ul,Qi=!1,ul=null,r}function Ie(r,s){var a=s[Vl];a===void 0&&(a=s[Vl]=new Set);var c=r+"__bubble";a.has(c)||(df(s,r,2,!1),a.add(c))}function Ol(r,s,a){var c=0;s&&(c|=4),df(a,r,c,s)}var mo="_reactListening"+Math.random().toString(36).slice(2);function qs(r){if(!r[mo]){r[mo]=!0,i.forEach(function(a){a!=="selectionchange"&&(Hw.has(a)||Ol(a,!1,r),Ol(a,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[mo]||(s[mo]=!0,Ol("selectionchange",!1,s))}}function df(r,s,a,c){switch(Oh(s)){case 1:var f=ow;break;case 4:f=aw;break;default:f=gl}a=f.bind(null,s,a,r),f=void 0,!ll||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),c?f!==void 0?r.addEventListener(s,a,{capture:!0,passive:f}):r.addEventListener(s,a,!0):f!==void 0?r.addEventListener(s,a,{passive:f}):r.addEventListener(s,a,!1)}function Il(r,s,a,c,f){var g=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var x=c.tag;if(x===3||x===4){var T=c.stateNode.containerInfo;if(T===f||T.nodeType===8&&T.parentNode===f)break;if(x===4)for(x=c.return;x!==null;){var C=x.tag;if((C===3||C===4)&&(C=x.stateNode.containerInfo,C===f||C.nodeType===8&&C.parentNode===f))return;x=x.return}for(;T!==null;){if(x=Xn(T),x===null)return;if(C=x.tag,C===5||C===6){c=g=x;continue e}T=T.parentNode}}c=c.return}mh(function(){var L=g,W=il(a),H=[];e:{var q=af.get(r);if(q!==void 0){var Q=wl,ee=r;switch(r){case"keypress":if(lo(a)===0)break e;case"keydown":case"keyup":Q=_w;break;case"focusin":ee="focus",Q=_l;break;case"focusout":ee="blur",Q=_l;break;case"beforeblur":case"afterblur":Q=_l;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=Lh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=cw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=Ew;break;case nf:case rf:case sf:Q=fw;break;case of:Q=jw;break;case"scroll":Q=lw;break;case"wheel":Q=Nw;break;case"copy":case"cut":case"paste":Q=mw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Uh}var te=(s&4)!==0,Ke=!te&&r==="scroll",O=te?q!==null?q+"Capture":null:q;te=[];for(var A=L,I;A!==null;){I=A;var G=I.stateNode;if(I.tag===5&&G!==null&&(I=G,O!==null&&(G=Ts(A,O),G!=null&&te.push(Ws(A,G,I)))),Ke)break;A=A.return}0<te.length&&(q=new Q(q,ee,null,a,W),H.push({event:q,listeners:te}))}}if((s&7)===0){e:{if(q=r==="mouseover"||r==="pointerover",Q=r==="mouseout"||r==="pointerout",q&&a!==sl&&(ee=a.relatedTarget||a.fromElement)&&(Xn(ee)||ee[dn]))break e;if((Q||q)&&(q=W.window===W?W:(q=W.ownerDocument)?q.defaultView||q.parentWindow:window,Q?(ee=a.relatedTarget||a.toElement,Q=L,ee=ee?Xn(ee):null,ee!==null&&(Ke=Qn(ee),ee!==Ke||ee.tag!==5&&ee.tag!==6)&&(ee=null)):(Q=null,ee=L),Q!==ee)){if(te=Lh,G="onMouseLeave",O="onMouseEnter",A="mouse",(r==="pointerout"||r==="pointerover")&&(te=Uh,G="onPointerLeave",O="onPointerEnter",A="pointer"),Ke=Q==null?q:Mr(Q),I=ee==null?q:Mr(ee),q=new te(G,A+"leave",Q,a,W),q.target=Ke,q.relatedTarget=I,G=null,Xn(W)===L&&(te=new te(O,A+"enter",ee,a,W),te.target=I,te.relatedTarget=Ke,G=te),Ke=G,Q&&ee)t:{for(te=Q,O=ee,A=0,I=te;I;I=Dr(I))A++;for(I=0,G=O;G;G=Dr(G))I++;for(;0<A-I;)te=Dr(te),A--;for(;0<I-A;)O=Dr(O),I--;for(;A--;){if(te===O||O!==null&&te===O.alternate)break t;te=Dr(te),O=Dr(O)}te=null}else te=null;Q!==null&&hf(H,q,Q,te,!1),ee!==null&&Ke!==null&&hf(H,Ke,ee,te,!0)}}e:{if(q=L?Mr(L):window,Q=q.nodeName&&q.nodeName.toLowerCase(),Q==="select"||Q==="input"&&q.type==="file")var ne=Lw;else if(qh(q))if(Hh)ne=Vw;else{ne=Uw;var ae=Mw}else(Q=q.nodeName)&&Q.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(ne=$w);if(ne&&(ne=ne(r,L))){Wh(H,ne,a,W);break e}ae&&ae(r,q,L),r==="focusout"&&(ae=q._wrapperState)&&ae.controlled&&q.type==="number"&&Za(q,"number",q.value)}switch(ae=L?Mr(L):window,r){case"focusin":(qh(ae)||ae.contentEditable==="true")&&(Or=ae,Cl=L,Bs=null);break;case"focusout":Bs=Cl=Or=null;break;case"mousedown":Nl=!0;break;case"contextmenu":case"mouseup":case"dragend":Nl=!1,ef(H,a,W);break;case"selectionchange":if(zw)break;case"keydown":case"keyup":ef(H,a,W)}var le;if(kl)e:{switch(r){case"compositionstart":var ge="onCompositionStart";break e;case"compositionend":ge="onCompositionEnd";break e;case"compositionupdate":ge="onCompositionUpdate";break e}ge=void 0}else Rr?Bh(r,a)&&(ge="onCompositionEnd"):r==="keydown"&&a.keyCode===229&&(ge="onCompositionStart");ge&&($h&&a.locale!=="ko"&&(Rr||ge!=="onCompositionStart"?ge==="onCompositionEnd"&&Rr&&(le=Ih()):(Nn=W,vl="value"in Nn?Nn.value:Nn.textContent,Rr=!0)),ae=go(L,ge),0<ae.length&&(ge=new Mh(ge,r,null,a,W),H.push({event:ge,listeners:ae}),le?ge.data=le:(le=zh(a),le!==null&&(ge.data=le)))),(le=Pw?Rw(r,a):Ow(r,a))&&(L=go(L,"onBeforeInput"),0<L.length&&(W=new Mh("onBeforeInput","beforeinput",null,a,W),H.push({event:W,listeners:L}),W.data=le))}cf(H,s)})}function Ws(r,s,a){return{instance:r,listener:s,currentTarget:a}}function go(r,s){for(var a=s+"Capture",c=[];r!==null;){var f=r,g=f.stateNode;f.tag===5&&g!==null&&(f=g,g=Ts(r,a),g!=null&&c.unshift(Ws(r,g,f)),g=Ts(r,s),g!=null&&c.push(Ws(r,g,f))),r=r.return}return c}function Dr(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function hf(r,s,a,c,f){for(var g=s._reactName,x=[];a!==null&&a!==c;){var T=a,C=T.alternate,L=T.stateNode;if(C!==null&&C===c)break;T.tag===5&&L!==null&&(T=L,f?(C=Ts(a,g),C!=null&&x.unshift(Ws(a,C,T))):f||(C=Ts(a,g),C!=null&&x.push(Ws(a,C,T)))),a=a.return}x.length!==0&&r.push({event:s,listeners:x})}var Kw=/\r\n?/g,Gw=/\u0000|\uFFFD/g;function ff(r){return(typeof r=="string"?r:""+r).replace(Kw,`
6
+ `).replace(Gw,"")}function yo(r,s,a){if(s=ff(s),ff(r)!==s&&a)throw Error(n(425))}function vo(){}var Dl=null,Ll=null;function Ml(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ul=typeof setTimeout=="function"?setTimeout:void 0,Jw=typeof clearTimeout=="function"?clearTimeout:void 0,pf=typeof Promise=="function"?Promise:void 0,Yw=typeof queueMicrotask=="function"?queueMicrotask:typeof pf<"u"?function(r){return pf.resolve(null).then(r).catch(Qw)}:Ul;function Qw(r){setTimeout(function(){throw r})}function $l(r,s){var a=s,c=0;do{var f=a.nextSibling;if(r.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(c===0){r.removeChild(f),Ds(s);return}c--}else a!=="$"&&a!=="$?"&&a!=="$!"||c++;a=f}while(a);Ds(s)}function Pn(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return r}function mf(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var a=r.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return r;s--}else a==="/$"&&s++}r=r.previousSibling}return null}var Lr=Math.random().toString(36).slice(2),nn="__reactFiber$"+Lr,Hs="__reactProps$"+Lr,dn="__reactContainer$"+Lr,Vl="__reactEvents$"+Lr,Xw="__reactListeners$"+Lr,Zw="__reactHandles$"+Lr;function Xn(r){var s=r[nn];if(s)return s;for(var a=r.parentNode;a;){if(s=a[dn]||a[nn]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(r=mf(r);r!==null;){if(a=r[nn])return a;r=mf(r)}return s}r=a,a=r.parentNode}return null}function Ks(r){return r=r[nn]||r[dn],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Mr(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function wo(r){return r[Hs]||null}var Fl=[],Ur=-1;function Rn(r){return{current:r}}function De(r){0>Ur||(r.current=Fl[Ur],Fl[Ur]=null,Ur--)}function Ae(r,s){Ur++,Fl[Ur]=r.current,r.current=s}var On={},lt=Rn(On),yt=Rn(!1),Zn=On;function $r(r,s){var a=r.type.contextTypes;if(!a)return On;var c=r.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in a)f[g]=s[g];return c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=s,r.__reactInternalMemoizedMaskedChildContext=f),f}function vt(r){return r=r.childContextTypes,r!=null}function xo(){De(yt),De(lt)}function gf(r,s,a){if(lt.current!==On)throw Error(n(168));Ae(lt,s),Ae(yt,a)}function yf(r,s,a){var c=r.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return a;c=c.getChildContext();for(var f in c)if(!(f in s))throw Error(n(108,Ee(r)||"Unknown",f));return K({},a,c)}function bo(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||On,Zn=lt.current,Ae(lt,r),Ae(yt,yt.current),!0}function vf(r,s,a){var c=r.stateNode;if(!c)throw Error(n(169));a?(r=yf(r,s,Zn),c.__reactInternalMemoizedMergedChildContext=r,De(yt),De(lt),Ae(lt,r)):De(yt),Ae(yt,a)}var hn=null,_o=!1,Bl=!1;function wf(r){hn===null?hn=[r]:hn.push(r)}function ex(r){_o=!0,wf(r)}function In(){if(!Bl&&hn!==null){Bl=!0;var r=0,s=Ce;try{var a=hn;for(Ce=1;r<a.length;r++){var c=a[r];do c=c(!0);while(c!==null)}hn=null,_o=!1}catch(f){throw hn!==null&&(hn=hn.slice(r+1)),xh(cl,In),f}finally{Ce=s,Bl=!1}}return null}var Vr=[],Fr=0,So=null,ko=0,Dt=[],Lt=0,er=null,fn=1,pn="";function tr(r,s){Vr[Fr++]=ko,Vr[Fr++]=So,So=r,ko=s}function xf(r,s,a){Dt[Lt++]=fn,Dt[Lt++]=pn,Dt[Lt++]=er,er=r;var c=fn;r=pn;var f=32-zt(c)-1;c&=~(1<<f),a+=1;var g=32-zt(s)+f;if(30<g){var x=f-f%5;g=(c&(1<<x)-1).toString(32),c>>=x,f-=x,fn=1<<32-zt(s)+f|a<<f|c,pn=g+r}else fn=1<<g|a<<f|c,pn=r}function zl(r){r.return!==null&&(tr(r,1),xf(r,1,0))}function ql(r){for(;r===So;)So=Vr[--Fr],Vr[Fr]=null,ko=Vr[--Fr],Vr[Fr]=null;for(;r===er;)er=Dt[--Lt],Dt[Lt]=null,pn=Dt[--Lt],Dt[Lt]=null,fn=Dt[--Lt],Dt[Lt]=null}var jt=null,Ct=null,Ue=!1,Wt=null;function bf(r,s){var a=Vt(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=r,s=r.deletions,s===null?(r.deletions=[a],r.flags|=16):s.push(a)}function _f(r,s){switch(r.tag){case 5:var a=r.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(r.stateNode=s,jt=r,Ct=Pn(s.firstChild),!0):!1;case 6:return s=r.pendingProps===""||s.nodeType!==3?null:s,s!==null?(r.stateNode=s,jt=r,Ct=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=er!==null?{id:fn,overflow:pn}:null,r.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=Vt(18,null,null,0),a.stateNode=s,a.return=r,r.child=a,jt=r,Ct=null,!0):!1;default:return!1}}function Wl(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Hl(r){if(Ue){var s=Ct;if(s){var a=s;if(!_f(r,s)){if(Wl(r))throw Error(n(418));s=Pn(a.nextSibling);var c=jt;s&&_f(r,s)?bf(c,a):(r.flags=r.flags&-4097|2,Ue=!1,jt=r)}}else{if(Wl(r))throw Error(n(418));r.flags=r.flags&-4097|2,Ue=!1,jt=r}}}function Sf(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jt=r}function Eo(r){if(r!==jt)return!1;if(!Ue)return Sf(r),Ue=!0,!1;var s;if((s=r.tag!==3)&&!(s=r.tag!==5)&&(s=r.type,s=s!=="head"&&s!=="body"&&!Ml(r.type,r.memoizedProps)),s&&(s=Ct)){if(Wl(r))throw kf(),Error(n(418));for(;s;)bf(r,s),s=Pn(s.nextSibling)}if(Sf(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,s=0;r;){if(r.nodeType===8){var a=r.data;if(a==="/$"){if(s===0){Ct=Pn(r.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}r=r.nextSibling}Ct=null}}else Ct=jt?Pn(r.stateNode.nextSibling):null;return!0}function kf(){for(var r=Ct;r;)r=Pn(r.nextSibling)}function Br(){Ct=jt=null,Ue=!1}function Kl(r){Wt===null?Wt=[r]:Wt.push(r)}var tx=U.ReactCurrentBatchConfig;function Gs(r,s,a){if(r=a.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(n(309));var c=a.stateNode}if(!c)throw Error(n(147,r));var f=c,g=""+r;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(x){var T=f.refs;x===null?delete T[g]:T[g]=x},s._stringRef=g,s)}if(typeof r!="string")throw Error(n(284));if(!a._owner)throw Error(n(290,r))}return r}function To(r,s){throw r=Object.prototype.toString.call(s),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r))}function Ef(r){var s=r._init;return s(r._payload)}function Tf(r){function s(O,A){if(r){var I=O.deletions;I===null?(O.deletions=[A],O.flags|=16):I.push(A)}}function a(O,A){if(!r)return null;for(;A!==null;)s(O,A),A=A.sibling;return null}function c(O,A){for(O=new Map;A!==null;)A.key!==null?O.set(A.key,A):O.set(A.index,A),A=A.sibling;return O}function f(O,A){return O=Bn(O,A),O.index=0,O.sibling=null,O}function g(O,A,I){return O.index=I,r?(I=O.alternate,I!==null?(I=I.index,I<A?(O.flags|=2,A):I):(O.flags|=2,A)):(O.flags|=1048576,A)}function x(O){return r&&O.alternate===null&&(O.flags|=2),O}function T(O,A,I,G){return A===null||A.tag!==6?(A=Uu(I,O.mode,G),A.return=O,A):(A=f(A,I),A.return=O,A)}function C(O,A,I,G){var ne=I.type;return ne===$?W(O,A,I.props.children,G,I.key):A!==null&&(A.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===be&&Ef(ne)===A.type)?(G=f(A,I.props),G.ref=Gs(O,A,I),G.return=O,G):(G=Yo(I.type,I.key,I.props,null,O.mode,G),G.ref=Gs(O,A,I),G.return=O,G)}function L(O,A,I,G){return A===null||A.tag!==4||A.stateNode.containerInfo!==I.containerInfo||A.stateNode.implementation!==I.implementation?(A=$u(I,O.mode,G),A.return=O,A):(A=f(A,I.children||[]),A.return=O,A)}function W(O,A,I,G,ne){return A===null||A.tag!==7?(A=ur(I,O.mode,G,ne),A.return=O,A):(A=f(A,I),A.return=O,A)}function H(O,A,I){if(typeof A=="string"&&A!==""||typeof A=="number")return A=Uu(""+A,O.mode,I),A.return=O,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case V:return I=Yo(A.type,A.key,A.props,null,O.mode,I),I.ref=Gs(O,null,A),I.return=O,I;case z:return A=$u(A,O.mode,I),A.return=O,A;case be:var G=A._init;return H(O,G(A._payload),I)}if(Ss(A)||J(A))return A=ur(A,O.mode,I,null),A.return=O,A;To(O,A)}return null}function q(O,A,I,G){var ne=A!==null?A.key:null;if(typeof I=="string"&&I!==""||typeof I=="number")return ne!==null?null:T(O,A,""+I,G);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case V:return I.key===ne?C(O,A,I,G):null;case z:return I.key===ne?L(O,A,I,G):null;case be:return ne=I._init,q(O,A,ne(I._payload),G)}if(Ss(I)||J(I))return ne!==null?null:W(O,A,I,G,null);To(O,I)}return null}function Q(O,A,I,G,ne){if(typeof G=="string"&&G!==""||typeof G=="number")return O=O.get(I)||null,T(A,O,""+G,ne);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case V:return O=O.get(G.key===null?I:G.key)||null,C(A,O,G,ne);case z:return O=O.get(G.key===null?I:G.key)||null,L(A,O,G,ne);case be:var ae=G._init;return Q(O,A,I,ae(G._payload),ne)}if(Ss(G)||J(G))return O=O.get(I)||null,W(A,O,G,ne,null);To(A,G)}return null}function ee(O,A,I,G){for(var ne=null,ae=null,le=A,ge=A=0,nt=null;le!==null&&ge<I.length;ge++){le.index>ge?(nt=le,le=null):nt=le.sibling;var Se=q(O,le,I[ge],G);if(Se===null){le===null&&(le=nt);break}r&&le&&Se.alternate===null&&s(O,le),A=g(Se,A,ge),ae===null?ne=Se:ae.sibling=Se,ae=Se,le=nt}if(ge===I.length)return a(O,le),Ue&&tr(O,ge),ne;if(le===null){for(;ge<I.length;ge++)le=H(O,I[ge],G),le!==null&&(A=g(le,A,ge),ae===null?ne=le:ae.sibling=le,ae=le);return Ue&&tr(O,ge),ne}for(le=c(O,le);ge<I.length;ge++)nt=Q(le,O,ge,I[ge],G),nt!==null&&(r&&nt.alternate!==null&&le.delete(nt.key===null?ge:nt.key),A=g(nt,A,ge),ae===null?ne=nt:ae.sibling=nt,ae=nt);return r&&le.forEach(function(zn){return s(O,zn)}),Ue&&tr(O,ge),ne}function te(O,A,I,G){var ne=J(I);if(typeof ne!="function")throw Error(n(150));if(I=ne.call(I),I==null)throw Error(n(151));for(var ae=ne=null,le=A,ge=A=0,nt=null,Se=I.next();le!==null&&!Se.done;ge++,Se=I.next()){le.index>ge?(nt=le,le=null):nt=le.sibling;var zn=q(O,le,Se.value,G);if(zn===null){le===null&&(le=nt);break}r&&le&&zn.alternate===null&&s(O,le),A=g(zn,A,ge),ae===null?ne=zn:ae.sibling=zn,ae=zn,le=nt}if(Se.done)return a(O,le),Ue&&tr(O,ge),ne;if(le===null){for(;!Se.done;ge++,Se=I.next())Se=H(O,Se.value,G),Se!==null&&(A=g(Se,A,ge),ae===null?ne=Se:ae.sibling=Se,ae=Se);return Ue&&tr(O,ge),ne}for(le=c(O,le);!Se.done;ge++,Se=I.next())Se=Q(le,O,ge,Se.value,G),Se!==null&&(r&&Se.alternate!==null&&le.delete(Se.key===null?ge:Se.key),A=g(Se,A,ge),ae===null?ne=Se:ae.sibling=Se,ae=Se);return r&&le.forEach(function(Ix){return s(O,Ix)}),Ue&&tr(O,ge),ne}function Ke(O,A,I,G){if(typeof I=="object"&&I!==null&&I.type===$&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case V:e:{for(var ne=I.key,ae=A;ae!==null;){if(ae.key===ne){if(ne=I.type,ne===$){if(ae.tag===7){a(O,ae.sibling),A=f(ae,I.props.children),A.return=O,O=A;break e}}else if(ae.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===be&&Ef(ne)===ae.type){a(O,ae.sibling),A=f(ae,I.props),A.ref=Gs(O,ae,I),A.return=O,O=A;break e}a(O,ae);break}else s(O,ae);ae=ae.sibling}I.type===$?(A=ur(I.props.children,O.mode,G,I.key),A.return=O,O=A):(G=Yo(I.type,I.key,I.props,null,O.mode,G),G.ref=Gs(O,A,I),G.return=O,O=G)}return x(O);case z:e:{for(ae=I.key;A!==null;){if(A.key===ae)if(A.tag===4&&A.stateNode.containerInfo===I.containerInfo&&A.stateNode.implementation===I.implementation){a(O,A.sibling),A=f(A,I.children||[]),A.return=O,O=A;break e}else{a(O,A);break}else s(O,A);A=A.sibling}A=$u(I,O.mode,G),A.return=O,O=A}return x(O);case be:return ae=I._init,Ke(O,A,ae(I._payload),G)}if(Ss(I))return ee(O,A,I,G);if(J(I))return te(O,A,I,G);To(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,A!==null&&A.tag===6?(a(O,A.sibling),A=f(A,I),A.return=O,O=A):(a(O,A),A=Uu(I,O.mode,G),A.return=O,O=A),x(O)):a(O,A)}return Ke}var zr=Tf(!0),jf=Tf(!1),jo=Rn(null),Co=null,qr=null,Gl=null;function Jl(){Gl=qr=Co=null}function Yl(r){var s=jo.current;De(jo),r._currentValue=s}function Ql(r,s,a){for(;r!==null;){var c=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),r===a)break;r=r.return}}function Wr(r,s){Co=r,Gl=qr=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&s)!==0&&(wt=!0),r.firstContext=null)}function Mt(r){var s=r._currentValue;if(Gl!==r)if(r={context:r,memoizedValue:s,next:null},qr===null){if(Co===null)throw Error(n(308));qr=r,Co.dependencies={lanes:0,firstContext:r}}else qr=qr.next=r;return s}var nr=null;function Xl(r){nr===null?nr=[r]:nr.push(r)}function Cf(r,s,a,c){var f=s.interleaved;return f===null?(a.next=a,Xl(s)):(a.next=f.next,f.next=a),s.interleaved=a,mn(r,c)}function mn(r,s){r.lanes|=s;var a=r.alternate;for(a!==null&&(a.lanes|=s),a=r,r=r.return;r!==null;)r.childLanes|=s,a=r.alternate,a!==null&&(a.childLanes|=s),a=r,r=r.return;return a.tag===3?a.stateNode:null}var Dn=!1;function Zl(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nf(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function gn(r,s){return{eventTime:r,lane:s,tag:0,payload:null,callback:null,next:null}}function Ln(r,s,a){var c=r.updateQueue;if(c===null)return null;if(c=c.shared,(_e&2)!==0){var f=c.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),c.pending=s,mn(r,a)}return f=c.interleaved,f===null?(s.next=s,Xl(c)):(s.next=f.next,f.next=s),c.interleaved=s,mn(r,a)}function No(r,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var c=s.lanes;c&=r.pendingLanes,a|=c,s.lanes=a,fl(r,a)}}function Af(r,s){var a=r.updateQueue,c=r.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var f=null,g=null;if(a=a.firstBaseUpdate,a!==null){do{var x={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};g===null?f=g=x:g=g.next=x,a=a.next}while(a!==null);g===null?f=g=s:g=g.next=s}else f=g=s;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:c.shared,effects:c.effects},r.updateQueue=a;return}r=a.lastBaseUpdate,r===null?a.firstBaseUpdate=s:r.next=s,a.lastBaseUpdate=s}function Ao(r,s,a,c){var f=r.updateQueue;Dn=!1;var g=f.firstBaseUpdate,x=f.lastBaseUpdate,T=f.shared.pending;if(T!==null){f.shared.pending=null;var C=T,L=C.next;C.next=null,x===null?g=L:x.next=L,x=C;var W=r.alternate;W!==null&&(W=W.updateQueue,T=W.lastBaseUpdate,T!==x&&(T===null?W.firstBaseUpdate=L:T.next=L,W.lastBaseUpdate=C))}if(g!==null){var H=f.baseState;x=0,W=L=C=null,T=g;do{var q=T.lane,Q=T.eventTime;if((c&q)===q){W!==null&&(W=W.next={eventTime:Q,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var ee=r,te=T;switch(q=s,Q=a,te.tag){case 1:if(ee=te.payload,typeof ee=="function"){H=ee.call(Q,H,q);break e}H=ee;break e;case 3:ee.flags=ee.flags&-65537|128;case 0:if(ee=te.payload,q=typeof ee=="function"?ee.call(Q,H,q):ee,q==null)break e;H=K({},H,q);break e;case 2:Dn=!0}}T.callback!==null&&T.lane!==0&&(r.flags|=64,q=f.effects,q===null?f.effects=[T]:q.push(T))}else Q={eventTime:Q,lane:q,tag:T.tag,payload:T.payload,callback:T.callback,next:null},W===null?(L=W=Q,C=H):W=W.next=Q,x|=q;if(T=T.next,T===null){if(T=f.shared.pending,T===null)break;q=T,T=q.next,q.next=null,f.lastBaseUpdate=q,f.shared.pending=null}}while(!0);if(W===null&&(C=H),f.baseState=C,f.firstBaseUpdate=L,f.lastBaseUpdate=W,s=f.shared.interleaved,s!==null){f=s;do x|=f.lane,f=f.next;while(f!==s)}else g===null&&(f.shared.lanes=0);ir|=x,r.lanes=x,r.memoizedState=H}}function Pf(r,s,a){if(r=s.effects,s.effects=null,r!==null)for(s=0;s<r.length;s++){var c=r[s],f=c.callback;if(f!==null){if(c.callback=null,c=a,typeof f!="function")throw Error(n(191,f));f.call(c)}}}var Js={},rn=Rn(Js),Ys=Rn(Js),Qs=Rn(Js);function rr(r){if(r===Js)throw Error(n(174));return r}function eu(r,s){switch(Ae(Qs,s),Ae(Ys,r),Ae(rn,Js),r=s.nodeType,r){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:tl(null,"");break;default:r=r===8?s.parentNode:s,s=r.namespaceURI||null,r=r.tagName,s=tl(s,r)}De(rn),Ae(rn,s)}function Hr(){De(rn),De(Ys),De(Qs)}function Rf(r){rr(Qs.current);var s=rr(rn.current),a=tl(s,r.type);s!==a&&(Ae(Ys,r),Ae(rn,a))}function tu(r){Ys.current===r&&(De(rn),De(Ys))}var $e=Rn(0);function Po(r){for(var s=r;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var nu=[];function ru(){for(var r=0;r<nu.length;r++)nu[r]._workInProgressVersionPrimary=null;nu.length=0}var Ro=U.ReactCurrentDispatcher,su=U.ReactCurrentBatchConfig,sr=0,Ve=null,Qe=null,et=null,Oo=!1,Xs=!1,Zs=0,nx=0;function ut(){throw Error(n(321))}function iu(r,s){if(s===null)return!1;for(var a=0;a<s.length&&a<r.length;a++)if(!qt(r[a],s[a]))return!1;return!0}function ou(r,s,a,c,f,g){if(sr=g,Ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ro.current=r===null||r.memoizedState===null?ox:ax,r=a(c,f),Xs){g=0;do{if(Xs=!1,Zs=0,25<=g)throw Error(n(301));g+=1,et=Qe=null,s.updateQueue=null,Ro.current=lx,r=a(c,f)}while(Xs)}if(Ro.current=Lo,s=Qe!==null&&Qe.next!==null,sr=0,et=Qe=Ve=null,Oo=!1,s)throw Error(n(300));return r}function au(){var r=Zs!==0;return Zs=0,r}function sn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return et===null?Ve.memoizedState=et=r:et=et.next=r,et}function Ut(){if(Qe===null){var r=Ve.alternate;r=r!==null?r.memoizedState:null}else r=Qe.next;var s=et===null?Ve.memoizedState:et.next;if(s!==null)et=s,Qe=r;else{if(r===null)throw Error(n(310));Qe=r,r={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},et===null?Ve.memoizedState=et=r:et=et.next=r}return et}function ei(r,s){return typeof s=="function"?s(r):s}function lu(r){var s=Ut(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var c=Qe,f=c.baseQueue,g=a.pending;if(g!==null){if(f!==null){var x=f.next;f.next=g.next,g.next=x}c.baseQueue=f=g,a.pending=null}if(f!==null){g=f.next,c=c.baseState;var T=x=null,C=null,L=g;do{var W=L.lane;if((sr&W)===W)C!==null&&(C=C.next={lane:0,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),c=L.hasEagerState?L.eagerState:r(c,L.action);else{var H={lane:W,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null};C===null?(T=C=H,x=c):C=C.next=H,Ve.lanes|=W,ir|=W}L=L.next}while(L!==null&&L!==g);C===null?x=c:C.next=T,qt(c,s.memoizedState)||(wt=!0),s.memoizedState=c,s.baseState=x,s.baseQueue=C,a.lastRenderedState=c}if(r=a.interleaved,r!==null){f=r;do g=f.lane,Ve.lanes|=g,ir|=g,f=f.next;while(f!==r)}else f===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function uu(r){var s=Ut(),a=s.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var c=a.dispatch,f=a.pending,g=s.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do g=r(g,x.action),x=x.next;while(x!==f);qt(g,s.memoizedState)||(wt=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),a.lastRenderedState=g}return[g,c]}function Of(){}function If(r,s){var a=Ve,c=Ut(),f=s(),g=!qt(c.memoizedState,f);if(g&&(c.memoizedState=f,wt=!0),c=c.queue,cu(Mf.bind(null,a,c,r),[r]),c.getSnapshot!==s||g||et!==null&&et.memoizedState.tag&1){if(a.flags|=2048,ti(9,Lf.bind(null,a,c,f,s),void 0,null),tt===null)throw Error(n(349));(sr&30)!==0||Df(a,s,f)}return f}function Df(r,s,a){r.flags|=16384,r={getSnapshot:s,value:a},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.stores=[r]):(a=s.stores,a===null?s.stores=[r]:a.push(r))}function Lf(r,s,a,c){s.value=a,s.getSnapshot=c,Uf(s)&&$f(r)}function Mf(r,s,a){return a(function(){Uf(s)&&$f(r)})}function Uf(r){var s=r.getSnapshot;r=r.value;try{var a=s();return!qt(r,a)}catch{return!0}}function $f(r){var s=mn(r,1);s!==null&&Jt(s,r,1,-1)}function Vf(r){var s=sn();return typeof r=="function"&&(r=r()),s.memoizedState=s.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:r},s.queue=r,r=r.dispatch=ix.bind(null,Ve,r),[s.memoizedState,r]}function ti(r,s,a,c){return r={tag:r,create:s,destroy:a,deps:c,next:null},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.lastEffect=r.next=r):(a=s.lastEffect,a===null?s.lastEffect=r.next=r:(c=a.next,a.next=r,r.next=c,s.lastEffect=r)),r}function Ff(){return Ut().memoizedState}function Io(r,s,a,c){var f=sn();Ve.flags|=r,f.memoizedState=ti(1|s,a,void 0,c===void 0?null:c)}function Do(r,s,a,c){var f=Ut();c=c===void 0?null:c;var g=void 0;if(Qe!==null){var x=Qe.memoizedState;if(g=x.destroy,c!==null&&iu(c,x.deps)){f.memoizedState=ti(s,a,g,c);return}}Ve.flags|=r,f.memoizedState=ti(1|s,a,g,c)}function Bf(r,s){return Io(8390656,8,r,s)}function cu(r,s){return Do(2048,8,r,s)}function zf(r,s){return Do(4,2,r,s)}function qf(r,s){return Do(4,4,r,s)}function Wf(r,s){if(typeof s=="function")return r=r(),s(r),function(){s(null)};if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function Hf(r,s,a){return a=a!=null?a.concat([r]):null,Do(4,4,Wf.bind(null,s,r),a)}function du(){}function Kf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&iu(s,c[1])?c[0]:(a.memoizedState=[r,s],r)}function Gf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&iu(s,c[1])?c[0]:(r=r(),a.memoizedState=[r,s],r)}function Jf(r,s,a){return(sr&21)===0?(r.baseState&&(r.baseState=!1,wt=!0),r.memoizedState=a):(qt(a,s)||(a=kh(),Ve.lanes|=a,ir|=a,r.baseState=!0),s)}function rx(r,s){var a=Ce;Ce=a!==0&&4>a?a:4,r(!0);var c=su.transition;su.transition={};try{r(!1),s()}finally{Ce=a,su.transition=c}}function Yf(){return Ut().memoizedState}function sx(r,s,a){var c=Vn(r);if(a={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null},Qf(r))Xf(s,a);else if(a=Cf(r,s,a,c),a!==null){var f=gt();Jt(a,r,c,f),Zf(a,s,c)}}function ix(r,s,a){var c=Vn(r),f={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null};if(Qf(r))Xf(s,f);else{var g=r.alternate;if(r.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var x=s.lastRenderedState,T=g(x,a);if(f.hasEagerState=!0,f.eagerState=T,qt(T,x)){var C=s.interleaved;C===null?(f.next=f,Xl(s)):(f.next=C.next,C.next=f),s.interleaved=f;return}}catch{}a=Cf(r,s,f,c),a!==null&&(f=gt(),Jt(a,r,c,f),Zf(a,s,c))}}function Qf(r){var s=r.alternate;return r===Ve||s!==null&&s===Ve}function Xf(r,s){Xs=Oo=!0;var a=r.pending;a===null?s.next=s:(s.next=a.next,a.next=s),r.pending=s}function Zf(r,s,a){if((a&4194240)!==0){var c=s.lanes;c&=r.pendingLanes,a|=c,s.lanes=a,fl(r,a)}}var Lo={readContext:Mt,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},ox={readContext:Mt,useCallback:function(r,s){return sn().memoizedState=[r,s===void 0?null:s],r},useContext:Mt,useEffect:Bf,useImperativeHandle:function(r,s,a){return a=a!=null?a.concat([r]):null,Io(4194308,4,Wf.bind(null,s,r),a)},useLayoutEffect:function(r,s){return Io(4194308,4,r,s)},useInsertionEffect:function(r,s){return Io(4,2,r,s)},useMemo:function(r,s){var a=sn();return s=s===void 0?null:s,r=r(),a.memoizedState=[r,s],r},useReducer:function(r,s,a){var c=sn();return s=a!==void 0?a(s):s,c.memoizedState=c.baseState=s,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:s},c.queue=r,r=r.dispatch=sx.bind(null,Ve,r),[c.memoizedState,r]},useRef:function(r){var s=sn();return r={current:r},s.memoizedState=r},useState:Vf,useDebugValue:du,useDeferredValue:function(r){return sn().memoizedState=r},useTransition:function(){var r=Vf(!1),s=r[0];return r=rx.bind(null,r[1]),sn().memoizedState=r,[s,r]},useMutableSource:function(){},useSyncExternalStore:function(r,s,a){var c=Ve,f=sn();if(Ue){if(a===void 0)throw Error(n(407));a=a()}else{if(a=s(),tt===null)throw Error(n(349));(sr&30)!==0||Df(c,s,a)}f.memoizedState=a;var g={value:a,getSnapshot:s};return f.queue=g,Bf(Mf.bind(null,c,g,r),[r]),c.flags|=2048,ti(9,Lf.bind(null,c,g,a,s),void 0,null),a},useId:function(){var r=sn(),s=tt.identifierPrefix;if(Ue){var a=pn,c=fn;a=(c&~(1<<32-zt(c)-1)).toString(32)+a,s=":"+s+"R"+a,a=Zs++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=nx++,s=":"+s+"r"+a.toString(32)+":";return r.memoizedState=s},unstable_isNewReconciler:!1},ax={readContext:Mt,useCallback:Kf,useContext:Mt,useEffect:cu,useImperativeHandle:Hf,useInsertionEffect:zf,useLayoutEffect:qf,useMemo:Gf,useReducer:lu,useRef:Ff,useState:function(){return lu(ei)},useDebugValue:du,useDeferredValue:function(r){var s=Ut();return Jf(s,Qe.memoizedState,r)},useTransition:function(){var r=lu(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Of,useSyncExternalStore:If,useId:Yf,unstable_isNewReconciler:!1},lx={readContext:Mt,useCallback:Kf,useContext:Mt,useEffect:cu,useImperativeHandle:Hf,useInsertionEffect:zf,useLayoutEffect:qf,useMemo:Gf,useReducer:uu,useRef:Ff,useState:function(){return uu(ei)},useDebugValue:du,useDeferredValue:function(r){var s=Ut();return Qe===null?s.memoizedState=r:Jf(s,Qe.memoizedState,r)},useTransition:function(){var r=uu(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Of,useSyncExternalStore:If,useId:Yf,unstable_isNewReconciler:!1};function Ht(r,s){if(r&&r.defaultProps){s=K({},s),r=r.defaultProps;for(var a in r)s[a]===void 0&&(s[a]=r[a]);return s}return s}function hu(r,s,a,c){s=r.memoizedState,a=a(c,s),a=a==null?s:K({},s,a),r.memoizedState=a,r.lanes===0&&(r.updateQueue.baseState=a)}var Mo={isMounted:function(r){return(r=r._reactInternals)?Qn(r)===r:!1},enqueueSetState:function(r,s,a){r=r._reactInternals;var c=gt(),f=Vn(r),g=gn(c,f);g.payload=s,a!=null&&(g.callback=a),s=Ln(r,g,f),s!==null&&(Jt(s,r,f,c),No(s,r,f))},enqueueReplaceState:function(r,s,a){r=r._reactInternals;var c=gt(),f=Vn(r),g=gn(c,f);g.tag=1,g.payload=s,a!=null&&(g.callback=a),s=Ln(r,g,f),s!==null&&(Jt(s,r,f,c),No(s,r,f))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var a=gt(),c=Vn(r),f=gn(a,c);f.tag=2,s!=null&&(f.callback=s),s=Ln(r,f,c),s!==null&&(Jt(s,r,c,a),No(s,r,c))}};function ep(r,s,a,c,f,g,x){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,g,x):s.prototype&&s.prototype.isPureReactComponent?!Fs(a,c)||!Fs(f,g):!0}function tp(r,s,a){var c=!1,f=On,g=s.contextType;return typeof g=="object"&&g!==null?g=Mt(g):(f=vt(s)?Zn:lt.current,c=s.contextTypes,g=(c=c!=null)?$r(r,f):On),s=new s(a,g),r.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Mo,r.stateNode=s,s._reactInternals=r,c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=f,r.__reactInternalMemoizedMaskedChildContext=g),s}function np(r,s,a,c){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,c),s.state!==r&&Mo.enqueueReplaceState(s,s.state,null)}function fu(r,s,a,c){var f=r.stateNode;f.props=a,f.state=r.memoizedState,f.refs={},Zl(r);var g=s.contextType;typeof g=="object"&&g!==null?f.context=Mt(g):(g=vt(s)?Zn:lt.current,f.context=$r(r,g)),f.state=r.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(hu(r,s,g,a),f.state=r.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(s=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),s!==f.state&&Mo.enqueueReplaceState(f,f.state,null),Ao(r,a,f,c),f.state=r.memoizedState),typeof f.componentDidMount=="function"&&(r.flags|=4194308)}function Kr(r,s){try{var a="",c=s;do a+=fe(c),c=c.return;while(c);var f=a}catch(g){f=`
7
7
  Error generating stack: `+g.message+`
8
- `+g.stack}return{value:r,source:s,stack:f,digest:null}}function pu(r,s,a){return{value:r,source:null,stack:a??null,digest:s??null}}function mu(r,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var lx=typeof WeakMap=="function"?WeakMap:Map;function np(r,s,a){a=gn(-1,a),a.tag=3,a.payload={element:null};var c=s.value;return a.callback=function(){zo||(zo=!0,Au=c),mu(r,s)},a}function rp(r,s,a){a=gn(-1,a),a.tag=3;var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var f=s.value;a.payload=function(){return c(f)},a.callback=function(){mu(r,s)}}var g=r.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){mu(r,s),typeof c!="function"&&(Un===null?Un=new Set([this]):Un.add(this));var x=s.stack;this.componentDidCatch(s.value,{componentStack:x!==null?x:""})}),a}function sp(r,s,a){var c=r.pingCache;if(c===null){c=r.pingCache=new lx;var f=new Set;c.set(s,f)}else f=c.get(s),f===void 0&&(f=new Set,c.set(s,f));f.has(a)||(f.add(a),r=_x.bind(null,r,s,a),s.then(r,r))}function ip(r){do{var s;if((s=r.tag===13)&&(s=r.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return r;r=r.return}while(r!==null);return null}function op(r,s,a,c,f){return(r.mode&1)===0?(r===s?r.flags|=65536:(r.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=gn(-1,1),s.tag=2,Ln(a,s,1))),a.lanes|=1),r):(r.flags|=65536,r.lanes=f,r)}var ux=U.ReactCurrentOwner,wt=!1;function mt(r,s,a,c){s.child=r===null?Tf(s,null,a,c):zr(s,r.child,a,c)}function ap(r,s,a,c,f){a=a.render;var g=s.ref;return Wr(s,f),c=ou(r,s,a,c,g,f),a=au(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,yn(r,s,f)):(Ue&&a&&zl(s),s.flags|=1,mt(r,s,c,f),s.child)}function lp(r,s,a,c,f){if(r===null){var g=a.type;return typeof g=="function"&&!Mu(g)&&g.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=g,up(r,s,g,c,f)):(r=Jo(a.type,null,c,s,s.mode,f),r.ref=s.ref,r.return=s,s.child=r)}if(g=r.child,(r.lanes&f)===0){var x=g.memoizedProps;if(a=a.compare,a=a!==null?a:Fs,a(x,c)&&r.ref===s.ref)return yn(r,s,f)}return s.flags|=1,r=Bn(g,c),r.ref=s.ref,r.return=s,s.child=r}function up(r,s,a,c,f){if(r!==null){var g=r.memoizedProps;if(Fs(g,c)&&r.ref===s.ref)if(wt=!1,s.pendingProps=c=g,(r.lanes&f)!==0)(r.flags&131072)!==0&&(wt=!0);else return s.lanes=r.lanes,yn(r,s,f)}return gu(r,s,a,c,f)}function cp(r,s,a){var c=s.pendingProps,f=c.children,g=r!==null?r.memoizedState:null;if(c.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ae(Jr,Nt),Nt|=a;else{if((a&1073741824)===0)return r=g!==null?g.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:r,cachePool:null,transitions:null},s.updateQueue=null,Ae(Jr,Nt),Nt|=r,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=g!==null?g.baseLanes:a,Ae(Jr,Nt),Nt|=c}else g!==null?(c=g.baseLanes|a,s.memoizedState=null):c=a,Ae(Jr,Nt),Nt|=c;return mt(r,s,f,a),s.child}function dp(r,s){var a=s.ref;(r===null&&a!==null||r!==null&&r.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function gu(r,s,a,c,f){var g=vt(a)?Zn:lt.current;return g=$r(s,g),Wr(s,f),a=ou(r,s,a,c,g,f),c=au(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,yn(r,s,f)):(Ue&&c&&zl(s),s.flags|=1,mt(r,s,a,f),s.child)}function hp(r,s,a,c,f){if(vt(a)){var g=!0;xo(s)}else g=!1;if(Wr(s,f),s.stateNode===null)Uo(r,s),ep(s,a,c),fu(s,a,c,f),c=!0;else if(r===null){var x=s.stateNode,T=s.memoizedProps;x.props=T;var C=x.context,L=a.contextType;typeof L=="object"&&L!==null?L=Mt(L):(L=vt(a)?Zn:lt.current,L=$r(s,L));var W=a.getDerivedStateFromProps,H=typeof W=="function"||typeof x.getSnapshotBeforeUpdate=="function";H||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==c||C!==L)&&tp(s,x,c,L),Dn=!1;var q=s.memoizedState;x.state=q,No(s,c,x,f),C=s.memoizedState,T!==c||q!==C||yt.current||Dn?(typeof W=="function"&&(hu(s,a,W,c),C=s.memoizedState),(T=Dn||Zf(s,a,T,c,q,C,L))?(H||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=C),x.props=c,x.state=C,x.context=L,c=T):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{x=s.stateNode,Cf(r,s),T=s.memoizedProps,L=s.type===s.elementType?T:Ht(s.type,T),x.props=L,H=s.pendingProps,q=x.context,C=a.contextType,typeof C=="object"&&C!==null?C=Mt(C):(C=vt(a)?Zn:lt.current,C=$r(s,C));var Q=a.getDerivedStateFromProps;(W=typeof Q=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==H||q!==C)&&tp(s,x,c,C),Dn=!1,q=s.memoizedState,x.state=q,No(s,c,x,f);var ee=s.memoizedState;T!==H||q!==ee||yt.current||Dn?(typeof Q=="function"&&(hu(s,a,Q,c),ee=s.memoizedState),(L=Dn||Zf(s,a,L,c,q,ee,C)||!1)?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(c,ee,C),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(c,ee,C)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=ee),x.props=c,x.state=ee,x.context=C,c=L):(typeof x.componentDidUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=1024),c=!1)}return yu(r,s,a,c,g,f)}function yu(r,s,a,c,f,g){dp(r,s);var x=(s.flags&128)!==0;if(!c&&!x)return f&&yf(s,a,!1),yn(r,s,g);c=s.stateNode,ux.current=s;var T=x&&typeof a.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,r!==null&&x?(s.child=zr(s,r.child,null,g),s.child=zr(s,null,T,g)):mt(r,s,T,g),s.memoizedState=c.state,f&&yf(s,a,!0),s.child}function fp(r){var s=r.stateNode;s.pendingContext?mf(r,s.pendingContext,s.pendingContext!==s.context):s.context&&mf(r,s.context,!1),eu(r,s.containerInfo)}function pp(r,s,a,c,f){return Br(),Kl(f),s.flags|=256,mt(r,s,a,c),s.child}var vu={dehydrated:null,treeContext:null,retryLane:0};function wu(r){return{baseLanes:r,cachePool:null,transitions:null}}function mp(r,s,a){var c=s.pendingProps,f=$e.current,g=!1,x=(s.flags&128)!==0,T;if((T=x)||(T=r!==null&&r.memoizedState===null?!1:(f&2)!==0),T?(g=!0,s.flags&=-129):(r===null||r.memoizedState!==null)&&(f|=1),Ae($e,f&1),r===null)return Hl(s),r=s.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((s.mode&1)===0?s.lanes=1:r.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(x=c.children,r=c.fallback,g?(c=s.mode,g=s.child,x={mode:"hidden",children:x},(c&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=x):g=Yo(x,c,0,null),r=ur(r,c,a,null),g.return=s,r.return=s,g.sibling=r,s.child=g,s.child.memoizedState=wu(a),s.memoizedState=vu,r):xu(s,x));if(f=r.memoizedState,f!==null&&(T=f.dehydrated,T!==null))return cx(r,s,x,c,T,f,a);if(g){g=c.fallback,x=s.mode,f=r.child,T=f.sibling;var C={mode:"hidden",children:c.children};return(x&1)===0&&s.child!==f?(c=s.child,c.childLanes=0,c.pendingProps=C,s.deletions=null):(c=Bn(f,C),c.subtreeFlags=f.subtreeFlags&14680064),T!==null?g=Bn(T,g):(g=ur(g,x,a,null),g.flags|=2),g.return=s,c.return=s,c.sibling=g,s.child=c,c=g,g=s.child,x=r.child.memoizedState,x=x===null?wu(a):{baseLanes:x.baseLanes|a,cachePool:null,transitions:x.transitions},g.memoizedState=x,g.childLanes=r.childLanes&~a,s.memoizedState=vu,c}return g=r.child,r=g.sibling,c=Bn(g,{mode:"visible",children:c.children}),(s.mode&1)===0&&(c.lanes=a),c.return=s,c.sibling=null,r!==null&&(a=s.deletions,a===null?(s.deletions=[r],s.flags|=16):a.push(r)),s.child=c,s.memoizedState=null,c}function xu(r,s){return s=Yo({mode:"visible",children:s},r.mode,0,null),s.return=r,r.child=s}function Mo(r,s,a,c){return c!==null&&Kl(c),zr(s,r.child,null,a),r=xu(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function cx(r,s,a,c,f,g,x){if(a)return s.flags&256?(s.flags&=-257,c=pu(Error(n(422))),Mo(r,s,x,c)):s.memoizedState!==null?(s.child=r.child,s.flags|=128,null):(g=c.fallback,f=s.mode,c=Yo({mode:"visible",children:c.children},f,0,null),g=ur(g,f,x,null),g.flags|=2,c.return=s,g.return=s,c.sibling=g,s.child=c,(s.mode&1)!==0&&zr(s,r.child,null,x),s.child.memoizedState=wu(x),s.memoizedState=vu,g);if((s.mode&1)===0)return Mo(r,s,x,null);if(f.data==="$!"){if(c=f.nextSibling&&f.nextSibling.dataset,c)var T=c.dgst;return c=T,g=Error(n(419)),c=pu(g,c,void 0),Mo(r,s,x,c)}if(T=(x&r.childLanes)!==0,wt||T){if(c=tt,c!==null){switch(x&-x){case 4:f=2;break;case 16:f=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:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(c.suspendedLanes|x))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,mn(r,f),Jt(c,r,f,-1))}return Lu(),c=pu(Error(n(421))),Mo(r,s,x,c)}return f.data==="$?"?(s.flags|=128,s.child=r.child,s=Sx.bind(null,r),f._reactRetry=s,null):(r=g.treeContext,Ct=Pn(f.nextSibling),jt=s,Ue=!0,Wt=null,r!==null&&(Dt[Lt++]=fn,Dt[Lt++]=pn,Dt[Lt++]=er,fn=r.id,pn=r.overflow,er=s),s=xu(s,c.children),s.flags|=4096,s)}function gp(r,s,a){r.lanes|=s;var c=r.alternate;c!==null&&(c.lanes|=s),Ql(r.return,s,a)}function bu(r,s,a,c,f){var g=r.memoizedState;g===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:f}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=c,g.tail=a,g.tailMode=f)}function yp(r,s,a){var c=s.pendingProps,f=c.revealOrder,g=c.tail;if(mt(r,s,c.children,a),c=$e.current,(c&2)!==0)c=c&1|2,s.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&gp(r,a,s);else if(r.tag===19)gp(r,a,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}c&=1}if(Ae($e,c),(s.mode&1)===0)s.memoizedState=null;else switch(f){case"forwards":for(a=s.child,f=null;a!==null;)r=a.alternate,r!==null&&Ao(r)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),bu(s,!1,f,a,g);break;case"backwards":for(a=null,f=s.child,s.child=null;f!==null;){if(r=f.alternate,r!==null&&Ao(r)===null){s.child=f;break}r=f.sibling,f.sibling=a,a=f,f=r}bu(s,!0,a,null,g);break;case"together":bu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Uo(r,s){(s.mode&1)===0&&r!==null&&(r.alternate=null,s.alternate=null,s.flags|=2)}function yn(r,s,a){if(r!==null&&(s.dependencies=r.dependencies),ir|=s.lanes,(a&s.childLanes)===0)return null;if(r!==null&&s.child!==r.child)throw Error(n(153));if(s.child!==null){for(r=s.child,a=Bn(r,r.pendingProps),s.child=a,a.return=s;r.sibling!==null;)r=r.sibling,a=a.sibling=Bn(r,r.pendingProps),a.return=s;a.sibling=null}return s.child}function dx(r,s,a){switch(s.tag){case 3:fp(s),Br();break;case 5:Pf(s);break;case 1:vt(s.type)&&xo(s);break;case 4:eu(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,f=s.memoizedProps.value;Ae(To,c._currentValue),c._currentValue=f;break;case 13:if(c=s.memoizedState,c!==null)return c.dehydrated!==null?(Ae($e,$e.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?mp(r,s,a):(Ae($e,$e.current&1),r=yn(r,s,a),r!==null?r.sibling:null);Ae($e,$e.current&1);break;case 19:if(c=(a&s.childLanes)!==0,(r.flags&128)!==0){if(c)return yp(r,s,a);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ae($e,$e.current),c)break;return null;case 22:case 23:return s.lanes=0,cp(r,s,a)}return yn(r,s,a)}var vp,_u,wp,xp;vp=function(r,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},_u=function(){},wp=function(r,s,a,c){var f=r.memoizedProps;if(f!==c){r=s.stateNode,rr(rn.current);var g=null;switch(a){case"input":f=Qa(r,f),c=Qa(r,c),g=[];break;case"select":f=K({},f,{value:void 0}),c=K({},c,{value:void 0}),g=[];break;case"textarea":f=el(r,f),c=el(r,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=yo)}nl(a,c);var x;a=null;for(L in f)if(!c.hasOwnProperty(L)&&f.hasOwnProperty(L)&&f[L]!=null)if(L==="style"){var T=f[L];for(x in T)T.hasOwnProperty(x)&&(a||(a={}),a[x]="")}else L!=="dangerouslySetInnerHTML"&&L!=="children"&&L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&L!=="autoFocus"&&(o.hasOwnProperty(L)?g||(g=[]):(g=g||[]).push(L,null));for(L in c){var C=c[L];if(T=f?.[L],c.hasOwnProperty(L)&&C!==T&&(C!=null||T!=null))if(L==="style")if(T){for(x in T)!T.hasOwnProperty(x)||C&&C.hasOwnProperty(x)||(a||(a={}),a[x]="");for(x in C)C.hasOwnProperty(x)&&T[x]!==C[x]&&(a||(a={}),a[x]=C[x])}else a||(g||(g=[]),g.push(L,a)),a=C;else L==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,T=T?T.__html:void 0,C!=null&&T!==C&&(g=g||[]).push(L,C)):L==="children"?typeof C!="string"&&typeof C!="number"||(g=g||[]).push(L,""+C):L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&(o.hasOwnProperty(L)?(C!=null&&L==="onScroll"&&Ie("scroll",r),g||T===C||(g=[])):(g=g||[]).push(L,C))}a&&(g=g||[]).push("style",a);var L=g;(s.updateQueue=L)&&(s.flags|=4)}},xp=function(r,s,a,c){a!==c&&(s.flags|=4)};function ni(r,s){if(!Ue)switch(r.tailMode){case"hidden":s=r.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?r.tail=null:a.sibling=null;break;case"collapsed":a=r.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:c.sibling=null}}function ct(r){var s=r.alternate!==null&&r.alternate.child===r.child,a=0,c=0;if(s)for(var f=r.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags&14680064,c|=f.flags&14680064,f.return=r,f=f.sibling;else for(f=r.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=r,f=f.sibling;return r.subtreeFlags|=c,r.childLanes=a,s}function hx(r,s,a){var c=s.pendingProps;switch(ql(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(s),null;case 1:return vt(s.type)&&wo(),ct(s),null;case 3:return c=s.stateNode,Hr(),De(yt),De(lt),ru(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(ko(s)?s.flags|=4:r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Wt!==null&&(Ou(Wt),Wt=null))),_u(r,s),ct(s),null;case 5:tu(s);var f=rr(Qs.current);if(a=s.type,r!==null&&s.stateNode!=null)wp(r,s,a,c,f),r.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(n(166));return ct(s),null}if(r=rr(rn.current),ko(s)){c=s.stateNode,a=s.type;var g=s.memoizedProps;switch(c[nn]=s,c[Hs]=g,r=(s.mode&1)!==0,a){case"dialog":Ie("cancel",c),Ie("close",c);break;case"iframe":case"object":case"embed":Ie("load",c);break;case"video":case"audio":for(f=0;f<zs.length;f++)Ie(zs[f],c);break;case"source":Ie("error",c);break;case"img":case"image":case"link":Ie("error",c),Ie("load",c);break;case"details":Ie("toggle",c);break;case"input":Zd(c,g),Ie("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!g.multiple},Ie("invalid",c);break;case"textarea":nh(c,g),Ie("invalid",c)}nl(a,g),f=null;for(var x in g)if(g.hasOwnProperty(x)){var T=g[x];x==="children"?typeof T=="string"?c.textContent!==T&&(g.suppressHydrationWarning!==!0&&go(c.textContent,T,r),f=["children",T]):typeof T=="number"&&c.textContent!==""+T&&(g.suppressHydrationWarning!==!0&&go(c.textContent,T,r),f=["children",""+T]):o.hasOwnProperty(x)&&T!=null&&x==="onScroll"&&Ie("scroll",c)}switch(a){case"input":Hi(c),th(c,g,!0);break;case"textarea":Hi(c),sh(c);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(c.onclick=yo)}c=f,s.updateQueue=c,c!==null&&(s.flags|=4)}else{x=f.nodeType===9?f:f.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=ih(a)),r==="http://www.w3.org/1999/xhtml"?a==="script"?(r=x.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof c.is=="string"?r=x.createElement(a,{is:c.is}):(r=x.createElement(a),a==="select"&&(x=r,c.multiple?x.multiple=!0:c.size&&(x.size=c.size))):r=x.createElementNS(r,a),r[nn]=s,r[Hs]=c,vp(r,s,!1,!1),s.stateNode=r;e:{switch(x=rl(a,c),a){case"dialog":Ie("cancel",r),Ie("close",r),f=c;break;case"iframe":case"object":case"embed":Ie("load",r),f=c;break;case"video":case"audio":for(f=0;f<zs.length;f++)Ie(zs[f],r);f=c;break;case"source":Ie("error",r),f=c;break;case"img":case"image":case"link":Ie("error",r),Ie("load",r),f=c;break;case"details":Ie("toggle",r),f=c;break;case"input":Zd(r,c),f=Qa(r,c),Ie("invalid",r);break;case"option":f=c;break;case"select":r._wrapperState={wasMultiple:!!c.multiple},f=K({},c,{value:void 0}),Ie("invalid",r);break;case"textarea":nh(r,c),f=el(r,c),Ie("invalid",r);break;default:f=c}nl(a,f),T=f;for(g in T)if(T.hasOwnProperty(g)){var C=T[g];g==="style"?lh(r,C):g==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,C!=null&&oh(r,C)):g==="children"?typeof C=="string"?(a!=="textarea"||C!=="")&&ks(r,C):typeof C=="number"&&ks(r,""+C):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(o.hasOwnProperty(g)?C!=null&&g==="onScroll"&&Ie("scroll",r):C!=null&&N(r,g,C,x))}switch(a){case"input":Hi(r),th(r,c,!1);break;case"textarea":Hi(r),sh(r);break;case"option":c.value!=null&&r.setAttribute("value",""+ke(c.value));break;case"select":r.multiple=!!c.multiple,g=c.value,g!=null?jr(r,!!c.multiple,g,!1):c.defaultValue!=null&&jr(r,!!c.multiple,c.defaultValue,!0);break;default:typeof f.onClick=="function"&&(r.onclick=yo)}switch(a){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return ct(s),null;case 6:if(r&&s.stateNode!=null)xp(r,s,r.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(n(166));if(a=rr(Qs.current),rr(rn.current),ko(s)){if(c=s.stateNode,a=s.memoizedProps,c[nn]=s,(g=c.nodeValue!==a)&&(r=jt,r!==null))switch(r.tag){case 3:go(c.nodeValue,a,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&go(c.nodeValue,a,(r.mode&1)!==0)}g&&(s.flags|=4)}else c=(a.nodeType===9?a:a.ownerDocument).createTextNode(c),c[nn]=s,s.stateNode=c}return ct(s),null;case 13:if(De($e),c=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Ue&&Ct!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Sf(),Br(),s.flags|=98560,g=!1;else if(g=ko(s),c!==null&&c.dehydrated!==null){if(r===null){if(!g)throw Error(n(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(n(317));g[nn]=s}else Br(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ct(s),g=!1}else Wt!==null&&(Ou(Wt),Wt=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(c=c!==null,c!==(r!==null&&r.memoizedState!==null)&&c&&(s.child.flags|=8192,(s.mode&1)!==0&&(r===null||($e.current&1)!==0?Xe===0&&(Xe=3):Lu())),s.updateQueue!==null&&(s.flags|=4),ct(s),null);case 4:return Hr(),_u(r,s),r===null&&qs(s.stateNode.containerInfo),ct(s),null;case 10:return Yl(s.type._context),ct(s),null;case 17:return vt(s.type)&&wo(),ct(s),null;case 19:if(De($e),g=s.memoizedState,g===null)return ct(s),null;if(c=(s.flags&128)!==0,x=g.rendering,x===null)if(c)ni(g,!1);else{if(Xe!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=Ao(r),x!==null){for(s.flags|=128,ni(g,!1),c=x.updateQueue,c!==null&&(s.updateQueue=c,s.flags|=4),s.subtreeFlags=0,c=a,a=s.child;a!==null;)g=a,r=c,g.flags&=14680066,x=g.alternate,x===null?(g.childLanes=0,g.lanes=r,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=x.childLanes,g.lanes=x.lanes,g.child=x.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=x.memoizedProps,g.memoizedState=x.memoizedState,g.updateQueue=x.updateQueue,g.type=x.type,r=x.dependencies,g.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),a=a.sibling;return Ae($e,$e.current&1|2),s.child}r=r.sibling}g.tail!==null&&He()>Yr&&(s.flags|=128,c=!0,ni(g,!1),s.lanes=4194304)}else{if(!c)if(r=Ao(x),r!==null){if(s.flags|=128,c=!0,a=r.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),ni(g,!0),g.tail===null&&g.tailMode==="hidden"&&!x.alternate&&!Ue)return ct(s),null}else 2*He()-g.renderingStartTime>Yr&&a!==1073741824&&(s.flags|=128,c=!0,ni(g,!1),s.lanes=4194304);g.isBackwards?(x.sibling=s.child,s.child=x):(a=g.last,a!==null?a.sibling=x:s.child=x,g.last=x)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=He(),s.sibling=null,a=$e.current,Ae($e,c?a&1|2:a&1),s):(ct(s),null);case 22:case 23:return Du(),c=s.memoizedState!==null,r!==null&&r.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Nt&1073741824)!==0&&(ct(s),s.subtreeFlags&6&&(s.flags|=8192)):ct(s),null;case 24:return null;case 25:return null}throw Error(n(156,s.tag))}function fx(r,s){switch(ql(s),s.tag){case 1:return vt(s.type)&&wo(),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return Hr(),De(yt),De(lt),ru(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return tu(s),null;case 13:if(De($e),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(n(340));Br()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return De($e),null;case 4:return Hr(),null;case 10:return Yl(s.type._context),null;case 22:case 23:return Du(),null;case 24:return null;default:return null}}var $o=!1,dt=!1,px=typeof WeakSet=="function"?WeakSet:Set,X=null;function Gr(r,s){var a=r.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(c){ze(r,s,c)}else a.current=null}function Su(r,s,a){try{a()}catch(c){ze(r,s,c)}}var bp=!1;function mx(r,s){if(Dl=so,r=Xh(),jl(r)){if("selectionStart"in r)var a={start:r.selectionStart,end:r.selectionEnd};else e:{a=(a=r.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var x=0,T=-1,C=-1,L=0,W=0,H=r,q=null;t:for(;;){for(var Q;H!==a||f!==0&&H.nodeType!==3||(T=x+f),H!==g||c!==0&&H.nodeType!==3||(C=x+c),H.nodeType===3&&(x+=H.nodeValue.length),(Q=H.firstChild)!==null;)q=H,H=Q;for(;;){if(H===r)break t;if(q===a&&++L===f&&(T=x),q===g&&++W===c&&(C=x),(Q=H.nextSibling)!==null)break;H=q,q=H.parentNode}H=Q}a=T===-1||C===-1?null:{start:T,end:C}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ll={focusedElem:r,selectionRange:a},so=!1,X=s;X!==null;)if(s=X,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,X=r;else for(;X!==null;){s=X;try{var ee=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(ee!==null){var te=ee.memoizedProps,Ke=ee.memoizedState,O=s.stateNode,A=O.getSnapshotBeforeUpdate(s.elementType===s.type?te:Ht(s.type,te),Ke);O.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var I=s.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(G){ze(s,s.return,G)}if(r=s.sibling,r!==null){r.return=s.return,X=r;break}X=s.return}return ee=bp,bp=!1,ee}function ri(r,s,a){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&r)===r){var g=f.destroy;f.destroy=void 0,g!==void 0&&Su(s,a,g)}f=f.next}while(f!==c)}}function Vo(r,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&r)===r){var c=a.create;a.destroy=c()}a=a.next}while(a!==s)}}function ku(r){var s=r.ref;if(s!==null){var a=r.stateNode;r.tag,r=a,typeof s=="function"?s(r):s.current=r}}function _p(r){var s=r.alternate;s!==null&&(r.alternate=null,_p(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&(delete s[nn],delete s[Hs],delete s[Vl],delete s[Qw],delete s[Xw])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Sp(r){return r.tag===5||r.tag===3||r.tag===4}function kp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Sp(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Eu(r,s,a){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(r,s):a.insertBefore(r,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(r,a)):(s=a,s.appendChild(r)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=yo));else if(c!==4&&(r=r.child,r!==null))for(Eu(r,s,a),r=r.sibling;r!==null;)Eu(r,s,a),r=r.sibling}function Tu(r,s,a){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?a.insertBefore(r,s):a.appendChild(r);else if(c!==4&&(r=r.child,r!==null))for(Tu(r,s,a),r=r.sibling;r!==null;)Tu(r,s,a),r=r.sibling}var rt=null,Kt=!1;function Mn(r,s,a){for(a=a.child;a!==null;)Ep(r,s,a),a=a.sibling}function Ep(r,s,a){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Xi,a)}catch{}switch(a.tag){case 5:dt||Gr(a,s);case 6:var c=rt,f=Kt;rt=null,Mn(r,s,a),rt=c,Kt=f,rt!==null&&(Kt?(r=rt,a=a.stateNode,r.nodeType===8?r.parentNode.removeChild(a):r.removeChild(a)):rt.removeChild(a.stateNode));break;case 18:rt!==null&&(Kt?(r=rt,a=a.stateNode,r.nodeType===8?$l(r.parentNode,a):r.nodeType===1&&$l(r,a),Ds(r)):$l(rt,a.stateNode));break;case 4:c=rt,f=Kt,rt=a.stateNode.containerInfo,Kt=!0,Mn(r,s,a),rt=c,Kt=f;break;case 0:case 11:case 14:case 15:if(!dt&&(c=a.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){f=c=c.next;do{var g=f,x=g.destroy;g=g.tag,x!==void 0&&((g&2)!==0||(g&4)!==0)&&Su(a,s,x),f=f.next}while(f!==c)}Mn(r,s,a);break;case 1:if(!dt&&(Gr(a,s),c=a.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(T){ze(a,s,T)}Mn(r,s,a);break;case 21:Mn(r,s,a);break;case 22:a.mode&1?(dt=(c=dt)||a.memoizedState!==null,Mn(r,s,a),dt=c):Mn(r,s,a);break;default:Mn(r,s,a)}}function Tp(r){var s=r.updateQueue;if(s!==null){r.updateQueue=null;var a=r.stateNode;a===null&&(a=r.stateNode=new px),s.forEach(function(c){var f=kx.bind(null,r,c);a.has(c)||(a.add(c),c.then(f,f))})}}function Gt(r,s){var a=s.deletions;if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];try{var g=r,x=s,T=x;e:for(;T!==null;){switch(T.tag){case 5:rt=T.stateNode,Kt=!1;break e;case 3:rt=T.stateNode.containerInfo,Kt=!0;break e;case 4:rt=T.stateNode.containerInfo,Kt=!0;break e}T=T.return}if(rt===null)throw Error(n(160));Ep(g,x,f),rt=null,Kt=!1;var C=f.alternate;C!==null&&(C.return=null),f.return=null}catch(L){ze(f,s,L)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)jp(s,r),s=s.sibling}function jp(r,s){var a=r.alternate,c=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Gt(s,r),on(r),c&4){try{ri(3,r,r.return),Vo(3,r)}catch(te){ze(r,r.return,te)}try{ri(5,r,r.return)}catch(te){ze(r,r.return,te)}}break;case 1:Gt(s,r),on(r),c&512&&a!==null&&Gr(a,a.return);break;case 5:if(Gt(s,r),on(r),c&512&&a!==null&&Gr(a,a.return),r.flags&32){var f=r.stateNode;try{ks(f,"")}catch(te){ze(r,r.return,te)}}if(c&4&&(f=r.stateNode,f!=null)){var g=r.memoizedProps,x=a!==null?a.memoizedProps:g,T=r.type,C=r.updateQueue;if(r.updateQueue=null,C!==null)try{T==="input"&&g.type==="radio"&&g.name!=null&&eh(f,g),rl(T,x);var L=rl(T,g);for(x=0;x<C.length;x+=2){var W=C[x],H=C[x+1];W==="style"?lh(f,H):W==="dangerouslySetInnerHTML"?oh(f,H):W==="children"?ks(f,H):N(f,W,H,L)}switch(T){case"input":Xa(f,g);break;case"textarea":rh(f,g);break;case"select":var q=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var Q=g.value;Q!=null?jr(f,!!g.multiple,Q,!1):q!==!!g.multiple&&(g.defaultValue!=null?jr(f,!!g.multiple,g.defaultValue,!0):jr(f,!!g.multiple,g.multiple?[]:"",!1))}f[Hs]=g}catch(te){ze(r,r.return,te)}}break;case 6:if(Gt(s,r),on(r),c&4){if(r.stateNode===null)throw Error(n(162));f=r.stateNode,g=r.memoizedProps;try{f.nodeValue=g}catch(te){ze(r,r.return,te)}}break;case 3:if(Gt(s,r),on(r),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Ds(s.containerInfo)}catch(te){ze(r,r.return,te)}break;case 4:Gt(s,r),on(r);break;case 13:Gt(s,r),on(r),f=r.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(Nu=He())),c&4&&Tp(r);break;case 22:if(W=a!==null&&a.memoizedState!==null,r.mode&1?(dt=(L=dt)||W,Gt(s,r),dt=L):Gt(s,r),on(r),c&8192){if(L=r.memoizedState!==null,(r.stateNode.isHidden=L)&&!W&&(r.mode&1)!==0)for(X=r,W=r.child;W!==null;){for(H=X=W;X!==null;){switch(q=X,Q=q.child,q.tag){case 0:case 11:case 14:case 15:ri(4,q,q.return);break;case 1:Gr(q,q.return);var ee=q.stateNode;if(typeof ee.componentWillUnmount=="function"){c=q,a=q.return;try{s=c,ee.props=s.memoizedProps,ee.state=s.memoizedState,ee.componentWillUnmount()}catch(te){ze(c,a,te)}}break;case 5:Gr(q,q.return);break;case 22:if(q.memoizedState!==null){Ap(H);continue}}Q!==null?(Q.return=q,X=Q):Ap(H)}W=W.sibling}e:for(W=null,H=r;;){if(H.tag===5){if(W===null){W=H;try{f=H.stateNode,L?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(T=H.stateNode,C=H.memoizedProps.style,x=C!=null&&C.hasOwnProperty("display")?C.display:null,T.style.display=ah("display",x))}catch(te){ze(r,r.return,te)}}}else if(H.tag===6){if(W===null)try{H.stateNode.nodeValue=L?"":H.memoizedProps}catch(te){ze(r,r.return,te)}}else if((H.tag!==22&&H.tag!==23||H.memoizedState===null||H===r)&&H.child!==null){H.child.return=H,H=H.child;continue}if(H===r)break e;for(;H.sibling===null;){if(H.return===null||H.return===r)break e;W===H&&(W=null),H=H.return}W===H&&(W=null),H.sibling.return=H.return,H=H.sibling}}break;case 19:Gt(s,r),on(r),c&4&&Tp(r);break;case 21:break;default:Gt(s,r),on(r)}}function on(r){var s=r.flags;if(s&2){try{e:{for(var a=r.return;a!==null;){if(Sp(a)){var c=a;break e}a=a.return}throw Error(n(160))}switch(c.tag){case 5:var f=c.stateNode;c.flags&32&&(ks(f,""),c.flags&=-33);var g=kp(r);Tu(r,g,f);break;case 3:case 4:var x=c.stateNode.containerInfo,T=kp(r);Eu(r,T,x);break;default:throw Error(n(161))}}catch(C){ze(r,r.return,C)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function gx(r,s,a){X=r,Cp(r)}function Cp(r,s,a){for(var c=(r.mode&1)!==0;X!==null;){var f=X,g=f.child;if(f.tag===22&&c){var x=f.memoizedState!==null||$o;if(!x){var T=f.alternate,C=T!==null&&T.memoizedState!==null||dt;T=$o;var L=dt;if($o=x,(dt=C)&&!L)for(X=f;X!==null;)x=X,C=x.child,x.tag===22&&x.memoizedState!==null?Pp(f):C!==null?(C.return=x,X=C):Pp(f);for(;g!==null;)X=g,Cp(g),g=g.sibling;X=f,$o=T,dt=L}Np(r)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,X=g):Np(r)}}function Np(r){for(;X!==null;){var s=X;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:dt||Vo(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!dt)if(a===null)c.componentDidMount();else{var f=s.elementType===s.type?a.memoizedProps:Ht(s.type,a.memoizedProps);c.componentDidUpdate(f,a.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&Af(s,g,c);break;case 3:var x=s.updateQueue;if(x!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}Af(s,x,a)}break;case 5:var T=s.stateNode;if(a===null&&s.flags&4){a=T;var C=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":C.autoFocus&&a.focus();break;case"img":C.src&&(a.src=C.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var L=s.alternate;if(L!==null){var W=L.memoizedState;if(W!==null){var H=W.dehydrated;H!==null&&Ds(H)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}dt||s.flags&512&&ku(s)}catch(q){ze(s,s.return,q)}}if(s===r){X=null;break}if(a=s.sibling,a!==null){a.return=s.return,X=a;break}X=s.return}}function Ap(r){for(;X!==null;){var s=X;if(s===r){X=null;break}var a=s.sibling;if(a!==null){a.return=s.return,X=a;break}X=s.return}}function Pp(r){for(;X!==null;){var s=X;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Vo(4,s)}catch(C){ze(s,a,C)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var f=s.return;try{c.componentDidMount()}catch(C){ze(s,f,C)}}var g=s.return;try{ku(s)}catch(C){ze(s,g,C)}break;case 5:var x=s.return;try{ku(s)}catch(C){ze(s,x,C)}}}catch(C){ze(s,s.return,C)}if(s===r){X=null;break}var T=s.sibling;if(T!==null){T.return=s.return,X=T;break}X=s.return}}var yx=Math.ceil,Fo=U.ReactCurrentDispatcher,ju=U.ReactCurrentOwner,$t=U.ReactCurrentBatchConfig,_e=0,tt=null,Je=null,st=0,Nt=0,Jr=Rn(0),Xe=0,si=null,ir=0,Bo=0,Cu=0,ii=null,xt=null,Nu=0,Yr=1/0,vn=null,zo=!1,Au=null,Un=null,qo=!1,$n=null,Wo=0,oi=0,Pu=null,Ho=-1,Ko=0;function gt(){return(_e&6)!==0?He():Ho!==-1?Ho:Ho=He()}function Vn(r){return(r.mode&1)===0?1:(_e&2)!==0&&st!==0?st&-st:ex.transition!==null?(Ko===0&&(Ko=Sh()),Ko):(r=Ce,r!==0||(r=window.event,r=r===void 0?16:Rh(r.type)),r)}function Jt(r,s,a,c){if(50<oi)throw oi=0,Pu=null,Error(n(185));As(r,a,c),((_e&2)===0||r!==tt)&&(r===tt&&((_e&2)===0&&(Bo|=a),Xe===4&&Fn(r,st)),bt(r,c),a===1&&_e===0&&(s.mode&1)===0&&(Yr=He()+500,bo&&In()))}function bt(r,s){var a=r.callbackNode;ew(r,s);var c=to(r,r===tt?st:0);if(c===0)a!==null&&xh(a),r.callbackNode=null,r.callbackPriority=0;else if(s=c&-c,r.callbackPriority!==s){if(a!=null&&xh(a),s===1)r.tag===0?Zw(Op.bind(null,r)):vf(Op.bind(null,r)),Jw(function(){(_e&6)===0&&In()}),a=null;else{switch(kh(c)){case 1:a=cl;break;case 4:a=bh;break;case 16:a=Qi;break;case 536870912:a=_h;break;default:a=Qi}a=Fp(a,Rp.bind(null,r))}r.callbackPriority=s,r.callbackNode=a}}function Rp(r,s){if(Ho=-1,Ko=0,(_e&6)!==0)throw Error(n(327));var a=r.callbackNode;if(Qr()&&r.callbackNode!==a)return null;var c=to(r,r===tt?st:0);if(c===0)return null;if((c&30)!==0||(c&r.expiredLanes)!==0||s)s=Go(r,c);else{s=c;var f=_e;_e|=2;var g=Dp();(tt!==r||st!==s)&&(vn=null,Yr=He()+500,ar(r,s));do try{xx();break}catch(T){Ip(r,T)}while(!0);Jl(),Fo.current=g,_e=f,Je!==null?s=0:(tt=null,st=0,s=Xe)}if(s!==0){if(s===2&&(f=dl(r),f!==0&&(c=f,s=Ru(r,f))),s===1)throw a=si,ar(r,0),Fn(r,c),bt(r,He()),a;if(s===6)Fn(r,c);else{if(f=r.current.alternate,(c&30)===0&&!vx(f)&&(s=Go(r,c),s===2&&(g=dl(r),g!==0&&(c=g,s=Ru(r,g))),s===1))throw a=si,ar(r,0),Fn(r,c),bt(r,He()),a;switch(r.finishedWork=f,r.finishedLanes=c,s){case 0:case 1:throw Error(n(345));case 2:lr(r,xt,vn);break;case 3:if(Fn(r,c),(c&130023424)===c&&(s=Nu+500-He(),10<s)){if(to(r,0)!==0)break;if(f=r.suspendedLanes,(f&c)!==c){gt(),r.pingedLanes|=r.suspendedLanes&f;break}r.timeoutHandle=Ul(lr.bind(null,r,xt,vn),s);break}lr(r,xt,vn);break;case 4:if(Fn(r,c),(c&4194240)===c)break;for(s=r.eventTimes,f=-1;0<c;){var x=31-zt(c);g=1<<x,x=s[x],x>f&&(f=x),c&=~g}if(c=f,c=He()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*yx(c/1960))-c,10<c){r.timeoutHandle=Ul(lr.bind(null,r,xt,vn),c);break}lr(r,xt,vn);break;case 5:lr(r,xt,vn);break;default:throw Error(n(329))}}}return bt(r,He()),r.callbackNode===a?Rp.bind(null,r):null}function Ru(r,s){var a=ii;return r.current.memoizedState.isDehydrated&&(ar(r,s).flags|=256),r=Go(r,s),r!==2&&(s=xt,xt=a,s!==null&&Ou(s)),r}function Ou(r){xt===null?xt=r:xt.push.apply(xt,r)}function vx(r){for(var s=r;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var c=0;c<a.length;c++){var f=a[c],g=f.getSnapshot;f=f.value;try{if(!qt(g(),f))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Fn(r,s){for(s&=~Cu,s&=~Bo,r.suspendedLanes|=s,r.pingedLanes&=~s,r=r.expirationTimes;0<s;){var a=31-zt(s),c=1<<a;r[a]=-1,s&=~c}}function Op(r){if((_e&6)!==0)throw Error(n(327));Qr();var s=to(r,0);if((s&1)===0)return bt(r,He()),null;var a=Go(r,s);if(r.tag!==0&&a===2){var c=dl(r);c!==0&&(s=c,a=Ru(r,c))}if(a===1)throw a=si,ar(r,0),Fn(r,s),bt(r,He()),a;if(a===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=s,lr(r,xt,vn),bt(r,He()),null}function Iu(r,s){var a=_e;_e|=1;try{return r(s)}finally{_e=a,_e===0&&(Yr=He()+500,bo&&In())}}function or(r){$n!==null&&$n.tag===0&&(_e&6)===0&&Qr();var s=_e;_e|=1;var a=$t.transition,c=Ce;try{if($t.transition=null,Ce=1,r)return r()}finally{Ce=c,$t.transition=a,_e=s,(_e&6)===0&&In()}}function Du(){Nt=Jr.current,De(Jr)}function ar(r,s){r.finishedWork=null,r.finishedLanes=0;var a=r.timeoutHandle;if(a!==-1&&(r.timeoutHandle=-1,Gw(a)),Je!==null)for(a=Je.return;a!==null;){var c=a;switch(ql(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&wo();break;case 3:Hr(),De(yt),De(lt),ru();break;case 5:tu(c);break;case 4:Hr();break;case 13:De($e);break;case 19:De($e);break;case 10:Yl(c.type._context);break;case 22:case 23:Du()}a=a.return}if(tt=r,Je=r=Bn(r.current,null),st=Nt=s,Xe=0,si=null,Cu=Bo=ir=0,xt=ii=null,nr!==null){for(s=0;s<nr.length;s++)if(a=nr[s],c=a.interleaved,c!==null){a.interleaved=null;var f=c.next,g=a.pending;if(g!==null){var x=g.next;g.next=f,c.next=x}a.pending=c}nr=null}return r}function Ip(r,s){do{var a=Je;try{if(Jl(),Po.current=Do,Ro){for(var c=Ve.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}Ro=!1}if(sr=0,et=Qe=Ve=null,Xs=!1,Zs=0,ju.current=null,a===null||a.return===null){Xe=1,si=s,Je=null;break}e:{var g=r,x=a.return,T=a,C=s;if(s=st,T.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){var L=C,W=T,H=W.tag;if((W.mode&1)===0&&(H===0||H===11||H===15)){var q=W.alternate;q?(W.updateQueue=q.updateQueue,W.memoizedState=q.memoizedState,W.lanes=q.lanes):(W.updateQueue=null,W.memoizedState=null)}var Q=ip(x);if(Q!==null){Q.flags&=-257,op(Q,x,T,g,s),Q.mode&1&&sp(g,L,s),s=Q,C=L;var ee=s.updateQueue;if(ee===null){var te=new Set;te.add(C),s.updateQueue=te}else ee.add(C);break e}else{if((s&1)===0){sp(g,L,s),Lu();break e}C=Error(n(426))}}else if(Ue&&T.mode&1){var Ke=ip(x);if(Ke!==null){(Ke.flags&65536)===0&&(Ke.flags|=256),op(Ke,x,T,g,s),Kl(Kr(C,T));break e}}g=C=Kr(C,T),Xe!==4&&(Xe=2),ii===null?ii=[g]:ii.push(g),g=x;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var O=np(g,C,s);Nf(g,O);break e;case 1:T=C;var A=g.type,I=g.stateNode;if((g.flags&128)===0&&(typeof A.getDerivedStateFromError=="function"||I!==null&&typeof I.componentDidCatch=="function"&&(Un===null||!Un.has(I)))){g.flags|=65536,s&=-s,g.lanes|=s;var G=rp(g,T,s);Nf(g,G);break e}}g=g.return}while(g!==null)}Mp(a)}catch(ne){s=ne,Je===a&&a!==null&&(Je=a=a.return);continue}break}while(!0)}function Dp(){var r=Fo.current;return Fo.current=Do,r===null?Do:r}function Lu(){(Xe===0||Xe===3||Xe===2)&&(Xe=4),tt===null||(ir&268435455)===0&&(Bo&268435455)===0||Fn(tt,st)}function Go(r,s){var a=_e;_e|=2;var c=Dp();(tt!==r||st!==s)&&(vn=null,ar(r,s));do try{wx();break}catch(f){Ip(r,f)}while(!0);if(Jl(),_e=a,Fo.current=c,Je!==null)throw Error(n(261));return tt=null,st=0,Xe}function wx(){for(;Je!==null;)Lp(Je)}function xx(){for(;Je!==null&&!Wv();)Lp(Je)}function Lp(r){var s=Vp(r.alternate,r,Nt);r.memoizedProps=r.pendingProps,s===null?Mp(r):Je=s,ju.current=null}function Mp(r){var s=r;do{var a=s.alternate;if(r=s.return,(s.flags&32768)===0){if(a=hx(a,s,Nt),a!==null){Je=a;return}}else{if(a=fx(a,s),a!==null){a.flags&=32767,Je=a;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Xe=6,Je=null;return}}if(s=s.sibling,s!==null){Je=s;return}Je=s=r}while(s!==null);Xe===0&&(Xe=5)}function lr(r,s,a){var c=Ce,f=$t.transition;try{$t.transition=null,Ce=1,bx(r,s,a,c)}finally{$t.transition=f,Ce=c}return null}function bx(r,s,a,c){do Qr();while($n!==null);if((_e&6)!==0)throw Error(n(327));a=r.finishedWork;var f=r.finishedLanes;if(a===null)return null;if(r.finishedWork=null,r.finishedLanes=0,a===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var g=a.lanes|a.childLanes;if(tw(r,g),r===tt&&(Je=tt=null,st=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||qo||(qo=!0,Fp(Qi,function(){return Qr(),null})),g=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||g){g=$t.transition,$t.transition=null;var x=Ce;Ce=1;var T=_e;_e|=4,ju.current=null,mx(r,a),jp(a,r),Fw(Ll),so=!!Dl,Ll=Dl=null,r.current=a,gx(a),Hv(),_e=T,Ce=x,$t.transition=g}else r.current=a;if(qo&&(qo=!1,$n=r,Wo=f),g=r.pendingLanes,g===0&&(Un=null),Jv(a.stateNode),bt(r,He()),s!==null)for(c=r.onRecoverableError,a=0;a<s.length;a++)f=s[a],c(f.value,{componentStack:f.stack,digest:f.digest});if(zo)throw zo=!1,r=Au,Au=null,r;return(Wo&1)!==0&&r.tag!==0&&Qr(),g=r.pendingLanes,(g&1)!==0?r===Pu?oi++:(oi=0,Pu=r):oi=0,In(),null}function Qr(){if($n!==null){var r=kh(Wo),s=$t.transition,a=Ce;try{if($t.transition=null,Ce=16>r?16:r,$n===null)var c=!1;else{if(r=$n,$n=null,Wo=0,(_e&6)!==0)throw Error(n(331));var f=_e;for(_e|=4,X=r.current;X!==null;){var g=X,x=g.child;if((X.flags&16)!==0){var T=g.deletions;if(T!==null){for(var C=0;C<T.length;C++){var L=T[C];for(X=L;X!==null;){var W=X;switch(W.tag){case 0:case 11:case 15:ri(8,W,g)}var H=W.child;if(H!==null)H.return=W,X=H;else for(;X!==null;){W=X;var q=W.sibling,Q=W.return;if(_p(W),W===L){X=null;break}if(q!==null){q.return=Q,X=q;break}X=Q}}}var ee=g.alternate;if(ee!==null){var te=ee.child;if(te!==null){ee.child=null;do{var Ke=te.sibling;te.sibling=null,te=Ke}while(te!==null)}}X=g}}if((g.subtreeFlags&2064)!==0&&x!==null)x.return=g,X=x;else e:for(;X!==null;){if(g=X,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:ri(9,g,g.return)}var O=g.sibling;if(O!==null){O.return=g.return,X=O;break e}X=g.return}}var A=r.current;for(X=A;X!==null;){x=X;var I=x.child;if((x.subtreeFlags&2064)!==0&&I!==null)I.return=x,X=I;else e:for(x=A;X!==null;){if(T=X,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:Vo(9,T)}}catch(ne){ze(T,T.return,ne)}if(T===x){X=null;break e}var G=T.sibling;if(G!==null){G.return=T.return,X=G;break e}X=T.return}}if(_e=f,In(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Xi,r)}catch{}c=!0}return c}finally{Ce=a,$t.transition=s}}return!1}function Up(r,s,a){s=Kr(a,s),s=np(r,s,1),r=Ln(r,s,1),s=gt(),r!==null&&(As(r,1,s),bt(r,s))}function ze(r,s,a){if(r.tag===3)Up(r,r,a);else for(;s!==null;){if(s.tag===3){Up(s,r,a);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Un===null||!Un.has(c))){r=Kr(a,r),r=rp(s,r,1),s=Ln(s,r,1),r=gt(),s!==null&&(As(s,1,r),bt(s,r));break}}s=s.return}}function _x(r,s,a){var c=r.pingCache;c!==null&&c.delete(s),s=gt(),r.pingedLanes|=r.suspendedLanes&a,tt===r&&(st&a)===a&&(Xe===4||Xe===3&&(st&130023424)===st&&500>He()-Nu?ar(r,0):Cu|=a),bt(r,s)}function $p(r,s){s===0&&((r.mode&1)===0?s=1:(s=eo,eo<<=1,(eo&130023424)===0&&(eo=4194304)));var a=gt();r=mn(r,s),r!==null&&(As(r,s,a),bt(r,a))}function Sx(r){var s=r.memoizedState,a=0;s!==null&&(a=s.retryLane),$p(r,a)}function kx(r,s){var a=0;switch(r.tag){case 13:var c=r.stateNode,f=r.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=r.stateNode;break;default:throw Error(n(314))}c!==null&&c.delete(s),$p(r,a)}var Vp;Vp=function(r,s,a){if(r!==null)if(r.memoizedProps!==s.pendingProps||yt.current)wt=!0;else{if((r.lanes&a)===0&&(s.flags&128)===0)return wt=!1,dx(r,s,a);wt=(r.flags&131072)!==0}else wt=!1,Ue&&(s.flags&1048576)!==0&&wf(s,So,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;Uo(r,s),r=s.pendingProps;var f=$r(s,lt.current);Wr(s,a),f=ou(null,s,c,r,f,a);var g=au();return s.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,vt(c)?(g=!0,xo(s)):g=!1,s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Zl(s),f.updater=Lo,s.stateNode=f,f._reactInternals=s,fu(s,c,r,a),s=yu(null,s,c,!0,g,a)):(s.tag=0,Ue&&g&&zl(s),mt(null,s,f,a),s=s.child),s;case 16:c=s.elementType;e:{switch(Uo(r,s),r=s.pendingProps,f=c._init,c=f(c._payload),s.type=c,f=s.tag=Tx(c),r=Ht(c,r),f){case 0:s=gu(null,s,c,r,a);break e;case 1:s=hp(null,s,c,r,a);break e;case 11:s=ap(null,s,c,r,a);break e;case 14:s=lp(null,s,c,Ht(c.type,r),a);break e}throw Error(n(306,c,""))}return s;case 0:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),gu(r,s,c,f,a);case 1:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),hp(r,s,c,f,a);case 3:e:{if(fp(s),r===null)throw Error(n(387));c=s.pendingProps,g=s.memoizedState,f=g.element,Cf(r,s),No(s,c,null,a);var x=s.memoizedState;if(c=x.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:x.cache,pendingSuspenseBoundaries:x.pendingSuspenseBoundaries,transitions:x.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){f=Kr(Error(n(423)),s),s=pp(r,s,c,a,f);break e}else if(c!==f){f=Kr(Error(n(424)),s),s=pp(r,s,c,a,f);break e}else for(Ct=Pn(s.stateNode.containerInfo.firstChild),jt=s,Ue=!0,Wt=null,a=Tf(s,null,c,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Br(),c===f){s=yn(r,s,a);break e}mt(r,s,c,a)}s=s.child}return s;case 5:return Pf(s),r===null&&Hl(s),c=s.type,f=s.pendingProps,g=r!==null?r.memoizedProps:null,x=f.children,Ml(c,f)?x=null:g!==null&&Ml(c,g)&&(s.flags|=32),dp(r,s),mt(r,s,x,a),s.child;case 6:return r===null&&Hl(s),null;case 13:return mp(r,s,a);case 4:return eu(s,s.stateNode.containerInfo),c=s.pendingProps,r===null?s.child=zr(s,null,c,a):mt(r,s,c,a),s.child;case 11:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),ap(r,s,c,f,a);case 7:return mt(r,s,s.pendingProps,a),s.child;case 8:return mt(r,s,s.pendingProps.children,a),s.child;case 12:return mt(r,s,s.pendingProps.children,a),s.child;case 10:e:{if(c=s.type._context,f=s.pendingProps,g=s.memoizedProps,x=f.value,Ae(To,c._currentValue),c._currentValue=x,g!==null)if(qt(g.value,x)){if(g.children===f.children&&!yt.current){s=yn(r,s,a);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var T=g.dependencies;if(T!==null){x=g.child;for(var C=T.firstContext;C!==null;){if(C.context===c){if(g.tag===1){C=gn(-1,a&-a),C.tag=2;var L=g.updateQueue;if(L!==null){L=L.shared;var W=L.pending;W===null?C.next=C:(C.next=W.next,W.next=C),L.pending=C}}g.lanes|=a,C=g.alternate,C!==null&&(C.lanes|=a),Ql(g.return,a,s),T.lanes|=a;break}C=C.next}}else if(g.tag===10)x=g.type===s.type?null:g.child;else if(g.tag===18){if(x=g.return,x===null)throw Error(n(341));x.lanes|=a,T=x.alternate,T!==null&&(T.lanes|=a),Ql(x,a,s),x=g.sibling}else x=g.child;if(x!==null)x.return=g;else for(x=g;x!==null;){if(x===s){x=null;break}if(g=x.sibling,g!==null){g.return=x.return,x=g;break}x=x.return}g=x}mt(r,s,f.children,a),s=s.child}return s;case 9:return f=s.type,c=s.pendingProps.children,Wr(s,a),f=Mt(f),c=c(f),s.flags|=1,mt(r,s,c,a),s.child;case 14:return c=s.type,f=Ht(c,s.pendingProps),f=Ht(c.type,f),lp(r,s,c,f,a);case 15:return up(r,s,s.type,s.pendingProps,a);case 17:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),Uo(r,s),s.tag=1,vt(c)?(r=!0,xo(s)):r=!1,Wr(s,a),ep(s,c,f),fu(s,c,f,a),yu(null,s,c,!0,r,a);case 19:return yp(r,s,a);case 22:return cp(r,s,a)}throw Error(n(156,s.tag))};function Fp(r,s){return wh(r,s)}function Ex(r,s,a,c){this.tag=r,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(r,s,a,c){return new Ex(r,s,a,c)}function Mu(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Tx(r){if(typeof r=="function")return Mu(r)?1:0;if(r!=null){if(r=r.$$typeof,r===ve)return 11;if(r===Oe)return 14}return 2}function Bn(r,s){var a=r.alternate;return a===null?(a=Vt(r.tag,s,r.key,r.mode),a.elementType=r.elementType,a.type=r.type,a.stateNode=r.stateNode,a.alternate=r,r.alternate=a):(a.pendingProps=s,a.type=r.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=r.flags&14680064,a.childLanes=r.childLanes,a.lanes=r.lanes,a.child=r.child,a.memoizedProps=r.memoizedProps,a.memoizedState=r.memoizedState,a.updateQueue=r.updateQueue,s=r.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=r.sibling,a.index=r.index,a.ref=r.ref,a}function Jo(r,s,a,c,f,g){var x=2;if(c=r,typeof r=="function")Mu(r)&&(x=1);else if(typeof r=="string")x=5;else e:switch(r){case $:return ur(a.children,f,g,s);case B:x=8,f|=8;break;case Y:return r=Vt(12,a,s,f|2),r.elementType=Y,r.lanes=g,r;case je:return r=Vt(13,a,s,f),r.elementType=je,r.lanes=g,r;case xe:return r=Vt(19,a,s,f),r.elementType=xe,r.lanes=g,r;case pe:return Yo(a,f,g,s);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case oe:x=10;break e;case Te:x=9;break e;case ve:x=11;break e;case Oe:x=14;break e;case be:x=16,c=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return s=Vt(x,a,s,f),s.elementType=r,s.type=c,s.lanes=g,s}function ur(r,s,a,c){return r=Vt(7,r,c,s),r.lanes=a,r}function Yo(r,s,a,c){return r=Vt(22,r,c,s),r.elementType=pe,r.lanes=a,r.stateNode={isHidden:!1},r}function Uu(r,s,a){return r=Vt(6,r,null,s),r.lanes=a,r}function $u(r,s,a){return s=Vt(4,r.children!==null?r.children:[],r.key,s),s.lanes=a,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}function jx(r,s,a,c,f){this.tag=s,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=hl(0),this.expirationTimes=hl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hl(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Vu(r,s,a,c,f,g,x,T,C){return r=new jx(r,s,a,T,C),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Vt(3,null,null,s),r.current=g,g.stateNode=r,g.memoizedState={element:c,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zl(g),r}function Cx(r,s,a){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:z,key:c==null?null:""+c,children:r,containerInfo:s,implementation:a}}function Bp(r){if(!r)return On;r=r._reactInternals;e:{if(Qn(r)!==r||r.tag!==1)throw Error(n(170));var s=r;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(vt(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(n(171))}if(r.tag===1){var a=r.type;if(vt(a))return gf(r,a,s)}return s}function zp(r,s,a,c,f,g,x,T,C){return r=Vu(a,c,!0,r,f,g,x,T,C),r.context=Bp(null),a=r.current,c=gt(),f=Vn(a),g=gn(c,f),g.callback=s??null,Ln(a,g,f),r.current.lanes=f,As(r,f,c),bt(r,c),r}function Qo(r,s,a,c){var f=s.current,g=gt(),x=Vn(f);return a=Bp(a),s.context===null?s.context=a:s.pendingContext=a,s=gn(g,x),s.payload={element:r},c=c===void 0?null:c,c!==null&&(s.callback=c),r=Ln(f,s,x),r!==null&&(Jt(r,f,x,g),Co(r,f,x)),x}function Xo(r){return r=r.current,r.child?(r.child.tag===5,r.child.stateNode):null}function qp(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var a=r.retryLane;r.retryLane=a!==0&&a<s?a:s}}function Fu(r,s){qp(r,s),(r=r.alternate)&&qp(r,s)}function Nx(){return null}var Wp=typeof reportError=="function"?reportError:function(r){console.error(r)};function Bu(r){this._internalRoot=r}Zo.prototype.render=Bu.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(n(409));Qo(r,s,null,null)},Zo.prototype.unmount=Bu.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;or(function(){Qo(null,r,null,null)}),s[dn]=null}};function Zo(r){this._internalRoot=r}Zo.prototype.unstable_scheduleHydration=function(r){if(r){var s=jh();r={blockedOn:null,target:r,priority:s};for(var a=0;a<Cn.length&&s!==0&&s<Cn[a].priority;a++);Cn.splice(a,0,r),a===0&&Ah(r)}};function zu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function ea(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Hp(){}function Ax(r,s,a,c,f){if(f){if(typeof c=="function"){var g=c;c=function(){var L=Xo(x);g.call(L)}}var x=zp(s,c,r,0,null,!1,!1,"",Hp);return r._reactRootContainer=x,r[dn]=x.current,qs(r.nodeType===8?r.parentNode:r),or(),x}for(;f=r.lastChild;)r.removeChild(f);if(typeof c=="function"){var T=c;c=function(){var L=Xo(C);T.call(L)}}var C=Vu(r,0,!1,null,null,!1,!1,"",Hp);return r._reactRootContainer=C,r[dn]=C.current,qs(r.nodeType===8?r.parentNode:r),or(function(){Qo(s,C,a,c)}),C}function ta(r,s,a,c,f){var g=a._reactRootContainer;if(g){var x=g;if(typeof f=="function"){var T=f;f=function(){var C=Xo(x);T.call(C)}}Qo(s,x,r,f)}else x=Ax(a,s,r,f,c);return Xo(x)}Eh=function(r){switch(r.tag){case 3:var s=r.stateNode;if(s.current.memoizedState.isDehydrated){var a=Ns(s.pendingLanes);a!==0&&(fl(s,a|1),bt(s,He()),(_e&6)===0&&(Yr=He()+500,In()))}break;case 13:or(function(){var c=mn(r,1);if(c!==null){var f=gt();Jt(c,r,1,f)}}),Fu(r,1)}},pl=function(r){if(r.tag===13){var s=mn(r,134217728);if(s!==null){var a=gt();Jt(s,r,134217728,a)}Fu(r,134217728)}},Th=function(r){if(r.tag===13){var s=Vn(r),a=mn(r,s);if(a!==null){var c=gt();Jt(a,r,s,c)}Fu(r,s)}},jh=function(){return Ce},Ch=function(r,s){var a=Ce;try{return Ce=r,s()}finally{Ce=a}},ol=function(r,s,a){switch(s){case"input":if(Xa(r,a),s=a.name,a.type==="radio"&&s!=null){for(a=r;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var c=a[s];if(c!==r&&c.form===r.form){var f=vo(c);if(!f)throw Error(n(90));Xd(c),Xa(c,f)}}}break;case"textarea":rh(r,a);break;case"select":s=a.value,s!=null&&jr(r,!!a.multiple,s,!1)}},hh=Iu,fh=or;var Px={usingClientEntryPoint:!1,Events:[Ks,Mr,vo,ch,dh,Iu]},ai={findFiberByHostInstance:Xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Rx={bundleType:ai.bundleType,version:ai.version,rendererPackageName:ai.rendererPackageName,rendererConfig:ai.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:U.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=yh(r),r===null?null:r.stateNode},findFiberByHostInstance:ai.findFiberByHostInstance||Nx,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 na=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!na.isDisabled&&na.supportsFiber)try{Xi=na.inject(Rx),tn=na}catch{}}return _t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Px,_t.createPortal=function(r,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!zu(s))throw Error(n(200));return Cx(r,s,null,a)},_t.createRoot=function(r,s){if(!zu(r))throw Error(n(299));var a=!1,c="",f=Wp;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(f=s.onRecoverableError)),s=Vu(r,1,!1,null,null,a,!1,c,f),r[dn]=s.current,qs(r.nodeType===8?r.parentNode:r),new Bu(s)},_t.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=yh(s),r=r===null?null:r.stateNode,r},_t.flushSync=function(r){return or(r)},_t.hydrate=function(r,s,a){if(!ea(s))throw Error(n(200));return ta(null,r,s,!0,a)},_t.hydrateRoot=function(r,s,a){if(!zu(r))throw Error(n(405));var c=a!=null&&a.hydratedSources||null,f=!1,g="",x=Wp;if(a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),s=zp(s,null,r,1,a??null,f,!1,g,x),r[dn]=s.current,qs(r),c)for(r=0;r<c.length;r++)a=c[r],f=a._getVersion,f=f(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,f]:s.mutableSourceEagerHydrationData.push(a,f);return new Zo(s)},_t.render=function(r,s,a){if(!ea(s))throw Error(n(200));return ta(null,r,s,!1,a)},_t.unmountComponentAtNode=function(r){if(!ea(r))throw Error(n(40));return r._reactRootContainer?(or(function(){ta(null,null,r,!1,function(){r._reactRootContainer=null,r[dn]=null})}),!0):!1},_t.unstable_batchedUpdates=Iu,_t.unstable_renderSubtreeIntoContainer=function(r,s,a,c){if(!ea(a))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return ta(r,s,a,!1,c)},_t.version="18.3.1-next-f1338f8080-20240426",_t}var em;function Vx(){if(em)return Hu.exports;em=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Hu.exports=$x(),Hu.exports}var tm;function Fx(){if(tm)return ra;tm=1;var t=Vx();return ra.createRoot=t.createRoot,ra.hydrateRoot=t.hydrateRoot,ra}var Bx=Fx();const zx=cy(Bx);var qx={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"};const Wx=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Z=(t,e)=>{const n=R.forwardRef(({color:i="currentColor",size:o=24,strokeWidth:l=2,absoluteStrokeWidth:u,className:d="",children:h,...m},y)=>R.createElement("svg",{ref:y,...qx,width:o,height:o,stroke:i,strokeWidth:u?Number(l)*24/Number(o):l,className:["lucide",`lucide-${Wx(t)}`,d].join(" "),...m},[...e.map(([v,w])=>R.createElement(v,w)),...Array.isArray(h)?h:[h]]));return n.displayName=`${t}`,n};const Hx=Z("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);const Li=Z("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const Kx=Z("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Gx=Z("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const Jx=Z("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Yx=Z("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Qx=Z("Bitcoin",[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]]);const Xx=Z("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const dy=Z("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);const Zx=Z("Briefcase",[["rect",{width:"20",height:"14",x:"2",y:"7",rx:"2",ry:"2",key:"eto64e"}],["path",{d:"M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"zwj3tp"}]]);const e1=Z("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);const t1=Z("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const n1=Z("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);const rd=Z("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const Si=Z("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const xa=Z("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const nm=Z("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const hy=Z("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const r1=Z("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const s1=Z("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const i1=Z("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);const ps=Z("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const fy=Z("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const sd=Z("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const ki=Z("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const o1=Z("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);const rm=Z("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const Da=Z("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const a1=Z("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const l1=Z("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const u1=Z("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Ju=Z("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const c1=Z("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const py=Z("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const d1=Z("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const h1=Z("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);const f1=Z("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"}]]);const p1=Z("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);const xn=Z("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const m1=Z("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const sm=Z("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);const im=Z("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const g1=Z("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);const y1=Z("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);const v1=Z("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const w1=Z("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const x1=Z("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const id=Z("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const b1=Z("RotateCcw",[["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"}]]);const ba=Z("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);const Sc=Z("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const _1=Z("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"}]]);const my=Z("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const S1=Z("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);const k1=Z("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const E1=Z("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);const kc=Z("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const T1=Z("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const j1=Z("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);const od=Z("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const om=Z("Volume2",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]]);const am=Z("VolumeX",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);const lm=Z("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const Sr=Z("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const kr=Z("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),ad=R.createContext({});function ld(t){const e=R.useRef(null);return e.current===null&&(e.current=t()),e.current}const La=R.createContext(null),ud=R.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class C1 extends R.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function N1({children:t,isPresent:e}){const n=R.useId(),i=R.useRef(null),o=R.useRef({width:0,height:0,top:0,left:0}),{nonce:l}=R.useContext(ud);return R.useInsertionEffect(()=>{const{width:u,height:d,top:h,left:m}=o.current;if(e||!i.current||!u||!d)return;i.current.dataset.motionPopId=n;const y=document.createElement("style");return l&&(y.nonce=l),document.head.appendChild(y),y.sheet&&y.sheet.insertRule(`
8
+ `+g.stack}return{value:r,source:s,stack:f,digest:null}}function pu(r,s,a){return{value:r,source:null,stack:a??null,digest:s??null}}function mu(r,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var ux=typeof WeakMap=="function"?WeakMap:Map;function rp(r,s,a){a=gn(-1,a),a.tag=3,a.payload={element:null};var c=s.value;return a.callback=function(){qo||(qo=!0,Au=c),mu(r,s)},a}function sp(r,s,a){a=gn(-1,a),a.tag=3;var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var f=s.value;a.payload=function(){return c(f)},a.callback=function(){mu(r,s)}}var g=r.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){mu(r,s),typeof c!="function"&&(Un===null?Un=new Set([this]):Un.add(this));var x=s.stack;this.componentDidCatch(s.value,{componentStack:x!==null?x:""})}),a}function ip(r,s,a){var c=r.pingCache;if(c===null){c=r.pingCache=new ux;var f=new Set;c.set(s,f)}else f=c.get(s),f===void 0&&(f=new Set,c.set(s,f));f.has(a)||(f.add(a),r=Sx.bind(null,r,s,a),s.then(r,r))}function op(r){do{var s;if((s=r.tag===13)&&(s=r.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return r;r=r.return}while(r!==null);return null}function ap(r,s,a,c,f){return(r.mode&1)===0?(r===s?r.flags|=65536:(r.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=gn(-1,1),s.tag=2,Ln(a,s,1))),a.lanes|=1),r):(r.flags|=65536,r.lanes=f,r)}var cx=U.ReactCurrentOwner,wt=!1;function mt(r,s,a,c){s.child=r===null?jf(s,null,a,c):zr(s,r.child,a,c)}function lp(r,s,a,c,f){a=a.render;var g=s.ref;return Wr(s,f),c=ou(r,s,a,c,g,f),a=au(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,yn(r,s,f)):(Ue&&a&&zl(s),s.flags|=1,mt(r,s,c,f),s.child)}function up(r,s,a,c,f){if(r===null){var g=a.type;return typeof g=="function"&&!Mu(g)&&g.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=g,cp(r,s,g,c,f)):(r=Yo(a.type,null,c,s,s.mode,f),r.ref=s.ref,r.return=s,s.child=r)}if(g=r.child,(r.lanes&f)===0){var x=g.memoizedProps;if(a=a.compare,a=a!==null?a:Fs,a(x,c)&&r.ref===s.ref)return yn(r,s,f)}return s.flags|=1,r=Bn(g,c),r.ref=s.ref,r.return=s,s.child=r}function cp(r,s,a,c,f){if(r!==null){var g=r.memoizedProps;if(Fs(g,c)&&r.ref===s.ref)if(wt=!1,s.pendingProps=c=g,(r.lanes&f)!==0)(r.flags&131072)!==0&&(wt=!0);else return s.lanes=r.lanes,yn(r,s,f)}return gu(r,s,a,c,f)}function dp(r,s,a){var c=s.pendingProps,f=c.children,g=r!==null?r.memoizedState:null;if(c.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ae(Jr,Nt),Nt|=a;else{if((a&1073741824)===0)return r=g!==null?g.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:r,cachePool:null,transitions:null},s.updateQueue=null,Ae(Jr,Nt),Nt|=r,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=g!==null?g.baseLanes:a,Ae(Jr,Nt),Nt|=c}else g!==null?(c=g.baseLanes|a,s.memoizedState=null):c=a,Ae(Jr,Nt),Nt|=c;return mt(r,s,f,a),s.child}function hp(r,s){var a=s.ref;(r===null&&a!==null||r!==null&&r.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function gu(r,s,a,c,f){var g=vt(a)?Zn:lt.current;return g=$r(s,g),Wr(s,f),a=ou(r,s,a,c,g,f),c=au(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,yn(r,s,f)):(Ue&&c&&zl(s),s.flags|=1,mt(r,s,a,f),s.child)}function fp(r,s,a,c,f){if(vt(a)){var g=!0;bo(s)}else g=!1;if(Wr(s,f),s.stateNode===null)$o(r,s),tp(s,a,c),fu(s,a,c,f),c=!0;else if(r===null){var x=s.stateNode,T=s.memoizedProps;x.props=T;var C=x.context,L=a.contextType;typeof L=="object"&&L!==null?L=Mt(L):(L=vt(a)?Zn:lt.current,L=$r(s,L));var W=a.getDerivedStateFromProps,H=typeof W=="function"||typeof x.getSnapshotBeforeUpdate=="function";H||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==c||C!==L)&&np(s,x,c,L),Dn=!1;var q=s.memoizedState;x.state=q,Ao(s,c,x,f),C=s.memoizedState,T!==c||q!==C||yt.current||Dn?(typeof W=="function"&&(hu(s,a,W,c),C=s.memoizedState),(T=Dn||ep(s,a,T,c,q,C,L))?(H||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=C),x.props=c,x.state=C,x.context=L,c=T):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{x=s.stateNode,Nf(r,s),T=s.memoizedProps,L=s.type===s.elementType?T:Ht(s.type,T),x.props=L,H=s.pendingProps,q=x.context,C=a.contextType,typeof C=="object"&&C!==null?C=Mt(C):(C=vt(a)?Zn:lt.current,C=$r(s,C));var Q=a.getDerivedStateFromProps;(W=typeof Q=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T!==H||q!==C)&&np(s,x,c,C),Dn=!1,q=s.memoizedState,x.state=q,Ao(s,c,x,f);var ee=s.memoizedState;T!==H||q!==ee||yt.current||Dn?(typeof Q=="function"&&(hu(s,a,Q,c),ee=s.memoizedState),(L=Dn||ep(s,a,L,c,q,ee,C)||!1)?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(c,ee,C),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(c,ee,C)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=ee),x.props=c,x.state=ee,x.context=C,c=L):(typeof x.componentDidUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||T===r.memoizedProps&&q===r.memoizedState||(s.flags|=1024),c=!1)}return yu(r,s,a,c,g,f)}function yu(r,s,a,c,f,g){hp(r,s);var x=(s.flags&128)!==0;if(!c&&!x)return f&&vf(s,a,!1),yn(r,s,g);c=s.stateNode,cx.current=s;var T=x&&typeof a.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,r!==null&&x?(s.child=zr(s,r.child,null,g),s.child=zr(s,null,T,g)):mt(r,s,T,g),s.memoizedState=c.state,f&&vf(s,a,!0),s.child}function pp(r){var s=r.stateNode;s.pendingContext?gf(r,s.pendingContext,s.pendingContext!==s.context):s.context&&gf(r,s.context,!1),eu(r,s.containerInfo)}function mp(r,s,a,c,f){return Br(),Kl(f),s.flags|=256,mt(r,s,a,c),s.child}var vu={dehydrated:null,treeContext:null,retryLane:0};function wu(r){return{baseLanes:r,cachePool:null,transitions:null}}function gp(r,s,a){var c=s.pendingProps,f=$e.current,g=!1,x=(s.flags&128)!==0,T;if((T=x)||(T=r!==null&&r.memoizedState===null?!1:(f&2)!==0),T?(g=!0,s.flags&=-129):(r===null||r.memoizedState!==null)&&(f|=1),Ae($e,f&1),r===null)return Hl(s),r=s.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((s.mode&1)===0?s.lanes=1:r.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(x=c.children,r=c.fallback,g?(c=s.mode,g=s.child,x={mode:"hidden",children:x},(c&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=x):g=Qo(x,c,0,null),r=ur(r,c,a,null),g.return=s,r.return=s,g.sibling=r,s.child=g,s.child.memoizedState=wu(a),s.memoizedState=vu,r):xu(s,x));if(f=r.memoizedState,f!==null&&(T=f.dehydrated,T!==null))return dx(r,s,x,c,T,f,a);if(g){g=c.fallback,x=s.mode,f=r.child,T=f.sibling;var C={mode:"hidden",children:c.children};return(x&1)===0&&s.child!==f?(c=s.child,c.childLanes=0,c.pendingProps=C,s.deletions=null):(c=Bn(f,C),c.subtreeFlags=f.subtreeFlags&14680064),T!==null?g=Bn(T,g):(g=ur(g,x,a,null),g.flags|=2),g.return=s,c.return=s,c.sibling=g,s.child=c,c=g,g=s.child,x=r.child.memoizedState,x=x===null?wu(a):{baseLanes:x.baseLanes|a,cachePool:null,transitions:x.transitions},g.memoizedState=x,g.childLanes=r.childLanes&~a,s.memoizedState=vu,c}return g=r.child,r=g.sibling,c=Bn(g,{mode:"visible",children:c.children}),(s.mode&1)===0&&(c.lanes=a),c.return=s,c.sibling=null,r!==null&&(a=s.deletions,a===null?(s.deletions=[r],s.flags|=16):a.push(r)),s.child=c,s.memoizedState=null,c}function xu(r,s){return s=Qo({mode:"visible",children:s},r.mode,0,null),s.return=r,r.child=s}function Uo(r,s,a,c){return c!==null&&Kl(c),zr(s,r.child,null,a),r=xu(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function dx(r,s,a,c,f,g,x){if(a)return s.flags&256?(s.flags&=-257,c=pu(Error(n(422))),Uo(r,s,x,c)):s.memoizedState!==null?(s.child=r.child,s.flags|=128,null):(g=c.fallback,f=s.mode,c=Qo({mode:"visible",children:c.children},f,0,null),g=ur(g,f,x,null),g.flags|=2,c.return=s,g.return=s,c.sibling=g,s.child=c,(s.mode&1)!==0&&zr(s,r.child,null,x),s.child.memoizedState=wu(x),s.memoizedState=vu,g);if((s.mode&1)===0)return Uo(r,s,x,null);if(f.data==="$!"){if(c=f.nextSibling&&f.nextSibling.dataset,c)var T=c.dgst;return c=T,g=Error(n(419)),c=pu(g,c,void 0),Uo(r,s,x,c)}if(T=(x&r.childLanes)!==0,wt||T){if(c=tt,c!==null){switch(x&-x){case 4:f=2;break;case 16:f=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:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(c.suspendedLanes|x))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,mn(r,f),Jt(c,r,f,-1))}return Lu(),c=pu(Error(n(421))),Uo(r,s,x,c)}return f.data==="$?"?(s.flags|=128,s.child=r.child,s=kx.bind(null,r),f._reactRetry=s,null):(r=g.treeContext,Ct=Pn(f.nextSibling),jt=s,Ue=!0,Wt=null,r!==null&&(Dt[Lt++]=fn,Dt[Lt++]=pn,Dt[Lt++]=er,fn=r.id,pn=r.overflow,er=s),s=xu(s,c.children),s.flags|=4096,s)}function yp(r,s,a){r.lanes|=s;var c=r.alternate;c!==null&&(c.lanes|=s),Ql(r.return,s,a)}function bu(r,s,a,c,f){var g=r.memoizedState;g===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:f}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=c,g.tail=a,g.tailMode=f)}function vp(r,s,a){var c=s.pendingProps,f=c.revealOrder,g=c.tail;if(mt(r,s,c.children,a),c=$e.current,(c&2)!==0)c=c&1|2,s.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&yp(r,a,s);else if(r.tag===19)yp(r,a,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}c&=1}if(Ae($e,c),(s.mode&1)===0)s.memoizedState=null;else switch(f){case"forwards":for(a=s.child,f=null;a!==null;)r=a.alternate,r!==null&&Po(r)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),bu(s,!1,f,a,g);break;case"backwards":for(a=null,f=s.child,s.child=null;f!==null;){if(r=f.alternate,r!==null&&Po(r)===null){s.child=f;break}r=f.sibling,f.sibling=a,a=f,f=r}bu(s,!0,a,null,g);break;case"together":bu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function $o(r,s){(s.mode&1)===0&&r!==null&&(r.alternate=null,s.alternate=null,s.flags|=2)}function yn(r,s,a){if(r!==null&&(s.dependencies=r.dependencies),ir|=s.lanes,(a&s.childLanes)===0)return null;if(r!==null&&s.child!==r.child)throw Error(n(153));if(s.child!==null){for(r=s.child,a=Bn(r,r.pendingProps),s.child=a,a.return=s;r.sibling!==null;)r=r.sibling,a=a.sibling=Bn(r,r.pendingProps),a.return=s;a.sibling=null}return s.child}function hx(r,s,a){switch(s.tag){case 3:pp(s),Br();break;case 5:Rf(s);break;case 1:vt(s.type)&&bo(s);break;case 4:eu(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,f=s.memoizedProps.value;Ae(jo,c._currentValue),c._currentValue=f;break;case 13:if(c=s.memoizedState,c!==null)return c.dehydrated!==null?(Ae($e,$e.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?gp(r,s,a):(Ae($e,$e.current&1),r=yn(r,s,a),r!==null?r.sibling:null);Ae($e,$e.current&1);break;case 19:if(c=(a&s.childLanes)!==0,(r.flags&128)!==0){if(c)return vp(r,s,a);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ae($e,$e.current),c)break;return null;case 22:case 23:return s.lanes=0,dp(r,s,a)}return yn(r,s,a)}var wp,_u,xp,bp;wp=function(r,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},_u=function(){},xp=function(r,s,a,c){var f=r.memoizedProps;if(f!==c){r=s.stateNode,rr(rn.current);var g=null;switch(a){case"input":f=Qa(r,f),c=Qa(r,c),g=[];break;case"select":f=K({},f,{value:void 0}),c=K({},c,{value:void 0}),g=[];break;case"textarea":f=el(r,f),c=el(r,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=vo)}nl(a,c);var x;a=null;for(L in f)if(!c.hasOwnProperty(L)&&f.hasOwnProperty(L)&&f[L]!=null)if(L==="style"){var T=f[L];for(x in T)T.hasOwnProperty(x)&&(a||(a={}),a[x]="")}else L!=="dangerouslySetInnerHTML"&&L!=="children"&&L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&L!=="autoFocus"&&(o.hasOwnProperty(L)?g||(g=[]):(g=g||[]).push(L,null));for(L in c){var C=c[L];if(T=f?.[L],c.hasOwnProperty(L)&&C!==T&&(C!=null||T!=null))if(L==="style")if(T){for(x in T)!T.hasOwnProperty(x)||C&&C.hasOwnProperty(x)||(a||(a={}),a[x]="");for(x in C)C.hasOwnProperty(x)&&T[x]!==C[x]&&(a||(a={}),a[x]=C[x])}else a||(g||(g=[]),g.push(L,a)),a=C;else L==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,T=T?T.__html:void 0,C!=null&&T!==C&&(g=g||[]).push(L,C)):L==="children"?typeof C!="string"&&typeof C!="number"||(g=g||[]).push(L,""+C):L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&(o.hasOwnProperty(L)?(C!=null&&L==="onScroll"&&Ie("scroll",r),g||T===C||(g=[])):(g=g||[]).push(L,C))}a&&(g=g||[]).push("style",a);var L=g;(s.updateQueue=L)&&(s.flags|=4)}},bp=function(r,s,a,c){a!==c&&(s.flags|=4)};function ni(r,s){if(!Ue)switch(r.tailMode){case"hidden":s=r.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?r.tail=null:a.sibling=null;break;case"collapsed":a=r.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:c.sibling=null}}function ct(r){var s=r.alternate!==null&&r.alternate.child===r.child,a=0,c=0;if(s)for(var f=r.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags&14680064,c|=f.flags&14680064,f.return=r,f=f.sibling;else for(f=r.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=r,f=f.sibling;return r.subtreeFlags|=c,r.childLanes=a,s}function fx(r,s,a){var c=s.pendingProps;switch(ql(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(s),null;case 1:return vt(s.type)&&xo(),ct(s),null;case 3:return c=s.stateNode,Hr(),De(yt),De(lt),ru(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Eo(s)?s.flags|=4:r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Wt!==null&&(Ou(Wt),Wt=null))),_u(r,s),ct(s),null;case 5:tu(s);var f=rr(Qs.current);if(a=s.type,r!==null&&s.stateNode!=null)xp(r,s,a,c,f),r.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(n(166));return ct(s),null}if(r=rr(rn.current),Eo(s)){c=s.stateNode,a=s.type;var g=s.memoizedProps;switch(c[nn]=s,c[Hs]=g,r=(s.mode&1)!==0,a){case"dialog":Ie("cancel",c),Ie("close",c);break;case"iframe":case"object":case"embed":Ie("load",c);break;case"video":case"audio":for(f=0;f<zs.length;f++)Ie(zs[f],c);break;case"source":Ie("error",c);break;case"img":case"image":case"link":Ie("error",c),Ie("load",c);break;case"details":Ie("toggle",c);break;case"input":eh(c,g),Ie("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!g.multiple},Ie("invalid",c);break;case"textarea":rh(c,g),Ie("invalid",c)}nl(a,g),f=null;for(var x in g)if(g.hasOwnProperty(x)){var T=g[x];x==="children"?typeof T=="string"?c.textContent!==T&&(g.suppressHydrationWarning!==!0&&yo(c.textContent,T,r),f=["children",T]):typeof T=="number"&&c.textContent!==""+T&&(g.suppressHydrationWarning!==!0&&yo(c.textContent,T,r),f=["children",""+T]):o.hasOwnProperty(x)&&T!=null&&x==="onScroll"&&Ie("scroll",c)}switch(a){case"input":Ki(c),nh(c,g,!0);break;case"textarea":Ki(c),ih(c);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(c.onclick=vo)}c=f,s.updateQueue=c,c!==null&&(s.flags|=4)}else{x=f.nodeType===9?f:f.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=oh(a)),r==="http://www.w3.org/1999/xhtml"?a==="script"?(r=x.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof c.is=="string"?r=x.createElement(a,{is:c.is}):(r=x.createElement(a),a==="select"&&(x=r,c.multiple?x.multiple=!0:c.size&&(x.size=c.size))):r=x.createElementNS(r,a),r[nn]=s,r[Hs]=c,wp(r,s,!1,!1),s.stateNode=r;e:{switch(x=rl(a,c),a){case"dialog":Ie("cancel",r),Ie("close",r),f=c;break;case"iframe":case"object":case"embed":Ie("load",r),f=c;break;case"video":case"audio":for(f=0;f<zs.length;f++)Ie(zs[f],r);f=c;break;case"source":Ie("error",r),f=c;break;case"img":case"image":case"link":Ie("error",r),Ie("load",r),f=c;break;case"details":Ie("toggle",r),f=c;break;case"input":eh(r,c),f=Qa(r,c),Ie("invalid",r);break;case"option":f=c;break;case"select":r._wrapperState={wasMultiple:!!c.multiple},f=K({},c,{value:void 0}),Ie("invalid",r);break;case"textarea":rh(r,c),f=el(r,c),Ie("invalid",r);break;default:f=c}nl(a,f),T=f;for(g in T)if(T.hasOwnProperty(g)){var C=T[g];g==="style"?uh(r,C):g==="dangerouslySetInnerHTML"?(C=C?C.__html:void 0,C!=null&&ah(r,C)):g==="children"?typeof C=="string"?(a!=="textarea"||C!=="")&&ks(r,C):typeof C=="number"&&ks(r,""+C):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(o.hasOwnProperty(g)?C!=null&&g==="onScroll"&&Ie("scroll",r):C!=null&&N(r,g,C,x))}switch(a){case"input":Ki(r),nh(r,c,!1);break;case"textarea":Ki(r),ih(r);break;case"option":c.value!=null&&r.setAttribute("value",""+ke(c.value));break;case"select":r.multiple=!!c.multiple,g=c.value,g!=null?jr(r,!!c.multiple,g,!1):c.defaultValue!=null&&jr(r,!!c.multiple,c.defaultValue,!0);break;default:typeof f.onClick=="function"&&(r.onclick=vo)}switch(a){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return ct(s),null;case 6:if(r&&s.stateNode!=null)bp(r,s,r.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(n(166));if(a=rr(Qs.current),rr(rn.current),Eo(s)){if(c=s.stateNode,a=s.memoizedProps,c[nn]=s,(g=c.nodeValue!==a)&&(r=jt,r!==null))switch(r.tag){case 3:yo(c.nodeValue,a,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&yo(c.nodeValue,a,(r.mode&1)!==0)}g&&(s.flags|=4)}else c=(a.nodeType===9?a:a.ownerDocument).createTextNode(c),c[nn]=s,s.stateNode=c}return ct(s),null;case 13:if(De($e),c=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Ue&&Ct!==null&&(s.mode&1)!==0&&(s.flags&128)===0)kf(),Br(),s.flags|=98560,g=!1;else if(g=Eo(s),c!==null&&c.dehydrated!==null){if(r===null){if(!g)throw Error(n(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(n(317));g[nn]=s}else Br(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ct(s),g=!1}else Wt!==null&&(Ou(Wt),Wt=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(c=c!==null,c!==(r!==null&&r.memoizedState!==null)&&c&&(s.child.flags|=8192,(s.mode&1)!==0&&(r===null||($e.current&1)!==0?Xe===0&&(Xe=3):Lu())),s.updateQueue!==null&&(s.flags|=4),ct(s),null);case 4:return Hr(),_u(r,s),r===null&&qs(s.stateNode.containerInfo),ct(s),null;case 10:return Yl(s.type._context),ct(s),null;case 17:return vt(s.type)&&xo(),ct(s),null;case 19:if(De($e),g=s.memoizedState,g===null)return ct(s),null;if(c=(s.flags&128)!==0,x=g.rendering,x===null)if(c)ni(g,!1);else{if(Xe!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=Po(r),x!==null){for(s.flags|=128,ni(g,!1),c=x.updateQueue,c!==null&&(s.updateQueue=c,s.flags|=4),s.subtreeFlags=0,c=a,a=s.child;a!==null;)g=a,r=c,g.flags&=14680066,x=g.alternate,x===null?(g.childLanes=0,g.lanes=r,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=x.childLanes,g.lanes=x.lanes,g.child=x.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=x.memoizedProps,g.memoizedState=x.memoizedState,g.updateQueue=x.updateQueue,g.type=x.type,r=x.dependencies,g.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),a=a.sibling;return Ae($e,$e.current&1|2),s.child}r=r.sibling}g.tail!==null&&He()>Yr&&(s.flags|=128,c=!0,ni(g,!1),s.lanes=4194304)}else{if(!c)if(r=Po(x),r!==null){if(s.flags|=128,c=!0,a=r.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),ni(g,!0),g.tail===null&&g.tailMode==="hidden"&&!x.alternate&&!Ue)return ct(s),null}else 2*He()-g.renderingStartTime>Yr&&a!==1073741824&&(s.flags|=128,c=!0,ni(g,!1),s.lanes=4194304);g.isBackwards?(x.sibling=s.child,s.child=x):(a=g.last,a!==null?a.sibling=x:s.child=x,g.last=x)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=He(),s.sibling=null,a=$e.current,Ae($e,c?a&1|2:a&1),s):(ct(s),null);case 22:case 23:return Du(),c=s.memoizedState!==null,r!==null&&r.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Nt&1073741824)!==0&&(ct(s),s.subtreeFlags&6&&(s.flags|=8192)):ct(s),null;case 24:return null;case 25:return null}throw Error(n(156,s.tag))}function px(r,s){switch(ql(s),s.tag){case 1:return vt(s.type)&&xo(),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return Hr(),De(yt),De(lt),ru(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return tu(s),null;case 13:if(De($e),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(n(340));Br()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return De($e),null;case 4:return Hr(),null;case 10:return Yl(s.type._context),null;case 22:case 23:return Du(),null;case 24:return null;default:return null}}var Vo=!1,dt=!1,mx=typeof WeakSet=="function"?WeakSet:Set,X=null;function Gr(r,s){var a=r.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(c){ze(r,s,c)}else a.current=null}function Su(r,s,a){try{a()}catch(c){ze(r,s,c)}}var _p=!1;function gx(r,s){if(Dl=io,r=Zh(),jl(r)){if("selectionStart"in r)var a={start:r.selectionStart,end:r.selectionEnd};else e:{a=(a=r.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var x=0,T=-1,C=-1,L=0,W=0,H=r,q=null;t:for(;;){for(var Q;H!==a||f!==0&&H.nodeType!==3||(T=x+f),H!==g||c!==0&&H.nodeType!==3||(C=x+c),H.nodeType===3&&(x+=H.nodeValue.length),(Q=H.firstChild)!==null;)q=H,H=Q;for(;;){if(H===r)break t;if(q===a&&++L===f&&(T=x),q===g&&++W===c&&(C=x),(Q=H.nextSibling)!==null)break;H=q,q=H.parentNode}H=Q}a=T===-1||C===-1?null:{start:T,end:C}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ll={focusedElem:r,selectionRange:a},io=!1,X=s;X!==null;)if(s=X,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,X=r;else for(;X!==null;){s=X;try{var ee=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(ee!==null){var te=ee.memoizedProps,Ke=ee.memoizedState,O=s.stateNode,A=O.getSnapshotBeforeUpdate(s.elementType===s.type?te:Ht(s.type,te),Ke);O.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var I=s.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(G){ze(s,s.return,G)}if(r=s.sibling,r!==null){r.return=s.return,X=r;break}X=s.return}return ee=_p,_p=!1,ee}function ri(r,s,a){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&r)===r){var g=f.destroy;f.destroy=void 0,g!==void 0&&Su(s,a,g)}f=f.next}while(f!==c)}}function Fo(r,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&r)===r){var c=a.create;a.destroy=c()}a=a.next}while(a!==s)}}function ku(r){var s=r.ref;if(s!==null){var a=r.stateNode;r.tag,r=a,typeof s=="function"?s(r):s.current=r}}function Sp(r){var s=r.alternate;s!==null&&(r.alternate=null,Sp(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&(delete s[nn],delete s[Hs],delete s[Vl],delete s[Xw],delete s[Zw])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function kp(r){return r.tag===5||r.tag===3||r.tag===4}function Ep(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||kp(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Eu(r,s,a){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(r,s):a.insertBefore(r,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(r,a)):(s=a,s.appendChild(r)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=vo));else if(c!==4&&(r=r.child,r!==null))for(Eu(r,s,a),r=r.sibling;r!==null;)Eu(r,s,a),r=r.sibling}function Tu(r,s,a){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?a.insertBefore(r,s):a.appendChild(r);else if(c!==4&&(r=r.child,r!==null))for(Tu(r,s,a),r=r.sibling;r!==null;)Tu(r,s,a),r=r.sibling}var rt=null,Kt=!1;function Mn(r,s,a){for(a=a.child;a!==null;)Tp(r,s,a),a=a.sibling}function Tp(r,s,a){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Zi,a)}catch{}switch(a.tag){case 5:dt||Gr(a,s);case 6:var c=rt,f=Kt;rt=null,Mn(r,s,a),rt=c,Kt=f,rt!==null&&(Kt?(r=rt,a=a.stateNode,r.nodeType===8?r.parentNode.removeChild(a):r.removeChild(a)):rt.removeChild(a.stateNode));break;case 18:rt!==null&&(Kt?(r=rt,a=a.stateNode,r.nodeType===8?$l(r.parentNode,a):r.nodeType===1&&$l(r,a),Ds(r)):$l(rt,a.stateNode));break;case 4:c=rt,f=Kt,rt=a.stateNode.containerInfo,Kt=!0,Mn(r,s,a),rt=c,Kt=f;break;case 0:case 11:case 14:case 15:if(!dt&&(c=a.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){f=c=c.next;do{var g=f,x=g.destroy;g=g.tag,x!==void 0&&((g&2)!==0||(g&4)!==0)&&Su(a,s,x),f=f.next}while(f!==c)}Mn(r,s,a);break;case 1:if(!dt&&(Gr(a,s),c=a.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(T){ze(a,s,T)}Mn(r,s,a);break;case 21:Mn(r,s,a);break;case 22:a.mode&1?(dt=(c=dt)||a.memoizedState!==null,Mn(r,s,a),dt=c):Mn(r,s,a);break;default:Mn(r,s,a)}}function jp(r){var s=r.updateQueue;if(s!==null){r.updateQueue=null;var a=r.stateNode;a===null&&(a=r.stateNode=new mx),s.forEach(function(c){var f=Ex.bind(null,r,c);a.has(c)||(a.add(c),c.then(f,f))})}}function Gt(r,s){var a=s.deletions;if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];try{var g=r,x=s,T=x;e:for(;T!==null;){switch(T.tag){case 5:rt=T.stateNode,Kt=!1;break e;case 3:rt=T.stateNode.containerInfo,Kt=!0;break e;case 4:rt=T.stateNode.containerInfo,Kt=!0;break e}T=T.return}if(rt===null)throw Error(n(160));Tp(g,x,f),rt=null,Kt=!1;var C=f.alternate;C!==null&&(C.return=null),f.return=null}catch(L){ze(f,s,L)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Cp(s,r),s=s.sibling}function Cp(r,s){var a=r.alternate,c=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Gt(s,r),on(r),c&4){try{ri(3,r,r.return),Fo(3,r)}catch(te){ze(r,r.return,te)}try{ri(5,r,r.return)}catch(te){ze(r,r.return,te)}}break;case 1:Gt(s,r),on(r),c&512&&a!==null&&Gr(a,a.return);break;case 5:if(Gt(s,r),on(r),c&512&&a!==null&&Gr(a,a.return),r.flags&32){var f=r.stateNode;try{ks(f,"")}catch(te){ze(r,r.return,te)}}if(c&4&&(f=r.stateNode,f!=null)){var g=r.memoizedProps,x=a!==null?a.memoizedProps:g,T=r.type,C=r.updateQueue;if(r.updateQueue=null,C!==null)try{T==="input"&&g.type==="radio"&&g.name!=null&&th(f,g),rl(T,x);var L=rl(T,g);for(x=0;x<C.length;x+=2){var W=C[x],H=C[x+1];W==="style"?uh(f,H):W==="dangerouslySetInnerHTML"?ah(f,H):W==="children"?ks(f,H):N(f,W,H,L)}switch(T){case"input":Xa(f,g);break;case"textarea":sh(f,g);break;case"select":var q=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var Q=g.value;Q!=null?jr(f,!!g.multiple,Q,!1):q!==!!g.multiple&&(g.defaultValue!=null?jr(f,!!g.multiple,g.defaultValue,!0):jr(f,!!g.multiple,g.multiple?[]:"",!1))}f[Hs]=g}catch(te){ze(r,r.return,te)}}break;case 6:if(Gt(s,r),on(r),c&4){if(r.stateNode===null)throw Error(n(162));f=r.stateNode,g=r.memoizedProps;try{f.nodeValue=g}catch(te){ze(r,r.return,te)}}break;case 3:if(Gt(s,r),on(r),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Ds(s.containerInfo)}catch(te){ze(r,r.return,te)}break;case 4:Gt(s,r),on(r);break;case 13:Gt(s,r),on(r),f=r.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(Nu=He())),c&4&&jp(r);break;case 22:if(W=a!==null&&a.memoizedState!==null,r.mode&1?(dt=(L=dt)||W,Gt(s,r),dt=L):Gt(s,r),on(r),c&8192){if(L=r.memoizedState!==null,(r.stateNode.isHidden=L)&&!W&&(r.mode&1)!==0)for(X=r,W=r.child;W!==null;){for(H=X=W;X!==null;){switch(q=X,Q=q.child,q.tag){case 0:case 11:case 14:case 15:ri(4,q,q.return);break;case 1:Gr(q,q.return);var ee=q.stateNode;if(typeof ee.componentWillUnmount=="function"){c=q,a=q.return;try{s=c,ee.props=s.memoizedProps,ee.state=s.memoizedState,ee.componentWillUnmount()}catch(te){ze(c,a,te)}}break;case 5:Gr(q,q.return);break;case 22:if(q.memoizedState!==null){Pp(H);continue}}Q!==null?(Q.return=q,X=Q):Pp(H)}W=W.sibling}e:for(W=null,H=r;;){if(H.tag===5){if(W===null){W=H;try{f=H.stateNode,L?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(T=H.stateNode,C=H.memoizedProps.style,x=C!=null&&C.hasOwnProperty("display")?C.display:null,T.style.display=lh("display",x))}catch(te){ze(r,r.return,te)}}}else if(H.tag===6){if(W===null)try{H.stateNode.nodeValue=L?"":H.memoizedProps}catch(te){ze(r,r.return,te)}}else if((H.tag!==22&&H.tag!==23||H.memoizedState===null||H===r)&&H.child!==null){H.child.return=H,H=H.child;continue}if(H===r)break e;for(;H.sibling===null;){if(H.return===null||H.return===r)break e;W===H&&(W=null),H=H.return}W===H&&(W=null),H.sibling.return=H.return,H=H.sibling}}break;case 19:Gt(s,r),on(r),c&4&&jp(r);break;case 21:break;default:Gt(s,r),on(r)}}function on(r){var s=r.flags;if(s&2){try{e:{for(var a=r.return;a!==null;){if(kp(a)){var c=a;break e}a=a.return}throw Error(n(160))}switch(c.tag){case 5:var f=c.stateNode;c.flags&32&&(ks(f,""),c.flags&=-33);var g=Ep(r);Tu(r,g,f);break;case 3:case 4:var x=c.stateNode.containerInfo,T=Ep(r);Eu(r,T,x);break;default:throw Error(n(161))}}catch(C){ze(r,r.return,C)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function yx(r,s,a){X=r,Np(r)}function Np(r,s,a){for(var c=(r.mode&1)!==0;X!==null;){var f=X,g=f.child;if(f.tag===22&&c){var x=f.memoizedState!==null||Vo;if(!x){var T=f.alternate,C=T!==null&&T.memoizedState!==null||dt;T=Vo;var L=dt;if(Vo=x,(dt=C)&&!L)for(X=f;X!==null;)x=X,C=x.child,x.tag===22&&x.memoizedState!==null?Rp(f):C!==null?(C.return=x,X=C):Rp(f);for(;g!==null;)X=g,Np(g),g=g.sibling;X=f,Vo=T,dt=L}Ap(r)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,X=g):Ap(r)}}function Ap(r){for(;X!==null;){var s=X;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:dt||Fo(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!dt)if(a===null)c.componentDidMount();else{var f=s.elementType===s.type?a.memoizedProps:Ht(s.type,a.memoizedProps);c.componentDidUpdate(f,a.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&Pf(s,g,c);break;case 3:var x=s.updateQueue;if(x!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}Pf(s,x,a)}break;case 5:var T=s.stateNode;if(a===null&&s.flags&4){a=T;var C=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":C.autoFocus&&a.focus();break;case"img":C.src&&(a.src=C.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var L=s.alternate;if(L!==null){var W=L.memoizedState;if(W!==null){var H=W.dehydrated;H!==null&&Ds(H)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}dt||s.flags&512&&ku(s)}catch(q){ze(s,s.return,q)}}if(s===r){X=null;break}if(a=s.sibling,a!==null){a.return=s.return,X=a;break}X=s.return}}function Pp(r){for(;X!==null;){var s=X;if(s===r){X=null;break}var a=s.sibling;if(a!==null){a.return=s.return,X=a;break}X=s.return}}function Rp(r){for(;X!==null;){var s=X;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{Fo(4,s)}catch(C){ze(s,a,C)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var f=s.return;try{c.componentDidMount()}catch(C){ze(s,f,C)}}var g=s.return;try{ku(s)}catch(C){ze(s,g,C)}break;case 5:var x=s.return;try{ku(s)}catch(C){ze(s,x,C)}}}catch(C){ze(s,s.return,C)}if(s===r){X=null;break}var T=s.sibling;if(T!==null){T.return=s.return,X=T;break}X=s.return}}var vx=Math.ceil,Bo=U.ReactCurrentDispatcher,ju=U.ReactCurrentOwner,$t=U.ReactCurrentBatchConfig,_e=0,tt=null,Je=null,st=0,Nt=0,Jr=Rn(0),Xe=0,si=null,ir=0,zo=0,Cu=0,ii=null,xt=null,Nu=0,Yr=1/0,vn=null,qo=!1,Au=null,Un=null,Wo=!1,$n=null,Ho=0,oi=0,Pu=null,Ko=-1,Go=0;function gt(){return(_e&6)!==0?He():Ko!==-1?Ko:Ko=He()}function Vn(r){return(r.mode&1)===0?1:(_e&2)!==0&&st!==0?st&-st:tx.transition!==null?(Go===0&&(Go=kh()),Go):(r=Ce,r!==0||(r=window.event,r=r===void 0?16:Oh(r.type)),r)}function Jt(r,s,a,c){if(50<oi)throw oi=0,Pu=null,Error(n(185));As(r,a,c),((_e&2)===0||r!==tt)&&(r===tt&&((_e&2)===0&&(zo|=a),Xe===4&&Fn(r,st)),bt(r,c),a===1&&_e===0&&(s.mode&1)===0&&(Yr=He()+500,_o&&In()))}function bt(r,s){var a=r.callbackNode;tw(r,s);var c=no(r,r===tt?st:0);if(c===0)a!==null&&bh(a),r.callbackNode=null,r.callbackPriority=0;else if(s=c&-c,r.callbackPriority!==s){if(a!=null&&bh(a),s===1)r.tag===0?ex(Ip.bind(null,r)):wf(Ip.bind(null,r)),Yw(function(){(_e&6)===0&&In()}),a=null;else{switch(Eh(c)){case 1:a=cl;break;case 4:a=_h;break;case 16:a=Xi;break;case 536870912:a=Sh;break;default:a=Xi}a=Bp(a,Op.bind(null,r))}r.callbackPriority=s,r.callbackNode=a}}function Op(r,s){if(Ko=-1,Go=0,(_e&6)!==0)throw Error(n(327));var a=r.callbackNode;if(Qr()&&r.callbackNode!==a)return null;var c=no(r,r===tt?st:0);if(c===0)return null;if((c&30)!==0||(c&r.expiredLanes)!==0||s)s=Jo(r,c);else{s=c;var f=_e;_e|=2;var g=Lp();(tt!==r||st!==s)&&(vn=null,Yr=He()+500,ar(r,s));do try{bx();break}catch(T){Dp(r,T)}while(!0);Jl(),Bo.current=g,_e=f,Je!==null?s=0:(tt=null,st=0,s=Xe)}if(s!==0){if(s===2&&(f=dl(r),f!==0&&(c=f,s=Ru(r,f))),s===1)throw a=si,ar(r,0),Fn(r,c),bt(r,He()),a;if(s===6)Fn(r,c);else{if(f=r.current.alternate,(c&30)===0&&!wx(f)&&(s=Jo(r,c),s===2&&(g=dl(r),g!==0&&(c=g,s=Ru(r,g))),s===1))throw a=si,ar(r,0),Fn(r,c),bt(r,He()),a;switch(r.finishedWork=f,r.finishedLanes=c,s){case 0:case 1:throw Error(n(345));case 2:lr(r,xt,vn);break;case 3:if(Fn(r,c),(c&130023424)===c&&(s=Nu+500-He(),10<s)){if(no(r,0)!==0)break;if(f=r.suspendedLanes,(f&c)!==c){gt(),r.pingedLanes|=r.suspendedLanes&f;break}r.timeoutHandle=Ul(lr.bind(null,r,xt,vn),s);break}lr(r,xt,vn);break;case 4:if(Fn(r,c),(c&4194240)===c)break;for(s=r.eventTimes,f=-1;0<c;){var x=31-zt(c);g=1<<x,x=s[x],x>f&&(f=x),c&=~g}if(c=f,c=He()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*vx(c/1960))-c,10<c){r.timeoutHandle=Ul(lr.bind(null,r,xt,vn),c);break}lr(r,xt,vn);break;case 5:lr(r,xt,vn);break;default:throw Error(n(329))}}}return bt(r,He()),r.callbackNode===a?Op.bind(null,r):null}function Ru(r,s){var a=ii;return r.current.memoizedState.isDehydrated&&(ar(r,s).flags|=256),r=Jo(r,s),r!==2&&(s=xt,xt=a,s!==null&&Ou(s)),r}function Ou(r){xt===null?xt=r:xt.push.apply(xt,r)}function wx(r){for(var s=r;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var c=0;c<a.length;c++){var f=a[c],g=f.getSnapshot;f=f.value;try{if(!qt(g(),f))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Fn(r,s){for(s&=~Cu,s&=~zo,r.suspendedLanes|=s,r.pingedLanes&=~s,r=r.expirationTimes;0<s;){var a=31-zt(s),c=1<<a;r[a]=-1,s&=~c}}function Ip(r){if((_e&6)!==0)throw Error(n(327));Qr();var s=no(r,0);if((s&1)===0)return bt(r,He()),null;var a=Jo(r,s);if(r.tag!==0&&a===2){var c=dl(r);c!==0&&(s=c,a=Ru(r,c))}if(a===1)throw a=si,ar(r,0),Fn(r,s),bt(r,He()),a;if(a===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=s,lr(r,xt,vn),bt(r,He()),null}function Iu(r,s){var a=_e;_e|=1;try{return r(s)}finally{_e=a,_e===0&&(Yr=He()+500,_o&&In())}}function or(r){$n!==null&&$n.tag===0&&(_e&6)===0&&Qr();var s=_e;_e|=1;var a=$t.transition,c=Ce;try{if($t.transition=null,Ce=1,r)return r()}finally{Ce=c,$t.transition=a,_e=s,(_e&6)===0&&In()}}function Du(){Nt=Jr.current,De(Jr)}function ar(r,s){r.finishedWork=null,r.finishedLanes=0;var a=r.timeoutHandle;if(a!==-1&&(r.timeoutHandle=-1,Jw(a)),Je!==null)for(a=Je.return;a!==null;){var c=a;switch(ql(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&xo();break;case 3:Hr(),De(yt),De(lt),ru();break;case 5:tu(c);break;case 4:Hr();break;case 13:De($e);break;case 19:De($e);break;case 10:Yl(c.type._context);break;case 22:case 23:Du()}a=a.return}if(tt=r,Je=r=Bn(r.current,null),st=Nt=s,Xe=0,si=null,Cu=zo=ir=0,xt=ii=null,nr!==null){for(s=0;s<nr.length;s++)if(a=nr[s],c=a.interleaved,c!==null){a.interleaved=null;var f=c.next,g=a.pending;if(g!==null){var x=g.next;g.next=f,c.next=x}a.pending=c}nr=null}return r}function Dp(r,s){do{var a=Je;try{if(Jl(),Ro.current=Lo,Oo){for(var c=Ve.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}Oo=!1}if(sr=0,et=Qe=Ve=null,Xs=!1,Zs=0,ju.current=null,a===null||a.return===null){Xe=1,si=s,Je=null;break}e:{var g=r,x=a.return,T=a,C=s;if(s=st,T.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){var L=C,W=T,H=W.tag;if((W.mode&1)===0&&(H===0||H===11||H===15)){var q=W.alternate;q?(W.updateQueue=q.updateQueue,W.memoizedState=q.memoizedState,W.lanes=q.lanes):(W.updateQueue=null,W.memoizedState=null)}var Q=op(x);if(Q!==null){Q.flags&=-257,ap(Q,x,T,g,s),Q.mode&1&&ip(g,L,s),s=Q,C=L;var ee=s.updateQueue;if(ee===null){var te=new Set;te.add(C),s.updateQueue=te}else ee.add(C);break e}else{if((s&1)===0){ip(g,L,s),Lu();break e}C=Error(n(426))}}else if(Ue&&T.mode&1){var Ke=op(x);if(Ke!==null){(Ke.flags&65536)===0&&(Ke.flags|=256),ap(Ke,x,T,g,s),Kl(Kr(C,T));break e}}g=C=Kr(C,T),Xe!==4&&(Xe=2),ii===null?ii=[g]:ii.push(g),g=x;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var O=rp(g,C,s);Af(g,O);break e;case 1:T=C;var A=g.type,I=g.stateNode;if((g.flags&128)===0&&(typeof A.getDerivedStateFromError=="function"||I!==null&&typeof I.componentDidCatch=="function"&&(Un===null||!Un.has(I)))){g.flags|=65536,s&=-s,g.lanes|=s;var G=sp(g,T,s);Af(g,G);break e}}g=g.return}while(g!==null)}Up(a)}catch(ne){s=ne,Je===a&&a!==null&&(Je=a=a.return);continue}break}while(!0)}function Lp(){var r=Bo.current;return Bo.current=Lo,r===null?Lo:r}function Lu(){(Xe===0||Xe===3||Xe===2)&&(Xe=4),tt===null||(ir&268435455)===0&&(zo&268435455)===0||Fn(tt,st)}function Jo(r,s){var a=_e;_e|=2;var c=Lp();(tt!==r||st!==s)&&(vn=null,ar(r,s));do try{xx();break}catch(f){Dp(r,f)}while(!0);if(Jl(),_e=a,Bo.current=c,Je!==null)throw Error(n(261));return tt=null,st=0,Xe}function xx(){for(;Je!==null;)Mp(Je)}function bx(){for(;Je!==null&&!Hv();)Mp(Je)}function Mp(r){var s=Fp(r.alternate,r,Nt);r.memoizedProps=r.pendingProps,s===null?Up(r):Je=s,ju.current=null}function Up(r){var s=r;do{var a=s.alternate;if(r=s.return,(s.flags&32768)===0){if(a=fx(a,s,Nt),a!==null){Je=a;return}}else{if(a=px(a,s),a!==null){a.flags&=32767,Je=a;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Xe=6,Je=null;return}}if(s=s.sibling,s!==null){Je=s;return}Je=s=r}while(s!==null);Xe===0&&(Xe=5)}function lr(r,s,a){var c=Ce,f=$t.transition;try{$t.transition=null,Ce=1,_x(r,s,a,c)}finally{$t.transition=f,Ce=c}return null}function _x(r,s,a,c){do Qr();while($n!==null);if((_e&6)!==0)throw Error(n(327));a=r.finishedWork;var f=r.finishedLanes;if(a===null)return null;if(r.finishedWork=null,r.finishedLanes=0,a===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var g=a.lanes|a.childLanes;if(nw(r,g),r===tt&&(Je=tt=null,st=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Wo||(Wo=!0,Bp(Xi,function(){return Qr(),null})),g=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||g){g=$t.transition,$t.transition=null;var x=Ce;Ce=1;var T=_e;_e|=4,ju.current=null,gx(r,a),Cp(a,r),Bw(Ll),io=!!Dl,Ll=Dl=null,r.current=a,yx(a),Kv(),_e=T,Ce=x,$t.transition=g}else r.current=a;if(Wo&&(Wo=!1,$n=r,Ho=f),g=r.pendingLanes,g===0&&(Un=null),Yv(a.stateNode),bt(r,He()),s!==null)for(c=r.onRecoverableError,a=0;a<s.length;a++)f=s[a],c(f.value,{componentStack:f.stack,digest:f.digest});if(qo)throw qo=!1,r=Au,Au=null,r;return(Ho&1)!==0&&r.tag!==0&&Qr(),g=r.pendingLanes,(g&1)!==0?r===Pu?oi++:(oi=0,Pu=r):oi=0,In(),null}function Qr(){if($n!==null){var r=Eh(Ho),s=$t.transition,a=Ce;try{if($t.transition=null,Ce=16>r?16:r,$n===null)var c=!1;else{if(r=$n,$n=null,Ho=0,(_e&6)!==0)throw Error(n(331));var f=_e;for(_e|=4,X=r.current;X!==null;){var g=X,x=g.child;if((X.flags&16)!==0){var T=g.deletions;if(T!==null){for(var C=0;C<T.length;C++){var L=T[C];for(X=L;X!==null;){var W=X;switch(W.tag){case 0:case 11:case 15:ri(8,W,g)}var H=W.child;if(H!==null)H.return=W,X=H;else for(;X!==null;){W=X;var q=W.sibling,Q=W.return;if(Sp(W),W===L){X=null;break}if(q!==null){q.return=Q,X=q;break}X=Q}}}var ee=g.alternate;if(ee!==null){var te=ee.child;if(te!==null){ee.child=null;do{var Ke=te.sibling;te.sibling=null,te=Ke}while(te!==null)}}X=g}}if((g.subtreeFlags&2064)!==0&&x!==null)x.return=g,X=x;else e:for(;X!==null;){if(g=X,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:ri(9,g,g.return)}var O=g.sibling;if(O!==null){O.return=g.return,X=O;break e}X=g.return}}var A=r.current;for(X=A;X!==null;){x=X;var I=x.child;if((x.subtreeFlags&2064)!==0&&I!==null)I.return=x,X=I;else e:for(x=A;X!==null;){if(T=X,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:Fo(9,T)}}catch(ne){ze(T,T.return,ne)}if(T===x){X=null;break e}var G=T.sibling;if(G!==null){G.return=T.return,X=G;break e}X=T.return}}if(_e=f,In(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Zi,r)}catch{}c=!0}return c}finally{Ce=a,$t.transition=s}}return!1}function $p(r,s,a){s=Kr(a,s),s=rp(r,s,1),r=Ln(r,s,1),s=gt(),r!==null&&(As(r,1,s),bt(r,s))}function ze(r,s,a){if(r.tag===3)$p(r,r,a);else for(;s!==null;){if(s.tag===3){$p(s,r,a);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Un===null||!Un.has(c))){r=Kr(a,r),r=sp(s,r,1),s=Ln(s,r,1),r=gt(),s!==null&&(As(s,1,r),bt(s,r));break}}s=s.return}}function Sx(r,s,a){var c=r.pingCache;c!==null&&c.delete(s),s=gt(),r.pingedLanes|=r.suspendedLanes&a,tt===r&&(st&a)===a&&(Xe===4||Xe===3&&(st&130023424)===st&&500>He()-Nu?ar(r,0):Cu|=a),bt(r,s)}function Vp(r,s){s===0&&((r.mode&1)===0?s=1:(s=to,to<<=1,(to&130023424)===0&&(to=4194304)));var a=gt();r=mn(r,s),r!==null&&(As(r,s,a),bt(r,a))}function kx(r){var s=r.memoizedState,a=0;s!==null&&(a=s.retryLane),Vp(r,a)}function Ex(r,s){var a=0;switch(r.tag){case 13:var c=r.stateNode,f=r.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=r.stateNode;break;default:throw Error(n(314))}c!==null&&c.delete(s),Vp(r,a)}var Fp;Fp=function(r,s,a){if(r!==null)if(r.memoizedProps!==s.pendingProps||yt.current)wt=!0;else{if((r.lanes&a)===0&&(s.flags&128)===0)return wt=!1,hx(r,s,a);wt=(r.flags&131072)!==0}else wt=!1,Ue&&(s.flags&1048576)!==0&&xf(s,ko,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;$o(r,s),r=s.pendingProps;var f=$r(s,lt.current);Wr(s,a),f=ou(null,s,c,r,f,a);var g=au();return s.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,vt(c)?(g=!0,bo(s)):g=!1,s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Zl(s),f.updater=Mo,s.stateNode=f,f._reactInternals=s,fu(s,c,r,a),s=yu(null,s,c,!0,g,a)):(s.tag=0,Ue&&g&&zl(s),mt(null,s,f,a),s=s.child),s;case 16:c=s.elementType;e:{switch($o(r,s),r=s.pendingProps,f=c._init,c=f(c._payload),s.type=c,f=s.tag=jx(c),r=Ht(c,r),f){case 0:s=gu(null,s,c,r,a);break e;case 1:s=fp(null,s,c,r,a);break e;case 11:s=lp(null,s,c,r,a);break e;case 14:s=up(null,s,c,Ht(c.type,r),a);break e}throw Error(n(306,c,""))}return s;case 0:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),gu(r,s,c,f,a);case 1:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),fp(r,s,c,f,a);case 3:e:{if(pp(s),r===null)throw Error(n(387));c=s.pendingProps,g=s.memoizedState,f=g.element,Nf(r,s),Ao(s,c,null,a);var x=s.memoizedState;if(c=x.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:x.cache,pendingSuspenseBoundaries:x.pendingSuspenseBoundaries,transitions:x.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){f=Kr(Error(n(423)),s),s=mp(r,s,c,a,f);break e}else if(c!==f){f=Kr(Error(n(424)),s),s=mp(r,s,c,a,f);break e}else for(Ct=Pn(s.stateNode.containerInfo.firstChild),jt=s,Ue=!0,Wt=null,a=jf(s,null,c,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Br(),c===f){s=yn(r,s,a);break e}mt(r,s,c,a)}s=s.child}return s;case 5:return Rf(s),r===null&&Hl(s),c=s.type,f=s.pendingProps,g=r!==null?r.memoizedProps:null,x=f.children,Ml(c,f)?x=null:g!==null&&Ml(c,g)&&(s.flags|=32),hp(r,s),mt(r,s,x,a),s.child;case 6:return r===null&&Hl(s),null;case 13:return gp(r,s,a);case 4:return eu(s,s.stateNode.containerInfo),c=s.pendingProps,r===null?s.child=zr(s,null,c,a):mt(r,s,c,a),s.child;case 11:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),lp(r,s,c,f,a);case 7:return mt(r,s,s.pendingProps,a),s.child;case 8:return mt(r,s,s.pendingProps.children,a),s.child;case 12:return mt(r,s,s.pendingProps.children,a),s.child;case 10:e:{if(c=s.type._context,f=s.pendingProps,g=s.memoizedProps,x=f.value,Ae(jo,c._currentValue),c._currentValue=x,g!==null)if(qt(g.value,x)){if(g.children===f.children&&!yt.current){s=yn(r,s,a);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var T=g.dependencies;if(T!==null){x=g.child;for(var C=T.firstContext;C!==null;){if(C.context===c){if(g.tag===1){C=gn(-1,a&-a),C.tag=2;var L=g.updateQueue;if(L!==null){L=L.shared;var W=L.pending;W===null?C.next=C:(C.next=W.next,W.next=C),L.pending=C}}g.lanes|=a,C=g.alternate,C!==null&&(C.lanes|=a),Ql(g.return,a,s),T.lanes|=a;break}C=C.next}}else if(g.tag===10)x=g.type===s.type?null:g.child;else if(g.tag===18){if(x=g.return,x===null)throw Error(n(341));x.lanes|=a,T=x.alternate,T!==null&&(T.lanes|=a),Ql(x,a,s),x=g.sibling}else x=g.child;if(x!==null)x.return=g;else for(x=g;x!==null;){if(x===s){x=null;break}if(g=x.sibling,g!==null){g.return=x.return,x=g;break}x=x.return}g=x}mt(r,s,f.children,a),s=s.child}return s;case 9:return f=s.type,c=s.pendingProps.children,Wr(s,a),f=Mt(f),c=c(f),s.flags|=1,mt(r,s,c,a),s.child;case 14:return c=s.type,f=Ht(c,s.pendingProps),f=Ht(c.type,f),up(r,s,c,f,a);case 15:return cp(r,s,s.type,s.pendingProps,a);case 17:return c=s.type,f=s.pendingProps,f=s.elementType===c?f:Ht(c,f),$o(r,s),s.tag=1,vt(c)?(r=!0,bo(s)):r=!1,Wr(s,a),tp(s,c,f),fu(s,c,f,a),yu(null,s,c,!0,r,a);case 19:return vp(r,s,a);case 22:return dp(r,s,a)}throw Error(n(156,s.tag))};function Bp(r,s){return xh(r,s)}function Tx(r,s,a,c){this.tag=r,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(r,s,a,c){return new Tx(r,s,a,c)}function Mu(r){return r=r.prototype,!(!r||!r.isReactComponent)}function jx(r){if(typeof r=="function")return Mu(r)?1:0;if(r!=null){if(r=r.$$typeof,r===ve)return 11;if(r===Oe)return 14}return 2}function Bn(r,s){var a=r.alternate;return a===null?(a=Vt(r.tag,s,r.key,r.mode),a.elementType=r.elementType,a.type=r.type,a.stateNode=r.stateNode,a.alternate=r,r.alternate=a):(a.pendingProps=s,a.type=r.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=r.flags&14680064,a.childLanes=r.childLanes,a.lanes=r.lanes,a.child=r.child,a.memoizedProps=r.memoizedProps,a.memoizedState=r.memoizedState,a.updateQueue=r.updateQueue,s=r.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=r.sibling,a.index=r.index,a.ref=r.ref,a}function Yo(r,s,a,c,f,g){var x=2;if(c=r,typeof r=="function")Mu(r)&&(x=1);else if(typeof r=="string")x=5;else e:switch(r){case $:return ur(a.children,f,g,s);case B:x=8,f|=8;break;case Y:return r=Vt(12,a,s,f|2),r.elementType=Y,r.lanes=g,r;case je:return r=Vt(13,a,s,f),r.elementType=je,r.lanes=g,r;case xe:return r=Vt(19,a,s,f),r.elementType=xe,r.lanes=g,r;case pe:return Qo(a,f,g,s);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case oe:x=10;break e;case Te:x=9;break e;case ve:x=11;break e;case Oe:x=14;break e;case be:x=16,c=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return s=Vt(x,a,s,f),s.elementType=r,s.type=c,s.lanes=g,s}function ur(r,s,a,c){return r=Vt(7,r,c,s),r.lanes=a,r}function Qo(r,s,a,c){return r=Vt(22,r,c,s),r.elementType=pe,r.lanes=a,r.stateNode={isHidden:!1},r}function Uu(r,s,a){return r=Vt(6,r,null,s),r.lanes=a,r}function $u(r,s,a){return s=Vt(4,r.children!==null?r.children:[],r.key,s),s.lanes=a,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}function Cx(r,s,a,c,f){this.tag=s,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=hl(0),this.expirationTimes=hl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hl(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Vu(r,s,a,c,f,g,x,T,C){return r=new Cx(r,s,a,T,C),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Vt(3,null,null,s),r.current=g,g.stateNode=r,g.memoizedState={element:c,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zl(g),r}function Nx(r,s,a){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:z,key:c==null?null:""+c,children:r,containerInfo:s,implementation:a}}function zp(r){if(!r)return On;r=r._reactInternals;e:{if(Qn(r)!==r||r.tag!==1)throw Error(n(170));var s=r;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(vt(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(n(171))}if(r.tag===1){var a=r.type;if(vt(a))return yf(r,a,s)}return s}function qp(r,s,a,c,f,g,x,T,C){return r=Vu(a,c,!0,r,f,g,x,T,C),r.context=zp(null),a=r.current,c=gt(),f=Vn(a),g=gn(c,f),g.callback=s??null,Ln(a,g,f),r.current.lanes=f,As(r,f,c),bt(r,c),r}function Xo(r,s,a,c){var f=s.current,g=gt(),x=Vn(f);return a=zp(a),s.context===null?s.context=a:s.pendingContext=a,s=gn(g,x),s.payload={element:r},c=c===void 0?null:c,c!==null&&(s.callback=c),r=Ln(f,s,x),r!==null&&(Jt(r,f,x,g),No(r,f,x)),x}function Zo(r){return r=r.current,r.child?(r.child.tag===5,r.child.stateNode):null}function Wp(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var a=r.retryLane;r.retryLane=a!==0&&a<s?a:s}}function Fu(r,s){Wp(r,s),(r=r.alternate)&&Wp(r,s)}function Ax(){return null}var Hp=typeof reportError=="function"?reportError:function(r){console.error(r)};function Bu(r){this._internalRoot=r}ea.prototype.render=Bu.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(n(409));Xo(r,s,null,null)},ea.prototype.unmount=Bu.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;or(function(){Xo(null,r,null,null)}),s[dn]=null}};function ea(r){this._internalRoot=r}ea.prototype.unstable_scheduleHydration=function(r){if(r){var s=Ch();r={blockedOn:null,target:r,priority:s};for(var a=0;a<Cn.length&&s!==0&&s<Cn[a].priority;a++);Cn.splice(a,0,r),a===0&&Ph(r)}};function zu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function ta(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Kp(){}function Px(r,s,a,c,f){if(f){if(typeof c=="function"){var g=c;c=function(){var L=Zo(x);g.call(L)}}var x=qp(s,c,r,0,null,!1,!1,"",Kp);return r._reactRootContainer=x,r[dn]=x.current,qs(r.nodeType===8?r.parentNode:r),or(),x}for(;f=r.lastChild;)r.removeChild(f);if(typeof c=="function"){var T=c;c=function(){var L=Zo(C);T.call(L)}}var C=Vu(r,0,!1,null,null,!1,!1,"",Kp);return r._reactRootContainer=C,r[dn]=C.current,qs(r.nodeType===8?r.parentNode:r),or(function(){Xo(s,C,a,c)}),C}function na(r,s,a,c,f){var g=a._reactRootContainer;if(g){var x=g;if(typeof f=="function"){var T=f;f=function(){var C=Zo(x);T.call(C)}}Xo(s,x,r,f)}else x=Px(a,s,r,f,c);return Zo(x)}Th=function(r){switch(r.tag){case 3:var s=r.stateNode;if(s.current.memoizedState.isDehydrated){var a=Ns(s.pendingLanes);a!==0&&(fl(s,a|1),bt(s,He()),(_e&6)===0&&(Yr=He()+500,In()))}break;case 13:or(function(){var c=mn(r,1);if(c!==null){var f=gt();Jt(c,r,1,f)}}),Fu(r,1)}},pl=function(r){if(r.tag===13){var s=mn(r,134217728);if(s!==null){var a=gt();Jt(s,r,134217728,a)}Fu(r,134217728)}},jh=function(r){if(r.tag===13){var s=Vn(r),a=mn(r,s);if(a!==null){var c=gt();Jt(a,r,s,c)}Fu(r,s)}},Ch=function(){return Ce},Nh=function(r,s){var a=Ce;try{return Ce=r,s()}finally{Ce=a}},ol=function(r,s,a){switch(s){case"input":if(Xa(r,a),s=a.name,a.type==="radio"&&s!=null){for(a=r;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var c=a[s];if(c!==r&&c.form===r.form){var f=wo(c);if(!f)throw Error(n(90));Zd(c),Xa(c,f)}}}break;case"textarea":sh(r,a);break;case"select":s=a.value,s!=null&&jr(r,!!a.multiple,s,!1)}},fh=Iu,ph=or;var Rx={usingClientEntryPoint:!1,Events:[Ks,Mr,wo,dh,hh,Iu]},ai={findFiberByHostInstance:Xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ox={bundleType:ai.bundleType,version:ai.version,rendererPackageName:ai.rendererPackageName,rendererConfig:ai.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:U.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=vh(r),r===null?null:r.stateNode},findFiberByHostInstance:ai.findFiberByHostInstance||Ax,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 ra=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ra.isDisabled&&ra.supportsFiber)try{Zi=ra.inject(Ox),tn=ra}catch{}}return _t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rx,_t.createPortal=function(r,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!zu(s))throw Error(n(200));return Nx(r,s,null,a)},_t.createRoot=function(r,s){if(!zu(r))throw Error(n(299));var a=!1,c="",f=Hp;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(f=s.onRecoverableError)),s=Vu(r,1,!1,null,null,a,!1,c,f),r[dn]=s.current,qs(r.nodeType===8?r.parentNode:r),new Bu(s)},_t.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=vh(s),r=r===null?null:r.stateNode,r},_t.flushSync=function(r){return or(r)},_t.hydrate=function(r,s,a){if(!ta(s))throw Error(n(200));return na(null,r,s,!0,a)},_t.hydrateRoot=function(r,s,a){if(!zu(r))throw Error(n(405));var c=a!=null&&a.hydratedSources||null,f=!1,g="",x=Hp;if(a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),s=qp(s,null,r,1,a??null,f,!1,g,x),r[dn]=s.current,qs(r),c)for(r=0;r<c.length;r++)a=c[r],f=a._getVersion,f=f(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,f]:s.mutableSourceEagerHydrationData.push(a,f);return new ea(s)},_t.render=function(r,s,a){if(!ta(s))throw Error(n(200));return na(null,r,s,!1,a)},_t.unmountComponentAtNode=function(r){if(!ta(r))throw Error(n(40));return r._reactRootContainer?(or(function(){na(null,null,r,!1,function(){r._reactRootContainer=null,r[dn]=null})}),!0):!1},_t.unstable_batchedUpdates=Iu,_t.unstable_renderSubtreeIntoContainer=function(r,s,a,c){if(!ta(a))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return na(r,s,a,!1,c)},_t.version="18.3.1-next-f1338f8080-20240426",_t}var tm;function Fx(){if(tm)return Hu.exports;tm=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Hu.exports=Vx(),Hu.exports}var nm;function Bx(){if(nm)return sa;nm=1;var t=Fx();return sa.createRoot=t.createRoot,sa.hydrateRoot=t.hydrateRoot,sa}var zx=Bx();const qx=dy(zx);var Wx={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"};const Hx=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Z=(t,e)=>{const n=R.forwardRef(({color:i="currentColor",size:o=24,strokeWidth:l=2,absoluteStrokeWidth:u,className:d="",children:h,...m},y)=>R.createElement("svg",{ref:y,...Wx,width:o,height:o,stroke:i,strokeWidth:u?Number(l)*24/Number(o):l,className:["lucide",`lucide-${Hx(t)}`,d].join(" "),...m},[...e.map(([v,w])=>R.createElement(v,w)),...Array.isArray(h)?h:[h]]));return n.displayName=`${t}`,n};const Kx=Z("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);const Mi=Z("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const Gx=Z("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Jx=Z("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const Yx=Z("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Qx=Z("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Xx=Z("Bitcoin",[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]]);const Zx=Z("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const hy=Z("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);const e1=Z("Briefcase",[["rect",{width:"20",height:"14",x:"2",y:"7",rx:"2",ry:"2",key:"eto64e"}],["path",{d:"M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"zwj3tp"}]]);const t1=Z("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);const n1=Z("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const r1=Z("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);const rd=Z("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const Si=Z("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const ba=Z("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const rm=Z("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const fy=Z("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const s1=Z("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const i1=Z("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const o1=Z("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);const ps=Z("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const py=Z("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const sd=Z("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const ki=Z("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const a1=Z("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);const sm=Z("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const Da=Z("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const l1=Z("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const u1=Z("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const c1=Z("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Ju=Z("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const d1=Z("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const my=Z("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const h1=Z("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const f1=Z("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);const p1=Z("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"}]]);const m1=Z("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);const xn=Z("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const g1=Z("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const im=Z("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);const om=Z("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const y1=Z("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);const v1=Z("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);const w1=Z("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const x1=Z("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const b1=Z("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const id=Z("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const _1=Z("RotateCcw",[["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"}]]);const _a=Z("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);const Sc=Z("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const S1=Z("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"}]]);const gy=Z("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const k1=Z("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);const E1=Z("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const T1=Z("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);const kc=Z("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const j1=Z("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const C1=Z("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);const od=Z("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const am=Z("Volume2",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]]);const lm=Z("VolumeX",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);const um=Z("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const Sr=Z("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const kr=Z("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),ad=R.createContext({});function ld(t){const e=R.useRef(null);return e.current===null&&(e.current=t()),e.current}const La=R.createContext(null),ud=R.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class N1 extends R.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function A1({children:t,isPresent:e}){const n=R.useId(),i=R.useRef(null),o=R.useRef({width:0,height:0,top:0,left:0}),{nonce:l}=R.useContext(ud);return R.useInsertionEffect(()=>{const{width:u,height:d,top:h,left:m}=o.current;if(e||!i.current||!u||!d)return;i.current.dataset.motionPopId=n;const y=document.createElement("style");return l&&(y.nonce=l),document.head.appendChild(y),y.sheet&&y.sheet.insertRule(`
9
9
  [data-motion-pop-id="${n}"] {
10
10
  position: absolute !important;
11
11
  width: ${u}px !important;
@@ -13,24 +13,24 @@ Error generating stack: `+g.message+`
13
13
  top: ${h}px !important;
14
14
  left: ${m}px !important;
15
15
  }
16
- `),()=>{document.head.removeChild(y)}},[e]),p.jsx(C1,{isPresent:e,childRef:i,sizeRef:o,children:R.cloneElement(t,{ref:i})})}const A1=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:o,presenceAffectsLayout:l,mode:u})=>{const d=ld(P1),h=R.useId(),m=R.useCallback(v=>{d.set(v,!0);for(const w of d.values())if(!w)return;i&&i()},[d,i]),y=R.useMemo(()=>({id:h,initial:e,isPresent:n,custom:o,onExitComplete:m,register:v=>(d.set(v,!1),()=>d.delete(v))}),l?[Math.random(),m]:[n,m]);return R.useMemo(()=>{d.forEach((v,w)=>d.set(w,!1))},[n]),R.useEffect(()=>{!n&&!d.size&&i&&i()},[n]),u==="popLayout"&&(t=p.jsx(N1,{isPresent:n,children:t})),p.jsx(La.Provider,{value:y,children:t})};function P1(){return new Map}function gy(t=!0){const e=R.useContext(La);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:o}=e,l=R.useId();R.useEffect(()=>{t&&o(l)},[t]);const u=R.useCallback(()=>t&&i&&i(l),[l,i,t]);return!n&&i?[!1,u]:[!0]}const sa=t=>t.key||"";function um(t){const e=[];return R.Children.forEach(t,n=>{R.isValidElement(n)&&e.push(n)}),e}const cd=typeof window<"u",yy=cd?R.useLayoutEffect:R.useEffect,cn=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:o=!0,mode:l="sync",propagate:u=!1})=>{const[d,h]=gy(u),m=R.useMemo(()=>um(t),[t]),y=u&&!d?[]:m.map(sa),v=R.useRef(!0),w=R.useRef(m),_=ld(()=>new Map),[b,S]=R.useState(m),[k,E]=R.useState(m);yy(()=>{v.current=!1,w.current=m;for(let U=0;U<k.length;U++){const V=sa(k[U]);y.includes(V)?_.delete(V):_.get(V)!==!0&&_.set(V,!1)}},[k,y.length,y.join("-")]);const P=[];if(m!==b){let U=[...m];for(let V=0;V<k.length;V++){const z=k[V],$=sa(z);y.includes($)||(U.splice(V,0,z),P.push(z))}l==="wait"&&P.length&&(U=P),E(um(U)),S(m);return}const{forceRender:N}=R.useContext(ad);return p.jsx(p.Fragment,{children:k.map(U=>{const V=sa(U),z=u&&!d?!1:m===k||y.includes(V),$=()=>{if(_.has(V))_.set(V,!0);else return;let B=!0;_.forEach(Y=>{Y||(B=!1)}),B&&(N?.(),E(w.current),u&&h?.(),i&&i())};return p.jsx(A1,{isPresent:z,initial:!v.current||n?void 0:!1,custom:z?void 0:e,presenceAffectsLayout:o,mode:l,onExitComplete:z?void 0:$,children:U},V)})})},Ot=t=>t;let vy=Ot;function dd(t){let e;return()=>(e===void 0&&(e=t()),e)}const ms=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i},bn=t=>t*1e3,_n=t=>t/1e3,R1={useManualTiming:!1};function O1(t){let e=new Set,n=new Set,i=!1,o=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(m){l.has(m)&&(h.schedule(m),t()),m(u)}const h={schedule:(m,y=!1,v=!1)=>{const _=v&&i?e:n;return y&&l.add(m),_.has(m)||_.add(m),m},cancel:m=>{n.delete(m),l.delete(m)},process:m=>{if(u=m,i){o=!0;return}i=!0,[e,n]=[n,e],e.forEach(d),e.clear(),i=!1,o&&(o=!1,h.process(m))}};return h}const ia=["read","resolveKeyframes","update","preRender","render","postRender"],I1=40;function wy(t,e){let n=!1,i=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=ia.reduce((E,P)=>(E[P]=O1(l),E),{}),{read:d,resolveKeyframes:h,update:m,preRender:y,render:v,postRender:w}=u,_=()=>{const E=performance.now();n=!1,o.delta=i?1e3/60:Math.max(Math.min(E-o.timestamp,I1),1),o.timestamp=E,o.isProcessing=!0,d.process(o),h.process(o),m.process(o),y.process(o),v.process(o),w.process(o),o.isProcessing=!1,n&&e&&(i=!1,t(_))},b=()=>{n=!0,i=!0,o.isProcessing||t(_)};return{schedule:ia.reduce((E,P)=>{const N=u[P];return E[P]=(U,V=!1,z=!1)=>(n||b(),N.schedule(U,V,z)),E},{}),cancel:E=>{for(let P=0;P<ia.length;P++)u[ia[P]].cancel(E)},state:o,steps:u}}const{schedule:Le,cancel:Gn,state:at,steps:Yu}=wy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ot,!0),xy=R.createContext({strict:!1}),cm={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},gs={};for(const t in cm)gs[t]={isEnabled:e=>cm[t].some(n=>!!e[n])};function D1(t){for(const e in t)gs[e]={...gs[e],...t[e]}}const L1=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function _a(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||L1.has(t)}let by=t=>!_a(t);function M1(t){t&&(by=e=>e.startsWith("on")?!_a(e):t(e))}try{M1(require("@emotion/is-prop-valid").default)}catch{}function U1(t,e,n){const i={};for(const o in t)o==="values"&&typeof t.values=="object"||(by(o)||n===!0&&_a(o)||!e&&!_a(o)||t.draggable&&o.startsWith("onDrag"))&&(i[o]=t[o]);return i}function $1(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...i)=>t(...i);return new Proxy(n,{get:(i,o)=>o==="create"?t:(e.has(o)||e.set(o,t(o)),e.get(o))})}const Ma=R.createContext({});function Ei(t){return typeof t=="string"||Array.isArray(t)}function Ua(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const hd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fd=["initial",...hd];function $a(t){return Ua(t.animate)||fd.some(e=>Ei(t[e]))}function _y(t){return!!($a(t)||t.variants)}function V1(t,e){if($a(t)){const{initial:n,animate:i}=t;return{initial:n===!1||Ei(n)?n:void 0,animate:Ei(i)?i:void 0}}return t.inherit!==!1?e:{}}function F1(t){const{initial:e,animate:n}=V1(t,R.useContext(Ma));return R.useMemo(()=>({initial:e,animate:n}),[dm(e),dm(n)])}function dm(t){return Array.isArray(t)?t.join(" "):t}const B1=Symbol.for("motionComponentSymbol");function as(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function z1(t,e,n){return R.useCallback(i=>{i&&t.onMount&&t.onMount(i),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):as(n)&&(n.current=i))},[e])}const pd=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),q1="framerAppearId",Sy="data-"+pd(q1),{schedule:md}=wy(queueMicrotask,!1),ky=R.createContext({});function W1(t,e,n,i,o){var l,u;const{visualElement:d}=R.useContext(Ma),h=R.useContext(xy),m=R.useContext(La),y=R.useContext(ud).reducedMotion,v=R.useRef(null);i=i||h.renderer,!v.current&&i&&(v.current=i(t,{visualState:e,parent:d,props:n,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:y}));const w=v.current,_=R.useContext(ky);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&H1(v.current,n,o,_);const b=R.useRef(!1);R.useInsertionEffect(()=>{w&&b.current&&w.update(n,m)});const S=n[Sy],k=R.useRef(!!S&&!(!((l=window.MotionHandoffIsComplete)===null||l===void 0)&&l.call(window,S))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,S)));return yy(()=>{w&&(b.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),md.render(w.render),k.current&&w.animationState&&w.animationState.animateChanges())}),R.useEffect(()=>{w&&(!k.current&&w.animationState&&w.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)===null||E===void 0||E.call(window,S)}),k.current=!1))}),w}function H1(t,e,n,i){const{layoutId:o,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:m}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ey(t.parent)),t.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||d&&as(d),visualElement:t,animationType:typeof l=="string"?l:"both",initialPromotionConfig:i,layoutScroll:h,layoutRoot:m})}function Ey(t){if(t)return t.options.allowProjection!==!1?t.projection:Ey(t.parent)}function K1({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:i,Component:o}){var l,u;t&&D1(t);function d(m,y){let v;const w={...R.useContext(ud),...m,layoutId:G1(m)},{isStatic:_}=w,b=F1(m),S=i(m,_);if(!_&&cd){J1();const k=Y1(w);v=k.MeasureLayout,b.visualElement=W1(o,S,w,e,k.ProjectionNode)}return p.jsxs(Ma.Provider,{value:b,children:[v&&b.visualElement?p.jsx(v,{visualElement:b.visualElement,...w}):null,n(o,m,z1(S,b.visualElement,y),S,_,b.visualElement)]})}d.displayName=`motion.${typeof o=="string"?o:`create(${(u=(l=o.displayName)!==null&&l!==void 0?l:o.name)!==null&&u!==void 0?u:""})`}`;const h=R.forwardRef(d);return h[B1]=o,h}function G1({layoutId:t}){const e=R.useContext(ad).id;return e&&t!==void 0?e+"-"+t:t}function J1(t,e){R.useContext(xy).strict}function Y1(t){const{drag:e,layout:n}=gs;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const Q1=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gd(t){return typeof t!="string"||t.includes("-")?!1:!!(Q1.indexOf(t)>-1||/[A-Z]/u.test(t))}function hm(t){const e=[{},{}];return t?.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function yd(t,e,n,i){if(typeof e=="function"){const[o,l]=hm(i);e=e(n!==void 0?n:t.custom,o,l)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,l]=hm(i);e=e(n!==void 0?n:t.custom,o,l)}return e}const Ec=t=>Array.isArray(t),X1=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),Z1=t=>Ec(t)?t[t.length-1]||0:t,pt=t=>!!(t&&t.getVelocity);function pa(t){const e=pt(t)?t.get():t;return X1(e)?e.toValue():e}function eb({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},i,o,l){const u={latestValues:tb(i,o,l,t),renderState:e()};return n&&(u.onMount=d=>n({props:i,current:d,...u}),u.onUpdate=d=>n(d)),u}const Ty=t=>(e,n)=>{const i=R.useContext(Ma),o=R.useContext(La),l=()=>eb(t,e,i,o);return n?l():ld(l)};function tb(t,e,n,i){const o={},l=i(t,{});for(const w in l)o[w]=pa(l[w]);let{initial:u,animate:d}=t;const h=$a(t),m=_y(t);e&&m&&!h&&t.inherit!==!1&&(u===void 0&&(u=e.initial),d===void 0&&(d=e.animate));let y=n?n.initial===!1:!1;y=y||u===!1;const v=y?d:u;if(v&&typeof v!="boolean"&&!Ua(v)){const w=Array.isArray(v)?v:[v];for(let _=0;_<w.length;_++){const b=yd(t,w[_]);if(b){const{transitionEnd:S,transition:k,...E}=b;for(const P in E){let N=E[P];if(Array.isArray(N)){const U=y?N.length-1:0;N=N[U]}N!==null&&(o[P]=N)}for(const P in S)o[P]=S[P]}}}return o}const ws=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Tr=new Set(ws),jy=t=>e=>typeof e=="string"&&e.startsWith(t),Cy=jy("--"),nb=jy("var(--"),vd=t=>nb(t)?rb.test(t.split("/*")[0].trim()):!1,rb=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ny=(t,e)=>e&&typeof t=="number"?e.transform(t):t,Sn=(t,e,n)=>n>e?e:n<t?t:n,xs={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ti={...xs,transform:t=>Sn(0,1,t)},oa={...xs,default:1},Mi=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Wn=Mi("deg"),ln=Mi("%"),de=Mi("px"),sb=Mi("vh"),ib=Mi("vw"),fm={...ln,parse:t=>ln.parse(t)/100,transform:t=>ln.transform(t*100)},ob={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de},ab={rotate:Wn,rotateX:Wn,rotateY:Wn,rotateZ:Wn,scale:oa,scaleX:oa,scaleY:oa,scaleZ:oa,skew:Wn,skewX:Wn,skewY:Wn,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:Ti,originX:fm,originY:fm,originZ:de},pm={...xs,transform:Math.round},wd={...ob,...ab,zIndex:pm,size:de,fillOpacity:Ti,strokeOpacity:Ti,numOctaves:pm},lb={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ub=ws.length;function cb(t,e,n){let i="",o=!0;for(let l=0;l<ub;l++){const u=ws[l],d=t[u];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(u.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const m=Ny(d,wd[u]);if(!h){o=!1;const y=lb[u]||u;i+=`${y}(${m}) `}n&&(e[u]=m)}}return i=i.trim(),n?i=n(e,o?"":i):o&&(i="none"),i}function xd(t,e,n){const{style:i,vars:o,transformOrigin:l}=t;let u=!1,d=!1;for(const h in e){const m=e[h];if(Tr.has(h)){u=!0;continue}else if(Cy(h)){o[h]=m;continue}else{const y=Ny(m,wd[h]);h.startsWith("origin")?(d=!0,l[h]=y):i[h]=y}}if(e.transform||(u||n?i.transform=cb(e,t.transform,n):i.transform&&(i.transform="none")),d){const{originX:h="50%",originY:m="50%",originZ:y=0}=l;i.transformOrigin=`${h} ${m} ${y}`}}const db={offset:"stroke-dashoffset",array:"stroke-dasharray"},hb={offset:"strokeDashoffset",array:"strokeDasharray"};function fb(t,e,n=1,i=0,o=!0){t.pathLength=1;const l=o?db:hb;t[l.offset]=de.transform(-i);const u=de.transform(e),d=de.transform(n);t[l.array]=`${u} ${d}`}function mm(t,e,n){return typeof t=="string"?t:de.transform(e+n*t)}function pb(t,e,n){const i=mm(e,t.x,t.width),o=mm(n,t.y,t.height);return`${i} ${o}`}function bd(t,{attrX:e,attrY:n,attrScale:i,originX:o,originY:l,pathLength:u,pathSpacing:d=1,pathOffset:h=0,...m},y,v){if(xd(t,m,v),y){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:w,style:_,dimensions:b}=t;w.transform&&(b&&(_.transform=w.transform),delete w.transform),b&&(o!==void 0||l!==void 0||_.transform)&&(_.transformOrigin=pb(b,o!==void 0?o:.5,l!==void 0?l:.5)),e!==void 0&&(w.x=e),n!==void 0&&(w.y=n),i!==void 0&&(w.scale=i),u!==void 0&&fb(w,u,d,h,!1)}const _d=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Ay=()=>({..._d(),attrs:{}}),Sd=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Py(t,{style:e,vars:n},i,o){Object.assign(t.style,e,o&&o.getProjectionStyles(i));for(const l in n)t.style.setProperty(l,n[l])}const Ry=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Oy(t,e,n,i){Py(t,e,void 0,i);for(const o in e.attrs)t.setAttribute(Ry.has(o)?o:pd(o),e.attrs[o])}const Sa={};function mb(t){Object.assign(Sa,t)}function Iy(t,{layout:e,layoutId:n}){return Tr.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Sa[t]||t==="opacity")}function kd(t,e,n){var i;const{style:o}=t,l={};for(const u in o)(pt(o[u])||e.style&&pt(e.style[u])||Iy(u,t)||((i=n?.getValue(u))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(l[u]=o[u]);return l}function Dy(t,e,n){const i=kd(t,e,n);for(const o in t)if(pt(t[o])||pt(e[o])){const l=ws.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;i[l]=t[o]}return i}function gb(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const gm=["x","y","width","height","cx","cy","r"],yb={useVisualState:Ty({scrapeMotionValuesFromProps:Dy,createRenderState:Ay,onUpdate:({props:t,prevProps:e,current:n,renderState:i,latestValues:o})=>{if(!n)return;let l=!!t.drag;if(!l){for(const d in o)if(Tr.has(d)){l=!0;break}}if(!l)return;let u=!e;if(e)for(let d=0;d<gm.length;d++){const h=gm[d];t[h]!==e[h]&&(u=!0)}u&&Le.read(()=>{gb(n,i),Le.render(()=>{bd(i,o,Sd(n.tagName),t.transformTemplate),Oy(n,i)})})}})},vb={useVisualState:Ty({scrapeMotionValuesFromProps:kd,createRenderState:_d})};function Ly(t,e,n){for(const i in e)!pt(e[i])&&!Iy(i,n)&&(t[i]=e[i])}function wb({transformTemplate:t},e){return R.useMemo(()=>{const n=_d();return xd(n,e,t),Object.assign({},n.vars,n.style)},[e])}function xb(t,e){const n=t.style||{},i={};return Ly(i,n,t),Object.assign(i,wb(t,e)),i}function bb(t,e){const n={},i=xb(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}function _b(t,e,n,i){const o=R.useMemo(()=>{const l=Ay();return bd(l,e,Sd(i),t.transformTemplate),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};Ly(l,t.style,t),o.style={...l,...o.style}}return o}function Sb(t=!1){return(n,i,o,{latestValues:l},u)=>{const h=(gd(n)?_b:bb)(i,l,u,n),m=U1(i,typeof n=="string",t),y=n!==R.Fragment?{...m,...h,ref:o}:{},{children:v}=i,w=R.useMemo(()=>pt(v)?v.get():v,[v]);return R.createElement(n,{...y,children:w})}}function kb(t,e){return function(i,{forwardMotionProps:o}={forwardMotionProps:!1}){const u={...gd(i)?yb:vb,preloadedFeatures:t,useRender:Sb(o),createVisualElement:e,Component:i};return K1(u)}}function My(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}function Va(t,e,n){const i=t.getProps();return yd(i,e,n!==void 0?n:i.custom,t)}const Eb=dd(()=>window.ScrollTimeline!==void 0);class Tb{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let i=0;i<this.animations.length;i++)this.animations[i][e]=n}attachTimeline(e,n){const i=this.animations.map(o=>{if(Eb()&&o.attachTimeline)return o.attachTimeline(e);if(typeof n=="function")return n(o)});return()=>{i.forEach((o,l)=>{o&&o(),this.animations[l].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class jb extends Tb{then(e,n){return Promise.all(this.animations).then(e).catch(n)}}function Ed(t,e){return t?t[e]||t.default||t:void 0}const Tc=2e4;function Uy(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<Tc;)e+=n,i=t.next(e);return e>=Tc?1/0:e}function Td(t){return typeof t=="function"}function ym(t,e){t.timeline=e,t.onfinish=null}const jd=t=>Array.isArray(t)&&typeof t[0]=="number",Cb={linearEasing:void 0};function Nb(t,e){const n=dd(t);return()=>{var i;return(i=Cb[e])!==null&&i!==void 0?i:n()}}const ka=Nb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),$y=(t,e,n=10)=>{let i="";const o=Math.max(Math.round(e/n),2);for(let l=0;l<o;l++)i+=t(ms(0,o-1,l))+", ";return`linear(${i.substring(0,i.length-2)})`};function Vy(t){return!!(typeof t=="function"&&ka()||!t||typeof t=="string"&&(t in jc||ka())||jd(t)||Array.isArray(t)&&t.every(Vy))}const hi=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,jc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:hi([0,.65,.55,1]),circOut:hi([.55,0,1,.45]),backIn:hi([.31,.01,.66,-.59]),backOut:hi([.33,1.53,.69,.99])};function Fy(t,e){if(t)return typeof t=="function"&&ka()?$y(t,e):jd(t)?hi(t):Array.isArray(t)?t.map(n=>Fy(n,e)||jc.easeOut):jc[t]}const Qt={x:!1,y:!1};function By(){return Qt.x||Qt.y}function Ab(t,e,n){var i;if(t instanceof Element)return[t];if(typeof t=="string"){let o=document;const l=(i=void 0)!==null&&i!==void 0?i:o.querySelectorAll(t);return l?Array.from(l):[]}return Array.from(t)}function zy(t,e){const n=Ab(t),i=new AbortController,o={passive:!0,...e,signal:i.signal};return[n,o,()=>i.abort()]}function vm(t){return e=>{e.pointerType==="touch"||By()||t(e)}}function Pb(t,e,n={}){const[i,o,l]=zy(t,n),u=vm(d=>{const{target:h}=d,m=e(d);if(typeof m!="function"||!h)return;const y=vm(v=>{m(v),h.removeEventListener("pointerleave",y)});h.addEventListener("pointerleave",y,o)});return i.forEach(d=>{d.addEventListener("pointerenter",u,o)}),l}const qy=(t,e)=>e?t===e?!0:qy(t,e.parentElement):!1,Cd=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Rb=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ob(t){return Rb.has(t.tagName)||t.tabIndex!==-1}const fi=new WeakSet;function wm(t){return e=>{e.key==="Enter"&&t(e)}}function Qu(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Ib=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=wm(()=>{if(fi.has(n))return;Qu(n,"down");const o=wm(()=>{Qu(n,"up")}),l=()=>Qu(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",l,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function xm(t){return Cd(t)&&!By()}function Db(t,e,n={}){const[i,o,l]=zy(t,n),u=d=>{const h=d.currentTarget;if(!xm(d)||fi.has(h))return;fi.add(h);const m=e(d),y=(_,b)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",w),!(!xm(_)||!fi.has(h))&&(fi.delete(h),typeof m=="function"&&m(_,{success:b}))},v=_=>{y(_,n.useGlobalTarget||qy(h,_.target))},w=_=>{y(_,!1)};window.addEventListener("pointerup",v,o),window.addEventListener("pointercancel",w,o)};return i.forEach(d=>{!Ob(d)&&d.getAttribute("tabindex")===null&&(d.tabIndex=0),(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,o),d.addEventListener("focus",m=>Ib(m,o),o)}),l}function Lb(t){return t==="x"||t==="y"?Qt[t]?null:(Qt[t]=!0,()=>{Qt[t]=!1}):Qt.x||Qt.y?null:(Qt.x=Qt.y=!0,()=>{Qt.x=Qt.y=!1})}const Wy=new Set(["width","height","top","left","right","bottom",...ws]);let ma;function Mb(){ma=void 0}const un={now:()=>(ma===void 0&&un.set(at.isProcessing||R1.useManualTiming?at.timestamp:performance.now()),ma),set:t=>{ma=t,queueMicrotask(Mb)}};function Nd(t,e){t.indexOf(e)===-1&&t.push(e)}function Ad(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Pd{constructor(){this.subscriptions=[]}add(e){return Nd(this.subscriptions,e),()=>Ad(this.subscriptions,e)}notify(e,n,i){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,i);else for(let l=0;l<o;l++){const u=this.subscriptions[l];u&&u(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Hy(t,e){return e?t*(1e3/e):0}const bm=30,Ub=t=>!isNaN(parseFloat(t));class $b{constructor(e,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,o=!0)=>{const l=un.now();this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=un.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Ub(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Pd);const i=this.events[e].add(n);return e==="change"?()=>{i(),Le.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>bm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,bm);return Hy(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ji(t,e){return new $b(t,e)}function Vb(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ji(n))}function Fb(t,e){const n=Va(t,e);let{transitionEnd:i={},transition:o={},...l}=n||{};l={...l,...i};for(const u in l){const d=Z1(l[u]);Vb(t,u,d)}}function Bb(t){return!!(pt(t)&&t.add)}function Cc(t,e){const n=t.getValue("willChange");if(Bb(n))return n.add(e)}function Ky(t){return t.props[Sy]}const Gy=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,zb=1e-7,qb=12;function Wb(t,e,n,i,o){let l,u,d=0;do u=e+(n-e)/2,l=Gy(u,i,o)-t,l>0?n=u:e=u;while(Math.abs(l)>zb&&++d<qb);return u}function Ui(t,e,n,i){if(t===e&&n===i)return Ot;const o=l=>Wb(l,0,1,t,n);return l=>l===0||l===1?l:Gy(o(l),e,i)}const Jy=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Yy=t=>e=>1-t(1-e),Qy=Ui(.33,1.53,.69,.99),Rd=Yy(Qy),Xy=Jy(Rd),Zy=t=>(t*=2)<1?.5*Rd(t):.5*(2-Math.pow(2,-10*(t-1))),Od=t=>1-Math.sin(Math.acos(t)),e0=Yy(Od),t0=Jy(Od),n0=t=>/^0[^.\s]+$/u.test(t);function Hb(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||n0(t):!0}const gi=t=>Math.round(t*1e5)/1e5,Id=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Kb(t){return t==null}const Gb=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Dd=(t,e)=>n=>!!(typeof n=="string"&&Gb.test(n)&&n.startsWith(t)||e&&!Kb(n)&&Object.prototype.hasOwnProperty.call(n,e)),r0=(t,e,n)=>i=>{if(typeof i!="string")return i;const[o,l,u,d]=i.match(Id);return{[t]:parseFloat(o),[e]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},Jb=t=>Sn(0,255,t),Xu={...xs,transform:t=>Math.round(Jb(t))},vr={test:Dd("rgb","red"),parse:r0("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Xu.transform(t)+", "+Xu.transform(e)+", "+Xu.transform(n)+", "+gi(Ti.transform(i))+")"};function Yb(t){let e="",n="",i="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,i+=i,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:o?parseInt(o,16)/255:1}}const Nc={test:Dd("#"),parse:Yb,transform:vr.transform},ls={test:Dd("hsl","hue"),parse:r0("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+ln.transform(gi(e))+", "+ln.transform(gi(n))+", "+gi(Ti.transform(i))+")"},ht={test:t=>vr.test(t)||Nc.test(t)||ls.test(t),parse:t=>vr.test(t)?vr.parse(t):ls.test(t)?ls.parse(t):Nc.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?vr.transform(t):ls.transform(t)},Qb=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Xb(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Id))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Qb))===null||n===void 0?void 0:n.length)||0)>0}const s0="number",i0="color",Zb="var",e_="var(",_m="${}",t_=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ci(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},o=[];let l=0;const d=e.replace(t_,h=>(ht.test(h)?(i.color.push(l),o.push(i0),n.push(ht.parse(h))):h.startsWith(e_)?(i.var.push(l),o.push(Zb),n.push(h)):(i.number.push(l),o.push(s0),n.push(parseFloat(h))),++l,_m)).split(_m);return{values:n,split:d,indexes:i,types:o}}function o0(t){return Ci(t).values}function a0(t){const{split:e,types:n}=Ci(t),i=e.length;return o=>{let l="";for(let u=0;u<i;u++)if(l+=e[u],o[u]!==void 0){const d=n[u];d===s0?l+=gi(o[u]):d===i0?l+=ht.transform(o[u]):l+=o[u]}return l}}const n_=t=>typeof t=="number"?0:t;function r_(t){const e=o0(t);return a0(t)(e.map(n_))}const Jn={test:Xb,parse:o0,createTransformer:a0,getAnimatableNone:r_},s_=new Set(["brightness","contrast","saturate","opacity"]);function i_(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Id)||[];if(!i)return t;const o=n.replace(i,"");let l=s_.has(e)?1:0;return i!==n&&(l*=100),e+"("+l+o+")"}const o_=/\b([a-z-]*)\(.*?\)/gu,Ac={...Jn,getAnimatableNone:t=>{const e=t.match(o_);return e?e.map(i_).join(" "):t}},a_={...wd,color:ht,backgroundColor:ht,outlineColor:ht,fill:ht,stroke:ht,borderColor:ht,borderTopColor:ht,borderRightColor:ht,borderBottomColor:ht,borderLeftColor:ht,filter:Ac,WebkitFilter:Ac},Ld=t=>a_[t];function l0(t,e){let n=Ld(t);return n!==Ac&&(n=Jn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const l_=new Set(["auto","none","0"]);function u_(t,e,n){let i=0,o;for(;i<t.length&&!o;){const l=t[i];typeof l=="string"&&!l_.has(l)&&Ci(l).values.length&&(o=t[i]),i++}if(o&&n)for(const l of e)t[l]=l0(n,o)}const Sm=t=>t===xs||t===de,km=(t,e)=>parseFloat(t.split(", ")[e]),Em=(t,e)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const o=i.match(/^matrix3d\((.+)\)$/u);if(o)return km(o[1],e);{const l=i.match(/^matrix\((.+)\)$/u);return l?km(l[1],t):0}},c_=new Set(["x","y","z"]),d_=ws.filter(t=>!c_.has(t));function h_(t){const e=[];return d_.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const ys={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:Em(4,13),y:Em(5,14)};ys.translateX=ys.x;ys.translateY=ys.y;const br=new Set;let Pc=!1,Rc=!1;function u0(){if(Rc){const t=Array.from(br).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const o=h_(i);o.length&&(n.set(i,o),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const o=n.get(i);o&&o.forEach(([l,u])=>{var d;(d=i.getValue(l))===null||d===void 0||d.set(u)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Rc=!1,Pc=!1,br.forEach(t=>t.complete()),br.clear()}function c0(){br.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Rc=!0)})}function f_(){c0(),u0()}class Md{constructor(e,n,i,o,l,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=o,this.element=l,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(br.add(this),Pc||(Pc=!0,Le.read(c0),Le.resolveKeyframes(u0))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:o}=this;for(let l=0;l<e.length;l++)if(e[l]===null)if(l===0){const u=o?.get(),d=e[e.length-1];if(u!==void 0)e[0]=u;else if(i&&n){const h=i.readValue(n,d);h!=null&&(e[0]=h)}e[0]===void 0&&(e[0]=d),o&&u===void 0&&o.set(e[0])}else e[l]=e[l-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),br.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,br.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const d0=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),p_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function m_(t){const e=p_.exec(t);if(!e)return[,];const[,n,i,o]=e;return[`--${n??i}`,o]}function h0(t,e,n=1){const[i,o]=m_(t);if(!i)return;const l=window.getComputedStyle(e).getPropertyValue(i);if(l){const u=l.trim();return d0(u)?parseFloat(u):u}return vd(o)?h0(o,e,n+1):o}const f0=t=>e=>e.test(t),g_={test:t=>t==="auto",parse:t=>t},p0=[xs,de,ln,Wn,ib,sb,g_],Tm=t=>p0.find(f0(t));class m0 extends Md{constructor(e,n,i,o,l){super(e,n,i,o,l,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),vd(m))){const y=h0(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!Wy.has(i)||e.length!==2)return;const[o,l]=e,u=Tm(o),d=Tm(l);if(u!==d)if(Sm(u)&&Sm(d))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let o=0;o<e.length;o++)Hb(e[o])&&i.push(o);i.length&&u_(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ys[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(i,o).jump(o,!1)}measureEndState(){var e;const{element:n,name:i,unresolvedKeyframes:o}=this;if(!n||!n.current)return;const l=n.getValue(i);l&&l.jump(this.measuredOrigin,!1);const u=o.length-1,d=o[u];o[u]=ys[i](n.measureViewportBox(),window.getComputedStyle(n.current)),d!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=d),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([h,m])=>{n.getValue(h).set(m)}),this.resolveNoneKeyframes()}}const jm=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Jn.test(t)||t==="0")&&!t.startsWith("url("));function y_(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function v_(t,e,n,i){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const l=t[t.length-1],u=jm(o,e),d=jm(l,e);return!u||!d?!1:y_(t)||(n==="spring"||Td(n))&&i}const w_=t=>t!==null;function Fa(t,{repeat:e,repeatType:n="loop"},i){const o=t.filter(w_),l=e&&n!=="loop"&&e%2===1?0:o.length-1;return!l||i===void 0?o[l]:i}const x_=40;class g0{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",...d}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=un.now(),this.options={autoplay:e,delay:n,type:i,repeat:o,repeatDelay:l,repeatType:u,...d},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>x_?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&f_(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=un.now(),this.hasAttemptedResolve=!0;const{name:i,type:o,velocity:l,delay:u,onComplete:d,onUpdate:h,isGenerator:m}=this.options;if(!m&&!v_(e,i,o,l))if(u)this.options.duration=0;else{h&&h(Fa(e,this.options,n)),d&&d(),this.resolveFinishedPromise();return}const y=this.initPlayback(e,n);y!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...y},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Be=(t,e,n)=>t+(e-t)*n;function Zu(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function b_({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let o=0,l=0,u=0;if(!e)o=l=u=n;else{const d=n<.5?n*(1+e):n+e-n*e,h=2*n-d;o=Zu(h,d,t+1/3),l=Zu(h,d,t),u=Zu(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:i}}function Ea(t,e){return n=>n>0?e:t}const ec=(t,e,n)=>{const i=t*t,o=n*(e*e-i)+i;return o<0?0:Math.sqrt(o)},__=[Nc,vr,ls],S_=t=>__.find(e=>e.test(t));function Cm(t){const e=S_(t);if(!e)return!1;let n=e.parse(t);return e===ls&&(n=b_(n)),n}const Nm=(t,e)=>{const n=Cm(t),i=Cm(e);if(!n||!i)return Ea(t,e);const o={...n};return l=>(o.red=ec(n.red,i.red,l),o.green=ec(n.green,i.green,l),o.blue=ec(n.blue,i.blue,l),o.alpha=Be(n.alpha,i.alpha,l),vr.transform(o))},k_=(t,e)=>n=>e(t(n)),$i=(...t)=>t.reduce(k_),Oc=new Set(["none","hidden"]);function E_(t,e){return Oc.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function T_(t,e){return n=>Be(t,e,n)}function Ud(t){return typeof t=="number"?T_:typeof t=="string"?vd(t)?Ea:ht.test(t)?Nm:N_:Array.isArray(t)?y0:typeof t=="object"?ht.test(t)?Nm:j_:Ea}function y0(t,e){const n=[...t],i=n.length,o=t.map((l,u)=>Ud(l)(l,e[u]));return l=>{for(let u=0;u<i;u++)n[u]=o[u](l);return n}}function j_(t,e){const n={...t,...e},i={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(i[o]=Ud(t[o])(t[o],e[o]));return o=>{for(const l in i)n[l]=i[l](o);return n}}function C_(t,e){var n;const i=[],o={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const u=e.types[l],d=t.indexes[u][o[u]],h=(n=t.values[d])!==null&&n!==void 0?n:0;i[l]=h,o[u]++}return i}const N_=(t,e)=>{const n=Jn.createTransformer(e),i=Ci(t),o=Ci(e);return i.indexes.var.length===o.indexes.var.length&&i.indexes.color.length===o.indexes.color.length&&i.indexes.number.length>=o.indexes.number.length?Oc.has(t)&&!o.values.length||Oc.has(e)&&!i.values.length?E_(t,e):$i(y0(C_(i,o),o.values),n):Ea(t,e)};function v0(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Be(t,e,n):Ud(t)(t,e)}const A_=5;function w0(t,e,n){const i=Math.max(e-A_,0);return Hy(n-t(i),e-i)}const We={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},tc=.001;function P_({duration:t=We.duration,bounce:e=We.bounce,velocity:n=We.velocity,mass:i=We.mass}){let o,l,u=1-e;u=Sn(We.minDamping,We.maxDamping,u),t=Sn(We.minDuration,We.maxDuration,_n(t)),u<1?(o=m=>{const y=m*u,v=y*t,w=y-n,_=Ic(m,u),b=Math.exp(-v);return tc-w/_*b},l=m=>{const v=m*u*t,w=v*n+n,_=Math.pow(u,2)*Math.pow(m,2)*t,b=Math.exp(-v),S=Ic(Math.pow(m,2),u);return(-o(m)+tc>0?-1:1)*((w-_)*b)/S}):(o=m=>{const y=Math.exp(-m*t),v=(m-n)*t+1;return-tc+y*v},l=m=>{const y=Math.exp(-m*t),v=(n-m)*(t*t);return y*v});const d=5/t,h=O_(o,l,d);if(t=bn(t),isNaN(h))return{stiffness:We.stiffness,damping:We.damping,duration:t};{const m=Math.pow(h,2)*i;return{stiffness:m,damping:u*2*Math.sqrt(i*m),duration:t}}}const R_=12;function O_(t,e,n){let i=n;for(let o=1;o<R_;o++)i=i-t(i)/e(i);return i}function Ic(t,e){return t*Math.sqrt(1-e*e)}const I_=["duration","bounce"],D_=["stiffness","damping","mass"];function Am(t,e){return e.some(n=>t[n]!==void 0)}function L_(t){let e={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...t};if(!Am(t,D_)&&Am(t,I_))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),o=i*i,l=2*Sn(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:We.mass,stiffness:o,damping:l}}else{const n=P_(t);e={...e,...n,mass:We.mass},e.isResolvedFromDuration=!0}return e}function x0(t=We.visualDuration,e=We.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:o}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:l},{stiffness:h,damping:m,mass:y,duration:v,velocity:w,isResolvedFromDuration:_}=L_({...n,velocity:-_n(n.velocity||0)}),b=w||0,S=m/(2*Math.sqrt(h*y)),k=u-l,E=_n(Math.sqrt(h/y)),P=Math.abs(k)<5;i||(i=P?We.restSpeed.granular:We.restSpeed.default),o||(o=P?We.restDelta.granular:We.restDelta.default);let N;if(S<1){const V=Ic(E,S);N=z=>{const $=Math.exp(-S*E*z);return u-$*((b+S*E*k)/V*Math.sin(V*z)+k*Math.cos(V*z))}}else if(S===1)N=V=>u-Math.exp(-E*V)*(k+(b+E*k)*V);else{const V=E*Math.sqrt(S*S-1);N=z=>{const $=Math.exp(-S*E*z),B=Math.min(V*z,300);return u-$*((b+S*E*k)*Math.sinh(B)+V*k*Math.cosh(B))/V}}const U={calculatedDuration:_&&v||null,next:V=>{const z=N(V);if(_)d.done=V>=v;else{let $=0;S<1&&($=V===0?bn(b):w0(N,V,z));const B=Math.abs($)<=i,Y=Math.abs(u-z)<=o;d.done=B&&Y}return d.value=d.done?u:z,d},toString:()=>{const V=Math.min(Uy(U),Tc),z=$y($=>U.next(V*$).value,V,30);return V+"ms "+z}};return U}function Pm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:h,restDelta:m=.5,restSpeed:y}){const v=t[0],w={done:!1,value:v},_=B=>d!==void 0&&B<d||h!==void 0&&B>h,b=B=>d===void 0?h:h===void 0||Math.abs(d-B)<Math.abs(h-B)?d:h;let S=n*e;const k=v+S,E=u===void 0?k:u(k);E!==k&&(S=E-v);const P=B=>-S*Math.exp(-B/i),N=B=>E+P(B),U=B=>{const Y=P(B),oe=N(B);w.done=Math.abs(Y)<=m,w.value=w.done?E:oe};let V,z;const $=B=>{_(w.value)&&(V=B,z=x0({keyframes:[w.value,b(w.value)],velocity:w0(N,B,w.value),damping:o,stiffness:l,restDelta:m,restSpeed:y}))};return $(0),{calculatedDuration:null,next:B=>{let Y=!1;return!z&&V===void 0&&(Y=!0,U(B),$(B)),V!==void 0&&B>=V?z.next(B-V):(!Y&&U(B),w)}}}const M_=Ui(.42,0,1,1),U_=Ui(0,0,.58,1),b0=Ui(.42,0,.58,1),$_=t=>Array.isArray(t)&&typeof t[0]!="number",V_={linear:Ot,easeIn:M_,easeInOut:b0,easeOut:U_,circIn:Od,circInOut:t0,circOut:e0,backIn:Rd,backInOut:Xy,backOut:Qy,anticipate:Zy},Rm=t=>{if(jd(t)){vy(t.length===4);const[e,n,i,o]=t;return Ui(e,n,i,o)}else if(typeof t=="string")return V_[t];return t};function F_(t,e,n){const i=[],o=n||v0,l=t.length-1;for(let u=0;u<l;u++){let d=o(t[u],t[u+1]);if(e){const h=Array.isArray(e)?e[u]||Ot:e;d=$i(h,d)}i.push(d)}return i}function B_(t,e,{clamp:n=!0,ease:i,mixer:o}={}){const l=t.length;if(vy(l===e.length),l===1)return()=>e[0];if(l===2&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=F_(e,i,o),h=d.length,m=y=>{if(u&&y<t[0])return e[0];let v=0;if(h>1)for(;v<t.length-2&&!(y<t[v+1]);v++);const w=ms(t[v],t[v+1],y);return d[v](w)};return n?y=>m(Sn(t[0],t[l-1],y)):m}function z_(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const o=ms(0,e,i);t.push(Be(n,1,o))}}function q_(t){const e=[0];return z_(e,t.length-1),e}function W_(t,e){return t.map(n=>n*e)}function H_(t,e){return t.map(()=>e||b0).splice(0,t.length-1)}function Ta({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const o=$_(i)?i.map(Rm):Rm(i),l={done:!1,value:e[0]},u=W_(n&&n.length===e.length?n:q_(e),t),d=B_(u,e,{ease:Array.isArray(o)?o:H_(e,o)});return{calculatedDuration:t,next:h=>(l.value=d(h),l.done=h>=t,l)}}const K_=t=>{const e=({timestamp:n})=>t(n);return{start:()=>Le.update(e,!0),stop:()=>Gn(e),now:()=>at.isProcessing?at.timestamp:un.now()}},G_={decay:Pm,inertia:Pm,tween:Ta,keyframes:Ta,spring:x0},J_=t=>t/100;class $d extends g0{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:n,motionValue:i,element:o,keyframes:l}=this.options,u=o?.KeyframeResolver||Md,d=(h,m)=>this.onKeyframesResolved(h,m);this.resolver=new u(l,d,n,i,o),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=this.options,d=Td(n)?n:G_[n]||Ta;let h,m;d!==Ta&&typeof e[0]!="number"&&(h=$i(J_,v0(e[0],e[1])),e=[0,100]);const y=d({...this.options,keyframes:e});l==="mirror"&&(m=d({...this.options,keyframes:[...e].reverse(),velocity:-u})),y.calculatedDuration===null&&(y.calculatedDuration=Uy(y));const{calculatedDuration:v}=y,w=v+o,_=w*(i+1)-o;return{generator:y,mirroredGenerator:m,mapPercentToKeyframes:h,calculatedDuration:v,resolvedDuration:w,totalDuration:_}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:i}=this;if(!i){const{keyframes:B}=this.options;return{done:!0,value:B[B.length-1]}}const{finalKeyframe:o,generator:l,mirroredGenerator:u,mapPercentToKeyframes:d,keyframes:h,calculatedDuration:m,totalDuration:y,resolvedDuration:v}=i;if(this.startTime===null)return l.next(0);const{delay:w,repeat:_,repeatType:b,repeatDelay:S,onUpdate:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-y/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const E=this.currentTime-w*(this.speed>=0?1:-1),P=this.speed>=0?E<0:E>y;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=y);let N=this.currentTime,U=l;if(_){const B=Math.min(this.currentTime,y)/v;let Y=Math.floor(B),oe=B%1;!oe&&B>=1&&(oe=1),oe===1&&Y--,Y=Math.min(Y,_+1),Y%2&&(b==="reverse"?(oe=1-oe,S&&(oe-=S/v)):b==="mirror"&&(U=u)),N=Sn(0,1,oe)*v}const V=P?{done:!1,value:h[0]}:U.next(N);d&&(V.value=d(V.value));let{done:z}=V;!P&&m!==null&&(z=this.speed>=0?this.currentTime>=y:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return $&&o!==void 0&&(V.value=Fa(h,this.options,o)),k&&k(V.value),$&&this.finish(),V}get duration(){const{resolved:e}=this;return e?_n(e.calculatedDuration):0}get time(){return _n(this.currentTime)}set time(e){e=bn(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=_n(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=K_,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=e(l=>this.tick(l))),n&&n();const o=this.driver.now();this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=o):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const Y_=new Set(["opacity","clipPath","filter","transform"]);function Q_(t,e,n,{delay:i=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:d="easeInOut",times:h}={}){const m={[e]:n};h&&(m.offset=h);const y=Fy(d,o);return Array.isArray(y)&&(m.easing=y),t.animate(m,{delay:i,duration:o,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"})}const X_=dd(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ja=10,Z_=2e4;function eS(t){return Td(t.type)||t.type==="spring"||!Vy(t.ease)}function tS(t,e){const n=new $d({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:t[0]};const o=[];let l=0;for(;!i.done&&l<Z_;)i=n.sample(l),o.push(i.value),l+=ja;return{times:void 0,keyframes:o,duration:l-ja,ease:"linear"}}const _0={anticipate:Zy,backInOut:Xy,circInOut:t0};function nS(t){return t in _0}class Om extends g0{constructor(e){super(e);const{name:n,motionValue:i,element:o,keyframes:l}=this.options;this.resolver=new m0(l,(u,d)=>this.onKeyframesResolved(u,d),n,i,o),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:i=300,times:o,ease:l,type:u,motionValue:d,name:h,startTime:m}=this.options;if(!d.owner||!d.owner.current)return!1;if(typeof l=="string"&&ka()&&nS(l)&&(l=_0[l]),eS(this.options)){const{onComplete:v,onUpdate:w,motionValue:_,element:b,...S}=this.options,k=tS(e,S);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,o=k.times,l=k.ease,u="keyframes"}const y=Q_(d.owner.current,h,e,{...this.options,duration:i,times:o,ease:l});return y.startTime=m??this.calcStartTime(),this.pendingTimeline?(ym(y,this.pendingTimeline),this.pendingTimeline=void 0):y.onfinish=()=>{const{onComplete:v}=this.options;d.set(Fa(e,this.options,n)),v&&v(),this.cancel(),this.resolveFinishedPromise()},{animation:y,duration:i,times:o,type:u,ease:l,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return _n(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return _n(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=bn(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Ot;const{animation:i}=n;ym(i,e)}return Ot}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:i,duration:o,type:l,ease:u,times:d}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:m,onUpdate:y,onComplete:v,element:w,..._}=this.options,b=new $d({..._,keyframes:i,duration:o,type:l,ease:u,times:d,isGenerator:!0}),S=bn(this.time);m.setWithVelocity(b.sample(S-ja).value,b.sample(S).value,ja)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:i,repeatDelay:o,repeatType:l,damping:u,type:d}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=n.owner.getProps();return X_()&&i&&Y_.has(i)&&!h&&!m&&!o&&l!=="mirror"&&u!==0&&d!=="inertia"}}const rS={type:"spring",stiffness:500,damping:25,restSpeed:10},sS=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),iS={type:"keyframes",duration:.8},oS={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},aS=(t,{keyframes:e})=>e.length>2?iS:Tr.has(t)?t.startsWith("scale")?sS(e[1]):rS:oS;function lS({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:o,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const Vd=(t,e,n,i={},o,l)=>u=>{const d=Ed(i,t)||{},h=d.delay||i.delay||0;let{elapsed:m=0}=i;m=m-bn(h);let y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-m,onUpdate:w=>{e.set(w),d.onUpdate&&d.onUpdate(w)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:t,motionValue:e,element:l?void 0:o};lS(d)||(y={...y,...aS(t,y)}),y.duration&&(y.duration=bn(y.duration)),y.repeatDelay&&(y.repeatDelay=bn(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let v=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(y.duration=0,y.delay===0&&(v=!0)),v&&!l&&e.get()!==void 0){const w=Fa(y.keyframes,d);if(w!==void 0)return Le.update(()=>{y.onUpdate(w),y.onComplete()}),new jb([])}return!l&&Om.supports(y)?new Om(y):new $d(y)};function uS({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function S0(t,e,{delay:n=0,transitionOverride:i,type:o}={}){var l;let{transition:u=t.getDefaultTransition(),transitionEnd:d,...h}=e;i&&(u=i);const m=[],y=o&&t.animationState&&t.animationState.getState()[o];for(const v in h){const w=t.getValue(v,(l=t.latestValues[v])!==null&&l!==void 0?l:null),_=h[v];if(_===void 0||y&&uS(y,v))continue;const b={delay:n,...Ed(u||{},v)};let S=!1;if(window.MotionHandoffAnimation){const E=Ky(t);if(E){const P=window.MotionHandoffAnimation(E,v,Le);P!==null&&(b.startTime=P,S=!0)}}Cc(t,v),w.start(Vd(v,w,_,t.shouldReduceMotion&&Wy.has(v)?{type:!1}:b,t,S));const k=w.animation;k&&m.push(k)}return d&&Promise.all(m).then(()=>{Le.update(()=>{d&&Fb(t,d)})}),m}function Dc(t,e,n={}){var i;const o=Va(t,e,n.type==="exit"?(i=t.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:l=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(l=n.transitionOverride);const u=o?()=>Promise.all(S0(t,o,n)):()=>Promise.resolve(),d=t.variantChildren&&t.variantChildren.size?(m=0)=>{const{delayChildren:y=0,staggerChildren:v,staggerDirection:w}=l;return cS(t,e,y+m,v,w,n)}:()=>Promise.resolve(),{when:h}=l;if(h){const[m,y]=h==="beforeChildren"?[u,d]:[d,u];return m().then(()=>y())}else return Promise.all([u(),d(n.delay)])}function cS(t,e,n=0,i=0,o=1,l){const u=[],d=(t.variantChildren.size-1)*i,h=o===1?(m=0)=>m*i:(m=0)=>d-m*i;return Array.from(t.variantChildren).sort(dS).forEach((m,y)=>{m.notify("AnimationStart",e),u.push(Dc(m,e,{...l,delay:n+h(y)}).then(()=>m.notify("AnimationComplete",e)))}),Promise.all(u)}function dS(t,e){return t.sortNodePosition(e)}function hS(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const o=e.map(l=>Dc(t,l,n));i=Promise.all(o)}else if(typeof e=="string")i=Dc(t,e,n);else{const o=typeof e=="function"?Va(t,e,n.custom):e;i=Promise.all(S0(t,o,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const fS=fd.length;function k0(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?k0(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<fS;n++){const i=fd[n],o=t.props[i];(Ei(o)||o===!1)&&(e[i]=o)}return e}const pS=[...hd].reverse(),mS=hd.length;function gS(t){return e=>Promise.all(e.map(({animation:n,options:i})=>hS(t,n,i)))}function yS(t){let e=gS(t),n=Im(),i=!0;const o=h=>(m,y)=>{var v;const w=Va(t,y,h==="exit"?(v=t.presenceContext)===null||v===void 0?void 0:v.custom:void 0);if(w){const{transition:_,transitionEnd:b,...S}=w;m={...m,...S,...b}}return m};function l(h){e=h(t)}function u(h){const{props:m}=t,y=k0(t.parent)||{},v=[],w=new Set;let _={},b=1/0;for(let k=0;k<mS;k++){const E=pS[k],P=n[E],N=m[E]!==void 0?m[E]:y[E],U=Ei(N),V=E===h?P.isActive:null;V===!1&&(b=k);let z=N===y[E]&&N!==m[E]&&U;if(z&&i&&t.manuallyAnimateOnMount&&(z=!1),P.protectedKeys={..._},!P.isActive&&V===null||!N&&!P.prevProp||Ua(N)||typeof N=="boolean")continue;const $=vS(P.prevProp,N);let B=$||E===h&&P.isActive&&!z&&U||k>b&&U,Y=!1;const oe=Array.isArray(N)?N:[N];let Te=oe.reduce(o(E),{});V===!1&&(Te={});const{prevResolvedValues:ve={}}=P,je={...ve,...Te},xe=pe=>{B=!0,w.has(pe)&&(Y=!0,w.delete(pe)),P.needsAnimating[pe]=!0;const F=t.getValue(pe);F&&(F.liveStyle=!1)};for(const pe in je){const F=Te[pe],J=ve[pe];if(_.hasOwnProperty(pe))continue;let K=!1;Ec(F)&&Ec(J)?K=!My(F,J):K=F!==J,K?F!=null?xe(pe):w.add(pe):F!==void 0&&w.has(pe)?xe(pe):P.protectedKeys[pe]=!0}P.prevProp=N,P.prevResolvedValues=Te,P.isActive&&(_={..._,...Te}),i&&t.blockInitialAnimation&&(B=!1),B&&(!(z&&$)||Y)&&v.push(...oe.map(pe=>({animation:pe,options:{type:E}})))}if(w.size){const k={};w.forEach(E=>{const P=t.getBaseTarget(E),N=t.getValue(E);N&&(N.liveStyle=!0),k[E]=P??null}),v.push({animation:k})}let S=!!v.length;return i&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(S=!1),i=!1,S?e(v):Promise.resolve()}function d(h,m){var y;if(n[h].isActive===m)return Promise.resolve();(y=t.variantChildren)===null||y===void 0||y.forEach(w=>{var _;return(_=w.animationState)===null||_===void 0?void 0:_.setActive(h,m)}),n[h].isActive=m;const v=u(h);for(const w in n)n[w].protectedKeys={};return v}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=Im(),i=!0}}}function vS(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!My(e,t):!1}function cr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Im(){return{animate:cr(!0),whileInView:cr(),whileHover:cr(),whileTap:cr(),whileDrag:cr(),whileFocus:cr(),exit:cr()}}class Yn{constructor(e){this.isMounted=!1,this.node=e}update(){}}class wS extends Yn{constructor(e){super(e),e.animationState||(e.animationState=yS(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ua(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let xS=0;class bS extends Yn{constructor(){super(...arguments),this.id=xS++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const o=this.node.animationState.setActive("exit",!e);n&&!e&&o.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const _S={animation:{Feature:wS},exit:{Feature:bS}};function Ni(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Vi(t){return{point:{x:t.pageX,y:t.pageY}}}const SS=t=>e=>Cd(e)&&t(e,Vi(e));function yi(t,e,n,i){return Ni(t,e,SS(n),i)}const Dm=(t,e)=>Math.abs(t-e);function kS(t,e){const n=Dm(t.x,e.x),i=Dm(t.y,e.y);return Math.sqrt(n**2+i**2)}class E0{constructor(e,n,{transformPagePoint:i,contextWindow:o,dragSnapToOrigin:l=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=rc(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,_=kS(v.offset,{x:0,y:0})>=3;if(!w&&!_)return;const{point:b}=v,{timestamp:S}=at;this.history.push({...b,timestamp:S});const{onStart:k,onMove:E}=this.handlers;w||(k&&k(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=nc(w,this.transformPagePoint),Le.update(this.updatePoint,!0)},this.handlePointerUp=(v,w)=>{this.end();const{onEnd:_,onSessionEnd:b,resumeAnimation:S}=this.handlers;if(this.dragSnapToOrigin&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=rc(v.type==="pointercancel"?this.lastMoveEventInfo:nc(w,this.transformPagePoint),this.history);this.startEvent&&_&&_(v,k),b&&b(v,k)},!Cd(e))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=i,this.contextWindow=o||window;const u=Vi(e),d=nc(u,this.transformPagePoint),{point:h}=d,{timestamp:m}=at;this.history=[{...h,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,rc(d,this.history)),this.removeListeners=$i(yi(this.contextWindow,"pointermove",this.handlePointerMove),yi(this.contextWindow,"pointerup",this.handlePointerUp),yi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Gn(this.updatePoint)}}function nc(t,e){return e?{point:e(t.point)}:t}function Lm(t,e){return{x:t.x-e.x,y:t.y-e.y}}function rc({point:t},e){return{point:t,delta:Lm(t,T0(e)),offset:Lm(t,ES(e)),velocity:TS(e,.1)}}function ES(t){return t[0]}function T0(t){return t[t.length-1]}function TS(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const o=T0(t);for(;n>=0&&(i=t[n],!(o.timestamp-i.timestamp>bn(e)));)n--;if(!i)return{x:0,y:0};const l=_n(o.timestamp-i.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-i.x)/l,y:(o.y-i.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const j0=1e-4,jS=1-j0,CS=1+j0,C0=.01,NS=0-C0,AS=0+C0;function It(t){return t.max-t.min}function PS(t,e,n){return Math.abs(t-e)<=n}function Mm(t,e,n,i=.5){t.origin=i,t.originPoint=Be(e.min,e.max,t.origin),t.scale=It(n)/It(e),t.translate=Be(n.min,n.max,t.origin)-t.originPoint,(t.scale>=jS&&t.scale<=CS||isNaN(t.scale))&&(t.scale=1),(t.translate>=NS&&t.translate<=AS||isNaN(t.translate))&&(t.translate=0)}function vi(t,e,n,i){Mm(t.x,e.x,n.x,i?i.originX:void 0),Mm(t.y,e.y,n.y,i?i.originY:void 0)}function Um(t,e,n){t.min=n.min+e.min,t.max=t.min+It(e)}function RS(t,e,n){Um(t.x,e.x,n.x),Um(t.y,e.y,n.y)}function $m(t,e,n){t.min=e.min-n.min,t.max=t.min+It(e)}function wi(t,e,n){$m(t.x,e.x,n.x),$m(t.y,e.y,n.y)}function OS(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Be(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Be(n,t,i.max):Math.min(t,n)),t}function Vm(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function IS(t,{top:e,left:n,bottom:i,right:o}){return{x:Vm(t.x,n,o),y:Vm(t.y,e,i)}}function Fm(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function DS(t,e){return{x:Fm(t.x,e.x),y:Fm(t.y,e.y)}}function LS(t,e){let n=.5;const i=It(t),o=It(e);return o>i?n=ms(e.min,e.max-i,t.min):i>o&&(n=ms(t.min,t.max-o,e.min)),Sn(0,1,n)}function MS(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Lc=.35;function US(t=Lc){return t===!1?t=0:t===!0&&(t=Lc),{x:Bm(t,"left","right"),y:Bm(t,"top","bottom")}}function Bm(t,e,n){return{min:zm(t,e),max:zm(t,n)}}function zm(t,e){return typeof t=="number"?t:t[e]||0}const qm=()=>({translate:0,scale:1,origin:0,originPoint:0}),us=()=>({x:qm(),y:qm()}),Wm=()=>({min:0,max:0}),Ge=()=>({x:Wm(),y:Wm()});function Bt(t){return[t("x"),t("y")]}function N0({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function $S({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function VS(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function sc(t){return t===void 0||t===1}function Mc({scale:t,scaleX:e,scaleY:n}){return!sc(t)||!sc(e)||!sc(n)}function fr(t){return Mc(t)||A0(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function A0(t){return Hm(t.x)||Hm(t.y)}function Hm(t){return t&&t!=="0%"}function Ca(t,e,n){const i=t-n,o=e*i;return n+o}function Km(t,e,n,i,o){return o!==void 0&&(t=Ca(t,o,i)),Ca(t,n,i)+e}function Uc(t,e=0,n=1,i,o){t.min=Km(t.min,e,n,i,o),t.max=Km(t.max,e,n,i,o)}function P0(t,{x:e,y:n}){Uc(t.x,e.translate,e.scale,e.originPoint),Uc(t.y,n.translate,n.scale,n.originPoint)}const Gm=.999999999999,Jm=1.0000000000001;function FS(t,e,n,i=!1){const o=n.length;if(!o)return;e.x=e.y=1;let l,u;for(let d=0;d<o;d++){l=n[d],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(i&&l.options.layoutScroll&&l.scroll&&l!==l.root&&ds(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,P0(t,u)),i&&fr(l.latestValues)&&ds(t,l.latestValues))}e.x<Jm&&e.x>Gm&&(e.x=1),e.y<Jm&&e.y>Gm&&(e.y=1)}function cs(t,e){t.min=t.min+e,t.max=t.max+e}function Ym(t,e,n,i,o=.5){const l=Be(t.min,t.max,o);Uc(t,e,n,l,i)}function ds(t,e){Ym(t.x,e.x,e.scaleX,e.scale,e.originX),Ym(t.y,e.y,e.scaleY,e.scale,e.originY)}function R0(t,e){return N0(VS(t.getBoundingClientRect(),e))}function BS(t,e,n){const i=R0(t,n),{scroll:o}=e;return o&&(cs(i.x,o.offset.x),cs(i.y,o.offset.y)),i}const O0=({current:t})=>t?t.ownerDocument.defaultView:null,zS=new WeakMap;class qS{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ge(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=y=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Vi(y).point)},l=(y,v)=>{const{drag:w,dragPropagation:_,onDragStart:b}=this.getProps();if(w&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Lb(w),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bt(k=>{let E=this.getAxisMotionValue(k).get()||0;if(ln.test(E)){const{projection:P}=this.visualElement;if(P&&P.layout){const N=P.layout.layoutBox[k];N&&(E=It(N)*(parseFloat(E)/100))}}this.originPoint[k]=E}),b&&Le.postRender(()=>b(y,v)),Cc(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},u=(y,v)=>{const{dragPropagation:w,dragDirectionLock:_,onDirectionLock:b,onDrag:S}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:k}=v;if(_&&this.currentDirection===null){this.currentDirection=WS(k),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",v.point,k),this.updateAxis("y",v.point,k),this.visualElement.render(),S&&S(y,v)},d=(y,v)=>this.stop(y,v),h=()=>Bt(y=>{var v;return this.getAnimationState(y)==="paused"&&((v=this.getAxisMotionValue(y).animation)===null||v===void 0?void 0:v.play())}),{dragSnapToOrigin:m}=this.getProps();this.panSession=new E0(e,{onSessionStart:o,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,contextWindow:O0(this.visualElement)})}stop(e,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Le.postRender(()=>l(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,i){const{drag:o}=this.getProps();if(!i||!aa(e,o,this.currentDirection))return;const l=this.getAxisMotionValue(e);let u=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(u=OS(u,this.constraints[e],this.elastic[e])),l.set(u)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:i}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,l=this.constraints;n&&as(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&o?this.constraints=IS(o.layoutBox,n):this.constraints=!1,this.elastic=US(i),l!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&Bt(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=MS(o.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!as(e))return!1;const i=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=BS(i,o.root,this.visualElement.getTransformPagePoint());let u=DS(o.layout.layoutBox,l);if(n){const d=n($S(u));this.hasMutatedConstraints=!!d,d&&(u=N0(d))}return u}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},m=Bt(y=>{if(!aa(y,n,this.currentDirection))return;let v=h&&h[y]||{};u&&(v={min:0,max:0});const w=o?200:1e6,_=o?40:1e7,b={type:"inertia",velocity:i?e[y]:0,bounceStiffness:w,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...l,...v};return this.startAxisValueAnimation(y,b)});return Promise.all(m).then(d)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return Cc(this.visualElement,e),i.start(Vd(e,i,0,n,this.visualElement,!1))}stopAnimation(){Bt(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Bt(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),o=i[n];return o||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Bt(n=>{const{drag:i}=this.getProps();if(!aa(n,i,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:d}=o.layout.layoutBox[n];l.set(e[n]-Be(u,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!as(n)||!i||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Bt(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();o[u]=LS({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Bt(u=>{if(!aa(u,e,null))return;const d=this.getAxisMotionValue(u),{min:h,max:m}=this.constraints[u];d.set(Be(h,m,o[u]))})}addListeners(){if(!this.visualElement.current)return;zS.set(this.visualElement,this);const e=this.visualElement.current,n=yi(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),i=()=>{const{dragConstraints:h}=this.getProps();as(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,l=o.addEventListener("measure",i);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Le.read(i);const u=Ni(window,"resize",()=>this.scalePositionWithinConstraints()),d=o.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(Bt(y=>{const v=this.getAxisMotionValue(y);v&&(this.originPoint[y]+=h[y].translate,v.set(v.get()+h[y].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=Lc,dragMomentum:d=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function aa(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function WS(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class HS extends Yn{constructor(e){super(e),this.removeGroupControls=Ot,this.removeListeners=Ot,this.controls=new qS(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ot}unmount(){this.removeGroupControls(),this.removeListeners()}}const Qm=t=>(e,n)=>{t&&Le.postRender(()=>t(e,n))};class KS extends Yn{constructor(){super(...arguments),this.removePointerDownListener=Ot}onPointerDown(e){this.session=new E0(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:O0(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:o}=this.node.getProps();return{onSessionStart:Qm(e),onStart:Qm(n),onMove:i,onEnd:(l,u)=>{delete this.session,o&&Le.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=yi(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ga={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Xm(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ui={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Xm(t,e.target.x),i=Xm(t,e.target.y);return`${n}% ${i}%`}},GS={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,o=Jn.parse(t);if(o.length>5)return i;const l=Jn.createTransformer(t),u=typeof o[0]!="number"?1:0,d=n.x.scale*e.x,h=n.y.scale*e.y;o[0+u]/=d,o[1+u]/=h;const m=Be(d,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=m),typeof o[3+u]=="number"&&(o[3+u]/=m),l(o)}};class JS extends R.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:o}=this.props,{projection:l}=e;mb(YS),l&&(n.group&&n.group.add(l),i&&i.register&&o&&i.register(l),l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),ga.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:o,isPresent:l}=this.props,u=i.projection;return u&&(u.isPresent=l,o||e.layoutDependency!==n||n===void 0?u.willUpdate():this.safeToRemove(),e.isPresent!==l&&(l?u.promote():u.relegate()||Le.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),md.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:o}=e;o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),i&&i.deregister&&i.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function I0(t){const[e,n]=gy(),i=R.useContext(ad);return p.jsx(JS,{...t,layoutGroup:i,switchLayoutGroup:R.useContext(ky),isPresent:e,safeToRemove:n})}const YS={borderRadius:{...ui,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ui,borderTopRightRadius:ui,borderBottomLeftRadius:ui,borderBottomRightRadius:ui,boxShadow:GS};function QS(t,e,n){const i=pt(t)?t:ji(t);return i.start(Vd("",i,e,n)),i.animation}function XS(t){return t instanceof SVGElement&&t.tagName!=="svg"}const ZS=(t,e)=>t.depth-e.depth;class ek{constructor(){this.children=[],this.isDirty=!1}add(e){Nd(this.children,e),this.isDirty=!0}remove(e){Ad(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(ZS),this.isDirty=!1,this.children.forEach(e)}}function tk(t,e){const n=un.now(),i=({timestamp:o})=>{const l=o-n;l>=e&&(Gn(i),t(l-e))};return Le.read(i,!0),()=>Gn(i)}const D0=["TopLeft","TopRight","BottomLeft","BottomRight"],nk=D0.length,Zm=t=>typeof t=="string"?parseFloat(t):t,eg=t=>typeof t=="number"||de.test(t);function rk(t,e,n,i,o,l){o?(t.opacity=Be(0,n.opacity!==void 0?n.opacity:1,sk(i)),t.opacityExit=Be(e.opacity!==void 0?e.opacity:1,0,ik(i))):l&&(t.opacity=Be(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let u=0;u<nk;u++){const d=`border${D0[u]}Radius`;let h=tg(e,d),m=tg(n,d);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||eg(h)===eg(m)?(t[d]=Math.max(Be(Zm(h),Zm(m),i),0),(ln.test(m)||ln.test(h))&&(t[d]+="%")):t[d]=m}(e.rotate||n.rotate)&&(t.rotate=Be(e.rotate||0,n.rotate||0,i))}function tg(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const sk=L0(0,.5,e0),ik=L0(.5,.95,Ot);function L0(t,e,n){return i=>i<t?0:i>e?1:n(ms(t,e,i))}function ng(t,e){t.min=e.min,t.max=e.max}function Ft(t,e){ng(t.x,e.x),ng(t.y,e.y)}function rg(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function sg(t,e,n,i,o){return t-=e,t=Ca(t,1/n,i),o!==void 0&&(t=Ca(t,1/o,i)),t}function ok(t,e=0,n=1,i=.5,o,l=t,u=t){if(ln.test(e)&&(e=parseFloat(e),e=Be(u.min,u.max,e/100)-u.min),typeof e!="number")return;let d=Be(l.min,l.max,i);t===l&&(d-=e),t.min=sg(t.min,e,n,d,o),t.max=sg(t.max,e,n,d,o)}function ig(t,e,[n,i,o],l,u){ok(t,e[n],e[i],e[o],e.scale,l,u)}const ak=["x","scaleX","originX"],lk=["y","scaleY","originY"];function og(t,e,n,i){ig(t.x,e,ak,n?n.x:void 0,i?i.x:void 0),ig(t.y,e,lk,n?n.y:void 0,i?i.y:void 0)}function ag(t){return t.translate===0&&t.scale===1}function M0(t){return ag(t.x)&&ag(t.y)}function lg(t,e){return t.min===e.min&&t.max===e.max}function uk(t,e){return lg(t.x,e.x)&&lg(t.y,e.y)}function ug(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function U0(t,e){return ug(t.x,e.x)&&ug(t.y,e.y)}function cg(t){return It(t.x)/It(t.y)}function dg(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class ck{constructor(){this.members=[]}add(e){Nd(this.members,e),e.scheduleRender()}remove(e){if(Ad(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(o=>e===o);if(n===0)return!1;let i;for(let o=n;o>=0;o--){const l=this.members[o];if(l.isPresent!==!1){i=l;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function dk(t,e,n){let i="";const o=t.x.translate/e.x,l=t.y.translate/e.y,u=n?.z||0;if((o||l||u)&&(i=`translate3d(${o}px, ${l}px, ${u}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:v,rotateY:w,skewX:_,skewY:b}=n;m&&(i=`perspective(${m}px) ${i}`),y&&(i+=`rotate(${y}deg) `),v&&(i+=`rotateX(${v}deg) `),w&&(i+=`rotateY(${w}deg) `),_&&(i+=`skewX(${_}deg) `),b&&(i+=`skewY(${b}deg) `)}const d=t.x.scale*e.x,h=t.y.scale*e.y;return(d!==1||h!==1)&&(i+=`scale(${d}, ${h})`),i||"none"}const pr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},pi=typeof window<"u"&&window.MotionDebug!==void 0,ic=["","X","Y","Z"],hk={visibility:"hidden"},hg=1e3;let fk=0;function oc(t,e,n,i){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),i&&(i[t]=0))}function $0(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Ky(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:l}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Le,!(o||l))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&$0(i)}function V0({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:o}){return class{constructor(u={},d=e?.()){this.id=fk++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,pi&&(pr.totalNodes=pr.resolvedTargetDeltas=pr.recalculatedProjection=0),this.nodes.forEach(gk),this.nodes.forEach(bk),this.nodes.forEach(_k),this.nodes.forEach(yk),pi&&window.MotionDebug.record(pr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new ek)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Pd),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,d=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=XS(u),this.instance=u;const{layoutId:h,layout:m,visualElement:y}=this.options;if(y&&!y.current&&y.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),d&&(m||h)&&(this.isLayoutDirty=!0),t){let v;const w=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,v&&v(),v=tk(w,250),ga.hasAnimatedSinceResize&&(ga.hasAnimatedSinceResize=!1,this.nodes.forEach(pg))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&y&&(h||m)&&this.addEventListener("didUpdate",({delta:v,hasLayoutChanged:w,hasRelativeTargetChanged:_,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||y.getDefaultTransition()||jk,{onLayoutAnimationStart:k,onLayoutAnimationComplete:E}=y.getProps(),P=!this.targetLayout||!U0(this.targetLayout,b)||_,N=!w&&_;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||N||w&&(P||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(v,N);const U={...Ed(S,"layout"),onPlay:k,onComplete:E};(y.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else w||pg(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Gn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Sk),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&$0(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const v=this.path[y];v.shouldResetTransform=!0,v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:d,layout:h}=this.options;if(d===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(fg);return}this.isUpdating||this.nodes.forEach(wk),this.isUpdating=!1,this.nodes.forEach(xk),this.nodes.forEach(pk),this.nodes.forEach(mk),this.clearAllSnapshots();const d=un.now();at.delta=Sn(0,1e3/60,d-at.timestamp),at.timestamp=d,at.isProcessing=!0,Yu.update.process(at),Yu.preRender.process(at),Yu.render.process(at),at.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,md.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(vk),this.sharedNodes.forEach(kk)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Le.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Le.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ge(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d){const h=i(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!M0(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;u&&(d||fr(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),Ck(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:d}=this.options;if(!d)return Ge();const h=d.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(Nk))){const{scroll:y}=this.root;y&&(cs(h.x,y.offset.x),cs(h.y,y.offset.y))}return h}removeElementScroll(u){var d;const h=Ge();if(Ft(h,u),!((d=this.scroll)===null||d===void 0)&&d.wasRoot)return h;for(let m=0;m<this.path.length;m++){const y=this.path[m],{scroll:v,options:w}=y;y!==this.root&&v&&w.layoutScroll&&(v.wasRoot&&Ft(h,u),cs(h.x,v.offset.x),cs(h.y,v.offset.y))}return h}applyTransform(u,d=!1){const h=Ge();Ft(h,u);for(let m=0;m<this.path.length;m++){const y=this.path[m];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&ds(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),fr(y.latestValues)&&ds(h,y.latestValues)}return fr(this.latestValues)&&ds(h,this.latestValues),h}removeTransform(u){const d=Ge();Ft(d,u);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!fr(m.latestValues))continue;Mc(m.latestValues)&&m.updateSnapshot();const y=Ge(),v=m.measurePageBox();Ft(y,v),og(d,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return fr(this.latestValues)&&og(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==at.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var d;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==h;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:v,layoutId:w}=this.options;if(!(!this.layout||!(v||w))){if(this.resolvedRelativeTargetAt=at.timestamp,!this.targetDelta&&!this.relativeTarget){const _=this.getClosestProjectingParent();_&&_.layout&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ge(),this.relativeTargetOrigin=Ge(),wi(this.relativeTargetOrigin,this.layout.layoutBox,_.layout.layoutBox),Ft(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Ge(),this.targetWithTransforms=Ge()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),RS(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ft(this.target,this.layout.layoutBox),P0(this.target,this.targetDelta)):Ft(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const _=this.getClosestProjectingParent();_&&!!_.resumingFrom==!!this.resumingFrom&&!_.options.layoutScroll&&_.target&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ge(),this.relativeTargetOrigin=Ge(),wi(this.relativeTargetOrigin,this.target,_.target),Ft(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}pi&&pr.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Mc(this.parent.latestValues)||A0(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const d=this.getLead(),h=!!this.resumingFrom||this!==d;let m=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(m=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===at.timestamp&&(m=!1),m)return;const{layout:y,layoutId:v}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(y||v))return;Ft(this.layoutCorrected,this.layout.layoutBox);const w=this.treeScale.x,_=this.treeScale.y;FS(this.layoutCorrected,this.treeScale,this.path,h),d.layout&&!d.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(d.target=d.layout.layoutBox,d.targetWithTransforms=Ge());const{target:b}=d;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(rg(this.prevProjectionDelta.x,this.projectionDelta.x),rg(this.prevProjectionDelta.y,this.projectionDelta.y)),vi(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==w||this.treeScale.y!==_||!dg(this.projectionDelta.x,this.prevProjectionDelta.x)||!dg(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),pi&&pr.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var d;if((d=this.options.visualElement)===null||d===void 0||d.scheduleRender(),u){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=us(),this.projectionDelta=us(),this.projectionDeltaWithTransform=us()}setAnimationOrigin(u,d=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},v=us();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const w=Ge(),_=h?h.source:void 0,b=this.layout?this.layout.source:void 0,S=_!==b,k=this.getStack(),E=!k||k.members.length<=1,P=!!(S&&!E&&this.options.crossfade===!0&&!this.path.some(Tk));this.animationProgress=0;let N;this.mixTargetDelta=U=>{const V=U/1e3;mg(v.x,u.x,V),mg(v.y,u.y,V),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wi(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Ek(this.relativeTarget,this.relativeTargetOrigin,w,V),N&&uk(this.relativeTarget,N)&&(this.isProjectionDirty=!1),N||(N=Ge()),Ft(N,this.relativeTarget)),S&&(this.animationValues=y,rk(y,m,this.latestValues,V,P,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=V},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Gn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Le.update(()=>{ga.hasAnimatedSinceResize=!0,this.currentAnimation=QS(0,hg,{...u,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(hg),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:m,latestValues:y}=u;if(!(!d||!h||!m)){if(this!==u&&this.layout&&m&&F0(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||Ge();const v=It(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+v;const w=It(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+w}Ft(d,h),ds(d,y),vi(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new ck),this.sharedNodes.get(u).add(d);const m=d.options.initialPromotionConfig;d.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:d}=this.options;return d?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:d}=this.options;return d?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const m={};h.z&&oc("z",u,m,this.animationValues);for(let y=0;y<ic.length;y++)oc(`rotate${ic[y]}`,u,m,this.animationValues),oc(`skew${ic[y]}`,u,m,this.animationValues);u.render();for(const y in m)u.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);u.scheduleRender()}getProjectionStyles(u){var d,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hk;const m={visibility:""},y=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,m.opacity="",m.pointerEvents=pa(u?.pointerEvents)||"",m.transform=y?y(this.latestValues,""):"none",m;const v=this.getLead();if(!this.projectionDelta||!this.layout||!v.target){const S={};return this.options.layoutId&&(S.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,S.pointerEvents=pa(u?.pointerEvents)||""),this.hasProjected&&!fr(this.latestValues)&&(S.transform=y?y({},""):"none",this.hasProjected=!1),S}const w=v.animationValues||v.latestValues;this.applyTransformsToTarget(),m.transform=dk(this.projectionDeltaWithTransform,this.treeScale,w),y&&(m.transform=y(w,m.transform));const{x:_,y:b}=this.projectionDelta;m.transformOrigin=`${_.origin*100}% ${b.origin*100}% 0`,v.animationValues?m.opacity=v===this?(h=(d=w.opacity)!==null&&d!==void 0?d:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:w.opacityExit:m.opacity=v===this?w.opacity!==void 0?w.opacity:"":w.opacityExit!==void 0?w.opacityExit:0;for(const S in Sa){if(w[S]===void 0)continue;const{correct:k,applyTo:E}=Sa[S],P=m.transform==="none"?w[S]:k(w[S],v);if(E){const N=E.length;for(let U=0;U<N;U++)m[E[U]]=P}else m[S]=P}return this.options.layoutId&&(m.pointerEvents=v===this?pa(u?.pointerEvents)||"":"none"),m}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var d;return(d=u.currentAnimation)===null||d===void 0?void 0:d.stop()}),this.root.nodes.forEach(fg),this.root.sharedNodes.clear()}}}function pk(t){t.updateLayout()}function mk(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:o}=t.layout,{animationType:l}=t.options,u=n.source!==t.layout.source;l==="size"?Bt(v=>{const w=u?n.measuredBox[v]:n.layoutBox[v],_=It(w);w.min=i[v].min,w.max=w.min+_}):F0(l,n.layoutBox,i)&&Bt(v=>{const w=u?n.measuredBox[v]:n.layoutBox[v],_=It(i[v]);w.max=w.min+_,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[v].max=t.relativeTarget[v].min+_)});const d=us();vi(d,i,n.layoutBox);const h=us();u?vi(h,t.applyTransform(o,!0),n.measuredBox):vi(h,i,n.layoutBox);const m=!M0(d);let y=!1;if(!t.resumeFrom){const v=t.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:w,layout:_}=v;if(w&&_){const b=Ge();wi(b,n.layoutBox,w.layoutBox);const S=Ge();wi(S,i,_.layoutBox),U0(b,S)||(y=!0),v.options.layoutRoot&&(t.relativeTarget=S,t.relativeTargetOrigin=b,t.relativeParent=v)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:h,layoutDelta:d,hasLayoutChanged:m,hasRelativeTargetChanged:y})}else if(t.isLead()){const{onExitComplete:i}=t.options;i&&i()}t.options.transition=void 0}function gk(t){pi&&pr.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function yk(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function vk(t){t.clearSnapshot()}function fg(t){t.clearMeasurements()}function wk(t){t.isLayoutDirty=!1}function xk(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function pg(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function bk(t){t.resolveTargetDelta()}function _k(t){t.calcProjection()}function Sk(t){t.resetSkewAndRotation()}function kk(t){t.removeLeadSnapshot()}function mg(t,e,n){t.translate=Be(e.translate,0,n),t.scale=Be(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function gg(t,e,n,i){t.min=Be(e.min,n.min,i),t.max=Be(e.max,n.max,i)}function Ek(t,e,n,i){gg(t.x,e.x,n.x,i),gg(t.y,e.y,n.y,i)}function Tk(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const jk={duration:.45,ease:[.4,0,.1,1]},yg=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),vg=yg("applewebkit/")&&!yg("chrome/")?Math.round:Ot;function wg(t){t.min=vg(t.min),t.max=vg(t.max)}function Ck(t){wg(t.x),wg(t.y)}function F0(t,e,n){return t==="position"||t==="preserve-aspect"&&!PS(cg(e),cg(n),.2)}function Nk(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const Ak=V0({attachResizeListener:(t,e)=>Ni(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ac={current:void 0},B0=V0({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ac.current){const t=new Ak({});t.mount(window),t.setOptions({layoutScroll:!0}),ac.current=t}return ac.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Pk={pan:{Feature:KS},drag:{Feature:HS,ProjectionNode:B0,MeasureLayout:I0}};function xg(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,l=i[o];l&&Le.postRender(()=>l(e,Vi(e)))}class Rk extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=Pb(e,n=>(xg(this.node,n,"Start"),i=>xg(this.node,i,"End"))))}unmount(){}}class Ok extends Yn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=$i(Ni(this.node.current,"focus",()=>this.onFocus()),Ni(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function bg(t,e,n){const{props:i}=t;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),l=i[o];l&&Le.postRender(()=>l(e,Vi(e)))}class Ik extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=Db(e,n=>(bg(this.node,n,"Start"),(i,{success:o})=>bg(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const $c=new WeakMap,lc=new WeakMap,Dk=t=>{const e=$c.get(t.target);e&&e(t)},Lk=t=>{t.forEach(Dk)};function Mk({root:t,...e}){const n=t||document;lc.has(n)||lc.set(n,{});const i=lc.get(n),o=JSON.stringify(e);return i[o]||(i[o]=new IntersectionObserver(Lk,{root:t,...e})),i[o]}function Uk(t,e,n){const i=Mk(e);return $c.set(t,n),i.observe(t),()=>{$c.delete(t),i.unobserve(t)}}const $k={some:0,all:1};class Vk extends Yn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:o="some",once:l}=e,u={root:n?n.current:void 0,rootMargin:i,threshold:typeof o=="number"?o:$k[o]},d=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,l&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:v}=this.node.getProps(),w=m?y:v;w&&w(h)};return Uk(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Fk(e,n))&&this.startObserver()}unmount(){}}function Fk({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const Bk={inView:{Feature:Vk},tap:{Feature:Ik},focus:{Feature:Ok},hover:{Feature:Rk}},zk={layout:{ProjectionNode:B0,MeasureLayout:I0}},Vc={current:null},z0={current:!1};function qk(){if(z0.current=!0,!!cd)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Vc.current=t.matches;t.addListener(e),e()}else Vc.current=!1}const Wk=[...p0,ht,Jn],Hk=t=>Wk.find(f0(t)),_g=new WeakMap;function Kk(t,e,n){for(const i in e){const o=e[i],l=n[i];if(pt(o))t.addValue(i,o);else if(pt(l))t.addValue(i,ji(o,{owner:t}));else if(l!==o)if(t.hasValue(i)){const u=t.getValue(i);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=t.getStaticValue(i);t.addValue(i,ji(u!==void 0?u:o,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const Sg=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Gk{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:o,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Md,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const _=un.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Le.render(this.render,!1,!0))};const{latestValues:h,renderState:m,onUpdate:y}=u;this.onUpdate=y,this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=$a(n),this.isVariantNode=_y(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:v,...w}=this.scrapeMotionValuesFromProps(n,{},this);for(const _ in w){const b=w[_];h[_]!==void 0&&pt(b)&&b.set(h[_],!1)}}mount(e){this.current=e,_g.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),z0.current||qk(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Vc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){_g.delete(this.current),this.projection&&this.projection.unmount(),Gn(this.notifyUpdate),Gn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Tr.has(e),o=n.on("change",d=>{this.latestValues[e]=d,this.props.onUpdate&&Le.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),l=n.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),l(),u&&u(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in gs){const n=gs[e];if(!n)continue;const{isEnabled:i,Feature:o}=n;if(!this.features[e]&&o&&i(this.props)&&(this.features[e]=new o(this)),this.features[e]){const l=this.features[e];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ge()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<Sg.length;i++){const o=Sg[i];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=e[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=Kk(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=ji(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){var i;let o=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(i=this.getBaseTargetFromProps(this.props,e))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,e,this.options);return o!=null&&(typeof o=="string"&&(d0(o)||n0(o))?o=parseFloat(o):!Hk(o)&&Jn.test(n)&&(o=l0(e,n)),this.setBaseTarget(e,pt(o)?o.get():o)),pt(o)?o.get():o}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:i}=this.props;let o;if(typeof i=="string"||typeof i=="object"){const u=yd(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);u&&(o=u[e])}if(i&&o!==void 0)return o;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!pt(l)?l:this.initialValues[e]!==void 0&&o===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Pd),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class q0 extends Gk{constructor(){super(...arguments),this.KeyframeResolver=m0}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;pt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Jk(t){return window.getComputedStyle(t)}class Yk extends q0{constructor(){super(...arguments),this.type="html",this.renderInstance=Py}readValueFromInstance(e,n){if(Tr.has(n)){const i=Ld(n);return i&&i.default||0}else{const i=Jk(e),o=(Cy(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return R0(e,n)}build(e,n,i){xd(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return kd(e,n,i)}}class Qk extends q0{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ge}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Tr.has(n)){const i=Ld(n);return i&&i.default||0}return n=Ry.has(n)?n:pd(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return Dy(e,n,i)}build(e,n,i){bd(e,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,i,o){Oy(e,n,i,o)}mount(e){this.isSVGTag=Sd(e.tagName),super.mount(e)}}const Xk=(t,e)=>gd(t)?new Qk(e):new Yk(e,{allowProjection:t!==R.Fragment}),Zk=kb({..._S,...Bk,...Pk,...zk},Xk),Ne=$1(Zk);function W0(t,e){return function(){return t.apply(e,arguments)}}const{toString:eE}=Object.prototype,{getPrototypeOf:Fd}=Object,{iterator:Ba,toStringTag:H0}=Symbol,za=(t=>e=>{const n=eE.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),en=t=>(t=t.toLowerCase(),e=>za(e)===t),qa=t=>e=>typeof e===t,{isArray:bs}=Array,vs=qa("undefined");function Fi(t){return t!==null&&!vs(t)&&t.constructor!==null&&!vs(t.constructor)&&St(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const K0=en("ArrayBuffer");function tE(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&K0(t.buffer),e}const nE=qa("string"),St=qa("function"),G0=qa("number"),Bi=t=>t!==null&&typeof t=="object",rE=t=>t===!0||t===!1,ya=t=>{if(za(t)!=="object")return!1;const e=Fd(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(H0 in t)&&!(Ba in t)},sE=t=>{if(!Bi(t)||Fi(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},iE=en("Date"),oE=en("File"),aE=en("Blob"),lE=en("FileList"),uE=t=>Bi(t)&&St(t.pipe),cE=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||St(t.append)&&((e=za(t))==="formdata"||e==="object"&&St(t.toString)&&t.toString()==="[object FormData]"))},dE=en("URLSearchParams"),[hE,fE,pE,mE]=["ReadableStream","Request","Response","Headers"].map(en),gE=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zi(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let i,o;if(typeof t!="object"&&(t=[t]),bs(t))for(i=0,o=t.length;i<o;i++)e.call(null,t[i],i,t);else{if(Fi(t))return;const l=n?Object.getOwnPropertyNames(t):Object.keys(t),u=l.length;let d;for(i=0;i<u;i++)d=l[i],e.call(null,t[d],d,t)}}function J0(t,e){if(Fi(t))return null;e=e.toLowerCase();const n=Object.keys(t);let i=n.length,o;for(;i-- >0;)if(o=n[i],e===o.toLowerCase())return o;return null}const wr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Y0=t=>!vs(t)&&t!==wr;function Fc(){const{caseless:t,skipUndefined:e}=Y0(this)&&this||{},n={},i=(o,l)=>{const u=t&&J0(n,l)||l;ya(n[u])&&ya(o)?n[u]=Fc(n[u],o):ya(o)?n[u]=Fc({},o):bs(o)?n[u]=o.slice():(!e||!vs(o))&&(n[u]=o)};for(let o=0,l=arguments.length;o<l;o++)arguments[o]&&zi(arguments[o],i);return n}const yE=(t,e,n,{allOwnKeys:i}={})=>(zi(e,(o,l)=>{n&&St(o)?t[l]=W0(o,n):t[l]=o},{allOwnKeys:i}),t),vE=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),wE=(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},xE=(t,e,n,i)=>{let o,l,u;const d={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),l=o.length;l-- >0;)u=o[l],(!i||i(u,t,e))&&!d[u]&&(e[u]=t[u],d[u]=!0);t=n!==!1&&Fd(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},bE=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return i!==-1&&i===n},_E=t=>{if(!t)return null;if(bs(t))return t;let e=t.length;if(!G0(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},SE=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Fd(Uint8Array)),kE=(t,e)=>{const i=(t&&t[Ba]).call(t);let o;for(;(o=i.next())&&!o.done;){const l=o.value;e.call(t,l[0],l[1])}},EE=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},TE=en("HTMLFormElement"),jE=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),kg=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),CE=en("RegExp"),Q0=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};zi(n,(o,l)=>{let u;(u=e(o,l,t))!==!1&&(i[l]=u||o)}),Object.defineProperties(t,i)},NE=t=>{Q0(t,(e,n)=>{if(St(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=t[n];if(St(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},AE=(t,e)=>{const n={},i=o=>{o.forEach(l=>{n[l]=!0})};return bs(t)?i(t):i(String(t).split(e)),n},PE=()=>{},RE=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function OE(t){return!!(t&&St(t.append)&&t[H0]==="FormData"&&t[Ba])}const IE=t=>{const e=new Array(10),n=(i,o)=>{if(Bi(i)){if(e.indexOf(i)>=0)return;if(Fi(i))return i;if(!("toJSON"in i)){e[o]=i;const l=bs(i)?[]:{};return zi(i,(u,d)=>{const h=n(u,o+1);!vs(h)&&(l[d]=h)}),e[o]=void 0,l}}return i};return n(t,0)},DE=en("AsyncFunction"),LE=t=>t&&(Bi(t)||St(t))&&St(t.then)&&St(t.catch),X0=((t,e)=>t?setImmediate:e?((n,i)=>(wr.addEventListener("message",({source:o,data:l})=>{o===wr&&l===n&&i.length&&i.shift()()},!1),o=>{i.push(o),wr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",St(wr.postMessage)),ME=typeof queueMicrotask<"u"?queueMicrotask.bind(wr):typeof process<"u"&&process.nextTick||X0,UE=t=>t!=null&&St(t[Ba]),M={isArray:bs,isArrayBuffer:K0,isBuffer:Fi,isFormData:cE,isArrayBufferView:tE,isString:nE,isNumber:G0,isBoolean:rE,isObject:Bi,isPlainObject:ya,isEmptyObject:sE,isReadableStream:hE,isRequest:fE,isResponse:pE,isHeaders:mE,isUndefined:vs,isDate:iE,isFile:oE,isBlob:aE,isRegExp:CE,isFunction:St,isStream:uE,isURLSearchParams:dE,isTypedArray:SE,isFileList:lE,forEach:zi,merge:Fc,extend:yE,trim:gE,stripBOM:vE,inherits:wE,toFlatObject:xE,kindOf:za,kindOfTest:en,endsWith:bE,toArray:_E,forEachEntry:kE,matchAll:EE,isHTMLForm:TE,hasOwnProperty:kg,hasOwnProp:kg,reduceDescriptors:Q0,freezeMethods:NE,toObjectSet:AE,toCamelCase:jE,noop:PE,toFiniteNumber:RE,findKey:J0,global:wr,isContextDefined:Y0,isSpecCompliantForm:OE,toJSONObject:IE,isAsyncFn:DE,isThenable:LE,setImmediate:X0,asap:ME,isIterable:UE};function ye(t,e,n,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status?o.status:null)}M.inherits(ye,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.status}}});const Z0=ye.prototype,ev={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{ev[t]={value:t}});Object.defineProperties(ye,ev);Object.defineProperty(Z0,"isAxiosError",{value:!0});ye.from=(t,e,n,i,o,l)=>{const u=Object.create(Z0);M.toFlatObject(t,u,function(y){return y!==Error.prototype},m=>m!=="isAxiosError");const d=t&&t.message?t.message:"Error",h=e==null&&t?t.code:e;return ye.call(u,d,h,n,i,o),t&&u.cause==null&&Object.defineProperty(u,"cause",{value:t,configurable:!0}),u.name=t&&t.name||"Error",l&&Object.assign(u,l),u};const $E=null;function Bc(t){return M.isPlainObject(t)||M.isArray(t)}function tv(t){return M.endsWith(t,"[]")?t.slice(0,-2):t}function Eg(t,e,n){return t?t.concat(e).map(function(o,l){return o=tv(o),!n&&l?"["+o+"]":o}).join(n?".":""):e}function VE(t){return M.isArray(t)&&!t.some(Bc)}const FE=M.toFlatObject(M,{},null,function(e){return/^is[A-Z]/.test(e)});function Wa(t,e,n){if(!M.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=M.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,k){return!M.isUndefined(k[S])});const i=n.metaTokens,o=n.visitor||y,l=n.dots,u=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&M.isSpecCompliantForm(e);if(!M.isFunction(o))throw new TypeError("visitor must be a function");function m(b){if(b===null)return"";if(M.isDate(b))return b.toISOString();if(M.isBoolean(b))return b.toString();if(!h&&M.isBlob(b))throw new ye("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(b)||M.isTypedArray(b)?h&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function y(b,S,k){let E=b;if(b&&!k&&typeof b=="object"){if(M.endsWith(S,"{}"))S=i?S:S.slice(0,-2),b=JSON.stringify(b);else if(M.isArray(b)&&VE(b)||(M.isFileList(b)||M.endsWith(S,"[]"))&&(E=M.toArray(b)))return S=tv(S),E.forEach(function(N,U){!(M.isUndefined(N)||N===null)&&e.append(u===!0?Eg([S],U,l):u===null?S:S+"[]",m(N))}),!1}return Bc(b)?!0:(e.append(Eg(k,S,l),m(b)),!1)}const v=[],w=Object.assign(FE,{defaultVisitor:y,convertValue:m,isVisitable:Bc});function _(b,S){if(!M.isUndefined(b)){if(v.indexOf(b)!==-1)throw Error("Circular reference detected in "+S.join("."));v.push(b),M.forEach(b,function(E,P){(!(M.isUndefined(E)||E===null)&&o.call(e,E,M.isString(P)?P.trim():P,S,w))===!0&&_(E,S?S.concat(P):[P])}),v.pop()}}if(!M.isObject(t))throw new TypeError("data must be an object");return _(t),e}function Tg(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Bd(t,e){this._pairs=[],t&&Wa(t,this,e)}const nv=Bd.prototype;nv.append=function(e,n){this._pairs.push([e,n])};nv.toString=function(e){const n=e?function(i){return e.call(this,i,Tg)}:Tg;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function BE(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function rv(t,e,n){if(!e)return t;const i=n&&n.encode||BE;M.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let l;if(o?l=o(e,n):l=M.isURLSearchParams(e)?e.toString():new Bd(e,n).toString(i),l){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+l}return t}class jg{constructor(){this.handlers=[]}use(e,n,i){return this.handlers.push({fulfilled:e,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){M.forEach(this.handlers,function(i){i!==null&&e(i)})}}const sv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zE=typeof URLSearchParams<"u"?URLSearchParams:Bd,qE=typeof FormData<"u"?FormData:null,WE=typeof Blob<"u"?Blob:null,HE={isBrowser:!0,classes:{URLSearchParams:zE,FormData:qE,Blob:WE},protocols:["http","https","file","blob","url","data"]},zd=typeof window<"u"&&typeof document<"u",zc=typeof navigator=="object"&&navigator||void 0,KE=zd&&(!zc||["ReactNative","NativeScript","NS"].indexOf(zc.product)<0),GE=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",JE=zd&&window.location.href||"http://localhost",YE=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zd,hasStandardBrowserEnv:KE,hasStandardBrowserWebWorkerEnv:GE,navigator:zc,origin:JE},Symbol.toStringTag,{value:"Module"})),ft={...YE,...HE};function QE(t,e){return Wa(t,new ft.classes.URLSearchParams,{visitor:function(n,i,o,l){return ft.isNode&&M.isBuffer(n)?(this.append(i,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...e})}function XE(t){return M.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function ZE(t){const e={},n=Object.keys(t);let i;const o=n.length;let l;for(i=0;i<o;i++)l=n[i],e[l]=t[l];return e}function iv(t){function e(n,i,o,l){let u=n[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),h=l>=n.length;return u=!u&&M.isArray(o)?o.length:u,h?(M.hasOwnProp(o,u)?o[u]=[o[u],i]:o[u]=i,!d):((!o[u]||!M.isObject(o[u]))&&(o[u]=[]),e(n,i,o[u],l)&&M.isArray(o[u])&&(o[u]=ZE(o[u])),!d)}if(M.isFormData(t)&&M.isFunction(t.entries)){const n={};return M.forEachEntry(t,(i,o)=>{e(XE(i),o,n,0)}),n}return null}function e2(t,e,n){if(M.isString(t))try{return(e||JSON.parse)(t),M.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(t)}const qi={transitional:sv,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const i=n.getContentType()||"",o=i.indexOf("application/json")>-1,l=M.isObject(e);if(l&&M.isHTMLForm(e)&&(e=new FormData(e)),M.isFormData(e))return o?JSON.stringify(iv(e)):e;if(M.isArrayBuffer(e)||M.isBuffer(e)||M.isStream(e)||M.isFile(e)||M.isBlob(e)||M.isReadableStream(e))return e;if(M.isArrayBufferView(e))return e.buffer;if(M.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(l){if(i.indexOf("application/x-www-form-urlencoded")>-1)return QE(e,this.formSerializer).toString();if((d=M.isFileList(e))||i.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Wa(d?{"files[]":e}:e,h&&new h,this.formSerializer)}}return l||o?(n.setContentType("application/json",!1),e2(e)):e}],transformResponse:[function(e){const n=this.transitional||qi.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(M.isResponse(e)||M.isReadableStream(e))return e;if(e&&M.isString(e)&&(i&&!this.responseType||o)){const u=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(d){if(u)throw d.name==="SyntaxError"?ye.from(d,ye.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ft.classes.FormData,Blob:ft.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};M.forEach(["delete","get","head","post","put","patch"],t=>{qi.headers[t]={}});const t2=M.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),n2=t=>{const e={};let n,i,o;return t&&t.split(`
17
- `).forEach(function(u){o=u.indexOf(":"),n=u.substring(0,o).trim().toLowerCase(),i=u.substring(o+1).trim(),!(!n||e[n]&&t2[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)}),e},Cg=Symbol("internals");function ci(t){return t&&String(t).trim().toLowerCase()}function va(t){return t===!1||t==null?t:M.isArray(t)?t.map(va):String(t)}function r2(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}const s2=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function uc(t,e,n,i,o){if(M.isFunction(i))return i.call(this,e,n);if(o&&(e=n),!!M.isString(e)){if(M.isString(i))return e.indexOf(i)!==-1;if(M.isRegExp(i))return i.test(e)}}function i2(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}function o2(t,e){const n=M.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(o,l,u){return this[i].call(this,e,o,l,u)},configurable:!0})})}let kt=class{constructor(e){e&&this.set(e)}set(e,n,i){const o=this;function l(d,h,m){const y=ci(h);if(!y)throw new Error("header name must be a non-empty string");const v=M.findKey(o,y);(!v||o[v]===void 0||m===!0||m===void 0&&o[v]!==!1)&&(o[v||h]=va(d))}const u=(d,h)=>M.forEach(d,(m,y)=>l(m,y,h));if(M.isPlainObject(e)||e instanceof this.constructor)u(e,n);else if(M.isString(e)&&(e=e.trim())&&!s2(e))u(n2(e),n);else if(M.isObject(e)&&M.isIterable(e)){let d={},h,m;for(const y of e){if(!M.isArray(y))throw TypeError("Object iterator must return a key-value pair");d[m=y[0]]=(h=d[m])?M.isArray(h)?[...h,y[1]]:[h,y[1]]:y[1]}u(d,n)}else e!=null&&l(n,e,i);return this}get(e,n){if(e=ci(e),e){const i=M.findKey(this,e);if(i){const o=this[i];if(!n)return o;if(n===!0)return r2(o);if(M.isFunction(n))return n.call(this,o,i);if(M.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ci(e),e){const i=M.findKey(this,e);return!!(i&&this[i]!==void 0&&(!n||uc(this,this[i],i,n)))}return!1}delete(e,n){const i=this;let o=!1;function l(u){if(u=ci(u),u){const d=M.findKey(i,u);d&&(!n||uc(i,i[d],d,n))&&(delete i[d],o=!0)}}return M.isArray(e)?e.forEach(l):l(e),o}clear(e){const n=Object.keys(this);let i=n.length,o=!1;for(;i--;){const l=n[i];(!e||uc(this,this[l],l,e,!0))&&(delete this[l],o=!0)}return o}normalize(e){const n=this,i={};return M.forEach(this,(o,l)=>{const u=M.findKey(i,l);if(u){n[u]=va(o),delete n[l];return}const d=e?i2(l):String(l).trim();d!==l&&delete n[l],n[d]=va(o),i[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return M.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=e&&M.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
18
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const i=new this(e);return n.forEach(o=>i.set(o)),i}static accessor(e){const i=(this[Cg]=this[Cg]={accessors:{}}).accessors,o=this.prototype;function l(u){const d=ci(u);i[d]||(o2(o,u),i[d]=!0)}return M.isArray(e)?e.forEach(l):l(e),this}};kt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);M.reduceDescriptors(kt.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[n]=i}}});M.freezeMethods(kt);function cc(t,e){const n=this||qi,i=e||n,o=kt.from(i.headers);let l=i.data;return M.forEach(t,function(d){l=d.call(n,l,o.normalize(),e?e.status:void 0)}),o.normalize(),l}function ov(t){return!!(t&&t.__CANCEL__)}function _s(t,e,n){ye.call(this,t??"canceled",ye.ERR_CANCELED,e,n),this.name="CanceledError"}M.inherits(_s,ye,{__CANCEL__:!0});function av(t,e,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?t(n):e(new ye("Request failed with status code "+n.status,[ye.ERR_BAD_REQUEST,ye.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function a2(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function l2(t,e){t=t||10;const n=new Array(t),i=new Array(t);let o=0,l=0,u;return e=e!==void 0?e:1e3,function(h){const m=Date.now(),y=i[l];u||(u=m),n[o]=h,i[o]=m;let v=l,w=0;for(;v!==o;)w+=n[v++],v=v%t;if(o=(o+1)%t,o===l&&(l=(l+1)%t),m-u<e)return;const _=y&&m-y;return _?Math.round(w*1e3/_):void 0}}function u2(t,e){let n=0,i=1e3/e,o,l;const u=(m,y=Date.now())=>{n=y,o=null,l&&(clearTimeout(l),l=null),t(...m)};return[(...m)=>{const y=Date.now(),v=y-n;v>=i?u(m,y):(o=m,l||(l=setTimeout(()=>{l=null,u(o)},i-v)))},()=>o&&u(o)]}const Na=(t,e,n=3)=>{let i=0;const o=l2(50,250);return u2(l=>{const u=l.loaded,d=l.lengthComputable?l.total:void 0,h=u-i,m=o(h),y=u<=d;i=u;const v={loaded:u,total:d,progress:d?u/d:void 0,bytes:h,rate:m||void 0,estimated:m&&d&&y?(d-u)/m:void 0,event:l,lengthComputable:d!=null,[e?"download":"upload"]:!0};t(v)},n)},Ng=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},Ag=t=>(...e)=>M.asap(()=>t(...e)),c2=ft.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ft.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ft.origin),ft.navigator&&/(msie|trident)/i.test(ft.navigator.userAgent)):()=>!0,d2=ft.hasStandardBrowserEnv?{write(t,e,n,i,o,l,u){if(typeof document>"u")return;const d=[`${t}=${encodeURIComponent(e)}`];M.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),M.isString(i)&&d.push(`path=${i}`),M.isString(o)&&d.push(`domain=${o}`),l===!0&&d.push("secure"),M.isString(u)&&d.push(`SameSite=${u}`),document.cookie=d.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function h2(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function f2(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function lv(t,e,n){let i=!h2(e);return t&&(i||n==!1)?f2(t,e):e}const Pg=t=>t instanceof kt?{...t}:t;function Er(t,e){e=e||{};const n={};function i(m,y,v,w){return M.isPlainObject(m)&&M.isPlainObject(y)?M.merge.call({caseless:w},m,y):M.isPlainObject(y)?M.merge({},y):M.isArray(y)?y.slice():y}function o(m,y,v,w){if(M.isUndefined(y)){if(!M.isUndefined(m))return i(void 0,m,v,w)}else return i(m,y,v,w)}function l(m,y){if(!M.isUndefined(y))return i(void 0,y)}function u(m,y){if(M.isUndefined(y)){if(!M.isUndefined(m))return i(void 0,m)}else return i(void 0,y)}function d(m,y,v){if(v in e)return i(m,y);if(v in t)return i(void 0,m)}const h={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d,headers:(m,y,v)=>o(Pg(m),Pg(y),v,!0)};return M.forEach(Object.keys({...t,...e}),function(y){const v=h[y]||o,w=v(t[y],e[y],y);M.isUndefined(w)&&v!==d||(n[y]=w)}),n}const uv=t=>{const e=Er({},t);let{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:l,headers:u,auth:d}=e;if(e.headers=u=kt.from(u),e.url=rv(lv(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&u.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),M.isFormData(n)){if(ft.hasStandardBrowserEnv||ft.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(M.isFunction(n.getHeaders)){const h=n.getHeaders(),m=["content-type","content-length"];Object.entries(h).forEach(([y,v])=>{m.includes(y.toLowerCase())&&u.set(y,v)})}}if(ft.hasStandardBrowserEnv&&(i&&M.isFunction(i)&&(i=i(e)),i||i!==!1&&c2(e.url))){const h=o&&l&&d2.read(l);h&&u.set(o,h)}return e},p2=typeof XMLHttpRequest<"u",m2=p2&&function(t){return new Promise(function(n,i){const o=uv(t);let l=o.data;const u=kt.from(o.headers).normalize();let{responseType:d,onUploadProgress:h,onDownloadProgress:m}=o,y,v,w,_,b;function S(){_&&_(),b&&b(),o.cancelToken&&o.cancelToken.unsubscribe(y),o.signal&&o.signal.removeEventListener("abort",y)}let k=new XMLHttpRequest;k.open(o.method.toUpperCase(),o.url,!0),k.timeout=o.timeout;function E(){if(!k)return;const N=kt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),V={data:!d||d==="text"||d==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:N,config:t,request:k};av(function($){n($),S()},function($){i($),S()},V),k=null}"onloadend"in k?k.onloadend=E:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(E)},k.onabort=function(){k&&(i(new ye("Request aborted",ye.ECONNABORTED,t,k)),k=null)},k.onerror=function(U){const V=U&&U.message?U.message:"Network Error",z=new ye(V,ye.ERR_NETWORK,t,k);z.event=U||null,i(z),k=null},k.ontimeout=function(){let U=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const V=o.transitional||sv;o.timeoutErrorMessage&&(U=o.timeoutErrorMessage),i(new ye(U,V.clarifyTimeoutError?ye.ETIMEDOUT:ye.ECONNABORTED,t,k)),k=null},l===void 0&&u.setContentType(null),"setRequestHeader"in k&&M.forEach(u.toJSON(),function(U,V){k.setRequestHeader(V,U)}),M.isUndefined(o.withCredentials)||(k.withCredentials=!!o.withCredentials),d&&d!=="json"&&(k.responseType=o.responseType),m&&([w,b]=Na(m,!0),k.addEventListener("progress",w)),h&&k.upload&&([v,_]=Na(h),k.upload.addEventListener("progress",v),k.upload.addEventListener("loadend",_)),(o.cancelToken||o.signal)&&(y=N=>{k&&(i(!N||N.type?new _s(null,t,k):N),k.abort(),k=null)},o.cancelToken&&o.cancelToken.subscribe(y),o.signal&&(o.signal.aborted?y():o.signal.addEventListener("abort",y)));const P=a2(o.url);if(P&&ft.protocols.indexOf(P)===-1){i(new ye("Unsupported protocol "+P+":",ye.ERR_BAD_REQUEST,t));return}k.send(l||null)})},g2=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let i=new AbortController,o;const l=function(m){if(!o){o=!0,d();const y=m instanceof Error?m:this.reason;i.abort(y instanceof ye?y:new _s(y instanceof Error?y.message:y))}};let u=e&&setTimeout(()=>{u=null,l(new ye(`timeout ${e} of ms exceeded`,ye.ETIMEDOUT))},e);const d=()=>{t&&(u&&clearTimeout(u),u=null,t.forEach(m=>{m.unsubscribe?m.unsubscribe(l):m.removeEventListener("abort",l)}),t=null)};t.forEach(m=>m.addEventListener("abort",l));const{signal:h}=i;return h.unsubscribe=()=>M.asap(d),h}},y2=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let i=0,o;for(;i<n;)o=i+e,yield t.slice(i,o),i=o},v2=async function*(t,e){for await(const n of w2(t))yield*y2(n,e)},w2=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:i}=await e.read();if(n)break;yield i}}finally{await e.cancel()}},Rg=(t,e,n,i)=>{const o=v2(t,e);let l=0,u,d=h=>{u||(u=!0,i&&i(h))};return new ReadableStream({async pull(h){try{const{done:m,value:y}=await o.next();if(m){d(),h.close();return}let v=y.byteLength;if(n){let w=l+=v;n(w)}h.enqueue(new Uint8Array(y))}catch(m){throw d(m),m}},cancel(h){return d(h),o.return()}},{highWaterMark:2})},Og=64*1024,{isFunction:la}=M,x2=(({Request:t,Response:e})=>({Request:t,Response:e}))(M.global),{ReadableStream:Ig,TextEncoder:Dg}=M.global,Lg=(t,...e)=>{try{return!!t(...e)}catch{return!1}},b2=t=>{t=M.merge.call({skipUndefined:!0},x2,t);const{fetch:e,Request:n,Response:i}=t,o=e?la(e):typeof fetch=="function",l=la(n),u=la(i);if(!o)return!1;const d=o&&la(Ig),h=o&&(typeof Dg=="function"?(b=>S=>b.encode(S))(new Dg):async b=>new Uint8Array(await new n(b).arrayBuffer())),m=l&&d&&Lg(()=>{let b=!1;const S=new n(ft.origin,{body:new Ig,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!S}),y=u&&d&&Lg(()=>M.isReadableStream(new i("").body)),v={stream:y&&(b=>b.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!v[b]&&(v[b]=(S,k)=>{let E=S&&S[b];if(E)return E.call(S);throw new ye(`Response type '${b}' is not supported`,ye.ERR_NOT_SUPPORT,k)})});const w=async b=>{if(b==null)return 0;if(M.isBlob(b))return b.size;if(M.isSpecCompliantForm(b))return(await new n(ft.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(M.isArrayBufferView(b)||M.isArrayBuffer(b))return b.byteLength;if(M.isURLSearchParams(b)&&(b=b+""),M.isString(b))return(await h(b)).byteLength},_=async(b,S)=>{const k=M.toFiniteNumber(b.getContentLength());return k??w(S)};return async b=>{let{url:S,method:k,data:E,signal:P,cancelToken:N,timeout:U,onDownloadProgress:V,onUploadProgress:z,responseType:$,headers:B,withCredentials:Y="same-origin",fetchOptions:oe}=uv(b),Te=e||fetch;$=$?($+"").toLowerCase():"text";let ve=g2([P,N&&N.toAbortSignal()],U),je=null;const xe=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let Oe;try{if(z&&m&&k!=="get"&&k!=="head"&&(Oe=await _(B,E))!==0){let j=new n(S,{method:"POST",body:E,duplex:"half"}),D;if(M.isFormData(E)&&(D=j.headers.get("content-type"))&&B.setContentType(D),j.body){const[se,ue]=Ng(Oe,Na(Ag(z)));E=Rg(j.body,Og,se,ue)}}M.isString(Y)||(Y=Y?"include":"omit");const be=l&&"credentials"in n.prototype,pe={...oe,signal:ve,method:k.toUpperCase(),headers:B.normalize().toJSON(),body:E,duplex:"half",credentials:be?Y:void 0};je=l&&new n(S,pe);let F=await(l?Te(je,oe):Te(S,pe));const J=y&&($==="stream"||$==="response");if(y&&(V||J&&xe)){const j={};["status","statusText","headers"].forEach(fe=>{j[fe]=F[fe]});const D=M.toFiniteNumber(F.headers.get("content-length")),[se,ue]=V&&Ng(D,Na(Ag(V),!0))||[];F=new i(Rg(F.body,Og,se,()=>{ue&&ue(),xe&&xe()}),j)}$=$||"text";let K=await v[M.findKey(v,$)||"text"](F,b);return!J&&xe&&xe(),await new Promise((j,D)=>{av(j,D,{data:K,headers:kt.from(F.headers),status:F.status,statusText:F.statusText,config:b,request:je})})}catch(be){throw xe&&xe(),be&&be.name==="TypeError"&&/Load failed|fetch/i.test(be.message)?Object.assign(new ye("Network Error",ye.ERR_NETWORK,b,je),{cause:be.cause||be}):ye.from(be,be&&be.code,b,je)}}},_2=new Map,cv=t=>{let e=t&&t.env||{};const{fetch:n,Request:i,Response:o}=e,l=[i,o,n];let u=l.length,d=u,h,m,y=_2;for(;d--;)h=l[d],m=y.get(h),m===void 0&&y.set(h,m=d?new Map:b2(e)),y=m;return m};cv();const qd={http:$E,xhr:m2,fetch:{get:cv}};M.forEach(qd,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Mg=t=>`- ${t}`,S2=t=>M.isFunction(t)||t===null||t===!1;function k2(t,e){t=M.isArray(t)?t:[t];const{length:n}=t;let i,o;const l={};for(let u=0;u<n;u++){i=t[u];let d;if(o=i,!S2(i)&&(o=qd[(d=String(i)).toLowerCase()],o===void 0))throw new ye(`Unknown adapter '${d}'`);if(o&&(M.isFunction(o)||(o=o.get(e))))break;l[d||"#"+u]=o}if(!o){const u=Object.entries(l).map(([h,m])=>`adapter ${h} `+(m===!1?"is not supported by the environment":"is not available in the build"));let d=n?u.length>1?`since :
19
- `+u.map(Mg).join(`
20
- `):" "+Mg(u[0]):"as no adapter specified";throw new ye("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return o}const dv={getAdapter:k2,adapters:qd};function dc(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _s(null,t)}function Ug(t){return dc(t),t.headers=kt.from(t.headers),t.data=cc.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),dv.getAdapter(t.adapter||qi.adapter,t)(t).then(function(i){return dc(t),i.data=cc.call(t,t.transformResponse,i),i.headers=kt.from(i.headers),i},function(i){return ov(i)||(dc(t),i&&i.response&&(i.response.data=cc.call(t,t.transformResponse,i.response),i.response.headers=kt.from(i.response.headers))),Promise.reject(i)})}const hv="1.13.2",Ha={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ha[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const $g={};Ha.transitional=function(e,n,i){function o(l,u){return"[Axios v"+hv+"] Transitional option '"+l+"'"+u+(i?". "+i:"")}return(l,u,d)=>{if(e===!1)throw new ye(o(u," has been removed"+(n?" in "+n:"")),ye.ERR_DEPRECATED);return n&&!$g[u]&&($g[u]=!0,console.warn(o(u," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(l,u,d):!0}};Ha.spelling=function(e){return(n,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function E2(t,e,n){if(typeof t!="object")throw new ye("options must be an object",ye.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let o=i.length;for(;o-- >0;){const l=i[o],u=e[l];if(u){const d=t[l],h=d===void 0||u(d,l,t);if(h!==!0)throw new ye("option "+l+" must be "+h,ye.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ye("Unknown option "+l,ye.ERR_BAD_OPTION)}}const wa={assertOptions:E2,validators:Ha},an=wa.validators;let _r=class{constructor(e){this.defaults=e||{},this.interceptors={request:new jg,response:new jg}}async request(e,n){try{return await this._request(e,n)}catch(i){if(i instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const l=o.stack?o.stack.replace(/^.+\n/,""):"";try{i.stack?l&&!String(i.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(i.stack+=`
21
- `+l):i.stack=l}catch{}}throw i}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Er(this.defaults,n);const{transitional:i,paramsSerializer:o,headers:l}=n;i!==void 0&&wa.assertOptions(i,{silentJSONParsing:an.transitional(an.boolean),forcedJSONParsing:an.transitional(an.boolean),clarifyTimeoutError:an.transitional(an.boolean)},!1),o!=null&&(M.isFunction(o)?n.paramsSerializer={serialize:o}:wa.assertOptions(o,{encode:an.function,serialize:an.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),wa.assertOptions(n,{baseUrl:an.spelling("baseURL"),withXsrfToken:an.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&M.merge(l.common,l[n.method]);l&&M.forEach(["delete","get","head","post","put","patch","common"],b=>{delete l[b]}),n.headers=kt.concat(u,l);const d=[];let h=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(n)===!1||(h=h&&S.synchronous,d.unshift(S.fulfilled,S.rejected))});const m=[];this.interceptors.response.forEach(function(S){m.push(S.fulfilled,S.rejected)});let y,v=0,w;if(!h){const b=[Ug.bind(this),void 0];for(b.unshift(...d),b.push(...m),w=b.length,y=Promise.resolve(n);v<w;)y=y.then(b[v++],b[v++]);return y}w=d.length;let _=n;for(;v<w;){const b=d[v++],S=d[v++];try{_=b(_)}catch(k){S.call(this,k);break}}try{y=Ug.call(this,_)}catch(b){return Promise.reject(b)}for(v=0,w=m.length;v<w;)y=y.then(m[v++],m[v++]);return y}getUri(e){e=Er(this.defaults,e);const n=lv(e.baseURL,e.url,e.allowAbsoluteUrls);return rv(n,e.params,e.paramsSerializer)}};M.forEach(["delete","get","head","options"],function(e){_r.prototype[e]=function(n,i){return this.request(Er(i||{},{method:e,url:n,data:(i||{}).data}))}});M.forEach(["post","put","patch"],function(e){function n(i){return function(l,u,d){return this.request(Er(d||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}_r.prototype[e]=n(),_r.prototype[e+"Form"]=n(!0)});let T2=class fv{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const i=this;this.promise.then(o=>{if(!i._listeners)return;let l=i._listeners.length;for(;l-- >0;)i._listeners[l](o);i._listeners=null}),this.promise.then=o=>{let l;const u=new Promise(d=>{i.subscribe(d),l=d}).then(o);return u.cancel=function(){i.unsubscribe(l)},u},e(function(l,u,d){i.reason||(i.reason=new _s(l,u,d),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=i=>{e.abort(i)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new fv(function(o){e=o}),cancel:e}}};function j2(t){return function(n){return t.apply(null,n)}}function C2(t){return M.isObject(t)&&t.isAxiosError===!0}const qc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(qc).forEach(([t,e])=>{qc[e]=t});function pv(t){const e=new _r(t),n=W0(_r.prototype.request,e);return M.extend(n,_r.prototype,e,{allOwnKeys:!0}),M.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return pv(Er(t,o))},n}const Re=pv(qi);Re.Axios=_r;Re.CanceledError=_s;Re.CancelToken=T2;Re.isCancel=ov;Re.VERSION=hv;Re.toFormData=Wa;Re.AxiosError=ye;Re.Cancel=Re.CanceledError;Re.all=function(e){return Promise.all(e)};Re.spread=j2;Re.isAxiosError=C2;Re.mergeConfig=Er;Re.AxiosHeaders=kt;Re.formToJSON=t=>iv(M.isHTMLForm(t)?new FormData(t):t);Re.getAdapter=dv.getAdapter;Re.HttpStatusCode=qc;Re.default=Re;const{Axios:YC,AxiosError:QC,CanceledError:XC,isCancel:ZC,CancelToken:eN,VERSION:tN,all:nN,Cancel:rN,isAxiosError:sN,spread:iN,toFormData:oN,AxiosHeaders:aN,HttpStatusCode:lN,formToJSON:uN,getAdapter:cN,mergeConfig:dN}=Re;function Ka(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]]);return n}function N2(t,e,n,i){function o(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function d(y){try{m(i.next(y))}catch(v){u(v)}}function h(y){try{m(i.throw(y))}catch(v){u(v)}}function m(y){y.done?l(y.value):o(y.value).then(d,h)}m((i=i.apply(t,e||[])).next())})}const A2=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Wd extends Error{constructor(e,n="FunctionsError",i){super(e),this.name=n,this.context=i}}class P2 extends Wd{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Vg extends Wd{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Fg extends Wd{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Wc;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Wc||(Wc={}));class R2{constructor(e,{headers:n={},customFetch:i,region:o=Wc.Any}={}){this.url=e,this.headers=n,this.region=o,this.fetch=A2(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return N2(this,arguments,void 0,function*(n,i={}){var o;let l,u;try{const{headers:d,method:h,body:m,signal:y,timeout:v}=i;let w={},{region:_}=i;_||(_=this.region);const b=new URL(`${this.url}/${n}`);_&&_!=="any"&&(w["x-region"]=_,b.searchParams.set("forceFunctionRegion",_));let S;m&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",S=m):typeof m=="string"?(w["Content-Type"]="text/plain",S=m):typeof FormData<"u"&&m instanceof FormData?S=m:(w["Content-Type"]="application/json",S=JSON.stringify(m)):m&&typeof m!="string"&&!(typeof Blob<"u"&&m instanceof Blob)&&!(m instanceof ArrayBuffer)&&!(typeof FormData<"u"&&m instanceof FormData)?S=JSON.stringify(m):S=m;let k=y;v&&(u=new AbortController,l=setTimeout(()=>u.abort(),v),y?(k=u.signal,y.addEventListener("abort",()=>u.abort())):k=u.signal);const E=yield this.fetch(b.toString(),{method:h||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),d),body:S,signal:k}).catch(V=>{throw new P2(V)}),P=E.headers.get("x-relay-error");if(P&&P==="true")throw new Vg(E);if(!E.ok)throw new Fg(E);let N=((o=E.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),U;return N==="application/json"?U=yield E.json():N==="application/octet-stream"||N==="application/pdf"?U=yield E.blob():N==="text/event-stream"?U=E:N==="multipart/form-data"?U=yield E.formData():U=yield E.text(),{data:U,error:null,response:E}}catch(d){return{data:null,error:d,response:d instanceof Fg||d instanceof Vg?d.context:void 0}}finally{l&&clearTimeout(l)}})}}var O2=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},I2=class{constructor(t){var e,n;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){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 i=this.fetch;let o=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async l=>{let u=null,d=null,h=null,m=l.status,y=l.statusText;if(l.ok){var v,w;if(n.method!=="HEAD"){var _;const E=await l.text();E===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((_=n.headers.get("Accept"))===null||_===void 0)&&_.includes("application/vnd.pgrst.plan+text"))?d=E:d=JSON.parse(E))}const S=(v=n.headers.get("Prefer"))===null||v===void 0?void 0:v.match(/count=(exact|planned|estimated)/),k=(w=l.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");S&&k&&k.length>1&&(h=parseInt(k[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,h=null,m=406,y="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{var b;const S=await l.text();try{u=JSON.parse(S),Array.isArray(u)&&l.status===404&&(d=[],u=null,m=200,y="OK")}catch{l.status===404&&S===""?(m=204,y="No Content"):u={message:S}}if(u&&n.isMaybeSingle&&(!(u==null||(b=u.details)===null||b===void 0)&&b.includes("0 rows"))&&(u=null,m=200,y="OK"),u&&n.shouldThrowOnError)throw new O2(u)}return{error:u,data:d,count:h,status:m,statusText:y}});return this.shouldThrowOnError||(o=o.catch(l=>{var u;let d="";const h=l?.cause;if(h){var m,y,v,w;const b=(m=h?.message)!==null&&m!==void 0?m:"",S=(y=h?.code)!==null&&y!==void 0?y:"";d=`${(v=l?.name)!==null&&v!==void 0?v:"FetchError"}: ${l?.message}`,d+=`
16
+ `),()=>{document.head.removeChild(y)}},[e]),p.jsx(N1,{isPresent:e,childRef:i,sizeRef:o,children:R.cloneElement(t,{ref:i})})}const P1=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:o,presenceAffectsLayout:l,mode:u})=>{const d=ld(R1),h=R.useId(),m=R.useCallback(v=>{d.set(v,!0);for(const w of d.values())if(!w)return;i&&i()},[d,i]),y=R.useMemo(()=>({id:h,initial:e,isPresent:n,custom:o,onExitComplete:m,register:v=>(d.set(v,!1),()=>d.delete(v))}),l?[Math.random(),m]:[n,m]);return R.useMemo(()=>{d.forEach((v,w)=>d.set(w,!1))},[n]),R.useEffect(()=>{!n&&!d.size&&i&&i()},[n]),u==="popLayout"&&(t=p.jsx(A1,{isPresent:n,children:t})),p.jsx(La.Provider,{value:y,children:t})};function R1(){return new Map}function yy(t=!0){const e=R.useContext(La);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:o}=e,l=R.useId();R.useEffect(()=>{t&&o(l)},[t]);const u=R.useCallback(()=>t&&i&&i(l),[l,i,t]);return!n&&i?[!1,u]:[!0]}const ia=t=>t.key||"";function cm(t){const e=[];return R.Children.forEach(t,n=>{R.isValidElement(n)&&e.push(n)}),e}const cd=typeof window<"u",vy=cd?R.useLayoutEffect:R.useEffect,cn=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:o=!0,mode:l="sync",propagate:u=!1})=>{const[d,h]=yy(u),m=R.useMemo(()=>cm(t),[t]),y=u&&!d?[]:m.map(ia),v=R.useRef(!0),w=R.useRef(m),_=ld(()=>new Map),[b,S]=R.useState(m),[k,E]=R.useState(m);vy(()=>{v.current=!1,w.current=m;for(let U=0;U<k.length;U++){const V=ia(k[U]);y.includes(V)?_.delete(V):_.get(V)!==!0&&_.set(V,!1)}},[k,y.length,y.join("-")]);const P=[];if(m!==b){let U=[...m];for(let V=0;V<k.length;V++){const z=k[V],$=ia(z);y.includes($)||(U.splice(V,0,z),P.push(z))}l==="wait"&&P.length&&(U=P),E(cm(U)),S(m);return}const{forceRender:N}=R.useContext(ad);return p.jsx(p.Fragment,{children:k.map(U=>{const V=ia(U),z=u&&!d?!1:m===k||y.includes(V),$=()=>{if(_.has(V))_.set(V,!0);else return;let B=!0;_.forEach(Y=>{Y||(B=!1)}),B&&(N?.(),E(w.current),u&&h?.(),i&&i())};return p.jsx(P1,{isPresent:z,initial:!v.current||n?void 0:!1,custom:z?void 0:e,presenceAffectsLayout:o,mode:l,onExitComplete:z?void 0:$,children:U},V)})})},Ot=t=>t;let wy=Ot;function dd(t){let e;return()=>(e===void 0&&(e=t()),e)}const ms=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i},bn=t=>t*1e3,_n=t=>t/1e3,O1={useManualTiming:!1};function I1(t){let e=new Set,n=new Set,i=!1,o=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(m){l.has(m)&&(h.schedule(m),t()),m(u)}const h={schedule:(m,y=!1,v=!1)=>{const _=v&&i?e:n;return y&&l.add(m),_.has(m)||_.add(m),m},cancel:m=>{n.delete(m),l.delete(m)},process:m=>{if(u=m,i){o=!0;return}i=!0,[e,n]=[n,e],e.forEach(d),e.clear(),i=!1,o&&(o=!1,h.process(m))}};return h}const oa=["read","resolveKeyframes","update","preRender","render","postRender"],D1=40;function xy(t,e){let n=!1,i=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=oa.reduce((E,P)=>(E[P]=I1(l),E),{}),{read:d,resolveKeyframes:h,update:m,preRender:y,render:v,postRender:w}=u,_=()=>{const E=performance.now();n=!1,o.delta=i?1e3/60:Math.max(Math.min(E-o.timestamp,D1),1),o.timestamp=E,o.isProcessing=!0,d.process(o),h.process(o),m.process(o),y.process(o),v.process(o),w.process(o),o.isProcessing=!1,n&&e&&(i=!1,t(_))},b=()=>{n=!0,i=!0,o.isProcessing||t(_)};return{schedule:oa.reduce((E,P)=>{const N=u[P];return E[P]=(U,V=!1,z=!1)=>(n||b(),N.schedule(U,V,z)),E},{}),cancel:E=>{for(let P=0;P<oa.length;P++)u[oa[P]].cancel(E)},state:o,steps:u}}const{schedule:Le,cancel:Gn,state:at,steps:Yu}=xy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ot,!0),by=R.createContext({strict:!1}),dm={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},gs={};for(const t in dm)gs[t]={isEnabled:e=>dm[t].some(n=>!!e[n])};function L1(t){for(const e in t)gs[e]={...gs[e],...t[e]}}const M1=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Sa(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||M1.has(t)}let _y=t=>!Sa(t);function U1(t){t&&(_y=e=>e.startsWith("on")?!Sa(e):t(e))}try{U1(require("@emotion/is-prop-valid").default)}catch{}function $1(t,e,n){const i={};for(const o in t)o==="values"&&typeof t.values=="object"||(_y(o)||n===!0&&Sa(o)||!e&&!Sa(o)||t.draggable&&o.startsWith("onDrag"))&&(i[o]=t[o]);return i}function V1(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...i)=>t(...i);return new Proxy(n,{get:(i,o)=>o==="create"?t:(e.has(o)||e.set(o,t(o)),e.get(o))})}const Ma=R.createContext({});function Ei(t){return typeof t=="string"||Array.isArray(t)}function Ua(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const hd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fd=["initial",...hd];function $a(t){return Ua(t.animate)||fd.some(e=>Ei(t[e]))}function Sy(t){return!!($a(t)||t.variants)}function F1(t,e){if($a(t)){const{initial:n,animate:i}=t;return{initial:n===!1||Ei(n)?n:void 0,animate:Ei(i)?i:void 0}}return t.inherit!==!1?e:{}}function B1(t){const{initial:e,animate:n}=F1(t,R.useContext(Ma));return R.useMemo(()=>({initial:e,animate:n}),[hm(e),hm(n)])}function hm(t){return Array.isArray(t)?t.join(" "):t}const z1=Symbol.for("motionComponentSymbol");function as(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function q1(t,e,n){return R.useCallback(i=>{i&&t.onMount&&t.onMount(i),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):as(n)&&(n.current=i))},[e])}const pd=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),W1="framerAppearId",ky="data-"+pd(W1),{schedule:md}=xy(queueMicrotask,!1),Ey=R.createContext({});function H1(t,e,n,i,o){var l,u;const{visualElement:d}=R.useContext(Ma),h=R.useContext(by),m=R.useContext(La),y=R.useContext(ud).reducedMotion,v=R.useRef(null);i=i||h.renderer,!v.current&&i&&(v.current=i(t,{visualState:e,parent:d,props:n,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:y}));const w=v.current,_=R.useContext(Ey);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&K1(v.current,n,o,_);const b=R.useRef(!1);R.useInsertionEffect(()=>{w&&b.current&&w.update(n,m)});const S=n[ky],k=R.useRef(!!S&&!(!((l=window.MotionHandoffIsComplete)===null||l===void 0)&&l.call(window,S))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,S)));return vy(()=>{w&&(b.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),md.render(w.render),k.current&&w.animationState&&w.animationState.animateChanges())}),R.useEffect(()=>{w&&(!k.current&&w.animationState&&w.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)===null||E===void 0||E.call(window,S)}),k.current=!1))}),w}function K1(t,e,n,i){const{layoutId:o,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:m}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ty(t.parent)),t.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||d&&as(d),visualElement:t,animationType:typeof l=="string"?l:"both",initialPromotionConfig:i,layoutScroll:h,layoutRoot:m})}function Ty(t){if(t)return t.options.allowProjection!==!1?t.projection:Ty(t.parent)}function G1({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:i,Component:o}){var l,u;t&&L1(t);function d(m,y){let v;const w={...R.useContext(ud),...m,layoutId:J1(m)},{isStatic:_}=w,b=B1(m),S=i(m,_);if(!_&&cd){Y1();const k=Q1(w);v=k.MeasureLayout,b.visualElement=H1(o,S,w,e,k.ProjectionNode)}return p.jsxs(Ma.Provider,{value:b,children:[v&&b.visualElement?p.jsx(v,{visualElement:b.visualElement,...w}):null,n(o,m,q1(S,b.visualElement,y),S,_,b.visualElement)]})}d.displayName=`motion.${typeof o=="string"?o:`create(${(u=(l=o.displayName)!==null&&l!==void 0?l:o.name)!==null&&u!==void 0?u:""})`}`;const h=R.forwardRef(d);return h[z1]=o,h}function J1({layoutId:t}){const e=R.useContext(ad).id;return e&&t!==void 0?e+"-"+t:t}function Y1(t,e){R.useContext(by).strict}function Q1(t){const{drag:e,layout:n}=gs;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const X1=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function gd(t){return typeof t!="string"||t.includes("-")?!1:!!(X1.indexOf(t)>-1||/[A-Z]/u.test(t))}function fm(t){const e=[{},{}];return t?.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function yd(t,e,n,i){if(typeof e=="function"){const[o,l]=fm(i);e=e(n!==void 0?n:t.custom,o,l)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,l]=fm(i);e=e(n!==void 0?n:t.custom,o,l)}return e}const Ec=t=>Array.isArray(t),Z1=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),eb=t=>Ec(t)?t[t.length-1]||0:t,pt=t=>!!(t&&t.getVelocity);function ma(t){const e=pt(t)?t.get():t;return Z1(e)?e.toValue():e}function tb({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},i,o,l){const u={latestValues:nb(i,o,l,t),renderState:e()};return n&&(u.onMount=d=>n({props:i,current:d,...u}),u.onUpdate=d=>n(d)),u}const jy=t=>(e,n)=>{const i=R.useContext(Ma),o=R.useContext(La),l=()=>tb(t,e,i,o);return n?l():ld(l)};function nb(t,e,n,i){const o={},l=i(t,{});for(const w in l)o[w]=ma(l[w]);let{initial:u,animate:d}=t;const h=$a(t),m=Sy(t);e&&m&&!h&&t.inherit!==!1&&(u===void 0&&(u=e.initial),d===void 0&&(d=e.animate));let y=n?n.initial===!1:!1;y=y||u===!1;const v=y?d:u;if(v&&typeof v!="boolean"&&!Ua(v)){const w=Array.isArray(v)?v:[v];for(let _=0;_<w.length;_++){const b=yd(t,w[_]);if(b){const{transitionEnd:S,transition:k,...E}=b;for(const P in E){let N=E[P];if(Array.isArray(N)){const U=y?N.length-1:0;N=N[U]}N!==null&&(o[P]=N)}for(const P in S)o[P]=S[P]}}}return o}const ws=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Tr=new Set(ws),Cy=t=>e=>typeof e=="string"&&e.startsWith(t),Ny=Cy("--"),rb=Cy("var(--"),vd=t=>rb(t)?sb.test(t.split("/*")[0].trim()):!1,sb=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ay=(t,e)=>e&&typeof t=="number"?e.transform(t):t,Sn=(t,e,n)=>n>e?e:n<t?t:n,xs={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ti={...xs,transform:t=>Sn(0,1,t)},aa={...xs,default:1},Ui=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Wn=Ui("deg"),ln=Ui("%"),de=Ui("px"),ib=Ui("vh"),ob=Ui("vw"),pm={...ln,parse:t=>ln.parse(t)/100,transform:t=>ln.transform(t*100)},ab={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de},lb={rotate:Wn,rotateX:Wn,rotateY:Wn,rotateZ:Wn,scale:aa,scaleX:aa,scaleY:aa,scaleZ:aa,skew:Wn,skewX:Wn,skewY:Wn,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:Ti,originX:pm,originY:pm,originZ:de},mm={...xs,transform:Math.round},wd={...ab,...lb,zIndex:mm,size:de,fillOpacity:Ti,strokeOpacity:Ti,numOctaves:mm},ub={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cb=ws.length;function db(t,e,n){let i="",o=!0;for(let l=0;l<cb;l++){const u=ws[l],d=t[u];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(u.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const m=Ay(d,wd[u]);if(!h){o=!1;const y=ub[u]||u;i+=`${y}(${m}) `}n&&(e[u]=m)}}return i=i.trim(),n?i=n(e,o?"":i):o&&(i="none"),i}function xd(t,e,n){const{style:i,vars:o,transformOrigin:l}=t;let u=!1,d=!1;for(const h in e){const m=e[h];if(Tr.has(h)){u=!0;continue}else if(Ny(h)){o[h]=m;continue}else{const y=Ay(m,wd[h]);h.startsWith("origin")?(d=!0,l[h]=y):i[h]=y}}if(e.transform||(u||n?i.transform=db(e,t.transform,n):i.transform&&(i.transform="none")),d){const{originX:h="50%",originY:m="50%",originZ:y=0}=l;i.transformOrigin=`${h} ${m} ${y}`}}const hb={offset:"stroke-dashoffset",array:"stroke-dasharray"},fb={offset:"strokeDashoffset",array:"strokeDasharray"};function pb(t,e,n=1,i=0,o=!0){t.pathLength=1;const l=o?hb:fb;t[l.offset]=de.transform(-i);const u=de.transform(e),d=de.transform(n);t[l.array]=`${u} ${d}`}function gm(t,e,n){return typeof t=="string"?t:de.transform(e+n*t)}function mb(t,e,n){const i=gm(e,t.x,t.width),o=gm(n,t.y,t.height);return`${i} ${o}`}function bd(t,{attrX:e,attrY:n,attrScale:i,originX:o,originY:l,pathLength:u,pathSpacing:d=1,pathOffset:h=0,...m},y,v){if(xd(t,m,v),y){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:w,style:_,dimensions:b}=t;w.transform&&(b&&(_.transform=w.transform),delete w.transform),b&&(o!==void 0||l!==void 0||_.transform)&&(_.transformOrigin=mb(b,o!==void 0?o:.5,l!==void 0?l:.5)),e!==void 0&&(w.x=e),n!==void 0&&(w.y=n),i!==void 0&&(w.scale=i),u!==void 0&&pb(w,u,d,h,!1)}const _d=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Py=()=>({..._d(),attrs:{}}),Sd=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Ry(t,{style:e,vars:n},i,o){Object.assign(t.style,e,o&&o.getProjectionStyles(i));for(const l in n)t.style.setProperty(l,n[l])}const Oy=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Iy(t,e,n,i){Ry(t,e,void 0,i);for(const o in e.attrs)t.setAttribute(Oy.has(o)?o:pd(o),e.attrs[o])}const ka={};function gb(t){Object.assign(ka,t)}function Dy(t,{layout:e,layoutId:n}){return Tr.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!ka[t]||t==="opacity")}function kd(t,e,n){var i;const{style:o}=t,l={};for(const u in o)(pt(o[u])||e.style&&pt(e.style[u])||Dy(u,t)||((i=n?.getValue(u))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(l[u]=o[u]);return l}function Ly(t,e,n){const i=kd(t,e,n);for(const o in t)if(pt(t[o])||pt(e[o])){const l=ws.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;i[l]=t[o]}return i}function yb(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const ym=["x","y","width","height","cx","cy","r"],vb={useVisualState:jy({scrapeMotionValuesFromProps:Ly,createRenderState:Py,onUpdate:({props:t,prevProps:e,current:n,renderState:i,latestValues:o})=>{if(!n)return;let l=!!t.drag;if(!l){for(const d in o)if(Tr.has(d)){l=!0;break}}if(!l)return;let u=!e;if(e)for(let d=0;d<ym.length;d++){const h=ym[d];t[h]!==e[h]&&(u=!0)}u&&Le.read(()=>{yb(n,i),Le.render(()=>{bd(i,o,Sd(n.tagName),t.transformTemplate),Iy(n,i)})})}})},wb={useVisualState:jy({scrapeMotionValuesFromProps:kd,createRenderState:_d})};function My(t,e,n){for(const i in e)!pt(e[i])&&!Dy(i,n)&&(t[i]=e[i])}function xb({transformTemplate:t},e){return R.useMemo(()=>{const n=_d();return xd(n,e,t),Object.assign({},n.vars,n.style)},[e])}function bb(t,e){const n=t.style||{},i={};return My(i,n,t),Object.assign(i,xb(t,e)),i}function _b(t,e){const n={},i=bb(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}function Sb(t,e,n,i){const o=R.useMemo(()=>{const l=Py();return bd(l,e,Sd(i),t.transformTemplate),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};My(l,t.style,t),o.style={...l,...o.style}}return o}function kb(t=!1){return(n,i,o,{latestValues:l},u)=>{const h=(gd(n)?Sb:_b)(i,l,u,n),m=$1(i,typeof n=="string",t),y=n!==R.Fragment?{...m,...h,ref:o}:{},{children:v}=i,w=R.useMemo(()=>pt(v)?v.get():v,[v]);return R.createElement(n,{...y,children:w})}}function Eb(t,e){return function(i,{forwardMotionProps:o}={forwardMotionProps:!1}){const u={...gd(i)?vb:wb,preloadedFeatures:t,useRender:kb(o),createVisualElement:e,Component:i};return G1(u)}}function Uy(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}function Va(t,e,n){const i=t.getProps();return yd(i,e,n!==void 0?n:i.custom,t)}const Tb=dd(()=>window.ScrollTimeline!==void 0);class jb{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let i=0;i<this.animations.length;i++)this.animations[i][e]=n}attachTimeline(e,n){const i=this.animations.map(o=>{if(Tb()&&o.attachTimeline)return o.attachTimeline(e);if(typeof n=="function")return n(o)});return()=>{i.forEach((o,l)=>{o&&o(),this.animations[l].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Cb extends jb{then(e,n){return Promise.all(this.animations).then(e).catch(n)}}function Ed(t,e){return t?t[e]||t.default||t:void 0}const Tc=2e4;function $y(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<Tc;)e+=n,i=t.next(e);return e>=Tc?1/0:e}function Td(t){return typeof t=="function"}function vm(t,e){t.timeline=e,t.onfinish=null}const jd=t=>Array.isArray(t)&&typeof t[0]=="number",Nb={linearEasing:void 0};function Ab(t,e){const n=dd(t);return()=>{var i;return(i=Nb[e])!==null&&i!==void 0?i:n()}}const Ea=Ab(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Vy=(t,e,n=10)=>{let i="";const o=Math.max(Math.round(e/n),2);for(let l=0;l<o;l++)i+=t(ms(0,o-1,l))+", ";return`linear(${i.substring(0,i.length-2)})`};function Fy(t){return!!(typeof t=="function"&&Ea()||!t||typeof t=="string"&&(t in jc||Ea())||jd(t)||Array.isArray(t)&&t.every(Fy))}const hi=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,jc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:hi([0,.65,.55,1]),circOut:hi([.55,0,1,.45]),backIn:hi([.31,.01,.66,-.59]),backOut:hi([.33,1.53,.69,.99])};function By(t,e){if(t)return typeof t=="function"&&Ea()?Vy(t,e):jd(t)?hi(t):Array.isArray(t)?t.map(n=>By(n,e)||jc.easeOut):jc[t]}const Qt={x:!1,y:!1};function zy(){return Qt.x||Qt.y}function Pb(t,e,n){var i;if(t instanceof Element)return[t];if(typeof t=="string"){let o=document;const l=(i=void 0)!==null&&i!==void 0?i:o.querySelectorAll(t);return l?Array.from(l):[]}return Array.from(t)}function qy(t,e){const n=Pb(t),i=new AbortController,o={passive:!0,...e,signal:i.signal};return[n,o,()=>i.abort()]}function wm(t){return e=>{e.pointerType==="touch"||zy()||t(e)}}function Rb(t,e,n={}){const[i,o,l]=qy(t,n),u=wm(d=>{const{target:h}=d,m=e(d);if(typeof m!="function"||!h)return;const y=wm(v=>{m(v),h.removeEventListener("pointerleave",y)});h.addEventListener("pointerleave",y,o)});return i.forEach(d=>{d.addEventListener("pointerenter",u,o)}),l}const Wy=(t,e)=>e?t===e?!0:Wy(t,e.parentElement):!1,Cd=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Ob=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ib(t){return Ob.has(t.tagName)||t.tabIndex!==-1}const fi=new WeakSet;function xm(t){return e=>{e.key==="Enter"&&t(e)}}function Qu(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Db=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=xm(()=>{if(fi.has(n))return;Qu(n,"down");const o=xm(()=>{Qu(n,"up")}),l=()=>Qu(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",l,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function bm(t){return Cd(t)&&!zy()}function Lb(t,e,n={}){const[i,o,l]=qy(t,n),u=d=>{const h=d.currentTarget;if(!bm(d)||fi.has(h))return;fi.add(h);const m=e(d),y=(_,b)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",w),!(!bm(_)||!fi.has(h))&&(fi.delete(h),typeof m=="function"&&m(_,{success:b}))},v=_=>{y(_,n.useGlobalTarget||Wy(h,_.target))},w=_=>{y(_,!1)};window.addEventListener("pointerup",v,o),window.addEventListener("pointercancel",w,o)};return i.forEach(d=>{!Ib(d)&&d.getAttribute("tabindex")===null&&(d.tabIndex=0),(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,o),d.addEventListener("focus",m=>Db(m,o),o)}),l}function Mb(t){return t==="x"||t==="y"?Qt[t]?null:(Qt[t]=!0,()=>{Qt[t]=!1}):Qt.x||Qt.y?null:(Qt.x=Qt.y=!0,()=>{Qt.x=Qt.y=!1})}const Hy=new Set(["width","height","top","left","right","bottom",...ws]);let ga;function Ub(){ga=void 0}const un={now:()=>(ga===void 0&&un.set(at.isProcessing||O1.useManualTiming?at.timestamp:performance.now()),ga),set:t=>{ga=t,queueMicrotask(Ub)}};function Nd(t,e){t.indexOf(e)===-1&&t.push(e)}function Ad(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Pd{constructor(){this.subscriptions=[]}add(e){return Nd(this.subscriptions,e),()=>Ad(this.subscriptions,e)}notify(e,n,i){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,i);else for(let l=0;l<o;l++){const u=this.subscriptions[l];u&&u(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Ky(t,e){return e?t*(1e3/e):0}const _m=30,$b=t=>!isNaN(parseFloat(t));class Vb{constructor(e,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,o=!0)=>{const l=un.now();this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=un.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=$b(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Pd);const i=this.events[e].add(n);return e==="change"?()=>{i(),Le.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>_m)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,_m);return Ky(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ji(t,e){return new Vb(t,e)}function Fb(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ji(n))}function Bb(t,e){const n=Va(t,e);let{transitionEnd:i={},transition:o={},...l}=n||{};l={...l,...i};for(const u in l){const d=eb(l[u]);Fb(t,u,d)}}function zb(t){return!!(pt(t)&&t.add)}function Cc(t,e){const n=t.getValue("willChange");if(zb(n))return n.add(e)}function Gy(t){return t.props[ky]}const Jy=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,qb=1e-7,Wb=12;function Hb(t,e,n,i,o){let l,u,d=0;do u=e+(n-e)/2,l=Jy(u,i,o)-t,l>0?n=u:e=u;while(Math.abs(l)>qb&&++d<Wb);return u}function $i(t,e,n,i){if(t===e&&n===i)return Ot;const o=l=>Hb(l,0,1,t,n);return l=>l===0||l===1?l:Jy(o(l),e,i)}const Yy=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Qy=t=>e=>1-t(1-e),Xy=$i(.33,1.53,.69,.99),Rd=Qy(Xy),Zy=Yy(Rd),e0=t=>(t*=2)<1?.5*Rd(t):.5*(2-Math.pow(2,-10*(t-1))),Od=t=>1-Math.sin(Math.acos(t)),t0=Qy(Od),n0=Yy(Od),r0=t=>/^0[^.\s]+$/u.test(t);function Kb(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||r0(t):!0}const gi=t=>Math.round(t*1e5)/1e5,Id=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Gb(t){return t==null}const Jb=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Dd=(t,e)=>n=>!!(typeof n=="string"&&Jb.test(n)&&n.startsWith(t)||e&&!Gb(n)&&Object.prototype.hasOwnProperty.call(n,e)),s0=(t,e,n)=>i=>{if(typeof i!="string")return i;const[o,l,u,d]=i.match(Id);return{[t]:parseFloat(o),[e]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},Yb=t=>Sn(0,255,t),Xu={...xs,transform:t=>Math.round(Yb(t))},vr={test:Dd("rgb","red"),parse:s0("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Xu.transform(t)+", "+Xu.transform(e)+", "+Xu.transform(n)+", "+gi(Ti.transform(i))+")"};function Qb(t){let e="",n="",i="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,i+=i,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:o?parseInt(o,16)/255:1}}const Nc={test:Dd("#"),parse:Qb,transform:vr.transform},ls={test:Dd("hsl","hue"),parse:s0("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+ln.transform(gi(e))+", "+ln.transform(gi(n))+", "+gi(Ti.transform(i))+")"},ht={test:t=>vr.test(t)||Nc.test(t)||ls.test(t),parse:t=>vr.test(t)?vr.parse(t):ls.test(t)?ls.parse(t):Nc.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?vr.transform(t):ls.transform(t)},Xb=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Zb(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Id))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Xb))===null||n===void 0?void 0:n.length)||0)>0}const i0="number",o0="color",e_="var",t_="var(",Sm="${}",n_=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ci(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},o=[];let l=0;const d=e.replace(n_,h=>(ht.test(h)?(i.color.push(l),o.push(o0),n.push(ht.parse(h))):h.startsWith(t_)?(i.var.push(l),o.push(e_),n.push(h)):(i.number.push(l),o.push(i0),n.push(parseFloat(h))),++l,Sm)).split(Sm);return{values:n,split:d,indexes:i,types:o}}function a0(t){return Ci(t).values}function l0(t){const{split:e,types:n}=Ci(t),i=e.length;return o=>{let l="";for(let u=0;u<i;u++)if(l+=e[u],o[u]!==void 0){const d=n[u];d===i0?l+=gi(o[u]):d===o0?l+=ht.transform(o[u]):l+=o[u]}return l}}const r_=t=>typeof t=="number"?0:t;function s_(t){const e=a0(t);return l0(t)(e.map(r_))}const Jn={test:Zb,parse:a0,createTransformer:l0,getAnimatableNone:s_},i_=new Set(["brightness","contrast","saturate","opacity"]);function o_(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Id)||[];if(!i)return t;const o=n.replace(i,"");let l=i_.has(e)?1:0;return i!==n&&(l*=100),e+"("+l+o+")"}const a_=/\b([a-z-]*)\(.*?\)/gu,Ac={...Jn,getAnimatableNone:t=>{const e=t.match(a_);return e?e.map(o_).join(" "):t}},l_={...wd,color:ht,backgroundColor:ht,outlineColor:ht,fill:ht,stroke:ht,borderColor:ht,borderTopColor:ht,borderRightColor:ht,borderBottomColor:ht,borderLeftColor:ht,filter:Ac,WebkitFilter:Ac},Ld=t=>l_[t];function u0(t,e){let n=Ld(t);return n!==Ac&&(n=Jn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const u_=new Set(["auto","none","0"]);function c_(t,e,n){let i=0,o;for(;i<t.length&&!o;){const l=t[i];typeof l=="string"&&!u_.has(l)&&Ci(l).values.length&&(o=t[i]),i++}if(o&&n)for(const l of e)t[l]=u0(n,o)}const km=t=>t===xs||t===de,Em=(t,e)=>parseFloat(t.split(", ")[e]),Tm=(t,e)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const o=i.match(/^matrix3d\((.+)\)$/u);if(o)return Em(o[1],e);{const l=i.match(/^matrix\((.+)\)$/u);return l?Em(l[1],t):0}},d_=new Set(["x","y","z"]),h_=ws.filter(t=>!d_.has(t));function f_(t){const e=[];return h_.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const ys={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:Tm(4,13),y:Tm(5,14)};ys.translateX=ys.x;ys.translateY=ys.y;const br=new Set;let Pc=!1,Rc=!1;function c0(){if(Rc){const t=Array.from(br).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const o=f_(i);o.length&&(n.set(i,o),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const o=n.get(i);o&&o.forEach(([l,u])=>{var d;(d=i.getValue(l))===null||d===void 0||d.set(u)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Rc=!1,Pc=!1,br.forEach(t=>t.complete()),br.clear()}function d0(){br.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Rc=!0)})}function p_(){d0(),c0()}class Md{constructor(e,n,i,o,l,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=o,this.element=l,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(br.add(this),Pc||(Pc=!0,Le.read(d0),Le.resolveKeyframes(c0))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:o}=this;for(let l=0;l<e.length;l++)if(e[l]===null)if(l===0){const u=o?.get(),d=e[e.length-1];if(u!==void 0)e[0]=u;else if(i&&n){const h=i.readValue(n,d);h!=null&&(e[0]=h)}e[0]===void 0&&(e[0]=d),o&&u===void 0&&o.set(e[0])}else e[l]=e[l-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),br.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,br.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const h0=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),m_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function g_(t){const e=m_.exec(t);if(!e)return[,];const[,n,i,o]=e;return[`--${n??i}`,o]}function f0(t,e,n=1){const[i,o]=g_(t);if(!i)return;const l=window.getComputedStyle(e).getPropertyValue(i);if(l){const u=l.trim();return h0(u)?parseFloat(u):u}return vd(o)?f0(o,e,n+1):o}const p0=t=>e=>e.test(t),y_={test:t=>t==="auto",parse:t=>t},m0=[xs,de,ln,Wn,ob,ib,y_],jm=t=>m0.find(p0(t));class g0 extends Md{constructor(e,n,i,o,l){super(e,n,i,o,l,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),vd(m))){const y=f0(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!Hy.has(i)||e.length!==2)return;const[o,l]=e,u=jm(o),d=jm(l);if(u!==d)if(km(u)&&km(d))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let o=0;o<e.length;o++)Kb(e[o])&&i.push(o);i.length&&c_(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ys[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(i,o).jump(o,!1)}measureEndState(){var e;const{element:n,name:i,unresolvedKeyframes:o}=this;if(!n||!n.current)return;const l=n.getValue(i);l&&l.jump(this.measuredOrigin,!1);const u=o.length-1,d=o[u];o[u]=ys[i](n.measureViewportBox(),window.getComputedStyle(n.current)),d!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=d),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([h,m])=>{n.getValue(h).set(m)}),this.resolveNoneKeyframes()}}const Cm=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Jn.test(t)||t==="0")&&!t.startsWith("url("));function v_(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function w_(t,e,n,i){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const l=t[t.length-1],u=Cm(o,e),d=Cm(l,e);return!u||!d?!1:v_(t)||(n==="spring"||Td(n))&&i}const x_=t=>t!==null;function Fa(t,{repeat:e,repeatType:n="loop"},i){const o=t.filter(x_),l=e&&n!=="loop"&&e%2===1?0:o.length-1;return!l||i===void 0?o[l]:i}const b_=40;class y0{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",...d}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=un.now(),this.options={autoplay:e,delay:n,type:i,repeat:o,repeatDelay:l,repeatType:u,...d},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>b_?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&p_(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=un.now(),this.hasAttemptedResolve=!0;const{name:i,type:o,velocity:l,delay:u,onComplete:d,onUpdate:h,isGenerator:m}=this.options;if(!m&&!w_(e,i,o,l))if(u)this.options.duration=0;else{h&&h(Fa(e,this.options,n)),d&&d(),this.resolveFinishedPromise();return}const y=this.initPlayback(e,n);y!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...y},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Be=(t,e,n)=>t+(e-t)*n;function Zu(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function __({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let o=0,l=0,u=0;if(!e)o=l=u=n;else{const d=n<.5?n*(1+e):n+e-n*e,h=2*n-d;o=Zu(h,d,t+1/3),l=Zu(h,d,t),u=Zu(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:i}}function Ta(t,e){return n=>n>0?e:t}const ec=(t,e,n)=>{const i=t*t,o=n*(e*e-i)+i;return o<0?0:Math.sqrt(o)},S_=[Nc,vr,ls],k_=t=>S_.find(e=>e.test(t));function Nm(t){const e=k_(t);if(!e)return!1;let n=e.parse(t);return e===ls&&(n=__(n)),n}const Am=(t,e)=>{const n=Nm(t),i=Nm(e);if(!n||!i)return Ta(t,e);const o={...n};return l=>(o.red=ec(n.red,i.red,l),o.green=ec(n.green,i.green,l),o.blue=ec(n.blue,i.blue,l),o.alpha=Be(n.alpha,i.alpha,l),vr.transform(o))},E_=(t,e)=>n=>e(t(n)),Vi=(...t)=>t.reduce(E_),Oc=new Set(["none","hidden"]);function T_(t,e){return Oc.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function j_(t,e){return n=>Be(t,e,n)}function Ud(t){return typeof t=="number"?j_:typeof t=="string"?vd(t)?Ta:ht.test(t)?Am:A_:Array.isArray(t)?v0:typeof t=="object"?ht.test(t)?Am:C_:Ta}function v0(t,e){const n=[...t],i=n.length,o=t.map((l,u)=>Ud(l)(l,e[u]));return l=>{for(let u=0;u<i;u++)n[u]=o[u](l);return n}}function C_(t,e){const n={...t,...e},i={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(i[o]=Ud(t[o])(t[o],e[o]));return o=>{for(const l in i)n[l]=i[l](o);return n}}function N_(t,e){var n;const i=[],o={color:0,var:0,number:0};for(let l=0;l<e.values.length;l++){const u=e.types[l],d=t.indexes[u][o[u]],h=(n=t.values[d])!==null&&n!==void 0?n:0;i[l]=h,o[u]++}return i}const A_=(t,e)=>{const n=Jn.createTransformer(e),i=Ci(t),o=Ci(e);return i.indexes.var.length===o.indexes.var.length&&i.indexes.color.length===o.indexes.color.length&&i.indexes.number.length>=o.indexes.number.length?Oc.has(t)&&!o.values.length||Oc.has(e)&&!i.values.length?T_(t,e):Vi(v0(N_(i,o),o.values),n):Ta(t,e)};function w0(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Be(t,e,n):Ud(t)(t,e)}const P_=5;function x0(t,e,n){const i=Math.max(e-P_,0);return Ky(n-t(i),e-i)}const We={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},tc=.001;function R_({duration:t=We.duration,bounce:e=We.bounce,velocity:n=We.velocity,mass:i=We.mass}){let o,l,u=1-e;u=Sn(We.minDamping,We.maxDamping,u),t=Sn(We.minDuration,We.maxDuration,_n(t)),u<1?(o=m=>{const y=m*u,v=y*t,w=y-n,_=Ic(m,u),b=Math.exp(-v);return tc-w/_*b},l=m=>{const v=m*u*t,w=v*n+n,_=Math.pow(u,2)*Math.pow(m,2)*t,b=Math.exp(-v),S=Ic(Math.pow(m,2),u);return(-o(m)+tc>0?-1:1)*((w-_)*b)/S}):(o=m=>{const y=Math.exp(-m*t),v=(m-n)*t+1;return-tc+y*v},l=m=>{const y=Math.exp(-m*t),v=(n-m)*(t*t);return y*v});const d=5/t,h=I_(o,l,d);if(t=bn(t),isNaN(h))return{stiffness:We.stiffness,damping:We.damping,duration:t};{const m=Math.pow(h,2)*i;return{stiffness:m,damping:u*2*Math.sqrt(i*m),duration:t}}}const O_=12;function I_(t,e,n){let i=n;for(let o=1;o<O_;o++)i=i-t(i)/e(i);return i}function Ic(t,e){return t*Math.sqrt(1-e*e)}const D_=["duration","bounce"],L_=["stiffness","damping","mass"];function Pm(t,e){return e.some(n=>t[n]!==void 0)}function M_(t){let e={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...t};if(!Pm(t,L_)&&Pm(t,D_))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),o=i*i,l=2*Sn(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:We.mass,stiffness:o,damping:l}}else{const n=R_(t);e={...e,...n,mass:We.mass},e.isResolvedFromDuration=!0}return e}function b0(t=We.visualDuration,e=We.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:o}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:l},{stiffness:h,damping:m,mass:y,duration:v,velocity:w,isResolvedFromDuration:_}=M_({...n,velocity:-_n(n.velocity||0)}),b=w||0,S=m/(2*Math.sqrt(h*y)),k=u-l,E=_n(Math.sqrt(h/y)),P=Math.abs(k)<5;i||(i=P?We.restSpeed.granular:We.restSpeed.default),o||(o=P?We.restDelta.granular:We.restDelta.default);let N;if(S<1){const V=Ic(E,S);N=z=>{const $=Math.exp(-S*E*z);return u-$*((b+S*E*k)/V*Math.sin(V*z)+k*Math.cos(V*z))}}else if(S===1)N=V=>u-Math.exp(-E*V)*(k+(b+E*k)*V);else{const V=E*Math.sqrt(S*S-1);N=z=>{const $=Math.exp(-S*E*z),B=Math.min(V*z,300);return u-$*((b+S*E*k)*Math.sinh(B)+V*k*Math.cosh(B))/V}}const U={calculatedDuration:_&&v||null,next:V=>{const z=N(V);if(_)d.done=V>=v;else{let $=0;S<1&&($=V===0?bn(b):x0(N,V,z));const B=Math.abs($)<=i,Y=Math.abs(u-z)<=o;d.done=B&&Y}return d.value=d.done?u:z,d},toString:()=>{const V=Math.min($y(U),Tc),z=Vy($=>U.next(V*$).value,V,30);return V+"ms "+z}};return U}function Rm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:h,restDelta:m=.5,restSpeed:y}){const v=t[0],w={done:!1,value:v},_=B=>d!==void 0&&B<d||h!==void 0&&B>h,b=B=>d===void 0?h:h===void 0||Math.abs(d-B)<Math.abs(h-B)?d:h;let S=n*e;const k=v+S,E=u===void 0?k:u(k);E!==k&&(S=E-v);const P=B=>-S*Math.exp(-B/i),N=B=>E+P(B),U=B=>{const Y=P(B),oe=N(B);w.done=Math.abs(Y)<=m,w.value=w.done?E:oe};let V,z;const $=B=>{_(w.value)&&(V=B,z=b0({keyframes:[w.value,b(w.value)],velocity:x0(N,B,w.value),damping:o,stiffness:l,restDelta:m,restSpeed:y}))};return $(0),{calculatedDuration:null,next:B=>{let Y=!1;return!z&&V===void 0&&(Y=!0,U(B),$(B)),V!==void 0&&B>=V?z.next(B-V):(!Y&&U(B),w)}}}const U_=$i(.42,0,1,1),$_=$i(0,0,.58,1),_0=$i(.42,0,.58,1),V_=t=>Array.isArray(t)&&typeof t[0]!="number",F_={linear:Ot,easeIn:U_,easeInOut:_0,easeOut:$_,circIn:Od,circInOut:n0,circOut:t0,backIn:Rd,backInOut:Zy,backOut:Xy,anticipate:e0},Om=t=>{if(jd(t)){wy(t.length===4);const[e,n,i,o]=t;return $i(e,n,i,o)}else if(typeof t=="string")return F_[t];return t};function B_(t,e,n){const i=[],o=n||w0,l=t.length-1;for(let u=0;u<l;u++){let d=o(t[u],t[u+1]);if(e){const h=Array.isArray(e)?e[u]||Ot:e;d=Vi(h,d)}i.push(d)}return i}function z_(t,e,{clamp:n=!0,ease:i,mixer:o}={}){const l=t.length;if(wy(l===e.length),l===1)return()=>e[0];if(l===2&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=B_(e,i,o),h=d.length,m=y=>{if(u&&y<t[0])return e[0];let v=0;if(h>1)for(;v<t.length-2&&!(y<t[v+1]);v++);const w=ms(t[v],t[v+1],y);return d[v](w)};return n?y=>m(Sn(t[0],t[l-1],y)):m}function q_(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const o=ms(0,e,i);t.push(Be(n,1,o))}}function W_(t){const e=[0];return q_(e,t.length-1),e}function H_(t,e){return t.map(n=>n*e)}function K_(t,e){return t.map(()=>e||_0).splice(0,t.length-1)}function ja({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const o=V_(i)?i.map(Om):Om(i),l={done:!1,value:e[0]},u=H_(n&&n.length===e.length?n:W_(e),t),d=z_(u,e,{ease:Array.isArray(o)?o:K_(e,o)});return{calculatedDuration:t,next:h=>(l.value=d(h),l.done=h>=t,l)}}const G_=t=>{const e=({timestamp:n})=>t(n);return{start:()=>Le.update(e,!0),stop:()=>Gn(e),now:()=>at.isProcessing?at.timestamp:un.now()}},J_={decay:Rm,inertia:Rm,tween:ja,keyframes:ja,spring:b0},Y_=t=>t/100;class $d extends y0{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:n,motionValue:i,element:o,keyframes:l}=this.options,u=o?.KeyframeResolver||Md,d=(h,m)=>this.onKeyframesResolved(h,m);this.resolver=new u(l,d,n,i,o),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=this.options,d=Td(n)?n:J_[n]||ja;let h,m;d!==ja&&typeof e[0]!="number"&&(h=Vi(Y_,w0(e[0],e[1])),e=[0,100]);const y=d({...this.options,keyframes:e});l==="mirror"&&(m=d({...this.options,keyframes:[...e].reverse(),velocity:-u})),y.calculatedDuration===null&&(y.calculatedDuration=$y(y));const{calculatedDuration:v}=y,w=v+o,_=w*(i+1)-o;return{generator:y,mirroredGenerator:m,mapPercentToKeyframes:h,calculatedDuration:v,resolvedDuration:w,totalDuration:_}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:i}=this;if(!i){const{keyframes:B}=this.options;return{done:!0,value:B[B.length-1]}}const{finalKeyframe:o,generator:l,mirroredGenerator:u,mapPercentToKeyframes:d,keyframes:h,calculatedDuration:m,totalDuration:y,resolvedDuration:v}=i;if(this.startTime===null)return l.next(0);const{delay:w,repeat:_,repeatType:b,repeatDelay:S,onUpdate:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-y/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const E=this.currentTime-w*(this.speed>=0?1:-1),P=this.speed>=0?E<0:E>y;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=y);let N=this.currentTime,U=l;if(_){const B=Math.min(this.currentTime,y)/v;let Y=Math.floor(B),oe=B%1;!oe&&B>=1&&(oe=1),oe===1&&Y--,Y=Math.min(Y,_+1),Y%2&&(b==="reverse"?(oe=1-oe,S&&(oe-=S/v)):b==="mirror"&&(U=u)),N=Sn(0,1,oe)*v}const V=P?{done:!1,value:h[0]}:U.next(N);d&&(V.value=d(V.value));let{done:z}=V;!P&&m!==null&&(z=this.speed>=0?this.currentTime>=y:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return $&&o!==void 0&&(V.value=Fa(h,this.options,o)),k&&k(V.value),$&&this.finish(),V}get duration(){const{resolved:e}=this;return e?_n(e.calculatedDuration):0}get time(){return _n(this.currentTime)}set time(e){e=bn(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=_n(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=G_,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=e(l=>this.tick(l))),n&&n();const o=this.driver.now();this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=o):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const Q_=new Set(["opacity","clipPath","filter","transform"]);function X_(t,e,n,{delay:i=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:d="easeInOut",times:h}={}){const m={[e]:n};h&&(m.offset=h);const y=By(d,o);return Array.isArray(y)&&(m.easing=y),t.animate(m,{delay:i,duration:o,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"})}const Z_=dd(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Ca=10,eS=2e4;function tS(t){return Td(t.type)||t.type==="spring"||!Fy(t.ease)}function nS(t,e){const n=new $d({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:t[0]};const o=[];let l=0;for(;!i.done&&l<eS;)i=n.sample(l),o.push(i.value),l+=Ca;return{times:void 0,keyframes:o,duration:l-Ca,ease:"linear"}}const S0={anticipate:e0,backInOut:Zy,circInOut:n0};function rS(t){return t in S0}class Im extends y0{constructor(e){super(e);const{name:n,motionValue:i,element:o,keyframes:l}=this.options;this.resolver=new g0(l,(u,d)=>this.onKeyframesResolved(u,d),n,i,o),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:i=300,times:o,ease:l,type:u,motionValue:d,name:h,startTime:m}=this.options;if(!d.owner||!d.owner.current)return!1;if(typeof l=="string"&&Ea()&&rS(l)&&(l=S0[l]),tS(this.options)){const{onComplete:v,onUpdate:w,motionValue:_,element:b,...S}=this.options,k=nS(e,S);e=k.keyframes,e.length===1&&(e[1]=e[0]),i=k.duration,o=k.times,l=k.ease,u="keyframes"}const y=X_(d.owner.current,h,e,{...this.options,duration:i,times:o,ease:l});return y.startTime=m??this.calcStartTime(),this.pendingTimeline?(vm(y,this.pendingTimeline),this.pendingTimeline=void 0):y.onfinish=()=>{const{onComplete:v}=this.options;d.set(Fa(e,this.options,n)),v&&v(),this.cancel(),this.resolveFinishedPromise()},{animation:y,duration:i,times:o,type:u,ease:l,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return _n(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return _n(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=bn(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Ot;const{animation:i}=n;vm(i,e)}return Ot}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:i,duration:o,type:l,ease:u,times:d}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:m,onUpdate:y,onComplete:v,element:w,..._}=this.options,b=new $d({..._,keyframes:i,duration:o,type:l,ease:u,times:d,isGenerator:!0}),S=bn(this.time);m.setWithVelocity(b.sample(S-Ca).value,b.sample(S).value,Ca)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:i,repeatDelay:o,repeatType:l,damping:u,type:d}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=n.owner.getProps();return Z_()&&i&&Q_.has(i)&&!h&&!m&&!o&&l!=="mirror"&&u!==0&&d!=="inertia"}}const sS={type:"spring",stiffness:500,damping:25,restSpeed:10},iS=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),oS={type:"keyframes",duration:.8},aS={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},lS=(t,{keyframes:e})=>e.length>2?oS:Tr.has(t)?t.startsWith("scale")?iS(e[1]):sS:aS;function uS({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:o,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const Vd=(t,e,n,i={},o,l)=>u=>{const d=Ed(i,t)||{},h=d.delay||i.delay||0;let{elapsed:m=0}=i;m=m-bn(h);let y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-m,onUpdate:w=>{e.set(w),d.onUpdate&&d.onUpdate(w)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:t,motionValue:e,element:l?void 0:o};uS(d)||(y={...y,...lS(t,y)}),y.duration&&(y.duration=bn(y.duration)),y.repeatDelay&&(y.repeatDelay=bn(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let v=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(y.duration=0,y.delay===0&&(v=!0)),v&&!l&&e.get()!==void 0){const w=Fa(y.keyframes,d);if(w!==void 0)return Le.update(()=>{y.onUpdate(w),y.onComplete()}),new Cb([])}return!l&&Im.supports(y)?new Im(y):new $d(y)};function cS({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function k0(t,e,{delay:n=0,transitionOverride:i,type:o}={}){var l;let{transition:u=t.getDefaultTransition(),transitionEnd:d,...h}=e;i&&(u=i);const m=[],y=o&&t.animationState&&t.animationState.getState()[o];for(const v in h){const w=t.getValue(v,(l=t.latestValues[v])!==null&&l!==void 0?l:null),_=h[v];if(_===void 0||y&&cS(y,v))continue;const b={delay:n,...Ed(u||{},v)};let S=!1;if(window.MotionHandoffAnimation){const E=Gy(t);if(E){const P=window.MotionHandoffAnimation(E,v,Le);P!==null&&(b.startTime=P,S=!0)}}Cc(t,v),w.start(Vd(v,w,_,t.shouldReduceMotion&&Hy.has(v)?{type:!1}:b,t,S));const k=w.animation;k&&m.push(k)}return d&&Promise.all(m).then(()=>{Le.update(()=>{d&&Bb(t,d)})}),m}function Dc(t,e,n={}){var i;const o=Va(t,e,n.type==="exit"?(i=t.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:l=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(l=n.transitionOverride);const u=o?()=>Promise.all(k0(t,o,n)):()=>Promise.resolve(),d=t.variantChildren&&t.variantChildren.size?(m=0)=>{const{delayChildren:y=0,staggerChildren:v,staggerDirection:w}=l;return dS(t,e,y+m,v,w,n)}:()=>Promise.resolve(),{when:h}=l;if(h){const[m,y]=h==="beforeChildren"?[u,d]:[d,u];return m().then(()=>y())}else return Promise.all([u(),d(n.delay)])}function dS(t,e,n=0,i=0,o=1,l){const u=[],d=(t.variantChildren.size-1)*i,h=o===1?(m=0)=>m*i:(m=0)=>d-m*i;return Array.from(t.variantChildren).sort(hS).forEach((m,y)=>{m.notify("AnimationStart",e),u.push(Dc(m,e,{...l,delay:n+h(y)}).then(()=>m.notify("AnimationComplete",e)))}),Promise.all(u)}function hS(t,e){return t.sortNodePosition(e)}function fS(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const o=e.map(l=>Dc(t,l,n));i=Promise.all(o)}else if(typeof e=="string")i=Dc(t,e,n);else{const o=typeof e=="function"?Va(t,e,n.custom):e;i=Promise.all(k0(t,o,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const pS=fd.length;function E0(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?E0(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<pS;n++){const i=fd[n],o=t.props[i];(Ei(o)||o===!1)&&(e[i]=o)}return e}const mS=[...hd].reverse(),gS=hd.length;function yS(t){return e=>Promise.all(e.map(({animation:n,options:i})=>fS(t,n,i)))}function vS(t){let e=yS(t),n=Dm(),i=!0;const o=h=>(m,y)=>{var v;const w=Va(t,y,h==="exit"?(v=t.presenceContext)===null||v===void 0?void 0:v.custom:void 0);if(w){const{transition:_,transitionEnd:b,...S}=w;m={...m,...S,...b}}return m};function l(h){e=h(t)}function u(h){const{props:m}=t,y=E0(t.parent)||{},v=[],w=new Set;let _={},b=1/0;for(let k=0;k<gS;k++){const E=mS[k],P=n[E],N=m[E]!==void 0?m[E]:y[E],U=Ei(N),V=E===h?P.isActive:null;V===!1&&(b=k);let z=N===y[E]&&N!==m[E]&&U;if(z&&i&&t.manuallyAnimateOnMount&&(z=!1),P.protectedKeys={..._},!P.isActive&&V===null||!N&&!P.prevProp||Ua(N)||typeof N=="boolean")continue;const $=wS(P.prevProp,N);let B=$||E===h&&P.isActive&&!z&&U||k>b&&U,Y=!1;const oe=Array.isArray(N)?N:[N];let Te=oe.reduce(o(E),{});V===!1&&(Te={});const{prevResolvedValues:ve={}}=P,je={...ve,...Te},xe=pe=>{B=!0,w.has(pe)&&(Y=!0,w.delete(pe)),P.needsAnimating[pe]=!0;const F=t.getValue(pe);F&&(F.liveStyle=!1)};for(const pe in je){const F=Te[pe],J=ve[pe];if(_.hasOwnProperty(pe))continue;let K=!1;Ec(F)&&Ec(J)?K=!Uy(F,J):K=F!==J,K?F!=null?xe(pe):w.add(pe):F!==void 0&&w.has(pe)?xe(pe):P.protectedKeys[pe]=!0}P.prevProp=N,P.prevResolvedValues=Te,P.isActive&&(_={..._,...Te}),i&&t.blockInitialAnimation&&(B=!1),B&&(!(z&&$)||Y)&&v.push(...oe.map(pe=>({animation:pe,options:{type:E}})))}if(w.size){const k={};w.forEach(E=>{const P=t.getBaseTarget(E),N=t.getValue(E);N&&(N.liveStyle=!0),k[E]=P??null}),v.push({animation:k})}let S=!!v.length;return i&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(S=!1),i=!1,S?e(v):Promise.resolve()}function d(h,m){var y;if(n[h].isActive===m)return Promise.resolve();(y=t.variantChildren)===null||y===void 0||y.forEach(w=>{var _;return(_=w.animationState)===null||_===void 0?void 0:_.setActive(h,m)}),n[h].isActive=m;const v=u(h);for(const w in n)n[w].protectedKeys={};return v}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=Dm(),i=!0}}}function wS(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Uy(e,t):!1}function cr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Dm(){return{animate:cr(!0),whileInView:cr(),whileHover:cr(),whileTap:cr(),whileDrag:cr(),whileFocus:cr(),exit:cr()}}class Yn{constructor(e){this.isMounted=!1,this.node=e}update(){}}class xS extends Yn{constructor(e){super(e),e.animationState||(e.animationState=vS(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ua(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let bS=0;class _S extends Yn{constructor(){super(...arguments),this.id=bS++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const o=this.node.animationState.setActive("exit",!e);n&&!e&&o.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const SS={animation:{Feature:xS},exit:{Feature:_S}};function Ni(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Fi(t){return{point:{x:t.pageX,y:t.pageY}}}const kS=t=>e=>Cd(e)&&t(e,Fi(e));function yi(t,e,n,i){return Ni(t,e,kS(n),i)}const Lm=(t,e)=>Math.abs(t-e);function ES(t,e){const n=Lm(t.x,e.x),i=Lm(t.y,e.y);return Math.sqrt(n**2+i**2)}class T0{constructor(e,n,{transformPagePoint:i,contextWindow:o,dragSnapToOrigin:l=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=rc(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,_=ES(v.offset,{x:0,y:0})>=3;if(!w&&!_)return;const{point:b}=v,{timestamp:S}=at;this.history.push({...b,timestamp:S});const{onStart:k,onMove:E}=this.handlers;w||(k&&k(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=nc(w,this.transformPagePoint),Le.update(this.updatePoint,!0)},this.handlePointerUp=(v,w)=>{this.end();const{onEnd:_,onSessionEnd:b,resumeAnimation:S}=this.handlers;if(this.dragSnapToOrigin&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=rc(v.type==="pointercancel"?this.lastMoveEventInfo:nc(w,this.transformPagePoint),this.history);this.startEvent&&_&&_(v,k),b&&b(v,k)},!Cd(e))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=i,this.contextWindow=o||window;const u=Fi(e),d=nc(u,this.transformPagePoint),{point:h}=d,{timestamp:m}=at;this.history=[{...h,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,rc(d,this.history)),this.removeListeners=Vi(yi(this.contextWindow,"pointermove",this.handlePointerMove),yi(this.contextWindow,"pointerup",this.handlePointerUp),yi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Gn(this.updatePoint)}}function nc(t,e){return e?{point:e(t.point)}:t}function Mm(t,e){return{x:t.x-e.x,y:t.y-e.y}}function rc({point:t},e){return{point:t,delta:Mm(t,j0(e)),offset:Mm(t,TS(e)),velocity:jS(e,.1)}}function TS(t){return t[0]}function j0(t){return t[t.length-1]}function jS(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const o=j0(t);for(;n>=0&&(i=t[n],!(o.timestamp-i.timestamp>bn(e)));)n--;if(!i)return{x:0,y:0};const l=_n(o.timestamp-i.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-i.x)/l,y:(o.y-i.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const C0=1e-4,CS=1-C0,NS=1+C0,N0=.01,AS=0-N0,PS=0+N0;function It(t){return t.max-t.min}function RS(t,e,n){return Math.abs(t-e)<=n}function Um(t,e,n,i=.5){t.origin=i,t.originPoint=Be(e.min,e.max,t.origin),t.scale=It(n)/It(e),t.translate=Be(n.min,n.max,t.origin)-t.originPoint,(t.scale>=CS&&t.scale<=NS||isNaN(t.scale))&&(t.scale=1),(t.translate>=AS&&t.translate<=PS||isNaN(t.translate))&&(t.translate=0)}function vi(t,e,n,i){Um(t.x,e.x,n.x,i?i.originX:void 0),Um(t.y,e.y,n.y,i?i.originY:void 0)}function $m(t,e,n){t.min=n.min+e.min,t.max=t.min+It(e)}function OS(t,e,n){$m(t.x,e.x,n.x),$m(t.y,e.y,n.y)}function Vm(t,e,n){t.min=e.min-n.min,t.max=t.min+It(e)}function wi(t,e,n){Vm(t.x,e.x,n.x),Vm(t.y,e.y,n.y)}function IS(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Be(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Be(n,t,i.max):Math.min(t,n)),t}function Fm(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function DS(t,{top:e,left:n,bottom:i,right:o}){return{x:Fm(t.x,n,o),y:Fm(t.y,e,i)}}function Bm(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function LS(t,e){return{x:Bm(t.x,e.x),y:Bm(t.y,e.y)}}function MS(t,e){let n=.5;const i=It(t),o=It(e);return o>i?n=ms(e.min,e.max-i,t.min):i>o&&(n=ms(t.min,t.max-o,e.min)),Sn(0,1,n)}function US(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Lc=.35;function $S(t=Lc){return t===!1?t=0:t===!0&&(t=Lc),{x:zm(t,"left","right"),y:zm(t,"top","bottom")}}function zm(t,e,n){return{min:qm(t,e),max:qm(t,n)}}function qm(t,e){return typeof t=="number"?t:t[e]||0}const Wm=()=>({translate:0,scale:1,origin:0,originPoint:0}),us=()=>({x:Wm(),y:Wm()}),Hm=()=>({min:0,max:0}),Ge=()=>({x:Hm(),y:Hm()});function Bt(t){return[t("x"),t("y")]}function A0({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function VS({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function FS(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function sc(t){return t===void 0||t===1}function Mc({scale:t,scaleX:e,scaleY:n}){return!sc(t)||!sc(e)||!sc(n)}function fr(t){return Mc(t)||P0(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function P0(t){return Km(t.x)||Km(t.y)}function Km(t){return t&&t!=="0%"}function Na(t,e,n){const i=t-n,o=e*i;return n+o}function Gm(t,e,n,i,o){return o!==void 0&&(t=Na(t,o,i)),Na(t,n,i)+e}function Uc(t,e=0,n=1,i,o){t.min=Gm(t.min,e,n,i,o),t.max=Gm(t.max,e,n,i,o)}function R0(t,{x:e,y:n}){Uc(t.x,e.translate,e.scale,e.originPoint),Uc(t.y,n.translate,n.scale,n.originPoint)}const Jm=.999999999999,Ym=1.0000000000001;function BS(t,e,n,i=!1){const o=n.length;if(!o)return;e.x=e.y=1;let l,u;for(let d=0;d<o;d++){l=n[d],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(i&&l.options.layoutScroll&&l.scroll&&l!==l.root&&ds(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,R0(t,u)),i&&fr(l.latestValues)&&ds(t,l.latestValues))}e.x<Ym&&e.x>Jm&&(e.x=1),e.y<Ym&&e.y>Jm&&(e.y=1)}function cs(t,e){t.min=t.min+e,t.max=t.max+e}function Qm(t,e,n,i,o=.5){const l=Be(t.min,t.max,o);Uc(t,e,n,l,i)}function ds(t,e){Qm(t.x,e.x,e.scaleX,e.scale,e.originX),Qm(t.y,e.y,e.scaleY,e.scale,e.originY)}function O0(t,e){return A0(FS(t.getBoundingClientRect(),e))}function zS(t,e,n){const i=O0(t,n),{scroll:o}=e;return o&&(cs(i.x,o.offset.x),cs(i.y,o.offset.y)),i}const I0=({current:t})=>t?t.ownerDocument.defaultView:null,qS=new WeakMap;class WS{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ge(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=y=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Fi(y).point)},l=(y,v)=>{const{drag:w,dragPropagation:_,onDragStart:b}=this.getProps();if(w&&!_&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Mb(w),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bt(k=>{let E=this.getAxisMotionValue(k).get()||0;if(ln.test(E)){const{projection:P}=this.visualElement;if(P&&P.layout){const N=P.layout.layoutBox[k];N&&(E=It(N)*(parseFloat(E)/100))}}this.originPoint[k]=E}),b&&Le.postRender(()=>b(y,v)),Cc(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},u=(y,v)=>{const{dragPropagation:w,dragDirectionLock:_,onDirectionLock:b,onDrag:S}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:k}=v;if(_&&this.currentDirection===null){this.currentDirection=HS(k),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",v.point,k),this.updateAxis("y",v.point,k),this.visualElement.render(),S&&S(y,v)},d=(y,v)=>this.stop(y,v),h=()=>Bt(y=>{var v;return this.getAnimationState(y)==="paused"&&((v=this.getAxisMotionValue(y).animation)===null||v===void 0?void 0:v.play())}),{dragSnapToOrigin:m}=this.getProps();this.panSession=new T0(e,{onSessionStart:o,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,contextWindow:I0(this.visualElement)})}stop(e,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Le.postRender(()=>l(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,i){const{drag:o}=this.getProps();if(!i||!la(e,o,this.currentDirection))return;const l=this.getAxisMotionValue(e);let u=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(u=IS(u,this.constraints[e],this.elastic[e])),l.set(u)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:i}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,l=this.constraints;n&&as(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&o?this.constraints=DS(o.layoutBox,n):this.constraints=!1,this.elastic=$S(i),l!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&Bt(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=US(o.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!as(e))return!1;const i=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=zS(i,o.root,this.visualElement.getTransformPagePoint());let u=LS(o.layout.layoutBox,l);if(n){const d=n(VS(u));this.hasMutatedConstraints=!!d,d&&(u=A0(d))}return u}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},m=Bt(y=>{if(!la(y,n,this.currentDirection))return;let v=h&&h[y]||{};u&&(v={min:0,max:0});const w=o?200:1e6,_=o?40:1e7,b={type:"inertia",velocity:i?e[y]:0,bounceStiffness:w,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...l,...v};return this.startAxisValueAnimation(y,b)});return Promise.all(m).then(d)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return Cc(this.visualElement,e),i.start(Vd(e,i,0,n,this.visualElement,!1))}stopAnimation(){Bt(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Bt(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),o=i[n];return o||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Bt(n=>{const{drag:i}=this.getProps();if(!la(n,i,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:d}=o.layout.layoutBox[n];l.set(e[n]-Be(u,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!as(n)||!i||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Bt(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();o[u]=MS({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Bt(u=>{if(!la(u,e,null))return;const d=this.getAxisMotionValue(u),{min:h,max:m}=this.constraints[u];d.set(Be(h,m,o[u]))})}addListeners(){if(!this.visualElement.current)return;qS.set(this.visualElement,this);const e=this.visualElement.current,n=yi(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),i=()=>{const{dragConstraints:h}=this.getProps();as(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,l=o.addEventListener("measure",i);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Le.read(i);const u=Ni(window,"resize",()=>this.scalePositionWithinConstraints()),d=o.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(Bt(y=>{const v=this.getAxisMotionValue(y);v&&(this.originPoint[y]+=h[y].translate,v.set(v.get()+h[y].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=Lc,dragMomentum:d=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function la(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function HS(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class KS extends Yn{constructor(e){super(e),this.removeGroupControls=Ot,this.removeListeners=Ot,this.controls=new WS(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ot}unmount(){this.removeGroupControls(),this.removeListeners()}}const Xm=t=>(e,n)=>{t&&Le.postRender(()=>t(e,n))};class GS extends Yn{constructor(){super(...arguments),this.removePointerDownListener=Ot}onPointerDown(e){this.session=new T0(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:I0(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:o}=this.node.getProps();return{onSessionStart:Xm(e),onStart:Xm(n),onMove:i,onEnd:(l,u)=>{delete this.session,o&&Le.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=yi(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ya={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Zm(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ui={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Zm(t,e.target.x),i=Zm(t,e.target.y);return`${n}% ${i}%`}},JS={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,o=Jn.parse(t);if(o.length>5)return i;const l=Jn.createTransformer(t),u=typeof o[0]!="number"?1:0,d=n.x.scale*e.x,h=n.y.scale*e.y;o[0+u]/=d,o[1+u]/=h;const m=Be(d,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=m),typeof o[3+u]=="number"&&(o[3+u]/=m),l(o)}};class YS extends R.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:o}=this.props,{projection:l}=e;gb(QS),l&&(n.group&&n.group.add(l),i&&i.register&&o&&i.register(l),l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),ya.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:o,isPresent:l}=this.props,u=i.projection;return u&&(u.isPresent=l,o||e.layoutDependency!==n||n===void 0?u.willUpdate():this.safeToRemove(),e.isPresent!==l&&(l?u.promote():u.relegate()||Le.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),md.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:o}=e;o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),i&&i.deregister&&i.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function D0(t){const[e,n]=yy(),i=R.useContext(ad);return p.jsx(YS,{...t,layoutGroup:i,switchLayoutGroup:R.useContext(Ey),isPresent:e,safeToRemove:n})}const QS={borderRadius:{...ui,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ui,borderTopRightRadius:ui,borderBottomLeftRadius:ui,borderBottomRightRadius:ui,boxShadow:JS};function XS(t,e,n){const i=pt(t)?t:ji(t);return i.start(Vd("",i,e,n)),i.animation}function ZS(t){return t instanceof SVGElement&&t.tagName!=="svg"}const ek=(t,e)=>t.depth-e.depth;class tk{constructor(){this.children=[],this.isDirty=!1}add(e){Nd(this.children,e),this.isDirty=!0}remove(e){Ad(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(ek),this.isDirty=!1,this.children.forEach(e)}}function nk(t,e){const n=un.now(),i=({timestamp:o})=>{const l=o-n;l>=e&&(Gn(i),t(l-e))};return Le.read(i,!0),()=>Gn(i)}const L0=["TopLeft","TopRight","BottomLeft","BottomRight"],rk=L0.length,eg=t=>typeof t=="string"?parseFloat(t):t,tg=t=>typeof t=="number"||de.test(t);function sk(t,e,n,i,o,l){o?(t.opacity=Be(0,n.opacity!==void 0?n.opacity:1,ik(i)),t.opacityExit=Be(e.opacity!==void 0?e.opacity:1,0,ok(i))):l&&(t.opacity=Be(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let u=0;u<rk;u++){const d=`border${L0[u]}Radius`;let h=ng(e,d),m=ng(n,d);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||tg(h)===tg(m)?(t[d]=Math.max(Be(eg(h),eg(m),i),0),(ln.test(m)||ln.test(h))&&(t[d]+="%")):t[d]=m}(e.rotate||n.rotate)&&(t.rotate=Be(e.rotate||0,n.rotate||0,i))}function ng(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const ik=M0(0,.5,t0),ok=M0(.5,.95,Ot);function M0(t,e,n){return i=>i<t?0:i>e?1:n(ms(t,e,i))}function rg(t,e){t.min=e.min,t.max=e.max}function Ft(t,e){rg(t.x,e.x),rg(t.y,e.y)}function sg(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function ig(t,e,n,i,o){return t-=e,t=Na(t,1/n,i),o!==void 0&&(t=Na(t,1/o,i)),t}function ak(t,e=0,n=1,i=.5,o,l=t,u=t){if(ln.test(e)&&(e=parseFloat(e),e=Be(u.min,u.max,e/100)-u.min),typeof e!="number")return;let d=Be(l.min,l.max,i);t===l&&(d-=e),t.min=ig(t.min,e,n,d,o),t.max=ig(t.max,e,n,d,o)}function og(t,e,[n,i,o],l,u){ak(t,e[n],e[i],e[o],e.scale,l,u)}const lk=["x","scaleX","originX"],uk=["y","scaleY","originY"];function ag(t,e,n,i){og(t.x,e,lk,n?n.x:void 0,i?i.x:void 0),og(t.y,e,uk,n?n.y:void 0,i?i.y:void 0)}function lg(t){return t.translate===0&&t.scale===1}function U0(t){return lg(t.x)&&lg(t.y)}function ug(t,e){return t.min===e.min&&t.max===e.max}function ck(t,e){return ug(t.x,e.x)&&ug(t.y,e.y)}function cg(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function $0(t,e){return cg(t.x,e.x)&&cg(t.y,e.y)}function dg(t){return It(t.x)/It(t.y)}function hg(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class dk{constructor(){this.members=[]}add(e){Nd(this.members,e),e.scheduleRender()}remove(e){if(Ad(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(o=>e===o);if(n===0)return!1;let i;for(let o=n;o>=0;o--){const l=this.members[o];if(l.isPresent!==!1){i=l;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function hk(t,e,n){let i="";const o=t.x.translate/e.x,l=t.y.translate/e.y,u=n?.z||0;if((o||l||u)&&(i=`translate3d(${o}px, ${l}px, ${u}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:v,rotateY:w,skewX:_,skewY:b}=n;m&&(i=`perspective(${m}px) ${i}`),y&&(i+=`rotate(${y}deg) `),v&&(i+=`rotateX(${v}deg) `),w&&(i+=`rotateY(${w}deg) `),_&&(i+=`skewX(${_}deg) `),b&&(i+=`skewY(${b}deg) `)}const d=t.x.scale*e.x,h=t.y.scale*e.y;return(d!==1||h!==1)&&(i+=`scale(${d}, ${h})`),i||"none"}const pr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},pi=typeof window<"u"&&window.MotionDebug!==void 0,ic=["","X","Y","Z"],fk={visibility:"hidden"},fg=1e3;let pk=0;function oc(t,e,n,i){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),i&&(i[t]=0))}function V0(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Gy(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:l}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Le,!(o||l))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&V0(i)}function F0({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:o}){return class{constructor(u={},d=e?.()){this.id=pk++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,pi&&(pr.totalNodes=pr.resolvedTargetDeltas=pr.recalculatedProjection=0),this.nodes.forEach(yk),this.nodes.forEach(_k),this.nodes.forEach(Sk),this.nodes.forEach(vk),pi&&window.MotionDebug.record(pr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new tk)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Pd),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,d=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=ZS(u),this.instance=u;const{layoutId:h,layout:m,visualElement:y}=this.options;if(y&&!y.current&&y.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),d&&(m||h)&&(this.isLayoutDirty=!0),t){let v;const w=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,v&&v(),v=nk(w,250),ya.hasAnimatedSinceResize&&(ya.hasAnimatedSinceResize=!1,this.nodes.forEach(mg))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&y&&(h||m)&&this.addEventListener("didUpdate",({delta:v,hasLayoutChanged:w,hasRelativeTargetChanged:_,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||y.getDefaultTransition()||Ck,{onLayoutAnimationStart:k,onLayoutAnimationComplete:E}=y.getProps(),P=!this.targetLayout||!$0(this.targetLayout,b)||_,N=!w&&_;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||N||w&&(P||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(v,N);const U={...Ed(S,"layout"),onPlay:k,onComplete:E};(y.shouldReduceMotion||this.options.layoutRoot)&&(U.delay=0,U.type=!1),this.startAnimation(U)}else w||mg(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Gn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(kk),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&V0(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const v=this.path[y];v.shouldResetTransform=!0,v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:d,layout:h}=this.options;if(d===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(pg);return}this.isUpdating||this.nodes.forEach(xk),this.isUpdating=!1,this.nodes.forEach(bk),this.nodes.forEach(mk),this.nodes.forEach(gk),this.clearAllSnapshots();const d=un.now();at.delta=Sn(0,1e3/60,d-at.timestamp),at.timestamp=d,at.isProcessing=!0,Yu.update.process(at),Yu.preRender.process(at),Yu.render.process(at),at.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,md.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(wk),this.sharedNodes.forEach(Ek)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Le.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Le.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ge(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d){const h=i(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!U0(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;u&&(d||fr(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),Nk(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:d}=this.options;if(!d)return Ge();const h=d.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(Ak))){const{scroll:y}=this.root;y&&(cs(h.x,y.offset.x),cs(h.y,y.offset.y))}return h}removeElementScroll(u){var d;const h=Ge();if(Ft(h,u),!((d=this.scroll)===null||d===void 0)&&d.wasRoot)return h;for(let m=0;m<this.path.length;m++){const y=this.path[m],{scroll:v,options:w}=y;y!==this.root&&v&&w.layoutScroll&&(v.wasRoot&&Ft(h,u),cs(h.x,v.offset.x),cs(h.y,v.offset.y))}return h}applyTransform(u,d=!1){const h=Ge();Ft(h,u);for(let m=0;m<this.path.length;m++){const y=this.path[m];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&ds(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),fr(y.latestValues)&&ds(h,y.latestValues)}return fr(this.latestValues)&&ds(h,this.latestValues),h}removeTransform(u){const d=Ge();Ft(d,u);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!fr(m.latestValues))continue;Mc(m.latestValues)&&m.updateSnapshot();const y=Ge(),v=m.measurePageBox();Ft(y,v),ag(d,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return fr(this.latestValues)&&ag(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==at.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var d;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==h;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:v,layoutId:w}=this.options;if(!(!this.layout||!(v||w))){if(this.resolvedRelativeTargetAt=at.timestamp,!this.targetDelta&&!this.relativeTarget){const _=this.getClosestProjectingParent();_&&_.layout&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ge(),this.relativeTargetOrigin=Ge(),wi(this.relativeTargetOrigin,this.layout.layoutBox,_.layout.layoutBox),Ft(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Ge(),this.targetWithTransforms=Ge()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),OS(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ft(this.target,this.layout.layoutBox),R0(this.target,this.targetDelta)):Ft(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const _=this.getClosestProjectingParent();_&&!!_.resumingFrom==!!this.resumingFrom&&!_.options.layoutScroll&&_.target&&this.animationProgress!==1?(this.relativeParent=_,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ge(),this.relativeTargetOrigin=Ge(),wi(this.relativeTargetOrigin,this.target,_.target),Ft(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}pi&&pr.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Mc(this.parent.latestValues)||P0(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const d=this.getLead(),h=!!this.resumingFrom||this!==d;let m=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(m=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===at.timestamp&&(m=!1),m)return;const{layout:y,layoutId:v}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(y||v))return;Ft(this.layoutCorrected,this.layout.layoutBox);const w=this.treeScale.x,_=this.treeScale.y;BS(this.layoutCorrected,this.treeScale,this.path,h),d.layout&&!d.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(d.target=d.layout.layoutBox,d.targetWithTransforms=Ge());const{target:b}=d;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(sg(this.prevProjectionDelta.x,this.projectionDelta.x),sg(this.prevProjectionDelta.y,this.projectionDelta.y)),vi(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==w||this.treeScale.y!==_||!hg(this.projectionDelta.x,this.prevProjectionDelta.x)||!hg(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),pi&&pr.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var d;if((d=this.options.visualElement)===null||d===void 0||d.scheduleRender(),u){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=us(),this.projectionDelta=us(),this.projectionDeltaWithTransform=us()}setAnimationOrigin(u,d=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},v=us();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const w=Ge(),_=h?h.source:void 0,b=this.layout?this.layout.source:void 0,S=_!==b,k=this.getStack(),E=!k||k.members.length<=1,P=!!(S&&!E&&this.options.crossfade===!0&&!this.path.some(jk));this.animationProgress=0;let N;this.mixTargetDelta=U=>{const V=U/1e3;gg(v.x,u.x,V),gg(v.y,u.y,V),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wi(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Tk(this.relativeTarget,this.relativeTargetOrigin,w,V),N&&ck(this.relativeTarget,N)&&(this.isProjectionDirty=!1),N||(N=Ge()),Ft(N,this.relativeTarget)),S&&(this.animationValues=y,sk(y,m,this.latestValues,V,P,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=V},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Gn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Le.update(()=>{ya.hasAnimatedSinceResize=!0,this.currentAnimation=XS(0,fg,{...u,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(fg),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:m,latestValues:y}=u;if(!(!d||!h||!m)){if(this!==u&&this.layout&&m&&B0(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||Ge();const v=It(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+v;const w=It(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+w}Ft(d,h),ds(d,y),vi(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new dk),this.sharedNodes.get(u).add(d);const m=d.options.initialPromotionConfig;d.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:d}=this.options;return d?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:d}=this.options;return d?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const m={};h.z&&oc("z",u,m,this.animationValues);for(let y=0;y<ic.length;y++)oc(`rotate${ic[y]}`,u,m,this.animationValues),oc(`skew${ic[y]}`,u,m,this.animationValues);u.render();for(const y in m)u.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);u.scheduleRender()}getProjectionStyles(u){var d,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return fk;const m={visibility:""},y=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,m.opacity="",m.pointerEvents=ma(u?.pointerEvents)||"",m.transform=y?y(this.latestValues,""):"none",m;const v=this.getLead();if(!this.projectionDelta||!this.layout||!v.target){const S={};return this.options.layoutId&&(S.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,S.pointerEvents=ma(u?.pointerEvents)||""),this.hasProjected&&!fr(this.latestValues)&&(S.transform=y?y({},""):"none",this.hasProjected=!1),S}const w=v.animationValues||v.latestValues;this.applyTransformsToTarget(),m.transform=hk(this.projectionDeltaWithTransform,this.treeScale,w),y&&(m.transform=y(w,m.transform));const{x:_,y:b}=this.projectionDelta;m.transformOrigin=`${_.origin*100}% ${b.origin*100}% 0`,v.animationValues?m.opacity=v===this?(h=(d=w.opacity)!==null&&d!==void 0?d:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:w.opacityExit:m.opacity=v===this?w.opacity!==void 0?w.opacity:"":w.opacityExit!==void 0?w.opacityExit:0;for(const S in ka){if(w[S]===void 0)continue;const{correct:k,applyTo:E}=ka[S],P=m.transform==="none"?w[S]:k(w[S],v);if(E){const N=E.length;for(let U=0;U<N;U++)m[E[U]]=P}else m[S]=P}return this.options.layoutId&&(m.pointerEvents=v===this?ma(u?.pointerEvents)||"":"none"),m}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var d;return(d=u.currentAnimation)===null||d===void 0?void 0:d.stop()}),this.root.nodes.forEach(pg),this.root.sharedNodes.clear()}}}function mk(t){t.updateLayout()}function gk(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:o}=t.layout,{animationType:l}=t.options,u=n.source!==t.layout.source;l==="size"?Bt(v=>{const w=u?n.measuredBox[v]:n.layoutBox[v],_=It(w);w.min=i[v].min,w.max=w.min+_}):B0(l,n.layoutBox,i)&&Bt(v=>{const w=u?n.measuredBox[v]:n.layoutBox[v],_=It(i[v]);w.max=w.min+_,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[v].max=t.relativeTarget[v].min+_)});const d=us();vi(d,i,n.layoutBox);const h=us();u?vi(h,t.applyTransform(o,!0),n.measuredBox):vi(h,i,n.layoutBox);const m=!U0(d);let y=!1;if(!t.resumeFrom){const v=t.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:w,layout:_}=v;if(w&&_){const b=Ge();wi(b,n.layoutBox,w.layoutBox);const S=Ge();wi(S,i,_.layoutBox),$0(b,S)||(y=!0),v.options.layoutRoot&&(t.relativeTarget=S,t.relativeTargetOrigin=b,t.relativeParent=v)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:h,layoutDelta:d,hasLayoutChanged:m,hasRelativeTargetChanged:y})}else if(t.isLead()){const{onExitComplete:i}=t.options;i&&i()}t.options.transition=void 0}function yk(t){pi&&pr.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function vk(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function wk(t){t.clearSnapshot()}function pg(t){t.clearMeasurements()}function xk(t){t.isLayoutDirty=!1}function bk(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function mg(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function _k(t){t.resolveTargetDelta()}function Sk(t){t.calcProjection()}function kk(t){t.resetSkewAndRotation()}function Ek(t){t.removeLeadSnapshot()}function gg(t,e,n){t.translate=Be(e.translate,0,n),t.scale=Be(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function yg(t,e,n,i){t.min=Be(e.min,n.min,i),t.max=Be(e.max,n.max,i)}function Tk(t,e,n,i){yg(t.x,e.x,n.x,i),yg(t.y,e.y,n.y,i)}function jk(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Ck={duration:.45,ease:[.4,0,.1,1]},vg=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),wg=vg("applewebkit/")&&!vg("chrome/")?Math.round:Ot;function xg(t){t.min=wg(t.min),t.max=wg(t.max)}function Nk(t){xg(t.x),xg(t.y)}function B0(t,e,n){return t==="position"||t==="preserve-aspect"&&!RS(dg(e),dg(n),.2)}function Ak(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const Pk=F0({attachResizeListener:(t,e)=>Ni(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ac={current:void 0},z0=F0({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ac.current){const t=new Pk({});t.mount(window),t.setOptions({layoutScroll:!0}),ac.current=t}return ac.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Rk={pan:{Feature:GS},drag:{Feature:KS,ProjectionNode:z0,MeasureLayout:D0}};function bg(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,l=i[o];l&&Le.postRender(()=>l(e,Fi(e)))}class Ok extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=Rb(e,n=>(bg(this.node,n,"Start"),i=>bg(this.node,i,"End"))))}unmount(){}}class Ik extends Yn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Vi(Ni(this.node.current,"focus",()=>this.onFocus()),Ni(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function _g(t,e,n){const{props:i}=t;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),l=i[o];l&&Le.postRender(()=>l(e,Fi(e)))}class Dk extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=Lb(e,n=>(_g(this.node,n,"Start"),(i,{success:o})=>_g(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const $c=new WeakMap,lc=new WeakMap,Lk=t=>{const e=$c.get(t.target);e&&e(t)},Mk=t=>{t.forEach(Lk)};function Uk({root:t,...e}){const n=t||document;lc.has(n)||lc.set(n,{});const i=lc.get(n),o=JSON.stringify(e);return i[o]||(i[o]=new IntersectionObserver(Mk,{root:t,...e})),i[o]}function $k(t,e,n){const i=Uk(e);return $c.set(t,n),i.observe(t),()=>{$c.delete(t),i.unobserve(t)}}const Vk={some:0,all:1};class Fk extends Yn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:o="some",once:l}=e,u={root:n?n.current:void 0,rootMargin:i,threshold:typeof o=="number"?o:Vk[o]},d=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,l&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:v}=this.node.getProps(),w=m?y:v;w&&w(h)};return $k(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Bk(e,n))&&this.startObserver()}unmount(){}}function Bk({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const zk={inView:{Feature:Fk},tap:{Feature:Dk},focus:{Feature:Ik},hover:{Feature:Ok}},qk={layout:{ProjectionNode:z0,MeasureLayout:D0}},Vc={current:null},q0={current:!1};function Wk(){if(q0.current=!0,!!cd)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Vc.current=t.matches;t.addListener(e),e()}else Vc.current=!1}const Hk=[...m0,ht,Jn],Kk=t=>Hk.find(p0(t)),Sg=new WeakMap;function Gk(t,e,n){for(const i in e){const o=e[i],l=n[i];if(pt(o))t.addValue(i,o);else if(pt(l))t.addValue(i,ji(o,{owner:t}));else if(l!==o)if(t.hasValue(i)){const u=t.getValue(i);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=t.getStaticValue(i);t.addValue(i,ji(u!==void 0?u:o,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const kg=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Jk{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:o,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Md,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const _=un.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Le.render(this.render,!1,!0))};const{latestValues:h,renderState:m,onUpdate:y}=u;this.onUpdate=y,this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=$a(n),this.isVariantNode=Sy(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:v,...w}=this.scrapeMotionValuesFromProps(n,{},this);for(const _ in w){const b=w[_];h[_]!==void 0&&pt(b)&&b.set(h[_],!1)}}mount(e){this.current=e,Sg.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),q0.current||Wk(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Vc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Sg.delete(this.current),this.projection&&this.projection.unmount(),Gn(this.notifyUpdate),Gn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Tr.has(e),o=n.on("change",d=>{this.latestValues[e]=d,this.props.onUpdate&&Le.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),l=n.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),l(),u&&u(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in gs){const n=gs[e];if(!n)continue;const{isEnabled:i,Feature:o}=n;if(!this.features[e]&&o&&i(this.props)&&(this.features[e]=new o(this)),this.features[e]){const l=this.features[e];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ge()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<kg.length;i++){const o=kg[i];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=e[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=Gk(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=ji(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){var i;let o=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(i=this.getBaseTargetFromProps(this.props,e))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,e,this.options);return o!=null&&(typeof o=="string"&&(h0(o)||r0(o))?o=parseFloat(o):!Kk(o)&&Jn.test(n)&&(o=u0(e,n)),this.setBaseTarget(e,pt(o)?o.get():o)),pt(o)?o.get():o}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:i}=this.props;let o;if(typeof i=="string"||typeof i=="object"){const u=yd(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);u&&(o=u[e])}if(i&&o!==void 0)return o;const l=this.getBaseTargetFromProps(this.props,e);return l!==void 0&&!pt(l)?l:this.initialValues[e]!==void 0&&o===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Pd),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class W0 extends Jk{constructor(){super(...arguments),this.KeyframeResolver=g0}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;pt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Yk(t){return window.getComputedStyle(t)}class Qk extends W0{constructor(){super(...arguments),this.type="html",this.renderInstance=Ry}readValueFromInstance(e,n){if(Tr.has(n)){const i=Ld(n);return i&&i.default||0}else{const i=Yk(e),o=(Ny(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return O0(e,n)}build(e,n,i){xd(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return kd(e,n,i)}}class Xk extends W0{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ge}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Tr.has(n)){const i=Ld(n);return i&&i.default||0}return n=Oy.has(n)?n:pd(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return Ly(e,n,i)}build(e,n,i){bd(e,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,i,o){Iy(e,n,i,o)}mount(e){this.isSVGTag=Sd(e.tagName),super.mount(e)}}const Zk=(t,e)=>gd(t)?new Xk(e):new Qk(e,{allowProjection:t!==R.Fragment}),eE=Eb({...SS,...zk,...Rk,...qk},Zk),Ne=V1(eE);function H0(t,e){return function(){return t.apply(e,arguments)}}const{toString:tE}=Object.prototype,{getPrototypeOf:Fd}=Object,{iterator:Ba,toStringTag:K0}=Symbol,za=(t=>e=>{const n=tE.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),en=t=>(t=t.toLowerCase(),e=>za(e)===t),qa=t=>e=>typeof e===t,{isArray:bs}=Array,vs=qa("undefined");function Bi(t){return t!==null&&!vs(t)&&t.constructor!==null&&!vs(t.constructor)&&St(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const G0=en("ArrayBuffer");function nE(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&G0(t.buffer),e}const rE=qa("string"),St=qa("function"),J0=qa("number"),zi=t=>t!==null&&typeof t=="object",sE=t=>t===!0||t===!1,va=t=>{if(za(t)!=="object")return!1;const e=Fd(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(K0 in t)&&!(Ba in t)},iE=t=>{if(!zi(t)||Bi(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},oE=en("Date"),aE=en("File"),lE=en("Blob"),uE=en("FileList"),cE=t=>zi(t)&&St(t.pipe),dE=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||St(t.append)&&((e=za(t))==="formdata"||e==="object"&&St(t.toString)&&t.toString()==="[object FormData]"))},hE=en("URLSearchParams"),[fE,pE,mE,gE]=["ReadableStream","Request","Response","Headers"].map(en),yE=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qi(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let i,o;if(typeof t!="object"&&(t=[t]),bs(t))for(i=0,o=t.length;i<o;i++)e.call(null,t[i],i,t);else{if(Bi(t))return;const l=n?Object.getOwnPropertyNames(t):Object.keys(t),u=l.length;let d;for(i=0;i<u;i++)d=l[i],e.call(null,t[d],d,t)}}function Y0(t,e){if(Bi(t))return null;e=e.toLowerCase();const n=Object.keys(t);let i=n.length,o;for(;i-- >0;)if(o=n[i],e===o.toLowerCase())return o;return null}const wr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Q0=t=>!vs(t)&&t!==wr;function Fc(){const{caseless:t,skipUndefined:e}=Q0(this)&&this||{},n={},i=(o,l)=>{const u=t&&Y0(n,l)||l;va(n[u])&&va(o)?n[u]=Fc(n[u],o):va(o)?n[u]=Fc({},o):bs(o)?n[u]=o.slice():(!e||!vs(o))&&(n[u]=o)};for(let o=0,l=arguments.length;o<l;o++)arguments[o]&&qi(arguments[o],i);return n}const vE=(t,e,n,{allOwnKeys:i}={})=>(qi(e,(o,l)=>{n&&St(o)?t[l]=H0(o,n):t[l]=o},{allOwnKeys:i}),t),wE=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),xE=(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},bE=(t,e,n,i)=>{let o,l,u;const d={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),l=o.length;l-- >0;)u=o[l],(!i||i(u,t,e))&&!d[u]&&(e[u]=t[u],d[u]=!0);t=n!==!1&&Fd(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},_E=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return i!==-1&&i===n},SE=t=>{if(!t)return null;if(bs(t))return t;let e=t.length;if(!J0(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},kE=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Fd(Uint8Array)),EE=(t,e)=>{const i=(t&&t[Ba]).call(t);let o;for(;(o=i.next())&&!o.done;){const l=o.value;e.call(t,l[0],l[1])}},TE=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},jE=en("HTMLFormElement"),CE=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),Eg=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),NE=en("RegExp"),X0=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};qi(n,(o,l)=>{let u;(u=e(o,l,t))!==!1&&(i[l]=u||o)}),Object.defineProperties(t,i)},AE=t=>{X0(t,(e,n)=>{if(St(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=t[n];if(St(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},PE=(t,e)=>{const n={},i=o=>{o.forEach(l=>{n[l]=!0})};return bs(t)?i(t):i(String(t).split(e)),n},RE=()=>{},OE=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function IE(t){return!!(t&&St(t.append)&&t[K0]==="FormData"&&t[Ba])}const DE=t=>{const e=new Array(10),n=(i,o)=>{if(zi(i)){if(e.indexOf(i)>=0)return;if(Bi(i))return i;if(!("toJSON"in i)){e[o]=i;const l=bs(i)?[]:{};return qi(i,(u,d)=>{const h=n(u,o+1);!vs(h)&&(l[d]=h)}),e[o]=void 0,l}}return i};return n(t,0)},LE=en("AsyncFunction"),ME=t=>t&&(zi(t)||St(t))&&St(t.then)&&St(t.catch),Z0=((t,e)=>t?setImmediate:e?((n,i)=>(wr.addEventListener("message",({source:o,data:l})=>{o===wr&&l===n&&i.length&&i.shift()()},!1),o=>{i.push(o),wr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",St(wr.postMessage)),UE=typeof queueMicrotask<"u"?queueMicrotask.bind(wr):typeof process<"u"&&process.nextTick||Z0,$E=t=>t!=null&&St(t[Ba]),M={isArray:bs,isArrayBuffer:G0,isBuffer:Bi,isFormData:dE,isArrayBufferView:nE,isString:rE,isNumber:J0,isBoolean:sE,isObject:zi,isPlainObject:va,isEmptyObject:iE,isReadableStream:fE,isRequest:pE,isResponse:mE,isHeaders:gE,isUndefined:vs,isDate:oE,isFile:aE,isBlob:lE,isRegExp:NE,isFunction:St,isStream:cE,isURLSearchParams:hE,isTypedArray:kE,isFileList:uE,forEach:qi,merge:Fc,extend:vE,trim:yE,stripBOM:wE,inherits:xE,toFlatObject:bE,kindOf:za,kindOfTest:en,endsWith:_E,toArray:SE,forEachEntry:EE,matchAll:TE,isHTMLForm:jE,hasOwnProperty:Eg,hasOwnProp:Eg,reduceDescriptors:X0,freezeMethods:AE,toObjectSet:PE,toCamelCase:CE,noop:RE,toFiniteNumber:OE,findKey:Y0,global:wr,isContextDefined:Q0,isSpecCompliantForm:IE,toJSONObject:DE,isAsyncFn:LE,isThenable:ME,setImmediate:Z0,asap:UE,isIterable:$E};function ye(t,e,n,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status?o.status:null)}M.inherits(ye,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.status}}});const ev=ye.prototype,tv={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{tv[t]={value:t}});Object.defineProperties(ye,tv);Object.defineProperty(ev,"isAxiosError",{value:!0});ye.from=(t,e,n,i,o,l)=>{const u=Object.create(ev);M.toFlatObject(t,u,function(y){return y!==Error.prototype},m=>m!=="isAxiosError");const d=t&&t.message?t.message:"Error",h=e==null&&t?t.code:e;return ye.call(u,d,h,n,i,o),t&&u.cause==null&&Object.defineProperty(u,"cause",{value:t,configurable:!0}),u.name=t&&t.name||"Error",l&&Object.assign(u,l),u};const VE=null;function Bc(t){return M.isPlainObject(t)||M.isArray(t)}function nv(t){return M.endsWith(t,"[]")?t.slice(0,-2):t}function Tg(t,e,n){return t?t.concat(e).map(function(o,l){return o=nv(o),!n&&l?"["+o+"]":o}).join(n?".":""):e}function FE(t){return M.isArray(t)&&!t.some(Bc)}const BE=M.toFlatObject(M,{},null,function(e){return/^is[A-Z]/.test(e)});function Wa(t,e,n){if(!M.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=M.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,k){return!M.isUndefined(k[S])});const i=n.metaTokens,o=n.visitor||y,l=n.dots,u=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&M.isSpecCompliantForm(e);if(!M.isFunction(o))throw new TypeError("visitor must be a function");function m(b){if(b===null)return"";if(M.isDate(b))return b.toISOString();if(M.isBoolean(b))return b.toString();if(!h&&M.isBlob(b))throw new ye("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(b)||M.isTypedArray(b)?h&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function y(b,S,k){let E=b;if(b&&!k&&typeof b=="object"){if(M.endsWith(S,"{}"))S=i?S:S.slice(0,-2),b=JSON.stringify(b);else if(M.isArray(b)&&FE(b)||(M.isFileList(b)||M.endsWith(S,"[]"))&&(E=M.toArray(b)))return S=nv(S),E.forEach(function(N,U){!(M.isUndefined(N)||N===null)&&e.append(u===!0?Tg([S],U,l):u===null?S:S+"[]",m(N))}),!1}return Bc(b)?!0:(e.append(Tg(k,S,l),m(b)),!1)}const v=[],w=Object.assign(BE,{defaultVisitor:y,convertValue:m,isVisitable:Bc});function _(b,S){if(!M.isUndefined(b)){if(v.indexOf(b)!==-1)throw Error("Circular reference detected in "+S.join("."));v.push(b),M.forEach(b,function(E,P){(!(M.isUndefined(E)||E===null)&&o.call(e,E,M.isString(P)?P.trim():P,S,w))===!0&&_(E,S?S.concat(P):[P])}),v.pop()}}if(!M.isObject(t))throw new TypeError("data must be an object");return _(t),e}function jg(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Bd(t,e){this._pairs=[],t&&Wa(t,this,e)}const rv=Bd.prototype;rv.append=function(e,n){this._pairs.push([e,n])};rv.toString=function(e){const n=e?function(i){return e.call(this,i,jg)}:jg;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function zE(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function sv(t,e,n){if(!e)return t;const i=n&&n.encode||zE;M.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let l;if(o?l=o(e,n):l=M.isURLSearchParams(e)?e.toString():new Bd(e,n).toString(i),l){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+l}return t}class Cg{constructor(){this.handlers=[]}use(e,n,i){return this.handlers.push({fulfilled:e,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){M.forEach(this.handlers,function(i){i!==null&&e(i)})}}const iv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},qE=typeof URLSearchParams<"u"?URLSearchParams:Bd,WE=typeof FormData<"u"?FormData:null,HE=typeof Blob<"u"?Blob:null,KE={isBrowser:!0,classes:{URLSearchParams:qE,FormData:WE,Blob:HE},protocols:["http","https","file","blob","url","data"]},zd=typeof window<"u"&&typeof document<"u",zc=typeof navigator=="object"&&navigator||void 0,GE=zd&&(!zc||["ReactNative","NativeScript","NS"].indexOf(zc.product)<0),JE=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",YE=zd&&window.location.href||"http://localhost",QE=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zd,hasStandardBrowserEnv:GE,hasStandardBrowserWebWorkerEnv:JE,navigator:zc,origin:YE},Symbol.toStringTag,{value:"Module"})),ft={...QE,...KE};function XE(t,e){return Wa(t,new ft.classes.URLSearchParams,{visitor:function(n,i,o,l){return ft.isNode&&M.isBuffer(n)?(this.append(i,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...e})}function ZE(t){return M.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function e2(t){const e={},n=Object.keys(t);let i;const o=n.length;let l;for(i=0;i<o;i++)l=n[i],e[l]=t[l];return e}function ov(t){function e(n,i,o,l){let u=n[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),h=l>=n.length;return u=!u&&M.isArray(o)?o.length:u,h?(M.hasOwnProp(o,u)?o[u]=[o[u],i]:o[u]=i,!d):((!o[u]||!M.isObject(o[u]))&&(o[u]=[]),e(n,i,o[u],l)&&M.isArray(o[u])&&(o[u]=e2(o[u])),!d)}if(M.isFormData(t)&&M.isFunction(t.entries)){const n={};return M.forEachEntry(t,(i,o)=>{e(ZE(i),o,n,0)}),n}return null}function t2(t,e,n){if(M.isString(t))try{return(e||JSON.parse)(t),M.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(t)}const Wi={transitional:iv,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const i=n.getContentType()||"",o=i.indexOf("application/json")>-1,l=M.isObject(e);if(l&&M.isHTMLForm(e)&&(e=new FormData(e)),M.isFormData(e))return o?JSON.stringify(ov(e)):e;if(M.isArrayBuffer(e)||M.isBuffer(e)||M.isStream(e)||M.isFile(e)||M.isBlob(e)||M.isReadableStream(e))return e;if(M.isArrayBufferView(e))return e.buffer;if(M.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(l){if(i.indexOf("application/x-www-form-urlencoded")>-1)return XE(e,this.formSerializer).toString();if((d=M.isFileList(e))||i.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Wa(d?{"files[]":e}:e,h&&new h,this.formSerializer)}}return l||o?(n.setContentType("application/json",!1),t2(e)):e}],transformResponse:[function(e){const n=this.transitional||Wi.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(M.isResponse(e)||M.isReadableStream(e))return e;if(e&&M.isString(e)&&(i&&!this.responseType||o)){const u=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(d){if(u)throw d.name==="SyntaxError"?ye.from(d,ye.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ft.classes.FormData,Blob:ft.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};M.forEach(["delete","get","head","post","put","patch"],t=>{Wi.headers[t]={}});const n2=M.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),r2=t=>{const e={};let n,i,o;return t&&t.split(`
17
+ `).forEach(function(u){o=u.indexOf(":"),n=u.substring(0,o).trim().toLowerCase(),i=u.substring(o+1).trim(),!(!n||e[n]&&n2[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)}),e},Ng=Symbol("internals");function ci(t){return t&&String(t).trim().toLowerCase()}function wa(t){return t===!1||t==null?t:M.isArray(t)?t.map(wa):String(t)}function s2(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}const i2=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function uc(t,e,n,i,o){if(M.isFunction(i))return i.call(this,e,n);if(o&&(e=n),!!M.isString(e)){if(M.isString(i))return e.indexOf(i)!==-1;if(M.isRegExp(i))return i.test(e)}}function o2(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}function a2(t,e){const n=M.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(o,l,u){return this[i].call(this,e,o,l,u)},configurable:!0})})}let kt=class{constructor(e){e&&this.set(e)}set(e,n,i){const o=this;function l(d,h,m){const y=ci(h);if(!y)throw new Error("header name must be a non-empty string");const v=M.findKey(o,y);(!v||o[v]===void 0||m===!0||m===void 0&&o[v]!==!1)&&(o[v||h]=wa(d))}const u=(d,h)=>M.forEach(d,(m,y)=>l(m,y,h));if(M.isPlainObject(e)||e instanceof this.constructor)u(e,n);else if(M.isString(e)&&(e=e.trim())&&!i2(e))u(r2(e),n);else if(M.isObject(e)&&M.isIterable(e)){let d={},h,m;for(const y of e){if(!M.isArray(y))throw TypeError("Object iterator must return a key-value pair");d[m=y[0]]=(h=d[m])?M.isArray(h)?[...h,y[1]]:[h,y[1]]:y[1]}u(d,n)}else e!=null&&l(n,e,i);return this}get(e,n){if(e=ci(e),e){const i=M.findKey(this,e);if(i){const o=this[i];if(!n)return o;if(n===!0)return s2(o);if(M.isFunction(n))return n.call(this,o,i);if(M.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ci(e),e){const i=M.findKey(this,e);return!!(i&&this[i]!==void 0&&(!n||uc(this,this[i],i,n)))}return!1}delete(e,n){const i=this;let o=!1;function l(u){if(u=ci(u),u){const d=M.findKey(i,u);d&&(!n||uc(i,i[d],d,n))&&(delete i[d],o=!0)}}return M.isArray(e)?e.forEach(l):l(e),o}clear(e){const n=Object.keys(this);let i=n.length,o=!1;for(;i--;){const l=n[i];(!e||uc(this,this[l],l,e,!0))&&(delete this[l],o=!0)}return o}normalize(e){const n=this,i={};return M.forEach(this,(o,l)=>{const u=M.findKey(i,l);if(u){n[u]=wa(o),delete n[l];return}const d=e?o2(l):String(l).trim();d!==l&&delete n[l],n[d]=wa(o),i[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return M.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=e&&M.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
18
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const i=new this(e);return n.forEach(o=>i.set(o)),i}static accessor(e){const i=(this[Ng]=this[Ng]={accessors:{}}).accessors,o=this.prototype;function l(u){const d=ci(u);i[d]||(a2(o,u),i[d]=!0)}return M.isArray(e)?e.forEach(l):l(e),this}};kt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);M.reduceDescriptors(kt.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[n]=i}}});M.freezeMethods(kt);function cc(t,e){const n=this||Wi,i=e||n,o=kt.from(i.headers);let l=i.data;return M.forEach(t,function(d){l=d.call(n,l,o.normalize(),e?e.status:void 0)}),o.normalize(),l}function av(t){return!!(t&&t.__CANCEL__)}function _s(t,e,n){ye.call(this,t??"canceled",ye.ERR_CANCELED,e,n),this.name="CanceledError"}M.inherits(_s,ye,{__CANCEL__:!0});function lv(t,e,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?t(n):e(new ye("Request failed with status code "+n.status,[ye.ERR_BAD_REQUEST,ye.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function l2(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function u2(t,e){t=t||10;const n=new Array(t),i=new Array(t);let o=0,l=0,u;return e=e!==void 0?e:1e3,function(h){const m=Date.now(),y=i[l];u||(u=m),n[o]=h,i[o]=m;let v=l,w=0;for(;v!==o;)w+=n[v++],v=v%t;if(o=(o+1)%t,o===l&&(l=(l+1)%t),m-u<e)return;const _=y&&m-y;return _?Math.round(w*1e3/_):void 0}}function c2(t,e){let n=0,i=1e3/e,o,l;const u=(m,y=Date.now())=>{n=y,o=null,l&&(clearTimeout(l),l=null),t(...m)};return[(...m)=>{const y=Date.now(),v=y-n;v>=i?u(m,y):(o=m,l||(l=setTimeout(()=>{l=null,u(o)},i-v)))},()=>o&&u(o)]}const Aa=(t,e,n=3)=>{let i=0;const o=u2(50,250);return c2(l=>{const u=l.loaded,d=l.lengthComputable?l.total:void 0,h=u-i,m=o(h),y=u<=d;i=u;const v={loaded:u,total:d,progress:d?u/d:void 0,bytes:h,rate:m||void 0,estimated:m&&d&&y?(d-u)/m:void 0,event:l,lengthComputable:d!=null,[e?"download":"upload"]:!0};t(v)},n)},Ag=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},Pg=t=>(...e)=>M.asap(()=>t(...e)),d2=ft.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ft.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ft.origin),ft.navigator&&/(msie|trident)/i.test(ft.navigator.userAgent)):()=>!0,h2=ft.hasStandardBrowserEnv?{write(t,e,n,i,o,l,u){if(typeof document>"u")return;const d=[`${t}=${encodeURIComponent(e)}`];M.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),M.isString(i)&&d.push(`path=${i}`),M.isString(o)&&d.push(`domain=${o}`),l===!0&&d.push("secure"),M.isString(u)&&d.push(`SameSite=${u}`),document.cookie=d.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function f2(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function p2(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function uv(t,e,n){let i=!f2(e);return t&&(i||n==!1)?p2(t,e):e}const Rg=t=>t instanceof kt?{...t}:t;function Er(t,e){e=e||{};const n={};function i(m,y,v,w){return M.isPlainObject(m)&&M.isPlainObject(y)?M.merge.call({caseless:w},m,y):M.isPlainObject(y)?M.merge({},y):M.isArray(y)?y.slice():y}function o(m,y,v,w){if(M.isUndefined(y)){if(!M.isUndefined(m))return i(void 0,m,v,w)}else return i(m,y,v,w)}function l(m,y){if(!M.isUndefined(y))return i(void 0,y)}function u(m,y){if(M.isUndefined(y)){if(!M.isUndefined(m))return i(void 0,m)}else return i(void 0,y)}function d(m,y,v){if(v in e)return i(m,y);if(v in t)return i(void 0,m)}const h={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d,headers:(m,y,v)=>o(Rg(m),Rg(y),v,!0)};return M.forEach(Object.keys({...t,...e}),function(y){const v=h[y]||o,w=v(t[y],e[y],y);M.isUndefined(w)&&v!==d||(n[y]=w)}),n}const cv=t=>{const e=Er({},t);let{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:l,headers:u,auth:d}=e;if(e.headers=u=kt.from(u),e.url=sv(uv(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&u.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),M.isFormData(n)){if(ft.hasStandardBrowserEnv||ft.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(M.isFunction(n.getHeaders)){const h=n.getHeaders(),m=["content-type","content-length"];Object.entries(h).forEach(([y,v])=>{m.includes(y.toLowerCase())&&u.set(y,v)})}}if(ft.hasStandardBrowserEnv&&(i&&M.isFunction(i)&&(i=i(e)),i||i!==!1&&d2(e.url))){const h=o&&l&&h2.read(l);h&&u.set(o,h)}return e},m2=typeof XMLHttpRequest<"u",g2=m2&&function(t){return new Promise(function(n,i){const o=cv(t);let l=o.data;const u=kt.from(o.headers).normalize();let{responseType:d,onUploadProgress:h,onDownloadProgress:m}=o,y,v,w,_,b;function S(){_&&_(),b&&b(),o.cancelToken&&o.cancelToken.unsubscribe(y),o.signal&&o.signal.removeEventListener("abort",y)}let k=new XMLHttpRequest;k.open(o.method.toUpperCase(),o.url,!0),k.timeout=o.timeout;function E(){if(!k)return;const N=kt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),V={data:!d||d==="text"||d==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:N,config:t,request:k};lv(function($){n($),S()},function($){i($),S()},V),k=null}"onloadend"in k?k.onloadend=E:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(E)},k.onabort=function(){k&&(i(new ye("Request aborted",ye.ECONNABORTED,t,k)),k=null)},k.onerror=function(U){const V=U&&U.message?U.message:"Network Error",z=new ye(V,ye.ERR_NETWORK,t,k);z.event=U||null,i(z),k=null},k.ontimeout=function(){let U=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const V=o.transitional||iv;o.timeoutErrorMessage&&(U=o.timeoutErrorMessage),i(new ye(U,V.clarifyTimeoutError?ye.ETIMEDOUT:ye.ECONNABORTED,t,k)),k=null},l===void 0&&u.setContentType(null),"setRequestHeader"in k&&M.forEach(u.toJSON(),function(U,V){k.setRequestHeader(V,U)}),M.isUndefined(o.withCredentials)||(k.withCredentials=!!o.withCredentials),d&&d!=="json"&&(k.responseType=o.responseType),m&&([w,b]=Aa(m,!0),k.addEventListener("progress",w)),h&&k.upload&&([v,_]=Aa(h),k.upload.addEventListener("progress",v),k.upload.addEventListener("loadend",_)),(o.cancelToken||o.signal)&&(y=N=>{k&&(i(!N||N.type?new _s(null,t,k):N),k.abort(),k=null)},o.cancelToken&&o.cancelToken.subscribe(y),o.signal&&(o.signal.aborted?y():o.signal.addEventListener("abort",y)));const P=l2(o.url);if(P&&ft.protocols.indexOf(P)===-1){i(new ye("Unsupported protocol "+P+":",ye.ERR_BAD_REQUEST,t));return}k.send(l||null)})},y2=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let i=new AbortController,o;const l=function(m){if(!o){o=!0,d();const y=m instanceof Error?m:this.reason;i.abort(y instanceof ye?y:new _s(y instanceof Error?y.message:y))}};let u=e&&setTimeout(()=>{u=null,l(new ye(`timeout ${e} of ms exceeded`,ye.ETIMEDOUT))},e);const d=()=>{t&&(u&&clearTimeout(u),u=null,t.forEach(m=>{m.unsubscribe?m.unsubscribe(l):m.removeEventListener("abort",l)}),t=null)};t.forEach(m=>m.addEventListener("abort",l));const{signal:h}=i;return h.unsubscribe=()=>M.asap(d),h}},v2=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let i=0,o;for(;i<n;)o=i+e,yield t.slice(i,o),i=o},w2=async function*(t,e){for await(const n of x2(t))yield*v2(n,e)},x2=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:i}=await e.read();if(n)break;yield i}}finally{await e.cancel()}},Og=(t,e,n,i)=>{const o=w2(t,e);let l=0,u,d=h=>{u||(u=!0,i&&i(h))};return new ReadableStream({async pull(h){try{const{done:m,value:y}=await o.next();if(m){d(),h.close();return}let v=y.byteLength;if(n){let w=l+=v;n(w)}h.enqueue(new Uint8Array(y))}catch(m){throw d(m),m}},cancel(h){return d(h),o.return()}},{highWaterMark:2})},Ig=64*1024,{isFunction:ua}=M,b2=(({Request:t,Response:e})=>({Request:t,Response:e}))(M.global),{ReadableStream:Dg,TextEncoder:Lg}=M.global,Mg=(t,...e)=>{try{return!!t(...e)}catch{return!1}},_2=t=>{t=M.merge.call({skipUndefined:!0},b2,t);const{fetch:e,Request:n,Response:i}=t,o=e?ua(e):typeof fetch=="function",l=ua(n),u=ua(i);if(!o)return!1;const d=o&&ua(Dg),h=o&&(typeof Lg=="function"?(b=>S=>b.encode(S))(new Lg):async b=>new Uint8Array(await new n(b).arrayBuffer())),m=l&&d&&Mg(()=>{let b=!1;const S=new n(ft.origin,{body:new Dg,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!S}),y=u&&d&&Mg(()=>M.isReadableStream(new i("").body)),v={stream:y&&(b=>b.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!v[b]&&(v[b]=(S,k)=>{let E=S&&S[b];if(E)return E.call(S);throw new ye(`Response type '${b}' is not supported`,ye.ERR_NOT_SUPPORT,k)})});const w=async b=>{if(b==null)return 0;if(M.isBlob(b))return b.size;if(M.isSpecCompliantForm(b))return(await new n(ft.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(M.isArrayBufferView(b)||M.isArrayBuffer(b))return b.byteLength;if(M.isURLSearchParams(b)&&(b=b+""),M.isString(b))return(await h(b)).byteLength},_=async(b,S)=>{const k=M.toFiniteNumber(b.getContentLength());return k??w(S)};return async b=>{let{url:S,method:k,data:E,signal:P,cancelToken:N,timeout:U,onDownloadProgress:V,onUploadProgress:z,responseType:$,headers:B,withCredentials:Y="same-origin",fetchOptions:oe}=cv(b),Te=e||fetch;$=$?($+"").toLowerCase():"text";let ve=y2([P,N&&N.toAbortSignal()],U),je=null;const xe=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let Oe;try{if(z&&m&&k!=="get"&&k!=="head"&&(Oe=await _(B,E))!==0){let j=new n(S,{method:"POST",body:E,duplex:"half"}),D;if(M.isFormData(E)&&(D=j.headers.get("content-type"))&&B.setContentType(D),j.body){const[se,ue]=Ag(Oe,Aa(Pg(z)));E=Og(j.body,Ig,se,ue)}}M.isString(Y)||(Y=Y?"include":"omit");const be=l&&"credentials"in n.prototype,pe={...oe,signal:ve,method:k.toUpperCase(),headers:B.normalize().toJSON(),body:E,duplex:"half",credentials:be?Y:void 0};je=l&&new n(S,pe);let F=await(l?Te(je,oe):Te(S,pe));const J=y&&($==="stream"||$==="response");if(y&&(V||J&&xe)){const j={};["status","statusText","headers"].forEach(fe=>{j[fe]=F[fe]});const D=M.toFiniteNumber(F.headers.get("content-length")),[se,ue]=V&&Ag(D,Aa(Pg(V),!0))||[];F=new i(Og(F.body,Ig,se,()=>{ue&&ue(),xe&&xe()}),j)}$=$||"text";let K=await v[M.findKey(v,$)||"text"](F,b);return!J&&xe&&xe(),await new Promise((j,D)=>{lv(j,D,{data:K,headers:kt.from(F.headers),status:F.status,statusText:F.statusText,config:b,request:je})})}catch(be){throw xe&&xe(),be&&be.name==="TypeError"&&/Load failed|fetch/i.test(be.message)?Object.assign(new ye("Network Error",ye.ERR_NETWORK,b,je),{cause:be.cause||be}):ye.from(be,be&&be.code,b,je)}}},S2=new Map,dv=t=>{let e=t&&t.env||{};const{fetch:n,Request:i,Response:o}=e,l=[i,o,n];let u=l.length,d=u,h,m,y=S2;for(;d--;)h=l[d],m=y.get(h),m===void 0&&y.set(h,m=d?new Map:_2(e)),y=m;return m};dv();const qd={http:VE,xhr:g2,fetch:{get:dv}};M.forEach(qd,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Ug=t=>`- ${t}`,k2=t=>M.isFunction(t)||t===null||t===!1;function E2(t,e){t=M.isArray(t)?t:[t];const{length:n}=t;let i,o;const l={};for(let u=0;u<n;u++){i=t[u];let d;if(o=i,!k2(i)&&(o=qd[(d=String(i)).toLowerCase()],o===void 0))throw new ye(`Unknown adapter '${d}'`);if(o&&(M.isFunction(o)||(o=o.get(e))))break;l[d||"#"+u]=o}if(!o){const u=Object.entries(l).map(([h,m])=>`adapter ${h} `+(m===!1?"is not supported by the environment":"is not available in the build"));let d=n?u.length>1?`since :
19
+ `+u.map(Ug).join(`
20
+ `):" "+Ug(u[0]):"as no adapter specified";throw new ye("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return o}const hv={getAdapter:E2,adapters:qd};function dc(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _s(null,t)}function $g(t){return dc(t),t.headers=kt.from(t.headers),t.data=cc.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),hv.getAdapter(t.adapter||Wi.adapter,t)(t).then(function(i){return dc(t),i.data=cc.call(t,t.transformResponse,i),i.headers=kt.from(i.headers),i},function(i){return av(i)||(dc(t),i&&i.response&&(i.response.data=cc.call(t,t.transformResponse,i.response),i.response.headers=kt.from(i.response.headers))),Promise.reject(i)})}const fv="1.13.2",Ha={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ha[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const Vg={};Ha.transitional=function(e,n,i){function o(l,u){return"[Axios v"+fv+"] Transitional option '"+l+"'"+u+(i?". "+i:"")}return(l,u,d)=>{if(e===!1)throw new ye(o(u," has been removed"+(n?" in "+n:"")),ye.ERR_DEPRECATED);return n&&!Vg[u]&&(Vg[u]=!0,console.warn(o(u," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(l,u,d):!0}};Ha.spelling=function(e){return(n,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function T2(t,e,n){if(typeof t!="object")throw new ye("options must be an object",ye.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let o=i.length;for(;o-- >0;){const l=i[o],u=e[l];if(u){const d=t[l],h=d===void 0||u(d,l,t);if(h!==!0)throw new ye("option "+l+" must be "+h,ye.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ye("Unknown option "+l,ye.ERR_BAD_OPTION)}}const xa={assertOptions:T2,validators:Ha},an=xa.validators;let _r=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Cg,response:new Cg}}async request(e,n){try{return await this._request(e,n)}catch(i){if(i instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const l=o.stack?o.stack.replace(/^.+\n/,""):"";try{i.stack?l&&!String(i.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(i.stack+=`
21
+ `+l):i.stack=l}catch{}}throw i}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Er(this.defaults,n);const{transitional:i,paramsSerializer:o,headers:l}=n;i!==void 0&&xa.assertOptions(i,{silentJSONParsing:an.transitional(an.boolean),forcedJSONParsing:an.transitional(an.boolean),clarifyTimeoutError:an.transitional(an.boolean)},!1),o!=null&&(M.isFunction(o)?n.paramsSerializer={serialize:o}:xa.assertOptions(o,{encode:an.function,serialize:an.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),xa.assertOptions(n,{baseUrl:an.spelling("baseURL"),withXsrfToken:an.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&M.merge(l.common,l[n.method]);l&&M.forEach(["delete","get","head","post","put","patch","common"],b=>{delete l[b]}),n.headers=kt.concat(u,l);const d=[];let h=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(n)===!1||(h=h&&S.synchronous,d.unshift(S.fulfilled,S.rejected))});const m=[];this.interceptors.response.forEach(function(S){m.push(S.fulfilled,S.rejected)});let y,v=0,w;if(!h){const b=[$g.bind(this),void 0];for(b.unshift(...d),b.push(...m),w=b.length,y=Promise.resolve(n);v<w;)y=y.then(b[v++],b[v++]);return y}w=d.length;let _=n;for(;v<w;){const b=d[v++],S=d[v++];try{_=b(_)}catch(k){S.call(this,k);break}}try{y=$g.call(this,_)}catch(b){return Promise.reject(b)}for(v=0,w=m.length;v<w;)y=y.then(m[v++],m[v++]);return y}getUri(e){e=Er(this.defaults,e);const n=uv(e.baseURL,e.url,e.allowAbsoluteUrls);return sv(n,e.params,e.paramsSerializer)}};M.forEach(["delete","get","head","options"],function(e){_r.prototype[e]=function(n,i){return this.request(Er(i||{},{method:e,url:n,data:(i||{}).data}))}});M.forEach(["post","put","patch"],function(e){function n(i){return function(l,u,d){return this.request(Er(d||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}_r.prototype[e]=n(),_r.prototype[e+"Form"]=n(!0)});let j2=class pv{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const i=this;this.promise.then(o=>{if(!i._listeners)return;let l=i._listeners.length;for(;l-- >0;)i._listeners[l](o);i._listeners=null}),this.promise.then=o=>{let l;const u=new Promise(d=>{i.subscribe(d),l=d}).then(o);return u.cancel=function(){i.unsubscribe(l)},u},e(function(l,u,d){i.reason||(i.reason=new _s(l,u,d),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=i=>{e.abort(i)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new pv(function(o){e=o}),cancel:e}}};function C2(t){return function(n){return t.apply(null,n)}}function N2(t){return M.isObject(t)&&t.isAxiosError===!0}const qc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(qc).forEach(([t,e])=>{qc[e]=t});function mv(t){const e=new _r(t),n=H0(_r.prototype.request,e);return M.extend(n,_r.prototype,e,{allOwnKeys:!0}),M.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return mv(Er(t,o))},n}const Re=mv(Wi);Re.Axios=_r;Re.CanceledError=_s;Re.CancelToken=j2;Re.isCancel=av;Re.VERSION=fv;Re.toFormData=Wa;Re.AxiosError=ye;Re.Cancel=Re.CanceledError;Re.all=function(e){return Promise.all(e)};Re.spread=C2;Re.isAxiosError=N2;Re.mergeConfig=Er;Re.AxiosHeaders=kt;Re.formToJSON=t=>ov(M.isHTMLForm(t)?new FormData(t):t);Re.getAdapter=hv.getAdapter;Re.HttpStatusCode=qc;Re.default=Re;const{Axios:YC,AxiosError:QC,CanceledError:XC,isCancel:ZC,CancelToken:eN,VERSION:tN,all:nN,Cancel:rN,isAxiosError:sN,spread:iN,toFormData:oN,AxiosHeaders:aN,HttpStatusCode:lN,formToJSON:uN,getAdapter:cN,mergeConfig:dN}=Re;function Ka(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(t);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(t,i[o])&&(n[i[o]]=t[i[o]]);return n}function A2(t,e,n,i){function o(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function d(y){try{m(i.next(y))}catch(v){u(v)}}function h(y){try{m(i.throw(y))}catch(v){u(v)}}function m(y){y.done?l(y.value):o(y.value).then(d,h)}m((i=i.apply(t,e||[])).next())})}const P2=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Wd extends Error{constructor(e,n="FunctionsError",i){super(e),this.name=n,this.context=i}}class R2 extends Wd{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Fg extends Wd{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Bg extends Wd{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Wc;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Wc||(Wc={}));class O2{constructor(e,{headers:n={},customFetch:i,region:o=Wc.Any}={}){this.url=e,this.headers=n,this.region=o,this.fetch=P2(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return A2(this,arguments,void 0,function*(n,i={}){var o;let l,u;try{const{headers:d,method:h,body:m,signal:y,timeout:v}=i;let w={},{region:_}=i;_||(_=this.region);const b=new URL(`${this.url}/${n}`);_&&_!=="any"&&(w["x-region"]=_,b.searchParams.set("forceFunctionRegion",_));let S;m&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",S=m):typeof m=="string"?(w["Content-Type"]="text/plain",S=m):typeof FormData<"u"&&m instanceof FormData?S=m:(w["Content-Type"]="application/json",S=JSON.stringify(m)):m&&typeof m!="string"&&!(typeof Blob<"u"&&m instanceof Blob)&&!(m instanceof ArrayBuffer)&&!(typeof FormData<"u"&&m instanceof FormData)?S=JSON.stringify(m):S=m;let k=y;v&&(u=new AbortController,l=setTimeout(()=>u.abort(),v),y?(k=u.signal,y.addEventListener("abort",()=>u.abort())):k=u.signal);const E=yield this.fetch(b.toString(),{method:h||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),d),body:S,signal:k}).catch(V=>{throw new R2(V)}),P=E.headers.get("x-relay-error");if(P&&P==="true")throw new Fg(E);if(!E.ok)throw new Bg(E);let N=((o=E.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),U;return N==="application/json"?U=yield E.json():N==="application/octet-stream"||N==="application/pdf"?U=yield E.blob():N==="text/event-stream"?U=E:N==="multipart/form-data"?U=yield E.formData():U=yield E.text(),{data:U,error:null,response:E}}catch(d){return{data:null,error:d,response:d instanceof Bg||d instanceof Fg?d.context:void 0}}finally{l&&clearTimeout(l)}})}}var I2=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},D2=class{constructor(t){var e,n;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){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 i=this.fetch;let o=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async l=>{let u=null,d=null,h=null,m=l.status,y=l.statusText;if(l.ok){var v,w;if(n.method!=="HEAD"){var _;const E=await l.text();E===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((_=n.headers.get("Accept"))===null||_===void 0)&&_.includes("application/vnd.pgrst.plan+text"))?d=E:d=JSON.parse(E))}const S=(v=n.headers.get("Prefer"))===null||v===void 0?void 0:v.match(/count=(exact|planned|estimated)/),k=(w=l.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");S&&k&&k.length>1&&(h=parseInt(k[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,h=null,m=406,y="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{var b;const S=await l.text();try{u=JSON.parse(S),Array.isArray(u)&&l.status===404&&(d=[],u=null,m=200,y="OK")}catch{l.status===404&&S===""?(m=204,y="No Content"):u={message:S}}if(u&&n.isMaybeSingle&&(!(u==null||(b=u.details)===null||b===void 0)&&b.includes("0 rows"))&&(u=null,m=200,y="OK"),u&&n.shouldThrowOnError)throw new I2(u)}return{error:u,data:d,count:h,status:m,statusText:y}});return this.shouldThrowOnError||(o=o.catch(l=>{var u;let d="";const h=l?.cause;if(h){var m,y,v,w;const b=(m=h?.message)!==null&&m!==void 0?m:"",S=(y=h?.code)!==null&&y!==void 0?y:"";d=`${(v=l?.name)!==null&&v!==void 0?v:"FetchError"}: ${l?.message}`,d+=`
22
22
 
23
23
  Caused by: ${(w=h?.name)!==null&&w!==void 0?w:"Error"}: ${b}`,S&&(d+=` (${S})`),h?.stack&&(d+=`
24
- ${h.stack}`)}else{var _;d=(_=l?.stack)!==null&&_!==void 0?_:""}return{error:{message:`${(u=l?.name)!==null&&u!==void 0?u:"FetchError"}: ${l?.message}`,details:d,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(t,e)}returns(){return this}overrideTypes(){return this}},D2=class extends I2{select(t){let e=!1;const n=(t??"*").split("").map(i=>/\s/.test(i)&&!e?"":(i==='"'&&(e=!e),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:i,referencedTable:o=i}={}){const l=o?`${o}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:i=n}={}){const o=typeof i>"u"?"offset":`${i}.offset`,l=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(o,`${t}`),this.url.searchParams.set(l,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:i=!1,wal:o=!1,format:l="text"}={}){var u;const d=[t?"analyze":null,e?"verbose":null,n?"settings":null,i?"buffers":null,o?"wal":null].filter(Boolean).join("|"),h=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${l}; for="${h}"; options=${d};`),l==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Bg=new RegExp("[,()]");var ss=class extends D2{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(i=>typeof i=="string"&&Bg.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(i=>typeof i=="string"&&Bg.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:i}={}){let o="";i==="plain"?o="pl":i==="phrase"?o="ph":i==="websearch"&&(o="w");const l=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${o}fts${l}.${e}`),this}match(t){return Object.entries(t).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},L2=class{constructor(t,{headers:e={},schema:n,fetch:i}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:n=!1,count:i}=e??{},o=n?"HEAD":"GET";let l=!1;const u=(t??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:d,headers:h}=this.cloneRequestState();return d.searchParams.set("select",u),i&&h.append("Prefer",`count=${i}`),new ss({method:o,url:d,headers:h,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:n=!0}={}){var i;const o="POST",{url:l,headers:u}=this.cloneRequestState();if(e&&u.append("Prefer",`count=${e}`),n||u.append("Prefer","missing=default"),Array.isArray(t)){const d=t.reduce((h,m)=>h.concat(Object.keys(m)),[]);if(d.length>0){const h=[...new Set(d)].map(m=>`"${m}"`);l.searchParams.set("columns",h.join(","))}}return new ss({method:o,url:l,headers:u,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:i,defaultToNull:o=!0}={}){var l;const u="POST",{url:d,headers:h}=this.cloneRequestState();if(h.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&d.searchParams.set("on_conflict",e),i&&h.append("Prefer",`count=${i}`),o||h.append("Prefer","missing=default"),Array.isArray(t)){const m=t.reduce((y,v)=>y.concat(Object.keys(v)),[]);if(m.length>0){const y=[...new Set(m)].map(v=>`"${v}"`);d.searchParams.set("columns",y.join(","))}}return new ss({method:u,url:d,headers:h,schema:this.schema,body:t,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}update(t,{count:e}={}){var n;const i="PATCH",{url:o,headers:l}=this.cloneRequestState();return e&&l.append("Prefer",`count=${e}`),new ss({method:i,url:o,headers:l,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:t}={}){var e;const n="DELETE",{url:i,headers:o}=this.cloneRequestState();return t&&o.append("Prefer",`count=${t}`),new ss({method:n,url:i,headers:o,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},M2=class mv{constructor(e,{headers:n={},schema:i,fetch:o}={}){this.url=e,this.headers=new Headers(n),this.schemaName=i,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new L2(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new mv(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:i=!1,get:o=!1,count:l}={}){var u;let d;const h=new URL(`${this.url}/rpc/${e}`);let m;const y=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(y)),v=i&&Object.values(n).some(y);v?(d="POST",m=n):i||o?(d=i?"HEAD":"GET",Object.entries(n).filter(([_,b])=>b!==void 0).map(([_,b])=>[_,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([_,b])=>{h.searchParams.append(_,b)})):(d="POST",m=n);const w=new Headers(this.headers);return v?w.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&w.set("Prefer",`count=${l}`),new ss({method:d,url:h,headers:w,schema:this.schemaName,body:m,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};class U2{constructor(){}static detectEnvironment(){var e;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"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.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 i=n.versions;if(i&&i.node){const o=i.node,l=parseInt(o.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
24
+ ${h.stack}`)}else{var _;d=(_=l?.stack)!==null&&_!==void 0?_:""}return{error:{message:`${(u=l?.name)!==null&&u!==void 0?u:"FetchError"}: ${l?.message}`,details:d,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(t,e)}returns(){return this}overrideTypes(){return this}},L2=class extends D2{select(t){let e=!1;const n=(t??"*").split("").map(i=>/\s/.test(i)&&!e?"":(i==='"'&&(e=!e),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:i,referencedTable:o=i}={}){const l=o?`${o}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:i=n}={}){const o=typeof i>"u"?"offset":`${i}.offset`,l=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(o,`${t}`),this.url.searchParams.set(l,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:i=!1,wal:o=!1,format:l="text"}={}){var u;const d=[t?"analyze":null,e?"verbose":null,n?"settings":null,i?"buffers":null,o?"wal":null].filter(Boolean).join("|"),h=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${l}; for="${h}"; options=${d};`),l==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const zg=new RegExp("[,()]");var ss=class extends L2{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(i=>typeof i=="string"&&zg.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(i=>typeof i=="string"&&zg.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:i}={}){let o="";i==="plain"?o="pl":i==="phrase"?o="ph":i==="websearch"&&(o="w");const l=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${o}fts${l}.${e}`),this}match(t){return Object.entries(t).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},M2=class{constructor(t,{headers:e={},schema:n,fetch:i}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:n=!1,count:i}=e??{},o=n?"HEAD":"GET";let l=!1;const u=(t??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:d,headers:h}=this.cloneRequestState();return d.searchParams.set("select",u),i&&h.append("Prefer",`count=${i}`),new ss({method:o,url:d,headers:h,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:n=!0}={}){var i;const o="POST",{url:l,headers:u}=this.cloneRequestState();if(e&&u.append("Prefer",`count=${e}`),n||u.append("Prefer","missing=default"),Array.isArray(t)){const d=t.reduce((h,m)=>h.concat(Object.keys(m)),[]);if(d.length>0){const h=[...new Set(d)].map(m=>`"${m}"`);l.searchParams.set("columns",h.join(","))}}return new ss({method:o,url:l,headers:u,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:i,defaultToNull:o=!0}={}){var l;const u="POST",{url:d,headers:h}=this.cloneRequestState();if(h.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&d.searchParams.set("on_conflict",e),i&&h.append("Prefer",`count=${i}`),o||h.append("Prefer","missing=default"),Array.isArray(t)){const m=t.reduce((y,v)=>y.concat(Object.keys(v)),[]);if(m.length>0){const y=[...new Set(m)].map(v=>`"${v}"`);d.searchParams.set("columns",y.join(","))}}return new ss({method:u,url:d,headers:h,schema:this.schema,body:t,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}update(t,{count:e}={}){var n;const i="PATCH",{url:o,headers:l}=this.cloneRequestState();return e&&l.append("Prefer",`count=${e}`),new ss({method:i,url:o,headers:l,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:t}={}){var e;const n="DELETE",{url:i,headers:o}=this.cloneRequestState();return t&&o.append("Prefer",`count=${t}`),new ss({method:n,url:i,headers:o,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},U2=class gv{constructor(e,{headers:n={},schema:i,fetch:o}={}){this.url=e,this.headers=new Headers(n),this.schemaName=i,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new M2(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new gv(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:i=!1,get:o=!1,count:l}={}){var u;let d;const h=new URL(`${this.url}/rpc/${e}`);let m;const y=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(y)),v=i&&Object.values(n).some(y);v?(d="POST",m=n):i||o?(d=i?"HEAD":"GET",Object.entries(n).filter(([_,b])=>b!==void 0).map(([_,b])=>[_,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([_,b])=>{h.searchParams.append(_,b)})):(d="POST",m=n);const w=new Headers(this.headers);return v?w.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&w.set("Prefer",`count=${l}`),new ss({method:d,url:h,headers:w,schema:this.schemaName,body:m,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};class $2{constructor(){}static detectEnvironment(){var e;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"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.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 i=n.versions;if(i&&i.node){const o=i.node,l=parseInt(o.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
25
25
  import ws from "ws"
26
26
  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 e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=`
27
27
 
28
- Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const i=this.getWebSocketConstructor();return new i(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const $2="2.91.0",V2=`realtime-js/${$2}`,F2="1.0.0",gv="2.0.0",zg=gv,Hc=1e4,B2=1e3,z2=100;var Hn;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(Hn||(Hn={}));var Ze;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ze||(Ze={}));var Zt;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Zt||(Zt={}));var Kc;(function(t){t.websocket="websocket"})(Kc||(Kc={}));var gr;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(gr||(gr={}));class q2{constructor(e){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=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(i))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,i;const o=(i=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&i!==void 0?i:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(e){var n,i;const o=(i=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&i!==void 0?i:{},u=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(e,n,i){var o,l;const u=e.topic,d=(o=e.ref)!==null&&o!==void 0?o:"",h=(l=e.join_ref)!==null&&l!==void 0?l:"",m=e.payload.event,y=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},v=Object.keys(y).length===0?"":JSON.stringify(y);if(h.length>255)throw new Error(`joinRef length ${h.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`ref length ${d.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`topic length ${u.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`userEvent length ${m.length} exceeds maximum of 255`);if(v.length>255)throw new Error(`metadata length ${v.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+h.length+d.length+u.length+m.length+v.length,_=new ArrayBuffer(this.HEADER_LENGTH+w);let b=new DataView(_),S=0;b.setUint8(S++,this.KINDS.userBroadcastPush),b.setUint8(S++,h.length),b.setUint8(S++,d.length),b.setUint8(S++,u.length),b.setUint8(S++,m.length),b.setUint8(S++,v.length),b.setUint8(S++,n),Array.from(h,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(d,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(u,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(m,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(v,E=>b.setUint8(S++,E.charCodeAt(0)));var k=new Uint8Array(_.byteLength+i.byteLength);return k.set(new Uint8Array(_),0),k.set(new Uint8Array(i),_.byteLength),k.buffer}decode(e,n){if(this._isArrayBuffer(e)){let i=this._binaryDecode(e);return n(i)}if(typeof e=="string"){const i=JSON.parse(e),[o,l,u,d,h]=i;return n({join_ref:o,ref:l,topic:u,event:d,payload:h})}return n({})}_binaryDecode(e){const n=new DataView(e),i=n.getUint8(0),o=new TextDecoder;if(i===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,n,o)}_decodeUserBroadcast(e,n,i){const o=n.getUint8(1),l=n.getUint8(2),u=n.getUint8(3),d=n.getUint8(4);let h=this.HEADER_LENGTH+4;const m=i.decode(e.slice(h,h+o));h=h+o;const y=i.decode(e.slice(h,h+l));h=h+l;const v=i.decode(e.slice(h,h+u));h=h+u;const w=e.slice(h,e.byteLength),_=d===this.JSON_ENCODING?JSON.parse(i.decode(w)):w,b={type:this.BROADCAST_EVENT,event:y,payload:_};return u>0&&(b.meta=JSON.parse(v)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([i])=>n.includes(i)))}}class yv{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,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 Pe;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Pe||(Pe={}));const qg=(t,e,n={})=>{var i;const o=(i=n.skipTypes)!==null&&i!==void 0?i:[];return e?Object.keys(e).reduce((l,u)=>(l[u]=W2(u,t,e,o),l),{}):{}},W2=(t,e,n,i)=>{const o=e.find(d=>d.name===t),l=o?.type,u=n[t];return l&&!i.includes(l)?vv(l,u):Gc(u)},vv=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return J2(e,n)}switch(t){case Pe.bool:return H2(e);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return K2(e);case Pe.json:case Pe.jsonb:return G2(e);case Pe.timestamp:return Y2(e);case Pe.abstime:case Pe.date:case Pe.daterange:case Pe.int4range:case Pe.int8range:case Pe.money:case Pe.reltime:case Pe.text:case Pe.time:case Pe.timestamptz:case Pe.timetz:case Pe.tsrange:case Pe.tstzrange:return Gc(e);default:return Gc(e)}},Gc=t=>t,H2=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},K2=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},G2=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},J2=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,i=t[n];if(t[0]==="{"&&i==="}"){let l;const u=t.slice(1,n);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(d=>vv(e,d))}return t},Y2=t=>typeof t=="string"?t.replace(" ","T"):t,wv=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class hc{constructor(e,n,i={},o=Hc){this.channel=e,this.event=n,this.payload=i,this.timeout=o,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,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(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var i;return this._hasReceived(e)&&n((i=this.receivedResp)===null||i===void 0?void 0:i.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,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:e,response:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Wg;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Wg||(Wg={}));class xi{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const i=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(i.state,{},o=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel._joinRef(),this.state=xi.syncState(this.state,o,l,u),this.pendingDiffs.forEach(h=>{this.state=xi.syncDiff(this.state,h,l,u)}),this.pendingDiffs=[],d()}),this.channel._on(i.diff,{},o=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=xi.syncDiff(this.state,o,l,u),d())}),this.onJoin((o,l,u)=>{this.channel._trigger("presence",{event:"join",key:o,currentPresences:l,newPresences:u})}),this.onLeave((o,l,u)=>{this.channel._trigger("presence",{event:"leave",key:o,currentPresences:l,leftPresences:u})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,i,o){const l=this.cloneDeep(e),u=this.transformState(n),d={},h={};return this.map(l,(m,y)=>{u[m]||(h[m]=y)}),this.map(u,(m,y)=>{const v=l[m];if(v){const w=y.map(k=>k.presence_ref),_=v.map(k=>k.presence_ref),b=y.filter(k=>_.indexOf(k.presence_ref)<0),S=v.filter(k=>w.indexOf(k.presence_ref)<0);b.length>0&&(d[m]=b),S.length>0&&(h[m]=S)}else d[m]=y}),this.syncDiff(l,{joins:d,leaves:h},i,o)}static syncDiff(e,n,i,o){const{joins:l,leaves:u}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return i||(i=()=>{}),o||(o=()=>{}),this.map(l,(d,h)=>{var m;const y=(m=e[d])!==null&&m!==void 0?m:[];if(e[d]=this.cloneDeep(h),y.length>0){const v=e[d].map(_=>_.presence_ref),w=y.filter(_=>v.indexOf(_.presence_ref)<0);e[d].unshift(...w)}i(d,y,h)}),this.map(u,(d,h)=>{let m=e[d];if(!m)return;const y=h.map(v=>v.presence_ref);m=m.filter(v=>y.indexOf(v.presence_ref)<0),e[d]=m,o(d,m,h),m.length===0&&delete e[d]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(i=>n(i,e[i]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,i)=>{const o=e[i];return"metas"in o?n[i]=o.metas.map(l=>(l.presence_ref=l.phx_ref,delete l.phx_ref,delete l.phx_ref_prev,l)):n[i]=o,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Hg;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Hg||(Hg={}));var bi;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(bi||(bi={}));var wn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(wn||(wn={}));class hs{constructor(e,n={config:{}},i){var o,l;if(this.topic=e,this.params=n,this.socket=i,this.bindings={},this.state=Ze.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.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 hc(this,Zt.join,this.params,this.timeout),this.rejoinTimer=new yv(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ze.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(u=>u.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ze.closed,this.socket._remove(this)}),this._onError(u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Zt.reply,{},(u,d)=>{this._trigger(this._replyEventName(d),u)}),this.presence=new xi(this),this.broadcastEndpointURL=wv(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((l=(o=this.params.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var i,o,l;if(this.socket.isConnected()||this.socket.connect(),this.state==Ze.closed){const{config:{broadcast:u,presence:d,private:h}}=this.params,m=(o=(i=this.bindings.postgres_changes)===null||i===void 0?void 0:i.map(_=>_.filter))!==null&&o!==void 0?o:[],y=!!this.bindings[bi.PRESENCE]&&this.bindings[bi.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,v={},w={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:y}),postgres_changes:m,private:h};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(_=>e?.(wn.CHANNEL_ERROR,_)),this._onClose(()=>e?.(wn.CLOSED)),this.updateJoinPayload(Object.assign({config:w},v)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:_})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){e?.(wn.SUBSCRIBED);return}else{const S=this.bindings.postgres_changes,k=(b=S?.length)!==null&&b!==void 0?b:0,E=[];for(let P=0;P<k;P++){const N=S[P],{filter:{event:U,schema:V,table:z,filter:$}}=N,B=_&&_[P];if(B&&B.event===U&&hs.isFilterValueEqual(B.schema,V)&&hs.isFilterValueEqual(B.table,z)&&hs.isFilterValueEqual(B.filter,$))E.push(Object.assign(Object.assign({},N),{id:B.id}));else{this.unsubscribe(),this.state=Ze.errored,e?.(wn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(wn.SUBSCRIBED);return}}).receive("error",_=>{this.state=Ze.errored,e?.(wn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(_).join(", ")||"error")))}).receive("timeout",()=>{e?.(wn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,i){return this.state===Ze.joined&&e===bi.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(e,n,i)}async httpSend(e,n,i={}){var o;if(n==null)return Promise.reject("Payload is required for httpSend()");const l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(o=i.timeout)!==null&&o!==void 0?o:this.timeout);if(d.status===202)return{success:!0};let h=d.statusText;try{const m=await d.json();h=m.error||m.message||h}catch{}return Promise.reject(new Error(h))}async send(e,n={}){var i,o;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:l,payload:u}=e,d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:l,payload:u,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);return await((o=m.body)===null||o===void 0?void 0:o.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,h;const m=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((h=(d=(u=this.params)===null||u===void 0?void 0:u.config)===null||d===void 0?void 0:d.broadcast)===null||h===void 0)&&h.ack)&&l("ok"),m.receive("ok",()=>l("ok")),m.receive("error",()=>l("error")),m.receive("timeout",()=>l("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ze.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Zt.close,"leave",this._joinRef())};this.joinPush.destroy();let i=null;return new Promise(o=>{i=new hc(this,Zt.leave,{},e),i.receive("ok",()=>{n(),o("ok")}).receive("timeout",()=>{n(),o("timed out")}).receive("error",()=>{o("error")}),i.send(),this._canPush()||i.trigger("ok",{})}).finally(()=>{i?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ze.closed,this.bindings={}}async _fetchWithTimeout(e,n,i){const o=new AbortController,l=setTimeout(()=>o.abort(),i),u=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:o.signal}));return clearTimeout(l),u}_push(e,n,i=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let o=new hc(this,e,n,i);return this._canPush()?o.send():this._addToPushBuffer(o),o}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>z2){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,i){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,i){var o,l;const u=e.toLocaleLowerCase(),{close:d,error:h,leave:m,join:y}=Zt;if(i&&[d,h,m,y].indexOf(u)>=0&&i!==this._joinRef())return;let w=this._onMessage(u,n,i);if(n&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(u)?(o=this.bindings.postgres_changes)===null||o===void 0||o.filter(_=>{var b,S,k;return((b=_.filter)===null||b===void 0?void 0:b.event)==="*"||((k=(S=_.filter)===null||S===void 0?void 0:S.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===u}).map(_=>_.callback(w,i)):(l=this.bindings[u])===null||l===void 0||l.filter(_=>{var b,S,k,E,P,N,U,V;if(["broadcast","presence","postgres_changes"].includes(u))if("id"in _){const z=_.id,$=(b=_.filter)===null||b===void 0?void 0:b.event;return z&&((S=n.ids)===null||S===void 0?void 0:S.includes(z))&&($==="*"||$?.toLocaleLowerCase()===((k=n.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))&&(!(!((E=_.filter)===null||E===void 0)&&E.table)||_.filter.table===((P=n.data)===null||P===void 0?void 0:P.table))}else{const z=(U=(N=_?.filter)===null||N===void 0?void 0:N.event)===null||U===void 0?void 0:U.toLocaleLowerCase();return z==="*"||z===((V=n?.event)===null||V===void 0?void 0:V.toLocaleLowerCase())}else return _.type.toLocaleLowerCase()===u}).map(_=>{if(typeof w=="object"&&"ids"in w){const b=w.data,{schema:S,table:k,commit_timestamp:E,type:P,errors:N}=b;w=Object.assign(Object.assign({},{schema:S,table:k,commit_timestamp:E,eventType:P,new:{},old:{},errors:N}),this._getPayloadRecords(b))}_.callback(w,i)})}_isClosed(){return this.state===Ze.closed}_isJoined(){return this.state===Ze.joined}_isJoining(){return this.state===Ze.joining}_isLeaving(){return this.state===Ze.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,i){const o=e.toLocaleLowerCase(),l={type:o,filter:n,callback:i};return this.bindings[o]?this.bindings[o].push(l):this.bindings[o]=[l],this}_off(e,n){const i=e.toLocaleLowerCase();return this.bindings[i]&&(this.bindings[i]=this.bindings[i].filter(o=>{var l;return!(((l=o.type)===null||l===void 0?void 0:l.toLocaleLowerCase())===i&&hs.isEqual(o.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const i in e)if(e[i]!==n[i])return!1;return!0}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Zt.close,{},e)}_onError(e){this._on(Zt.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ze.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=qg(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=qg(e.columns,e.old_record)),n}}const fc=()=>{},ua={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Q2=[1e3,2e3,5e3,1e4],X2=1e4,Z2=`
28
+ Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const i=this.getWebSocketConstructor();return new i(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const V2="2.91.0",F2=`realtime-js/${V2}`,B2="1.0.0",yv="2.0.0",qg=yv,Hc=1e4,z2=1e3,q2=100;var Hn;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(Hn||(Hn={}));var Ze;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ze||(Ze={}));var Zt;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Zt||(Zt={}));var Kc;(function(t){t.websocket="websocket"})(Kc||(Kc={}));var gr;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(gr||(gr={}));class W2{constructor(e){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=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(i))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,i;const o=(i=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&i!==void 0?i:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(e){var n,i;const o=(i=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&i!==void 0?i:{},u=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(e,n,i){var o,l;const u=e.topic,d=(o=e.ref)!==null&&o!==void 0?o:"",h=(l=e.join_ref)!==null&&l!==void 0?l:"",m=e.payload.event,y=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},v=Object.keys(y).length===0?"":JSON.stringify(y);if(h.length>255)throw new Error(`joinRef length ${h.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`ref length ${d.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`topic length ${u.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`userEvent length ${m.length} exceeds maximum of 255`);if(v.length>255)throw new Error(`metadata length ${v.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+h.length+d.length+u.length+m.length+v.length,_=new ArrayBuffer(this.HEADER_LENGTH+w);let b=new DataView(_),S=0;b.setUint8(S++,this.KINDS.userBroadcastPush),b.setUint8(S++,h.length),b.setUint8(S++,d.length),b.setUint8(S++,u.length),b.setUint8(S++,m.length),b.setUint8(S++,v.length),b.setUint8(S++,n),Array.from(h,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(d,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(u,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(m,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(v,E=>b.setUint8(S++,E.charCodeAt(0)));var k=new Uint8Array(_.byteLength+i.byteLength);return k.set(new Uint8Array(_),0),k.set(new Uint8Array(i),_.byteLength),k.buffer}decode(e,n){if(this._isArrayBuffer(e)){let i=this._binaryDecode(e);return n(i)}if(typeof e=="string"){const i=JSON.parse(e),[o,l,u,d,h]=i;return n({join_ref:o,ref:l,topic:u,event:d,payload:h})}return n({})}_binaryDecode(e){const n=new DataView(e),i=n.getUint8(0),o=new TextDecoder;if(i===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,n,o)}_decodeUserBroadcast(e,n,i){const o=n.getUint8(1),l=n.getUint8(2),u=n.getUint8(3),d=n.getUint8(4);let h=this.HEADER_LENGTH+4;const m=i.decode(e.slice(h,h+o));h=h+o;const y=i.decode(e.slice(h,h+l));h=h+l;const v=i.decode(e.slice(h,h+u));h=h+u;const w=e.slice(h,e.byteLength),_=d===this.JSON_ENCODING?JSON.parse(i.decode(w)):w,b={type:this.BROADCAST_EVENT,event:y,payload:_};return u>0&&(b.meta=JSON.parse(v)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([i])=>n.includes(i)))}}class vv{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,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 Pe;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Pe||(Pe={}));const Wg=(t,e,n={})=>{var i;const o=(i=n.skipTypes)!==null&&i!==void 0?i:[];return e?Object.keys(e).reduce((l,u)=>(l[u]=H2(u,t,e,o),l),{}):{}},H2=(t,e,n,i)=>{const o=e.find(d=>d.name===t),l=o?.type,u=n[t];return l&&!i.includes(l)?wv(l,u):Gc(u)},wv=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return Y2(e,n)}switch(t){case Pe.bool:return K2(e);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return G2(e);case Pe.json:case Pe.jsonb:return J2(e);case Pe.timestamp:return Q2(e);case Pe.abstime:case Pe.date:case Pe.daterange:case Pe.int4range:case Pe.int8range:case Pe.money:case Pe.reltime:case Pe.text:case Pe.time:case Pe.timestamptz:case Pe.timetz:case Pe.tsrange:case Pe.tstzrange:return Gc(e);default:return Gc(e)}},Gc=t=>t,K2=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},G2=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},J2=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Y2=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,i=t[n];if(t[0]==="{"&&i==="}"){let l;const u=t.slice(1,n);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(d=>wv(e,d))}return t},Q2=t=>typeof t=="string"?t.replace(" ","T"):t,xv=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class hc{constructor(e,n,i={},o=Hc){this.channel=e,this.event=n,this.payload=i,this.timeout=o,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,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(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var i;return this._hasReceived(e)&&n((i=this.receivedResp)===null||i===void 0?void 0:i.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,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:e,response:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Hg;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Hg||(Hg={}));class xi{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const i=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(i.state,{},o=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel._joinRef(),this.state=xi.syncState(this.state,o,l,u),this.pendingDiffs.forEach(h=>{this.state=xi.syncDiff(this.state,h,l,u)}),this.pendingDiffs=[],d()}),this.channel._on(i.diff,{},o=>{const{onJoin:l,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=xi.syncDiff(this.state,o,l,u),d())}),this.onJoin((o,l,u)=>{this.channel._trigger("presence",{event:"join",key:o,currentPresences:l,newPresences:u})}),this.onLeave((o,l,u)=>{this.channel._trigger("presence",{event:"leave",key:o,currentPresences:l,leftPresences:u})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,i,o){const l=this.cloneDeep(e),u=this.transformState(n),d={},h={};return this.map(l,(m,y)=>{u[m]||(h[m]=y)}),this.map(u,(m,y)=>{const v=l[m];if(v){const w=y.map(k=>k.presence_ref),_=v.map(k=>k.presence_ref),b=y.filter(k=>_.indexOf(k.presence_ref)<0),S=v.filter(k=>w.indexOf(k.presence_ref)<0);b.length>0&&(d[m]=b),S.length>0&&(h[m]=S)}else d[m]=y}),this.syncDiff(l,{joins:d,leaves:h},i,o)}static syncDiff(e,n,i,o){const{joins:l,leaves:u}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return i||(i=()=>{}),o||(o=()=>{}),this.map(l,(d,h)=>{var m;const y=(m=e[d])!==null&&m!==void 0?m:[];if(e[d]=this.cloneDeep(h),y.length>0){const v=e[d].map(_=>_.presence_ref),w=y.filter(_=>v.indexOf(_.presence_ref)<0);e[d].unshift(...w)}i(d,y,h)}),this.map(u,(d,h)=>{let m=e[d];if(!m)return;const y=h.map(v=>v.presence_ref);m=m.filter(v=>y.indexOf(v.presence_ref)<0),e[d]=m,o(d,m,h),m.length===0&&delete e[d]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(i=>n(i,e[i]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,i)=>{const o=e[i];return"metas"in o?n[i]=o.metas.map(l=>(l.presence_ref=l.phx_ref,delete l.phx_ref,delete l.phx_ref_prev,l)):n[i]=o,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Kg;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Kg||(Kg={}));var bi;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(bi||(bi={}));var wn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(wn||(wn={}));class hs{constructor(e,n={config:{}},i){var o,l;if(this.topic=e,this.params=n,this.socket=i,this.bindings={},this.state=Ze.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.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 hc(this,Zt.join,this.params,this.timeout),this.rejoinTimer=new vv(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ze.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(u=>u.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ze.closed,this.socket._remove(this)}),this._onError(u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=Ze.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Zt.reply,{},(u,d)=>{this._trigger(this._replyEventName(d),u)}),this.presence=new xi(this),this.broadcastEndpointURL=xv(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((l=(o=this.params.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var i,o,l;if(this.socket.isConnected()||this.socket.connect(),this.state==Ze.closed){const{config:{broadcast:u,presence:d,private:h}}=this.params,m=(o=(i=this.bindings.postgres_changes)===null||i===void 0?void 0:i.map(_=>_.filter))!==null&&o!==void 0?o:[],y=!!this.bindings[bi.PRESENCE]&&this.bindings[bi.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,v={},w={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:y}),postgres_changes:m,private:h};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(_=>e?.(wn.CHANNEL_ERROR,_)),this._onClose(()=>e?.(wn.CLOSED)),this.updateJoinPayload(Object.assign({config:w},v)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:_})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){e?.(wn.SUBSCRIBED);return}else{const S=this.bindings.postgres_changes,k=(b=S?.length)!==null&&b!==void 0?b:0,E=[];for(let P=0;P<k;P++){const N=S[P],{filter:{event:U,schema:V,table:z,filter:$}}=N,B=_&&_[P];if(B&&B.event===U&&hs.isFilterValueEqual(B.schema,V)&&hs.isFilterValueEqual(B.table,z)&&hs.isFilterValueEqual(B.filter,$))E.push(Object.assign(Object.assign({},N),{id:B.id}));else{this.unsubscribe(),this.state=Ze.errored,e?.(wn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(wn.SUBSCRIBED);return}}).receive("error",_=>{this.state=Ze.errored,e?.(wn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(_).join(", ")||"error")))}).receive("timeout",()=>{e?.(wn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,i){return this.state===Ze.joined&&e===bi.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(e,n,i)}async httpSend(e,n,i={}){var o;if(n==null)return Promise.reject("Payload is required for httpSend()");const l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(o=i.timeout)!==null&&o!==void 0?o:this.timeout);if(d.status===202)return{success:!0};let h=d.statusText;try{const m=await d.json();h=m.error||m.message||h}catch{}return Promise.reject(new Error(h))}async send(e,n={}){var i,o;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:l,payload:u}=e,d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:l,payload:u,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);return await((o=m.body)===null||o===void 0?void 0:o.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,h;const m=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((h=(d=(u=this.params)===null||u===void 0?void 0:u.config)===null||d===void 0?void 0:d.broadcast)===null||h===void 0)&&h.ack)&&l("ok"),m.receive("ok",()=>l("ok")),m.receive("error",()=>l("error")),m.receive("timeout",()=>l("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ze.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Zt.close,"leave",this._joinRef())};this.joinPush.destroy();let i=null;return new Promise(o=>{i=new hc(this,Zt.leave,{},e),i.receive("ok",()=>{n(),o("ok")}).receive("timeout",()=>{n(),o("timed out")}).receive("error",()=>{o("error")}),i.send(),this._canPush()||i.trigger("ok",{})}).finally(()=>{i?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ze.closed,this.bindings={}}async _fetchWithTimeout(e,n,i){const o=new AbortController,l=setTimeout(()=>o.abort(),i),u=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:o.signal}));return clearTimeout(l),u}_push(e,n,i=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let o=new hc(this,e,n,i);return this._canPush()?o.send():this._addToPushBuffer(o),o}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>q2){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,i){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,i){var o,l;const u=e.toLocaleLowerCase(),{close:d,error:h,leave:m,join:y}=Zt;if(i&&[d,h,m,y].indexOf(u)>=0&&i!==this._joinRef())return;let w=this._onMessage(u,n,i);if(n&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(u)?(o=this.bindings.postgres_changes)===null||o===void 0||o.filter(_=>{var b,S,k;return((b=_.filter)===null||b===void 0?void 0:b.event)==="*"||((k=(S=_.filter)===null||S===void 0?void 0:S.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===u}).map(_=>_.callback(w,i)):(l=this.bindings[u])===null||l===void 0||l.filter(_=>{var b,S,k,E,P,N,U,V;if(["broadcast","presence","postgres_changes"].includes(u))if("id"in _){const z=_.id,$=(b=_.filter)===null||b===void 0?void 0:b.event;return z&&((S=n.ids)===null||S===void 0?void 0:S.includes(z))&&($==="*"||$?.toLocaleLowerCase()===((k=n.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))&&(!(!((E=_.filter)===null||E===void 0)&&E.table)||_.filter.table===((P=n.data)===null||P===void 0?void 0:P.table))}else{const z=(U=(N=_?.filter)===null||N===void 0?void 0:N.event)===null||U===void 0?void 0:U.toLocaleLowerCase();return z==="*"||z===((V=n?.event)===null||V===void 0?void 0:V.toLocaleLowerCase())}else return _.type.toLocaleLowerCase()===u}).map(_=>{if(typeof w=="object"&&"ids"in w){const b=w.data,{schema:S,table:k,commit_timestamp:E,type:P,errors:N}=b;w=Object.assign(Object.assign({},{schema:S,table:k,commit_timestamp:E,eventType:P,new:{},old:{},errors:N}),this._getPayloadRecords(b))}_.callback(w,i)})}_isClosed(){return this.state===Ze.closed}_isJoined(){return this.state===Ze.joined}_isJoining(){return this.state===Ze.joining}_isLeaving(){return this.state===Ze.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,i){const o=e.toLocaleLowerCase(),l={type:o,filter:n,callback:i};return this.bindings[o]?this.bindings[o].push(l):this.bindings[o]=[l],this}_off(e,n){const i=e.toLocaleLowerCase();return this.bindings[i]&&(this.bindings[i]=this.bindings[i].filter(o=>{var l;return!(((l=o.type)===null||l===void 0?void 0:l.toLocaleLowerCase())===i&&hs.isEqual(o.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const i in e)if(e[i]!==n[i])return!1;return!0}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Zt.close,{},e)}_onError(e){this._on(Zt.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ze.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Wg(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Wg(e.columns,e.old_record)),n}}const fc=()=>{},ca={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},X2=[1e3,2e3,5e3,1e4],Z2=1e4,eT=`
29
29
  addEventListener("message", (e) => {
30
30
  if (e.data.event === "start") {
31
31
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
32
32
  }
33
- });`;class eT{constructor(e,n){var i;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Hc,this.transport=null,this.heartbeatIntervalMs=ua.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=fc,this.ref=0,this.reconnectTimer=null,this.vsn=zg,this.logger=fc,this.conn=null,this.sendBuffer=[],this.serializer=new q2,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=o=>o?(...l)=>o(...l):(...l)=>fetch(...l),!(!((i=n?.params)===null||i===void 0)&&i.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Kc.websocket}`,this.httpEndpoint=wv(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(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=U2.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
33
+ });`;class tT{constructor(e,n){var i;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Hc,this.transport=null,this.heartbeatIntervalMs=ca.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=fc,this.ref=0,this.reconnectTimer=null,this.vsn=qg,this.logger=fc,this.conn=null,this.sendBuffer=[],this.serializer=new W2,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=o=>o?(...l)=>o(...l):(...l)=>fetch(...l),!(!((i=n?.params)===null||i===void 0)&&i.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Kc.websocket}`,this.httpEndpoint=xv(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(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=$2.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
34
34
 
35
35
  To use Realtime in Node.js, you need to provide a WebSocket implementation:
36
36
 
@@ -43,9 +43,9 @@ Option 2: Install and provide the "ws" package:
43
43
  const client = new RealtimeClient(url, {
44
44
  ...options,
45
45
  transport: ws
46
- })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const i=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(i),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,i){this.logger(e,n,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Hn.connecting:return gr.Connecting;case Hn.open:return gr.Open;case Hn.closing:return gr.Closing;default:return gr.Closed}}isConnected(){return this.connectionState()===gr.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const i=`realtime:${e}`,o=this.getChannels().find(l=>l.topic===i);if(o)return o;{const l=new hs(`realtime:${e}`,n,this);return this.channels.push(l),l}}push(e){const{topic:n,event:i,payload:o,ref:l}=e,u=()=>{this.encode(e,d=>{var h;(h=this.conn)===null||h===void 0||h.send(d)})};this.log("push",`${n} ${i} (${l})`,o),this.isConnected()?u():this.sendBuffer.push(u)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;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,(e=this.conn)===null||e===void 0||e.close(B2,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},ua.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(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(i=>i.topic===e&&(i._isJoined()||i._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const m=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",m)}catch(y){this.log("error","error in heartbeat callback",y)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:i,event:o,payload:l,ref:u}=n,d=u?`(${u})`:"",h=l.status||"";this.log("receive",`${h} ${i} ${o} ${d}`.trim(),l),this.channels.filter(m=>m._isMember(i)).forEach(m=>m._trigger(o,l,u)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="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=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Hn.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Hn.open||this.conn.readyState===Hn.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}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(e=>e.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 e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),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(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Zt.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const i=e.match(/\?/)?"&":"?",o=new URLSearchParams(n);return`${e}${i}${o}`}_workerObjectUrl(e){let n;if(e)n=e;else{const i=new Blob([Z2],{type:"application/javascript"});n=URL.createObjectURL(i)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n,i=!1;if(e)n=e,i=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),n=this.accessTokenValue}else n=this.accessTokenValue;i?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(o=>{const l={access_token:n,version:V2};n&&o.updateJoinPayload(l),o.joinedOnce&&o._isJoined()&&o._push(Zt.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(i=>{try{i(n)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(i){this.log("error",`error triggering ${e} callbacks`,i)}}_setupReconnectionTimer(){this.reconnectTimer=new yv(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},ua.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,i,o,l,u,d,h,m,y,v,w,_;switch(this.transport=(n=e?.transport)!==null&&n!==void 0?n:null,this.timeout=(i=e?.timeout)!==null&&i!==void 0?i:Hc,this.heartbeatIntervalMs=(o=e?.heartbeatIntervalMs)!==null&&o!==void 0?o:ua.HEARTBEAT_INTERVAL,this.worker=(l=e?.worker)!==null&&l!==void 0?l:!1,this.accessToken=(u=e?.accessToken)!==null&&u!==void 0?u:null,this.heartbeatCallback=(d=e?.heartbeatCallback)!==null&&d!==void 0?d:fc,this.vsn=(h=e?.vsn)!==null&&h!==void 0?h:zg,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(m=e?.reconnectAfterMs)!==null&&m!==void 0?m:(b=>Q2[b-1]||X2),this.vsn){case F2:this.encode=(y=e?.encode)!==null&&y!==void 0?y:((b,S)=>S(JSON.stringify(b))),this.decode=(v=e?.decode)!==null&&v!==void 0?v:((b,S)=>S(JSON.parse(b)));break;case gv:this.encode=(w=e?.encode)!==null&&w!==void 0?w:this.serializer.encode.bind(this.serializer),this.decode=(_=e?.decode)!==null&&_!==void 0?_: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=e?.workerUrl}}}var Ai=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function tT(t,e,n){const i=new URL(e,t);if(n)for(const[o,l]of Object.entries(n))l!==void 0&&i.searchParams.set(o,l);return i.toString()}async function nT(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function rT(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:i,query:o,body:l,headers:u}){const d=tT(t.baseUrl,i,o),h=await nT(t.auth),m=await e(d,{method:n,headers:{...l?{"Content-Type":"application/json"}:{},...h,...u},body:l?JSON.stringify(l):void 0}),y=await m.text(),v=(m.headers.get("content-type")||"").includes("application/json"),w=v&&y?JSON.parse(y):y;if(!m.ok){const _=v?w:void 0,b=_?.error;throw new Ai(b?.message??`Request failed with status ${m.status}`,{status:m.status,icebergType:b?.type,icebergCode:b?.code,details:_})}return{status:m.status,headers:m.headers,data:w}}}}function ca(t){return t.join("")}var sT=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:ca(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(i=>({namespace:i}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ca(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ca(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ca(t.namespace)}`}),!0}catch(e){if(e instanceof Ai&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof Ai&&n.status===409)return;throw n}}};function Xr(t){return t.join("")}var iT=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof Ai&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof Ai&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},oT=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=rT({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new sT(this.client,e),this.tableOps=new iT(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},Ga=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function Fe(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var aT=class extends Ga{constructor(t,e,n){super(t),this.name="StorageApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Jc=class extends Ga{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Hd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),lT=()=>Response,Yc=t=>{if(Array.isArray(t))return t.map(n=>Yc(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,i])=>{const o=n.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));e[o]=Yc(i)}),e},uT=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},cT=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function Pi(t){"@babel/helpers - typeof";return Pi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pi(t)}function dT(t,e){if(Pi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(Pi(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hT(t){var e=dT(t,"string");return Pi(e)=="symbol"?e:e+""}function fT(t,e,n){return(e=hT(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,i)}return n}function he(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Kg(Object(n),!0).forEach(function(i){fT(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Kg(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const pc=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},pT=async(t,e,n)=>{t instanceof await lT()&&!n?.noResolveJson?t.json().then(i=>{const o=t.status||500,l=i?.statusCode||o+"";e(new aT(pc(i),o,l))}).catch(i=>{e(new Jc(pc(i),i))}):e(new Jc(pc(t),t))},mT=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"||!i?o:(uT(i)?(o.headers=he({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(i)):o.body=i,e?.duplex&&(o.duplex=e.duplex),he(he({},o),n))};async function Wi(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,mT(e,i,o,l)).then(h=>{if(!h.ok)throw h;return i?.noResolveJson?h:h.json()}).then(h=>u(h)).catch(h=>pT(h,d,i))})}async function Ri(t,e,n,i){return Wi(t,"GET",e,n,i)}async function Xt(t,e,n,i,o){return Wi(t,"POST",e,i,o,n)}async function Qc(t,e,n,i,o){return Wi(t,"PUT",e,i,o,n)}async function gT(t,e,n,i){return Wi(t,"HEAD",e,he(he({},n),{},{noResolveJson:!0}),i)}async function Kd(t,e,n,i,o){return Wi(t,"DELETE",e,i,o,n)}var yT=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Fe(e))return{data:null,error:e};throw e}}};let xv;xv=Symbol.toStringTag;var vT=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[xv]="BlobDownloadBuilder",this.promise=null}asStream(){return new yT(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Fe(e))return{data:null,error:e};throw e}}};const wT={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Gg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var xT=class{constructor(t,e={},n,i){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=n,this.fetch=Hd(i)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,n,i){var o=this;try{let l;const u=he(he({},Gg),i);let d=he(he({},o.headers),t==="POST"&&{"x-upsert":String(u.upsert)});const h=u.metadata;typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),h&&l.append("metadata",o.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),h&&!l.has("metadata")&&l.append("metadata",o.encodeMetadata(h))):(l=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=o.toBase64(o.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),i?.headers&&(d=he(he({},d),i.headers));const m=o._removeEmptyFolders(e),y=o._getFinalPath(m),v=await(t=="PUT"?Qc:Xt)(o.fetch,`${o.url}/object/${y}`,l,he({headers:d},u?.duplex?{duplex:u.duplex}:{}));return{data:{path:m,id:v.Id,fullPath:v.Key},error:null}}catch(l){if(o.shouldThrowOnError)throw l;if(Fe(l))return{data:null,error:l};throw l}}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,i){var o=this;const l=o._removeEmptyFolders(t),u=o._getFinalPath(l),d=new URL(o.url+`/object/upload/sign/${u}`);d.searchParams.set("token",e);try{let h;const m=he({upsert:Gg.upsert},i),y=he(he({},o.headers),{"x-upsert":String(m.upsert)});return typeof Blob<"u"&&n instanceof Blob?(h=new FormData,h.append("cacheControl",m.cacheControl),h.append("",n)):typeof FormData<"u"&&n instanceof FormData?(h=n,h.append("cacheControl",m.cacheControl)):(h=n,y["cache-control"]=`max-age=${m.cacheControl}`,y["content-type"]=m.contentType),{data:{path:l,fullPath:(await Qc(o.fetch,d.toString(),h,{headers:y})).Key},error:null}}catch(h){if(o.shouldThrowOnError)throw h;if(Fe(h))return{data:null,error:h};throw h}}async createSignedUploadUrl(t,e){var n=this;try{let i=n._getFinalPath(t);const o=he({},n.headers);e?.upsert&&(o["x-upsert"]="true");const l=await Xt(n.fetch,`${n.url}/object/upload/sign/${i}`,{},{headers:o}),u=new URL(n.url+l.url),d=u.searchParams.get("token");if(!d)throw new Ga("No token returned by API");return{data:{signedUrl:u.toString(),path:t,token:d},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var i=this;try{return{data:await Xt(i.fetch,`${i.url}/object/move`,{bucketId:i.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:i.headers}),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async copy(t,e,n){var i=this;try{return{data:{path:(await Xt(i.fetch,`${i.url}/object/copy`,{bucketId:i.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:i.headers})).Key},error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async createSignedUrl(t,e,n){var i=this;try{let o=i._getFinalPath(t),l=await Xt(i.fetch,`${i.url}/object/sign/${o}`,he({expiresIn:e},n?.transform?{transform:n.transform}:{}),{headers:i.headers});const u=n?.download?`&download=${n.download===!0?"":n.download}`:"";return l={signedUrl:encodeURI(`${i.url}${l.signedURL}${u}`)},{data:l,error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async createSignedUrls(t,e,n){var i=this;try{const o=await Xt(i.fetch,`${i.url}/object/sign/${i.bucketId}`,{expiresIn:e,paths:t},{headers:i.headers}),l=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(u=>he(he({},u),{},{signedUrl:u.signedURL?encodeURI(`${i.url}${u.signedURL}${l}`):null})),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}download(t,e){const n=typeof e?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(e?.transform||{}),o=i?`?${i}`:"",l=this._getFinalPath(t),u=()=>Ri(this.fetch,`${this.url}/${n}/${l}${o}`,{headers:this.headers,noResolveJson:!0});return new vT(u,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);try{return{data:Yc(await Ri(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})),error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await gT(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Fe(i)&&i instanceof Jc){const o=i.originalError;if([400,404].includes(o?.status))return{data:!1,error:i}}throw i}}getPublicUrl(t,e){const n=this._getFinalPath(t),i=[],o=e?.download?`download=${e.download===!0?"":e.download}`:"";o!==""&&i.push(o);const l=typeof e?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(e?.transform||{});u!==""&&i.push(u);let d=i.join("&");return d!==""&&(d=`?${d}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${d}`)}}}async remove(t){var e=this;try{return{data:await Kd(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async list(t,e,n){var i=this;try{const o=he(he(he({},wT),e),{},{prefix:t||""});return{data:await Xt(i.fetch,`${i.url}/object/list/${i.bucketId}`,o,{headers:i.headers},n),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async listV2(t,e){var n=this;try{const i=he({},t);return{data:await Xt(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,i,{headers:n.headers},e),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const bv="2.91.0",_v={"X-Client-Info":`storage-js/${bv}`};var bT=class{constructor(t,e={},n,i){this.shouldThrowOnError=!1;const o=new URL(t);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=he(he({},_v),e),this.fetch=Hd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const n=e.listBucketOptionsToQueryString(t);return{data:await Ri(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Ri(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async createBucket(t,e={public:!1}){var n=this;try{return{data:await Xt(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async updateBucket(t,e){var n=this;try{return{data:await Qc(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async emptyBucket(t){var e=this;try{return{data:await Xt(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Kd(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},_T=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},_v),e),this.fetch=Hd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Xt(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async listBuckets(t){var e=this;try{const n=new URLSearchParams;t?.limit!==void 0&&n.set("limit",t.limit.toString()),t?.offset!==void 0&&n.set("offset",t.offset.toString()),t?.sortColumn&&n.set("sortColumn",t.sortColumn),t?.sortOrder&&n.set("sortOrder",t.sortOrder),t?.search&&n.set("search",t.search);const i=n.toString(),o=i?`${e.url}/bucket?${i}`:`${e.url}/bucket`;return{data:await Ri(e.fetch,o,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Kd(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}from(t){var e=this;if(!cT(t))throw new Ga("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 oT({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),i=this.shouldThrowOnError;return new Proxy(n,{get(o,l){const u=o[l];return typeof u!="function"?u:async(...d)=>{try{return{data:await u.apply(o,d),error:null}}catch(h){if(i)throw h;return{data:null,error:h}}}}})}};const Gd={"X-Client-Info":`storage-js/${bv}`,"Content-Type":"application/json"};var Sv=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Pt(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var mc=class extends Sv{constructor(t,e,n){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},ST=class extends Sv{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const Jd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),kT=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Jg=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),ET=async(t,e,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!n?.noResolveJson){const i=t.status||500,o=t;if(typeof o.json=="function")o.json().then(l=>{const u=l?.statusCode||l?.code||i+"";e(new mc(Jg(l),i,u))}).catch(()=>{const l=i+"";e(new mc(o.statusText||`HTTP ${i} error`,i,l))});else{const l=i+"";e(new mc(o.statusText||`HTTP ${i} error`,i,l))}}else e(new ST(Jg(t),t))},TT=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return i?(kT(i)?(o.headers=he({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(i)):o.body=i,he(he({},o),n)):o};async function jT(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,TT(e,i,o,l)).then(h=>{if(!h.ok)throw h;if(i?.noResolveJson)return h;const m=h.headers.get("content-type");return!m||!m.includes("application/json")?{}:h.json()}).then(h=>u(h)).catch(h=>ET(h,d,i))})}async function Rt(t,e,n,i,o){return jT(t,"POST",e,i,o,n)}var CT=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Gd),e),this.fetch=Jd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getIndex(t,e){var n=this;try{return{data:await Rt(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Pt(i))return{data:null,error:i};throw i}}async listIndexes(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteIndex(t,e){var n=this;try{return{data:await Rt(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Pt(i))return{data:null,error:i};throw i}}},NT=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Gd),e),this.fetch=Jd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Rt(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getVectors(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await Rt(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async queryVectors(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Rt(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}},AT=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Gd),e),this.fetch=Jd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async listBuckets(t={}){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}},PT=class extends AT{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new RT(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},RT=class extends CT{constructor(t,e,n,i){super(t,e,i),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new OT(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},OT=class extends NT{constructor(t,e,n,i,o){super(t,e,o),this.vectorBucketName=n,this.indexName=i}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},IT=class extends bT{constructor(t,e={},n,i){super(t,e,n,i)}from(t){return new xT(this.url,this.headers,t,this.fetch)}get vectors(){return new PT(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new _T(this.url+"/iceberg",this.headers,this.fetch)}};const kv="2.91.0",is=30*1e3,Xc=3,gc=Xc*is,DT="http://localhost:9999",LT="supabase.auth.token",MT={"X-Client-Info":`gotrue-js/${kv}`},Zc="X-Supabase-Api-Version",Ev={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},UT=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,$T=600*1e3;class Oi extends Error{constructor(e,n,i){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=i}}function re(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class VT extends Oi{constructor(e,n,i){super(e,n,i),this.name="AuthApiError",this.status=n,this.code=i}}function FT(t){return re(t)&&t.name==="AuthApiError"}class yr extends Oi{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class kn extends Oi{constructor(e,n,i,o){super(e,i,o),this.name=n,this.status=i}}class At extends kn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function BT(t){return re(t)&&t.name==="AuthSessionMissingError"}class Zr extends kn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class da extends kn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class ha extends kn{constructor(e,n=null){super(e,"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 zT(t){return re(t)&&t.name==="AuthImplicitGrantRedirectError"}class Yg extends kn{constructor(e,n=null){super(e,"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 qT extends kn{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 ed extends kn{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function yc(t){return re(t)&&t.name==="AuthRetryableFetchError"}class Qg extends kn{constructor(e,n,i){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=i}}class td extends kn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Aa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Xg=`
47
- \r=`.split(""),WT=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Xg.length;e+=1)t[Xg[e].charCodeAt(0)]=-2;for(let e=0;e<Aa.length;e+=1)t[Aa[e].charCodeAt(0)]=e;return t})();function Zg(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;n(Aa[i]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;n(Aa[i]),e.queuedBits-=6}}function Tv(t,e,n){const i=WT[t];if(i>-1)for(e.queue=e.queue<<6|i,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(i===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function ey(t){const e=[],n=u=>{e.push(String.fromCodePoint(u))},i={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{GT(u,i,n)};for(let u=0;u<t.length;u+=1)Tv(t.charCodeAt(u),o,l);return e.join("")}function HT(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function KT(t,e){for(let n=0;n<t.length;n+=1){let i=t.charCodeAt(n);if(i>55295&&i<=56319){const o=(i-55296)*1024&65535;i=(t.charCodeAt(n+1)-56320&65535|o)+65536,n+=1}HT(i,e)}}function GT(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let i=1;i<6;i+=1)if((t>>7-i&1)===0){e.utf8seq=i;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function fs(t){const e=[],n={queue:0,queuedBits:0},i=o=>{e.push(o)};for(let o=0;o<t.length;o+=1)Tv(t.charCodeAt(o),n,i);return new Uint8Array(e)}function JT(t){const e=[];return KT(t,n=>e.push(n)),new Uint8Array(e)}function xr(t){const e=[],n={queue:0,queuedBits:0},i=o=>{e.push(o)};return t.forEach(o=>Zg(o,n,i)),Zg(null,n,i),e.join("")}function YT(t){return Math.round(Date.now()/1e3)+t}function QT(){return Symbol("auth-callback")}const ot=()=>typeof window<"u"&&typeof document<"u",dr={tested:!1,writable:!1},jv=()=>{if(!ot())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(dr.tested)return dr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),dr.tested=!0,dr.writable=!0}catch{dr.tested=!0,dr.writable=!1}return dr.writable};function XT(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((o,l)=>{e[l]=o})}catch{}return n.searchParams.forEach((i,o)=>{e[o]=i}),e}const Cv=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ZT=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",os=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},hr=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},it=async(t,e)=>{await t.removeItem(e)};class Ja{constructor(){this.promise=new Ja.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Ja.promiseConstructor=Promise;function vc(t){const e=t.split(".");if(e.length!==3)throw new td("Invalid JWT structure");for(let i=0;i<e.length;i++)if(!UT.test(e[i]))throw new td("JWT not in base64url format");return{header:JSON.parse(ey(e[0])),payload:JSON.parse(ey(e[1])),signature:fs(e[2]),raw:{header:e[0],payload:e[1]}}}async function ej(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function tj(t,e){return new Promise((i,o)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await t(l);if(!e(l,null,u)){i(u);return}}catch(u){if(!e(l,u)){o(u);return}}})()})}function nj(t){return("0"+t.toString(16)).substr(-2)}function rj(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=n.length;let o="";for(let l=0;l<56;l++)o+=n.charAt(Math.floor(Math.random()*i));return o}return crypto.getRandomValues(e),Array.from(e,nj).join("")}async function sj(t){const n=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",n),o=new Uint8Array(i);return Array.from(o).map(l=>String.fromCharCode(l)).join("")}async function ij(t){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."),t;const n=await sj(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function es(t,e,n=!1){const i=rj();let o=i;n&&(o+="/PASSWORD_RECOVERY"),await os(t,`${e}-code-verifier`,o);const l=await ij(i);return[l,i===l?"plain":"s256"]}const oj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function aj(t){const e=t.headers.get(Zc);if(!e||!e.match(oj))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function lj(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function uj(t){switch(t){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 cj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ts(t){if(!cj.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function wc(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="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:(e,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:(e,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 dj(t,e){return new Proxy(t,{get:(n,i,o)=>{if(i==="__isInsecureUserWarningProxy")return!0;if(typeof i=="symbol"){const l=i.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,i,o)}return!e.value&&typeof i=="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."),e.value=!0),Reflect.get(n,i,o)}})}function ty(t){return JSON.parse(JSON.stringify(t))}const mr=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),hj=[502,503,504];async function ny(t){var e;if(!ZT(t))throw new ed(mr(t),0);if(hj.includes(t.status))throw new ed(mr(t),t.status);let n;try{n=await t.json()}catch(l){throw new yr(mr(l),l)}let i;const o=aj(t);if(o&&o.getTime()>=Ev["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?i=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(i=n.error_code),i){if(i==="weak_password")throw new Qg(mr(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(i==="session_not_found")throw new At}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((l,u)=>l&&typeof u=="string",!0))throw new Qg(mr(n),t.status,n.weak_password.reasons);throw new VT(mr(n),t.status||500,i)}const fj=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),o.body=JSON.stringify(i),Object.assign(Object.assign({},o),n))};async function ce(t,e,n,i){var o;const l=Object.assign({},i?.headers);l[Zc]||(l[Zc]=Ev["2024-01-01"].name),i?.jwt&&(l.Authorization=`Bearer ${i.jwt}`);const u=(o=i?.query)!==null&&o!==void 0?o:{};i?.redirectTo&&(u.redirect_to=i.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",h=await pj(t,e,n+d,{headers:l,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(h):{data:Object.assign({},h),error:null}}async function pj(t,e,n,i,o,l){const u=fj(e,i,o,l);let d;try{d=await t(n,Object.assign({},u))}catch(h){throw console.error(h),new ed(mr(h),0)}if(d.ok||await ny(d),i?.noResolveJson)return d;try{return await d.json()}catch(h){await ny(h)}}function Yt(t){var e;let n=null;yj(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=YT(t.expires_in)));const i=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:i},error:null}}function ry(t){const e=Yt(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,i)=>n&&typeof i=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Kn(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function mj(t){return{data:t,error:null}}function gj(t){const{action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l}=t,u=Ka(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l},h=Object.assign({},u);return{data:{properties:d,user:h},error:null}}function sy(t){return t}function yj(t){return t.access_token&&t.refresh_token&&t.expires_in}const xc=["global","local","others"];class vj{constructor({url:e="",headers:n={},fetch:i}){this.url=e,this.headers=n,this.fetch=Cv(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=xc[0]){if(xc.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${xc.join(", ")}`);try{return await ce(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(i){if(re(i))return{data:null,error:i};throw i}}async inviteUserByEmail(e,n={}){try{return await ce(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Kn})}catch(i){if(re(i))return{data:{user:null},error:i};throw i}}async generateLink(e){try{const{options:n}=e,i=Ka(e,["options"]),o=Object.assign(Object.assign({},i),n);return"newEmail"in i&&(o.new_email=i?.newEmail,delete o.newEmail),await ce(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:gj,redirectTo:n?.redirectTo})}catch(n){if(re(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Kn})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,i,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},y=await ce(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:"",per_page:(l=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:sy});if(y.error)throw y.error;const v=await y.json(),w=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(b=>{const S=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);m[`${k}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(re(m))return{data:{users:[]},error:m};throw m}}async getUserById(e){ts(e);try{return await ce(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Kn})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){ts(e);try{return await ce(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Kn})}catch(i){if(re(i))return{data:{user:null},error:i};throw i}}async deleteUser(e,n=!1){ts(e);try{return await ce(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Kn})}catch(i){if(re(i))return{data:{user:null},error:i};throw i}}async _listFactors(e){ts(e.userId);try{const{data:n,error:i}=await ce(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:n,error:i}}catch(n){if(re(n))return{data:null,error:n};throw n}}async _deleteFactor(e){ts(e.userId),ts(e.id);try{return{data:await ce(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(re(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,i,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},y=await ce(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:"",per_page:(l=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:sy});if(y.error)throw y.error;const v=await y.json(),w=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(b=>{const S=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);m[`${k}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(re(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await ce(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await ce(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(re(i))return{data:null,error:i};throw i}}async _deleteOAuthClient(e){try{return await ce(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(re(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}}function iy(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const ns={debug:!!(globalThis&&jv()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Nv extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class wj extends Nv{}async function xj(t,e,n){ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const i=new globalThis.AbortController;return e>0&&setTimeout(()=>{i.abort(),ns.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async o=>{if(o){ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,o.name);try{return await n()}finally{ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,o.name)}}else{if(e===0)throw ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new wj(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(ns.debug)try{const l=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(l,null," "))}catch(l){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",l)}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 bj(){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 Av(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function _j(t){return parseInt(t,16)}function Sj(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,i=>i.toString(16).padStart(2,"0")).join("")}function kj(t){var e;const{chainId:n,domain:i,expirationTime:o,issuedAt:l=new Date,nonce:u,notBefore:d,requestId:h,resources:m,scheme:y,uri:v,version:w}=t;{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(!i)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(u&&u.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${u}`);if(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
48
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const _=Av(t.address),b=y?`${y}://${i}`:i,S=t.statement?`${t.statement}
46
+ })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const i=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(i),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,i){this.logger(e,n,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Hn.connecting:return gr.Connecting;case Hn.open:return gr.Open;case Hn.closing:return gr.Closing;default:return gr.Closed}}isConnected(){return this.connectionState()===gr.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const i=`realtime:${e}`,o=this.getChannels().find(l=>l.topic===i);if(o)return o;{const l=new hs(`realtime:${e}`,n,this);return this.channels.push(l),l}}push(e){const{topic:n,event:i,payload:o,ref:l}=e,u=()=>{this.encode(e,d=>{var h;(h=this.conn)===null||h===void 0||h.send(d)})};this.log("push",`${n} ${i} (${l})`,o),this.isConnected()?u():this.sendBuffer.push(u)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;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,(e=this.conn)===null||e===void 0||e.close(z2,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},ca.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(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(i=>i.topic===e&&(i._isJoined()||i._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const m=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",m)}catch(y){this.log("error","error in heartbeat callback",y)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:i,event:o,payload:l,ref:u}=n,d=u?`(${u})`:"",h=l.status||"";this.log("receive",`${h} ${i} ${o} ${d}`.trim(),l),this.channels.filter(m=>m._isMember(i)).forEach(m=>m._trigger(o,l,u)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="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=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Hn.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Hn.open||this.conn.readyState===Hn.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}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(e=>e.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 e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),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(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Zt.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const i=e.match(/\?/)?"&":"?",o=new URLSearchParams(n);return`${e}${i}${o}`}_workerObjectUrl(e){let n;if(e)n=e;else{const i=new Blob([eT],{type:"application/javascript"});n=URL.createObjectURL(i)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n,i=!1;if(e)n=e,i=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),n=this.accessTokenValue}else n=this.accessTokenValue;i?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(o=>{const l={access_token:n,version:F2};n&&o.updateJoinPayload(l),o.joinedOnce&&o._isJoined()&&o._push(Zt.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(i=>{try{i(n)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(i){this.log("error",`error triggering ${e} callbacks`,i)}}_setupReconnectionTimer(){this.reconnectTimer=new vv(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},ca.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,i,o,l,u,d,h,m,y,v,w,_;switch(this.transport=(n=e?.transport)!==null&&n!==void 0?n:null,this.timeout=(i=e?.timeout)!==null&&i!==void 0?i:Hc,this.heartbeatIntervalMs=(o=e?.heartbeatIntervalMs)!==null&&o!==void 0?o:ca.HEARTBEAT_INTERVAL,this.worker=(l=e?.worker)!==null&&l!==void 0?l:!1,this.accessToken=(u=e?.accessToken)!==null&&u!==void 0?u:null,this.heartbeatCallback=(d=e?.heartbeatCallback)!==null&&d!==void 0?d:fc,this.vsn=(h=e?.vsn)!==null&&h!==void 0?h:qg,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(m=e?.reconnectAfterMs)!==null&&m!==void 0?m:(b=>X2[b-1]||Z2),this.vsn){case B2:this.encode=(y=e?.encode)!==null&&y!==void 0?y:((b,S)=>S(JSON.stringify(b))),this.decode=(v=e?.decode)!==null&&v!==void 0?v:((b,S)=>S(JSON.parse(b)));break;case yv:this.encode=(w=e?.encode)!==null&&w!==void 0?w:this.serializer.encode.bind(this.serializer),this.decode=(_=e?.decode)!==null&&_!==void 0?_: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=e?.workerUrl}}}var Ai=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function nT(t,e,n){const i=new URL(e,t);if(n)for(const[o,l]of Object.entries(n))l!==void 0&&i.searchParams.set(o,l);return i.toString()}async function rT(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function sT(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:i,query:o,body:l,headers:u}){const d=nT(t.baseUrl,i,o),h=await rT(t.auth),m=await e(d,{method:n,headers:{...l?{"Content-Type":"application/json"}:{},...h,...u},body:l?JSON.stringify(l):void 0}),y=await m.text(),v=(m.headers.get("content-type")||"").includes("application/json"),w=v&&y?JSON.parse(y):y;if(!m.ok){const _=v?w:void 0,b=_?.error;throw new Ai(b?.message??`Request failed with status ${m.status}`,{status:m.status,icebergType:b?.type,icebergCode:b?.code,details:_})}return{status:m.status,headers:m.headers,data:w}}}}function da(t){return t.join("")}var iT=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:da(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(i=>({namespace:i}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${da(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${da(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${da(t.namespace)}`}),!0}catch(e){if(e instanceof Ai&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof Ai&&n.status===409)return;throw n}}};function Xr(t){return t.join("")}var oT=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Xr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof Ai&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof Ai&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},aT=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=sT({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new iT(this.client,e),this.tableOps=new oT(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},Ga=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function Fe(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var lT=class extends Ga{constructor(t,e,n){super(t),this.name="StorageApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Jc=class extends Ga{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Hd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),uT=()=>Response,Yc=t=>{if(Array.isArray(t))return t.map(n=>Yc(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,i])=>{const o=n.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));e[o]=Yc(i)}),e},cT=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},dT=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function Pi(t){"@babel/helpers - typeof";return Pi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pi(t)}function hT(t,e){if(Pi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(Pi(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fT(t){var e=hT(t,"string");return Pi(e)=="symbol"?e:e+""}function pT(t,e,n){return(e=fT(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,i)}return n}function he(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gg(Object(n),!0).forEach(function(i){pT(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gg(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const pc=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},mT=async(t,e,n)=>{t instanceof await uT()&&!n?.noResolveJson?t.json().then(i=>{const o=t.status||500,l=i?.statusCode||o+"";e(new lT(pc(i),o,l))}).catch(i=>{e(new Jc(pc(i),i))}):e(new Jc(pc(t),t))},gT=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"||!i?o:(cT(i)?(o.headers=he({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(i)):o.body=i,e?.duplex&&(o.duplex=e.duplex),he(he({},o),n))};async function Hi(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,gT(e,i,o,l)).then(h=>{if(!h.ok)throw h;return i?.noResolveJson?h:h.json()}).then(h=>u(h)).catch(h=>mT(h,d,i))})}async function Ri(t,e,n,i){return Hi(t,"GET",e,n,i)}async function Xt(t,e,n,i,o){return Hi(t,"POST",e,i,o,n)}async function Qc(t,e,n,i,o){return Hi(t,"PUT",e,i,o,n)}async function yT(t,e,n,i){return Hi(t,"HEAD",e,he(he({},n),{},{noResolveJson:!0}),i)}async function Kd(t,e,n,i,o){return Hi(t,"DELETE",e,i,o,n)}var vT=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Fe(e))return{data:null,error:e};throw e}}};let bv;bv=Symbol.toStringTag;var wT=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[bv]="BlobDownloadBuilder",this.promise=null}asStream(){return new vT(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(Fe(e))return{data:null,error:e};throw e}}};const xT={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Jg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var bT=class{constructor(t,e={},n,i){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=n,this.fetch=Hd(i)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,n,i){var o=this;try{let l;const u=he(he({},Jg),i);let d=he(he({},o.headers),t==="POST"&&{"x-upsert":String(u.upsert)});const h=u.metadata;typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),h&&l.append("metadata",o.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),h&&!l.has("metadata")&&l.append("metadata",o.encodeMetadata(h))):(l=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=o.toBase64(o.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),i?.headers&&(d=he(he({},d),i.headers));const m=o._removeEmptyFolders(e),y=o._getFinalPath(m),v=await(t=="PUT"?Qc:Xt)(o.fetch,`${o.url}/object/${y}`,l,he({headers:d},u?.duplex?{duplex:u.duplex}:{}));return{data:{path:m,id:v.Id,fullPath:v.Key},error:null}}catch(l){if(o.shouldThrowOnError)throw l;if(Fe(l))return{data:null,error:l};throw l}}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,i){var o=this;const l=o._removeEmptyFolders(t),u=o._getFinalPath(l),d=new URL(o.url+`/object/upload/sign/${u}`);d.searchParams.set("token",e);try{let h;const m=he({upsert:Jg.upsert},i),y=he(he({},o.headers),{"x-upsert":String(m.upsert)});return typeof Blob<"u"&&n instanceof Blob?(h=new FormData,h.append("cacheControl",m.cacheControl),h.append("",n)):typeof FormData<"u"&&n instanceof FormData?(h=n,h.append("cacheControl",m.cacheControl)):(h=n,y["cache-control"]=`max-age=${m.cacheControl}`,y["content-type"]=m.contentType),{data:{path:l,fullPath:(await Qc(o.fetch,d.toString(),h,{headers:y})).Key},error:null}}catch(h){if(o.shouldThrowOnError)throw h;if(Fe(h))return{data:null,error:h};throw h}}async createSignedUploadUrl(t,e){var n=this;try{let i=n._getFinalPath(t);const o=he({},n.headers);e?.upsert&&(o["x-upsert"]="true");const l=await Xt(n.fetch,`${n.url}/object/upload/sign/${i}`,{},{headers:o}),u=new URL(n.url+l.url),d=u.searchParams.get("token");if(!d)throw new Ga("No token returned by API");return{data:{signedUrl:u.toString(),path:t,token:d},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var i=this;try{return{data:await Xt(i.fetch,`${i.url}/object/move`,{bucketId:i.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:i.headers}),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async copy(t,e,n){var i=this;try{return{data:{path:(await Xt(i.fetch,`${i.url}/object/copy`,{bucketId:i.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n?.destinationBucket},{headers:i.headers})).Key},error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async createSignedUrl(t,e,n){var i=this;try{let o=i._getFinalPath(t),l=await Xt(i.fetch,`${i.url}/object/sign/${o}`,he({expiresIn:e},n?.transform?{transform:n.transform}:{}),{headers:i.headers});const u=n?.download?`&download=${n.download===!0?"":n.download}`:"";return l={signedUrl:encodeURI(`${i.url}${l.signedURL}${u}`)},{data:l,error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async createSignedUrls(t,e,n){var i=this;try{const o=await Xt(i.fetch,`${i.url}/object/sign/${i.bucketId}`,{expiresIn:e,paths:t},{headers:i.headers}),l=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(u=>he(he({},u),{},{signedUrl:u.signedURL?encodeURI(`${i.url}${u.signedURL}${l}`):null})),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}download(t,e){const n=typeof e?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(e?.transform||{}),o=i?`?${i}`:"",l=this._getFinalPath(t),u=()=>Ri(this.fetch,`${this.url}/${n}/${l}${o}`,{headers:this.headers,noResolveJson:!0});return new wT(u,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);try{return{data:Yc(await Ri(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})),error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await yT(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(Fe(i)&&i instanceof Jc){const o=i.originalError;if([400,404].includes(o?.status))return{data:!1,error:i}}throw i}}getPublicUrl(t,e){const n=this._getFinalPath(t),i=[],o=e?.download?`download=${e.download===!0?"":e.download}`:"";o!==""&&i.push(o);const l=typeof e?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(e?.transform||{});u!==""&&i.push(u);let d=i.join("&");return d!==""&&(d=`?${d}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${d}`)}}}async remove(t){var e=this;try{return{data:await Kd(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async list(t,e,n){var i=this;try{const o=he(he(he({},xT),e),{},{prefix:t||""});return{data:await Xt(i.fetch,`${i.url}/object/list/${i.bucketId}`,o,{headers:i.headers},n),error:null}}catch(o){if(i.shouldThrowOnError)throw o;if(Fe(o))return{data:null,error:o};throw o}}async listV2(t,e){var n=this;try{const i=he({},t);return{data:await Xt(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,i,{headers:n.headers},e),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const _v="2.91.0",Sv={"X-Client-Info":`storage-js/${_v}`};var _T=class{constructor(t,e={},n,i){this.shouldThrowOnError=!1;const o=new URL(t);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=he(he({},Sv),e),this.fetch=Hd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const n=e.listBucketOptionsToQueryString(t);return{data:await Ri(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Ri(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async createBucket(t,e={public:!1}){var n=this;try{return{data:await Xt(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async updateBucket(t,e){var n=this;try{return{data:await Qc(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Fe(i))return{data:null,error:i};throw i}}async emptyBucket(t){var e=this;try{return{data:await Xt(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Kd(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},ST=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Sv),e),this.fetch=Hd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Xt(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async listBuckets(t){var e=this;try{const n=new URLSearchParams;t?.limit!==void 0&&n.set("limit",t.limit.toString()),t?.offset!==void 0&&n.set("offset",t.offset.toString()),t?.sortColumn&&n.set("sortColumn",t.sortColumn),t?.sortOrder&&n.set("sortOrder",t.sortOrder),t?.search&&n.set("search",t.search);const i=n.toString(),o=i?`${e.url}/bucket?${i}`:`${e.url}/bucket`;return{data:await Ri(e.fetch,o,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Kd(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Fe(n))return{data:null,error:n};throw n}}from(t){var e=this;if(!dT(t))throw new Ga("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 aT({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),i=this.shouldThrowOnError;return new Proxy(n,{get(o,l){const u=o[l];return typeof u!="function"?u:async(...d)=>{try{return{data:await u.apply(o,d),error:null}}catch(h){if(i)throw h;return{data:null,error:h}}}}})}};const Gd={"X-Client-Info":`storage-js/${_v}`,"Content-Type":"application/json"};var kv=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Pt(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var mc=class extends kv{constructor(t,e,n){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},kT=class extends kv{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const Jd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ET=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Yg=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),TT=async(t,e,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!n?.noResolveJson){const i=t.status||500,o=t;if(typeof o.json=="function")o.json().then(l=>{const u=l?.statusCode||l?.code||i+"";e(new mc(Yg(l),i,u))}).catch(()=>{const l=i+"";e(new mc(o.statusText||`HTTP ${i} error`,i,l))});else{const l=i+"";e(new mc(o.statusText||`HTTP ${i} error`,i,l))}}else e(new kT(Yg(t),t))},jT=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return i?(ET(i)?(o.headers=he({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(i)):o.body=i,he(he({},o),n)):o};async function CT(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,jT(e,i,o,l)).then(h=>{if(!h.ok)throw h;if(i?.noResolveJson)return h;const m=h.headers.get("content-type");return!m||!m.includes("application/json")?{}:h.json()}).then(h=>u(h)).catch(h=>TT(h,d,i))})}async function Rt(t,e,n,i,o){return CT(t,"POST",e,i,o,n)}var NT=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Gd),e),this.fetch=Jd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getIndex(t,e){var n=this;try{return{data:await Rt(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}),error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Pt(i))return{data:null,error:i};throw i}}async listIndexes(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteIndex(t,e){var n=this;try{return{data:await Rt(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{},error:null}}catch(i){if(n.shouldThrowOnError)throw i;if(Pt(i))return{data:null,error:i};throw i}}},AT=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Gd),e),this.fetch=Jd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Rt(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getVectors(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await Rt(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async queryVectors(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Rt(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}},PT=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},Gd),e),this.fetch=Jd(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async listBuckets(t={}){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Rt(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Pt(n))return{data:null,error:n};throw n}}},RT=class extends PT{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new OT(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},OT=class extends NT{constructor(t,e,n,i){super(t,e,i),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new IT(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},IT=class extends AT{constructor(t,e,n,i,o){super(t,e,o),this.vectorBucketName=n,this.indexName=i}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,he(he({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},DT=class extends _T{constructor(t,e={},n,i){super(t,e,n,i)}from(t){return new bT(this.url,this.headers,t,this.fetch)}get vectors(){return new RT(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new ST(this.url+"/iceberg",this.headers,this.fetch)}};const Ev="2.91.0",is=30*1e3,Xc=3,gc=Xc*is,LT="http://localhost:9999",MT="supabase.auth.token",UT={"X-Client-Info":`gotrue-js/${Ev}`},Zc="X-Supabase-Api-Version",Tv={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},$T=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,VT=600*1e3;class Oi extends Error{constructor(e,n,i){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=i}}function re(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class FT extends Oi{constructor(e,n,i){super(e,n,i),this.name="AuthApiError",this.status=n,this.code=i}}function BT(t){return re(t)&&t.name==="AuthApiError"}class yr extends Oi{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class kn extends Oi{constructor(e,n,i,o){super(e,i,o),this.name=n,this.status=i}}class At extends kn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function zT(t){return re(t)&&t.name==="AuthSessionMissingError"}class Zr extends kn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ha extends kn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class fa extends kn{constructor(e,n=null){super(e,"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 qT(t){return re(t)&&t.name==="AuthImplicitGrantRedirectError"}class Qg extends kn{constructor(e,n=null){super(e,"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 WT extends kn{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 ed extends kn{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function yc(t){return re(t)&&t.name==="AuthRetryableFetchError"}class Xg extends kn{constructor(e,n,i){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=i}}class td extends kn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Pa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Zg=`
47
+ \r=`.split(""),HT=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Zg.length;e+=1)t[Zg[e].charCodeAt(0)]=-2;for(let e=0;e<Pa.length;e+=1)t[Pa[e].charCodeAt(0)]=e;return t})();function ey(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;n(Pa[i]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;n(Pa[i]),e.queuedBits-=6}}function jv(t,e,n){const i=HT[t];if(i>-1)for(e.queue=e.queue<<6|i,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(i===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function ty(t){const e=[],n=u=>{e.push(String.fromCodePoint(u))},i={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{JT(u,i,n)};for(let u=0;u<t.length;u+=1)jv(t.charCodeAt(u),o,l);return e.join("")}function KT(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function GT(t,e){for(let n=0;n<t.length;n+=1){let i=t.charCodeAt(n);if(i>55295&&i<=56319){const o=(i-55296)*1024&65535;i=(t.charCodeAt(n+1)-56320&65535|o)+65536,n+=1}KT(i,e)}}function JT(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let i=1;i<6;i+=1)if((t>>7-i&1)===0){e.utf8seq=i;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function fs(t){const e=[],n={queue:0,queuedBits:0},i=o=>{e.push(o)};for(let o=0;o<t.length;o+=1)jv(t.charCodeAt(o),n,i);return new Uint8Array(e)}function YT(t){const e=[];return GT(t,n=>e.push(n)),new Uint8Array(e)}function xr(t){const e=[],n={queue:0,queuedBits:0},i=o=>{e.push(o)};return t.forEach(o=>ey(o,n,i)),ey(null,n,i),e.join("")}function QT(t){return Math.round(Date.now()/1e3)+t}function XT(){return Symbol("auth-callback")}const ot=()=>typeof window<"u"&&typeof document<"u",dr={tested:!1,writable:!1},Cv=()=>{if(!ot())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(dr.tested)return dr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),dr.tested=!0,dr.writable=!0}catch{dr.tested=!0,dr.writable=!1}return dr.writable};function ZT(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((o,l)=>{e[l]=o})}catch{}return n.searchParams.forEach((i,o)=>{e[o]=i}),e}const Nv=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ej=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",os=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},hr=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},it=async(t,e)=>{await t.removeItem(e)};class Ja{constructor(){this.promise=new Ja.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Ja.promiseConstructor=Promise;function vc(t){const e=t.split(".");if(e.length!==3)throw new td("Invalid JWT structure");for(let i=0;i<e.length;i++)if(!$T.test(e[i]))throw new td("JWT not in base64url format");return{header:JSON.parse(ty(e[0])),payload:JSON.parse(ty(e[1])),signature:fs(e[2]),raw:{header:e[0],payload:e[1]}}}async function tj(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function nj(t,e){return new Promise((i,o)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await t(l);if(!e(l,null,u)){i(u);return}}catch(u){if(!e(l,u)){o(u);return}}})()})}function rj(t){return("0"+t.toString(16)).substr(-2)}function sj(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=n.length;let o="";for(let l=0;l<56;l++)o+=n.charAt(Math.floor(Math.random()*i));return o}return crypto.getRandomValues(e),Array.from(e,rj).join("")}async function ij(t){const n=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",n),o=new Uint8Array(i);return Array.from(o).map(l=>String.fromCharCode(l)).join("")}async function oj(t){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."),t;const n=await ij(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function es(t,e,n=!1){const i=sj();let o=i;n&&(o+="/PASSWORD_RECOVERY"),await os(t,`${e}-code-verifier`,o);const l=await oj(i);return[l,i===l?"plain":"s256"]}const aj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function lj(t){const e=t.headers.get(Zc);if(!e||!e.match(aj))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function uj(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function cj(t){switch(t){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 dj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ts(t){if(!dj.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function wc(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="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:(e,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:(e,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 hj(t,e){return new Proxy(t,{get:(n,i,o)=>{if(i==="__isInsecureUserWarningProxy")return!0;if(typeof i=="symbol"){const l=i.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,i,o)}return!e.value&&typeof i=="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."),e.value=!0),Reflect.get(n,i,o)}})}function ny(t){return JSON.parse(JSON.stringify(t))}const mr=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),fj=[502,503,504];async function ry(t){var e;if(!ej(t))throw new ed(mr(t),0);if(fj.includes(t.status))throw new ed(mr(t),t.status);let n;try{n=await t.json()}catch(l){throw new yr(mr(l),l)}let i;const o=lj(t);if(o&&o.getTime()>=Tv["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?i=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(i=n.error_code),i){if(i==="weak_password")throw new Xg(mr(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(i==="session_not_found")throw new At}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((l,u)=>l&&typeof u=="string",!0))throw new Xg(mr(n),t.status,n.weak_password.reasons);throw new FT(mr(n),t.status||500,i)}const pj=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),o.body=JSON.stringify(i),Object.assign(Object.assign({},o),n))};async function ce(t,e,n,i){var o;const l=Object.assign({},i?.headers);l[Zc]||(l[Zc]=Tv["2024-01-01"].name),i?.jwt&&(l.Authorization=`Bearer ${i.jwt}`);const u=(o=i?.query)!==null&&o!==void 0?o:{};i?.redirectTo&&(u.redirect_to=i.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",h=await mj(t,e,n+d,{headers:l,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(h):{data:Object.assign({},h),error:null}}async function mj(t,e,n,i,o,l){const u=pj(e,i,o,l);let d;try{d=await t(n,Object.assign({},u))}catch(h){throw console.error(h),new ed(mr(h),0)}if(d.ok||await ry(d),i?.noResolveJson)return d;try{return await d.json()}catch(h){await ry(h)}}function Yt(t){var e;let n=null;vj(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=QT(t.expires_in)));const i=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:i},error:null}}function sy(t){const e=Yt(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,i)=>n&&typeof i=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Kn(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function gj(t){return{data:t,error:null}}function yj(t){const{action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l}=t,u=Ka(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l},h=Object.assign({},u);return{data:{properties:d,user:h},error:null}}function iy(t){return t}function vj(t){return t.access_token&&t.refresh_token&&t.expires_in}const xc=["global","local","others"];class wj{constructor({url:e="",headers:n={},fetch:i}){this.url=e,this.headers=n,this.fetch=Nv(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=xc[0]){if(xc.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${xc.join(", ")}`);try{return await ce(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(i){if(re(i))return{data:null,error:i};throw i}}async inviteUserByEmail(e,n={}){try{return await ce(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Kn})}catch(i){if(re(i))return{data:{user:null},error:i};throw i}}async generateLink(e){try{const{options:n}=e,i=Ka(e,["options"]),o=Object.assign(Object.assign({},i),n);return"newEmail"in i&&(o.new_email=i?.newEmail,delete o.newEmail),await ce(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:yj,redirectTo:n?.redirectTo})}catch(n){if(re(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Kn})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,i,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},y=await ce(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:"",per_page:(l=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:iy});if(y.error)throw y.error;const v=await y.json(),w=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(b=>{const S=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);m[`${k}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(re(m))return{data:{users:[]},error:m};throw m}}async getUserById(e){ts(e);try{return await ce(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Kn})}catch(n){if(re(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){ts(e);try{return await ce(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Kn})}catch(i){if(re(i))return{data:{user:null},error:i};throw i}}async deleteUser(e,n=!1){ts(e);try{return await ce(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Kn})}catch(i){if(re(i))return{data:{user:null},error:i};throw i}}async _listFactors(e){ts(e.userId);try{const{data:n,error:i}=await ce(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:n,error:i}}catch(n){if(re(n))return{data:null,error:n};throw n}}async _deleteFactor(e){ts(e.userId),ts(e.id);try{return{data:await ce(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(re(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,i,o,l,u,d,h;try{const m={nextPage:null,lastPage:0,total:0},y=await ce(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:"",per_page:(l=(o=e?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:iy});if(y.error)throw y.error;const v=await y.json(),w=(u=y.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(h=(d=y.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return _.length>0&&(_.forEach(b=>{const S=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(b.split(";")[1].split("=")[1]);m[`${k}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(re(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await ce(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await ce(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(re(i))return{data:null,error:i};throw i}}async _deleteOAuthClient(e){try{return await ce(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(re(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await ce(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(re(n))return{data:null,error:n};throw n}}}function oy(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const ns={debug:!!(globalThis&&Cv()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Av extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class xj extends Av{}async function bj(t,e,n){ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const i=new globalThis.AbortController;return e>0&&setTimeout(()=>{i.abort(),ns.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async o=>{if(o){ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,o.name);try{return await n()}finally{ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,o.name)}}else{if(e===0)throw ns.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new xj(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(ns.debug)try{const l=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(l,null," "))}catch(l){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",l)}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 _j(){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 Pv(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Sj(t){return parseInt(t,16)}function kj(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,i=>i.toString(16).padStart(2,"0")).join("")}function Ej(t){var e;const{chainId:n,domain:i,expirationTime:o,issuedAt:l=new Date,nonce:u,notBefore:d,requestId:h,resources:m,scheme:y,uri:v,version:w}=t;{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(!i)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(u&&u.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${u}`);if(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
48
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const _=Pv(t.address),b=y?`${y}://${i}`:i,S=t.statement?`${t.statement}
49
49
  `:"",k=`${b} wants you to sign in with your Ethereum account:
50
50
  ${_}
51
51
 
@@ -59,14 +59,14 @@ Not Before: ${d.toISOString()}`),h&&(E+=`
59
59
  Request ID: ${h}`),m){let P=`
60
60
  Resources:`;for(const N of m){if(!N||typeof N!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${N}`);P+=`
61
61
  - ${N}`}E+=P}return`${k}
62
- ${E}`}class Ye extends Error{constructor({message:e,code:n,cause:i,name:o}){var l;super(e,{cause:i}),this.__isWebAuthnError=!0,this.name=(l=o??(i instanceof Error?i.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=n}}class Pa extends Ye{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function Ej({error:t,options:e}){var n,i,o;const{publicKey:l}=e;if(!l)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ye({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=l.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ye({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((i=l.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Ye({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((o=l.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new Ye({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Ye({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ye({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return l.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new Ye({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ye({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const u=window.location.hostname;if(Pv(u)){if(l.rp.id!==u)return new Ye({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ye({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new Ye({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Ye({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ye({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Tj({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ye({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ye({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const i=window.location.hostname;if(Pv(i)){if(n.rpId!==i)return new Ye({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ye({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ye({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ye({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class jj{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Cj=new jj;function Nj(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:i}=t,o=Ka(t,["challenge","user","excludeCredentials"]),l=fs(e).buffer,u=Object.assign(Object.assign({},n),{id:fs(n.id).buffer}),d=Object.assign(Object.assign({},o),{challenge:l,user:u});if(i&&i.length>0){d.excludeCredentials=new Array(i.length);for(let h=0;h<i.length;h++){const m=i[h];d.excludeCredentials[h]=Object.assign(Object.assign({},m),{id:fs(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function Aj(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,i=Ka(t,["challenge","allowCredentials"]),o=fs(e).buffer,l=Object.assign(Object.assign({},i),{challenge:o});if(n&&n.length>0){l.allowCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const d=n[u];l.allowCredentials[u]=Object.assign(Object.assign({},d),{id:fs(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function Pj(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:xr(new Uint8Array(t.response.attestationObject)),clientDataJSON:xr(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Rj(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,i=t.getClientExtensionResults(),o=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:xr(new Uint8Array(o.authenticatorData)),clientDataJSON:xr(new Uint8Array(o.clientDataJSON)),signature:xr(new Uint8Array(o.signature)),userHandle:o.userHandle?xr(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:i,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Pv(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function oy(){var t,e;return!!(ot()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Oj(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Pa("Browser returned unexpected credential type",e)}:{data:null,error:new Pa("Empty credential response",e)}}catch(e){return{data:null,error:Ej({error:e,options:t})}}}async function Ij(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Pa("Browser returned unexpected credential type",e)}:{data:null,error:new Pa("Empty credential response",e)}}catch(e){return{data:null,error:Tj({error:e,options:t})}}}const Dj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Lj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ra(...t){const e=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),n=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),i={};for(const o of t)if(o)for(const l in o){const u=o[l];if(u!==void 0)if(Array.isArray(u))i[l]=u;else if(n(u))i[l]=u;else if(e(u)){const d=i[l];e(d)?i[l]=Ra(d,u):i[l]=Ra(u)}else i[l]=u}return i}function Mj(t,e){return Ra(Dj,t,e||{})}function Uj(t,e){return Ra(Lj,t,e||{})}class $j{constructor(e){this.client=e,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(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:i,signal:o},l){try{const{data:u,error:d}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!u)return{data:null,error:d};const h=o??Cj.createNewAbortSignal();if(u.webauthn.type==="create"){const{user:m}=u.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${i}`),m.displayName||(m.displayName=m.name)}switch(u.webauthn.type){case"create":{const m=Mj(u.webauthn.credential_options.publicKey,l?.create),{data:y,error:v}=await Oj({publicKey:m,signal:h});return y?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}case"request":{const m=Uj(u.webauthn.credential_options.publicKey,l?.request),{data:y,error:v}=await Ij(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:m,signal:h}));return y?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}}}catch(u){return re(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in challenge",u)}}}async _verify({challengeId:e,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:i})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new Oi("rpId is required for WebAuthn authentication")};try{if(!oy())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:i},signal:o},{request:l});if(!u)return{data:null,error:d};const{webauthn:h}=u;return this._verify({factorId:e,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:i,credential_response:h.credential_response}})}catch(u){return re(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in authenticate",u)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new Oi("rpId is required for WebAuthn registration")};try{if(!oy())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:e});if(!u)return await this.client.mfa.listFactors().then(y=>{var v;return(v=y.data)===null||v===void 0?void 0:v.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(y=>y?this.client.mfa.unenroll({factorId:y?.id}):void 0),{data:null,error:d};const{data:h,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:i},signal:o},{create:l});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:i,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:m}}catch(u){return re(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in register",u)}}}}bj();const Vj={url:DT,storageKey:LT,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:MT,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function ay(t,e,n){return await n()}const rs={};class Ii{get jwks(){var e,n;return(n=(e=rs[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){rs[this.storageKey]=Object.assign(Object.assign({},rs[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=rs[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){rs[this.storageKey]=Object.assign(Object.assign({},rs[this.storageKey]),{cachedAt:e})}constructor(e){var n,i,o;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 l=Object.assign(Object.assign({},Vj),e);if(this.storageKey=l.storageKey,this.instanceID=(n=Ii.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Ii.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!l.debug,typeof l.debug=="function"&&(this.logger=l.debug),this.instanceID>0&&ot()){const u=`${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(u),this.logDebugMessages&&console.trace(u)}if(this.persistSession=l.persistSession,this.autoRefreshToken=l.autoRefreshToken,this.admin=new vj({url:l.url,headers:l.headers,fetch:l.fetch}),this.url=l.url,this.headers=l.headers,this.fetch=Cv(l.fetch),this.lock=l.lock||ay,this.detectSessionInUrl=l.detectSessionInUrl,this.flowType=l.flowType,this.hasCustomAuthorizationHeader=l.hasCustomAuthorizationHeader,this.throwOnError=l.throwOnError,this.lockAcquireTimeout=l.lockAcquireTimeout,l.lock?this.lock=l.lock:this.persistSession&&ot()&&(!((i=globalThis?.navigator)===null||i===void 0)&&i.locks)?this.lock=xj:this.lock=ay,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 $j(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?(l.storage?this.storage=l.storage:jv()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=iy(this.memoryStorage)),l.userStorage&&(this.userStorage=l.userStorage)):(this.memoryStorage={},this.storage=iy(this.memoryStorage)),ot()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(u){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",u)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async u=>{this._debug("received broadcast notification from other tab or client",u),await this._notifyAllSubscribers(u.data.event,u.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${kv}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),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 e;try{let n={},i="none";if(ot()&&(n=XT(window.location.href),this._isImplicitGrantCallback(n)?i="implicit":await this._isPKCECallback(n)&&(i="pkce")),ot()&&this.detectSessionInUrl&&i!=="none"){const{data:o,error:l}=await this._getSessionFromURL(n,i);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),zT(l)){const h=(e=l.details)===null||e===void 0?void 0:e.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:l}}return{error:l}}const{session:u,redirectType:d}=o;return this._debug("#_initialize()","detected session in URL",u,"redirect type",d),await this._saveSession(u),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return re(n)?this._returnResult({error:n}):this._returnResult({error:new yr("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,i,o;try{const l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(n=e?.options)===null||n===void 0?void 0:n.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(o=e?.options)===null||o===void 0?void 0:o.captchaToken}},xform:Yt}),{data:u,error:d}=l;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(re(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(e){var n,i,o;try{let l;if("email"in e){const{email:y,password:v,options:w}=e;let _=null,b=null;this.flowType==="pkce"&&([_,b]=await es(this.storage,this.storageKey)),l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w?.emailRedirectTo,body:{email:y,password:v,data:(n=w?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:w?.captchaToken},code_challenge:_,code_challenge_method:b},xform:Yt})}else if("phone"in e){const{phone:y,password:v,options:w}=e;l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:y,password:v,data:(i=w?.data)!==null&&i!==void 0?i:{},channel:(o=w?.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:w?.captchaToken}},xform:Yt})}else throw new da("You must provide either an email or phone number and a password");const{data:u,error:d}=l;if(d||!u)return await it(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(e){try{let n;if("email"in e){const{email:l,password:u,options:d}=e;n=await ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:ry})}else if("phone"in e){const{phone:l,password:u,options:d}=e;n=await ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:ry})}else throw new da("You must provide either an email or phone number and a password");const{data:i,error:o}=n;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!i||!i.session||!i.user){const l=new Zr;return this._returnResult({data:{user:null,session:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:o})}catch(n){if(re(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,i,o,l;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(o=e.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(l=e.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,i,o,l,u,d,h,m,y,v,w;let _,b;if("message"in e)_=e.message,b=e.signature;else{const{chain:S,wallet:k,statement:E,options:P}=e;let N;if(ot())if(typeof k=="object")N=k;else{const Y=window;if("ethereum"in Y&&typeof Y.ethereum=="object"&&"request"in Y.ethereum&&typeof Y.ethereum.request=="function")N=Y.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"||!P?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=k}const U=new URL((n=P?.url)!==null&&n!==void 0?n:window.location.href),V=await N.request({method:"eth_requestAccounts"}).then(Y=>Y).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!V||V.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const z=Av(V[0]);let $=(i=P?.signInWithEthereum)===null||i===void 0?void 0:i.chainId;if(!$){const Y=await N.request({method:"eth_chainId"});$=_j(Y)}const B={domain:U.host,address:z,statement:E,uri:U.href,version:"1",chainId:$,nonce:(o=P?.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(u=(l=P?.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=P?.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(h=P?.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(m=P?.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(y=P?.signInWithEthereum)===null||y===void 0?void 0:y.resources};_=kj(B),b=await N.request({method:"personal_sign",params:[Sj(_),z]})}try{const{data:S,error:k}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:b},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Yt});if(k)throw k;if(!S||!S.session||!S.user){const E=new Zr;return this._returnResult({data:{user:null,session:null},error:E})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:k})}catch(S){if(re(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(e){var n,i,o,l,u,d,h,m,y,v,w,_;let b,S;if("message"in e)b=e.message,S=e.signature;else{const{chain:k,wallet:E,statement:P,options:N}=e;let U;if(ot())if(typeof E=="object")U=E;else{const z=window;if("solana"in z&&typeof z.solana=="object"&&("signIn"in z.solana&&typeof z.solana.signIn=="function"||"signMessage"in z.solana&&typeof z.solana.signMessage=="function"))U=z.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 E!="object"||!N?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");U=E}const V=new URL((n=N?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in U&&U.signIn){const z=await U.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N?.signInWithSolana),{version:"1",domain:V.host,uri:V.href}),P?{statement:P}:null));let $;if(Array.isArray(z)&&z[0]&&typeof z[0]=="object")$=z[0];else if(z&&typeof z=="object"&&"signedMessage"in z&&"signature"in z)$=z;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in $&&"signature"in $&&(typeof $.signedMessage=="string"||$.signedMessage instanceof Uint8Array)&&$.signature instanceof Uint8Array)b=typeof $.signedMessage=="string"?$.signedMessage:new TextDecoder().decode($.signedMessage),S=$.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in U)||typeof U.signMessage!="function"||!("publicKey"in U)||typeof U!="object"||!U.publicKey||!("toBase58"in U.publicKey)||typeof U.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${V.host} wants you to sign in with your Solana account:`,U.publicKey.toBase58(),...P?["",P,""]:[""],"Version: 1",`URI: ${V.href}`,`Issued At: ${(o=(i=N?.signInWithSolana)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((l=N?.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((u=N?.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((d=N?.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((h=N?.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((m=N?.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((v=(y=N?.signInWithSolana)===null||y===void 0?void 0:y.resources)===null||v===void 0)&&v.length?["Resources",...N.signInWithSolana.resources.map($=>`- ${$}`)]:[]].join(`
63
- `);const z=await U.signMessage(new TextEncoder().encode(b),"utf8");if(!z||!(z instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=z}}try{const{data:k,error:E}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:xr(S)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=e.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Yt});if(E)throw E;if(!k||!k.session||!k.user){const P=new Zr;return this._returnResult({data:{user:null,session:null},error:P})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:E})}catch(k){if(re(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(e){const n=await hr(this.storage,`${this.storageKey}-code-verifier`),[i,o]=(n??"").split("/");try{if(!i&&this.flowType==="pkce")throw new qT;const{data:l,error:u}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:Yt});if(await it(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Zr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),setTimeout(async()=>{await this._notifyAllSubscribers("SIGNED_IN",l.session)},0)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:o??null}),error:u})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(e){try{const{options:n,provider:i,token:o,access_token:l,nonce:u}=e,d=await ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:o,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Yt}),{data:h,error:m}=d;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!h||!h.session||!h.user){const y=new Zr;return this._returnResult({data:{user:null,session:null},error:y})}return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),this._returnResult({data:h,error:m})}catch(n){if(re(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,i,o,l,u;try{if("email"in e){const{email:d,options:h}=e;let m=null,y=null;this.flowType==="pkce"&&([m,y]=await es(this.storage,this.storageKey));const{error:v}=await ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(n=h?.data)!==null&&n!==void 0?n:{},create_user:(i=h?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:m,code_challenge_method:y},redirectTo:h?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:v})}if("phone"in e){const{phone:d,options:h}=e,{data:m,error:y}=await ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(o=h?.data)!==null&&o!==void 0?o:{},create_user:(l=h?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},channel:(u=h?.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m?.message_id},error:y})}throw new da("You must provide either an email or phone number.")}catch(d){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(e){var n,i;try{let o,l;"options"in e&&(o=(n=e.options)===null||n===void 0?void 0:n.redirectTo,l=(i=e.options)===null||i===void 0?void 0:i.captchaToken);const{data:u,error:d}=await ce(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:l}}),redirectTo:o,xform:Yt});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const h=u.session,m=u.user;return h?.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(o){if(re(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(e){var n,i,o,l,u;try{let d=null,h=null;this.flowType==="pkce"&&([d,h]=await es(this.storage,this.storageKey));const m=await ce(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&i!==void 0?i:void 0}),!((o=e?.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:h}),headers:this.headers,xform:mj});return!((l=m.data)===null||l===void 0)&&l.url&&ot()&&!(!((u=e.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(d))return this._returnResult({data:null,error:d});throw d}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;if(i)throw i;if(!n)throw new At;const{error:o}=await ce(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(e){if(re(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:i,type:o,options:l}=e,{error:u}=await ce(this.fetch,"POST",n,{headers:this.headers,body:{email:i,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}},redirectTo:l?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in e){const{phone:i,type:o,options:l}=e,{data:u,error:d}=await ce(this.fetch,"POST",n,{headers:this.headers,body:{phone:i,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:d})}throw new da("You must provide either an email or phone number and a type")}catch(n){if(re(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(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await i,await n()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const i=n();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(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 e=null;const n=await hr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const i=e.expires_at?e.expires_at*1e3-Date.now()<gc:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.userStorage){const u=await hr(this.userStorage,this.storageKey+"-user");u?.user?e.user=u.user:e.user=wc()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};e.user=dj(e.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Kn}):await this._useSession(async n=>{var i,o,l;const{data:u,error:d}=n;if(d)throw d;return!(!((i=u.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new At}:await ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(o=u.session)===null||o===void 0?void 0:o.access_token)!==null&&l!==void 0?l:void 0,xform:Kn})})}catch(n){if(re(n))return BT(n)&&(await this._removeSession(),await it(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async i=>{const{data:o,error:l}=i;if(l)throw l;if(!o.session)throw new At;const u=o.session;let d=null,h=null;this.flowType==="pkce"&&e.email!=null&&([d,h]=await es(this.storage,this.storageKey));const{data:m,error:y}=await ce(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:d,code_challenge_method:h}),jwt:u.access_token,xform:Kn});if(y)throw y;return u.user=m.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(i){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(i))return this._returnResult({data:{user:null},error:i});throw i}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new At;const n=Date.now()/1e3;let i=n,o=!0,l=null;const{payload:u}=vc(e.access_token);if(u.exp&&(i=u.exp,o=i<=n),o){const{data:d,error:h}=await this._callRefreshToken(e.refresh_token);if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!d)return{data:{user:null,session:null},error:null};l=d}else{const{data:d,error:h}=await this._getUser(e.access_token);if(h)throw h;l={access_token:e.access_token,refresh_token:e.refresh_token,user:d.user,token_type:"bearer",expires_in:i-n,expires_at:i},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(n){if(re(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var i;if(!e){const{data:u,error:d}=n;if(d)throw d;e=(i=u.session)!==null&&i!==void 0?i:void 0}if(!e?.refresh_token)throw new At;const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(re(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){try{if(!ot())throw new ha("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ha(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Yg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ha("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Yg("No code detected.");const{data:P,error:N}=await this._exchangeCodeForSession(e.code);if(N)throw N;const U=new URL(window.location.href);return U.searchParams.delete("code"),window.history.replaceState(window.history.state,"",U.toString()),{data:{session:P.session,redirectType:null},error:null}}const{provider_token:i,provider_refresh_token:o,access_token:l,refresh_token:u,expires_in:d,expires_at:h,token_type:m}=e;if(!l||!d||!u||!m)throw new ha("No session defined in URL");const y=Math.round(Date.now()/1e3),v=parseInt(d);let w=y+v;h&&(w=parseInt(h));const _=w-y;_*1e3<=is&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${_}s, should have been closer to ${v}s`);const b=w-v;y-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,w,y):y-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,w,y);const{data:S,error:k}=await this._getUser(l);if(k)throw k;const E={provider_token:i,provider_refresh_token:o,access_token:l,expires_in:v,expires_at:w,refresh_token:u,token_type:m,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:E,redirectType:e.type},error:null})}catch(i){if(re(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await hr(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({error:l});const u=(i=o.session)===null||i===void 0?void 0:i.access_token;if(u){const{error:d}=await this.admin.signOut(u,e);if(d&&!(FT(d)&&(d.status===404||d.status===401||d.status===403)))return this._returnResult({error:d})}return e!=="others"&&(await this._removeSession(),await it(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=QT(),i={id:n,callback:e,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,i),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async n=>{var i,o;try{const{data:{session:l},error:u}=n;if(u)throw u;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",e,"session",l)}catch(l){await((o=this.stateChangeEmitters.get(e))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",l),console.error(l)}})}async resetPasswordForEmail(e,n={}){let i=null,o=null;this.flowType==="pkce"&&([i,o]=await es(this.storage,this.storageKey,!0));try{return await ce(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:o,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var e;try{const{data:n,error:i}=await this.getUser();if(i)throw i;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:i,error:o}=await this._useSession(async l=>{var u,d,h,m,y;const{data:v,error:w}=l;if(w)throw w;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(u=e.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=e.options)===null||d===void 0?void 0:d.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await ce(this.fetch,"GET",_,{headers:this.headers,jwt:(y=(m=v.session)===null||m===void 0?void 0:m.access_token)!==null&&y!==void 0?y:void 0})});if(o)throw o;return ot()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(i?.url),this._returnResult({data:{provider:e.provider,url:i?.url},error:null})}catch(i){if(re(i))return this._returnResult({data:{provider:e.provider,url:null},error:i});throw i}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var i;try{const{error:o,data:{session:l}}=n;if(o)throw o;const{options:u,provider:d,token:h,access_token:m,nonce:y}=e,v=await ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(i=l?.access_token)!==null&&i!==void 0?i:void 0,body:{provider:d,id_token:h,access_token:m,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:u?.captchaToken}},xform:Yt}),{data:w,error:_}=v;return _?this._returnResult({data:{user:null,session:null},error:_}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new Zr}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:_}))}catch(o){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var i,o;const{data:l,error:u}=n;if(u)throw u;return await ce(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(o=(i=l.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0})})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const i=Date.now();return await tj(async o=>(o>0&&await ej(200*Math.pow(2,o-1)),this._debug(n,"refreshing attempt",o),await ce(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Yt})),(o,l)=>{const u=200*Math.pow(2,o);return l&&yc(l)&&Date.now()+u-i<is})}catch(i){if(this._debug(n,"error",i),re(i))return this._returnResult({data:{session:null,user:null},error:i});throw i}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const i=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",i),ot()&&!n.skipBrowserRedirect&&window.location.assign(i),{data:{provider:e,url:i},error:null}}async _recoverAndRefresh(){var e,n;const i="#_recoverAndRefresh()";this._debug(i,"begin");try{const o=await hr(this.storage,this.storageKey);if(o&&this.userStorage){let u=await hr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:o.user},await os(this.userStorage,this.storageKey+"-user",u)),o.user=(e=u?.user)!==null&&e!==void 0?e:wc()}else if(o&&!o.user&&!o.user){const u=await hr(this.storage,this.storageKey+"-user");u&&u?.user?(o.user=u.user,await it(this.storage,this.storageKey+"-user"),await os(this.storage,this.storageKey,o)):o.user=wc()}if(this._debug(i,"session from storage",o),!this._isValidSession(o)){this._debug(i,"session is not valid"),o!==null&&await this._removeSession();return}const l=((n=o.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<gc;if(this._debug(i,`session has${l?"":" not"} expired with margin of ${gc}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),yc(u)||(this._debug(i,"refresh failed with a non-retryable error, removing the session",u),await this._removeSession()))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:d}=await this._getUser(o.access_token);!d&&u?.user?(o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(i,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(i,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(i,"error",o),console.error(o);return}finally{this._debug(i,"end")}}async _callRefreshToken(e){var n,i;if(!e)throw new At;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new Ja;const{data:l,error:u}=await this._refreshAccessToken(e);if(u)throw u;if(!l.session)throw new At;await this._saveSession(l.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",l.session);const d={data:l.session,error:null};return this.refreshingDeferred.resolve(d),d}catch(l){if(this._debug(o,"error",l),re(l)){const u={data:null,error:l};return yc(l)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(u),u}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(l),l}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(e,n,i=!0){const o=`#_notifyAllSubscribers(${e})`;this._debug(o,"begin",n,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:e,session:n});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(e,n)}catch(h){l.push(h)}});if(await Promise.all(u),l.length>0){for(let d=0;d<l.length;d+=1)console.error(l[d]);throw l[0]}}finally{this._debug(o,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await it(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),i=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!i&&n.user&&await os(this.userStorage,this.storageKey+"-user",{user:n.user});const o=Object.assign({},n);delete o.user;const l=ty(o);await os(this.storage,this.storageKey,l)}else{const o=ty(n);await os(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await it(this.storage,this.storageKey),await it(this.storage,this.storageKey+"-code-verifier"),await it(this.storage,this.storageKey+"-user"),this.userStorage&&await it(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ot()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),is);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);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 e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);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 e=Date.now();try{return await this._useSession(async n=>{const{data:{session:i}}=n;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((i.expires_at*1e3-e)/is);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${is}ms, refresh threshold is ${Xc} ticks`),o<=Xc&&await this._callRefreshToken(i.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(e){if(e.isAcquireTimeout||e instanceof Nv)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ot()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(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(e,n,i){const o=[`provider=${encodeURIComponent(n)}`];if(i?.redirectTo&&o.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&o.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){const[l,u]=await es(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});o.push(d.toString())}if(i?.queryParams){const l=new URLSearchParams(i.queryParams);o.push(l.toString())}return i?.skipBrowserRedirect&&o.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${o.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;return l?this._returnResult({data:null,error:l}):await ce(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token})})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var i,o;const{data:l,error:u}=n;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:h,error:m}=await ce(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(i=l?.session)===null||i===void 0?void 0:i.access_token});return m?this._returnResult({data:null,error:m}):(e.factorType==="totp"&&h.type==="totp"&&(!((o=h?.totp)===null||o===void 0)&&o.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),this._returnResult({data:h,error:null}))})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Pj(e.webauthn.credential_response):Rj(e.webauthn.credential_response)})}:{code:e.code}),{data:d,error:h}=await ce(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:u,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});return h?this._returnResult({data:null,error:h}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+d.expires_in},d)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",d),this._returnResult({data:d,error:h}))})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=await ce(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});if(u.error)return u;const{data:d}=u;if(d.type!=="webauthn")return{data:d,error:null};switch(d.webauthn.type){case"create":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:Nj(d.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:Aj(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(e){const{data:n,error:i}=await this._challenge({factorId:e.factorId});return i?this._returnResult({data:null,error:i}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:i}=await this.getUser();if(i)return{data:null,error:i};const o={all:[],phone:[],totp:[],webauthn:[]};for(const l of(e=n?.factors)!==null&&e!==void 0?e:[])o.all.push(l),l.status==="verified"&&o[l.factor_type].push(l);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:i},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=vc(i.access_token);let u=null;l.aal&&(u=l.aal);let d=u;((n=(e=i.user.factors)===null||e===void 0?void 0:e.filter(y=>y.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(d="aal2");const m=l.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:i},error:o}=n;return o?this._returnResult({data:null,error:o}):i?await ce(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:i.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new At})})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async i=>{const{data:{session:o},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new At});const u=await ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&ot()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(re(i))return this._returnResult({data:null,error:i});throw i}}async _denyAuthorization(e,n){try{return await this._useSession(async i=>{const{data:{session:o},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new At});const u=await ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&ot()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(re(i))return this._returnResult({data:null,error:i});throw i}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;return i?this._returnResult({data:null,error:i}):n?await ce(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new At})})}catch(e){if(re(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:i},error:o}=n;return o?this._returnResult({data:null,error:o}):i?(await ce(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:i.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new At})})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let i=n.keys.find(d=>d.kid===e);if(i)return i;const o=Date.now();if(i=this.jwks.keys.find(d=>d.kid===e),i&&this.jwks_cached_at+$T>o)return i;const{data:l,error:u}=await ce(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=o,i=l.keys.find(d=>d.kid===e),!i)?null:i}async getClaims(e,n={}){try{let i=e;if(!i){const{data:_,error:b}=await this.getSession();if(b||!_.session)return this._returnResult({data:null,error:b});i=_.session.access_token}const{header:o,payload:l,signature:u,raw:{header:d,payload:h}}=vc(i);n?.allowExpired||lj(l.exp);const m=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!m){const{error:_}=await this.getUser(i);if(_)throw _;return{data:{claims:l,header:o,signature:u},error:null}}const y=uj(o.alg),v=await crypto.subtle.importKey("jwk",m,y,!0,["verify"]);if(!await crypto.subtle.verify(y,v,u,JT(`${d}.${h}`)))throw new td("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(i){if(re(i))return this._returnResult({data:null,error:i});throw i}}}Ii.nextInstanceID={};const Fj=Ii,Bj="2.91.0";let mi="";typeof Deno<"u"?mi="deno":typeof document<"u"?mi="web":typeof navigator<"u"&&navigator.product==="ReactNative"?mi="react-native":mi="node";const zj={"X-Client-Info":`supabase-js-${mi}/${Bj}`},qj={headers:zj},Wj={schema:"public"},Hj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Kj={};function Di(t){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Di(t)}function Gj(t,e){if(Di(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(Di(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jj(t){var e=Gj(t,"string");return Di(e)=="symbol"?e:e+""}function Yj(t,e,n){return(e=Jj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ly(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,i)}return n}function qe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ly(Object(n),!0).forEach(function(i){Yj(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ly(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const Qj=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Xj=()=>Headers,Zj=(t,e,n)=>{const i=Qj(n),o=Xj();return async(l,u)=>{var d;const h=(d=await e())!==null&&d!==void 0?d:t;let m=new o(u?.headers);return m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${h}`),i(l,qe(qe({},u),{},{headers:m}))}};function eC(t){return t.endsWith("/")?t:t+"/"}function tC(t,e){var n,i;const{db:o,auth:l,realtime:u,global:d}=t,{db:h,auth:m,realtime:y,global:v}=e,w={db:qe(qe({},h),o),auth:qe(qe({},m),l),realtime:qe(qe({},y),u),storage:{},global:qe(qe(qe({},v),d),{},{headers:qe(qe({},(n=v?.headers)!==null&&n!==void 0?n:{}),(i=d?.headers)!==null&&i!==void 0?i:{})}),accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function nC(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(eC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var rC=class extends Fj{constructor(t){super(t)}},sC=class{constructor(t,e,n){var i,o;this.supabaseUrl=t,this.supabaseKey=e;const l=nC(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const u=`sb-${l.hostname.split(".")[0]}-auth-token`,d={db:Wj,realtime:Kj,auth:qe(qe({},Hj),{},{storageKey:u}),global:qj},h=tC(n??{},d);if(this.storageKey=(i=h.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=h.global.headers)!==null&&o!==void 0?o:{},h.accessToken)this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(y,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}});else{var m;this.auth=this._initSupabaseAuthClient((m=h.auth)!==null&&m!==void 0?m:{},this.headers,h.global.fetch)}this.fetch=Zj(e,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(qe({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(y=>this.realtime.setAuth(y)).catch(y=>console.warn("Failed to set initial Realtime auth token:",y)),this.rest=new M2(new URL("rest/v1",l).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new IT(this.storageUrl.href,this.headers,this.fetch,n?.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new R2(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:i}=await t.auth.getSession();return(e=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:i,userStorage:o,storageKey:l,flowType:u,lock:d,debug:h,throwOnError:m},y,v){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new rC({url:this.authUrl.href,headers:qe(qe({},w),y),storageKey:l,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:i,userStorage:o,flowType:u,lock:d,debug:h,throwOnError:m,fetch:v,hasCustomAuthorizationHeader:Object.keys(this.headers).some(_=>_.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new eT(this.realtimeUrl.href,qe(qe({},t),{},{params:qe(qe({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const iC=(t,e,n)=>new sC(t,e,n);function oC(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const n=e.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}oC()&&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 Ya="alchemy_supabase_config";function Yd(){try{const t=localStorage.getItem(Ya);if(t)return JSON.parse(t)}catch(t){console.error("Error reading Supabase config:",t)}return null}function aC(t){try{localStorage.setItem(Ya,JSON.stringify(t))}catch(e){console.error("Error saving Supabase config:",e)}}function lC(){try{localStorage.removeItem(Ya)}catch(t){console.error("Error clearing Supabase config:",t)}}async function uC(t,e){try{if(!t.startsWith("http://")&&!t.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const n=e.startsWith("eyJ"),i=e.startsWith("sb_publishable_");if(!n&&!i)return{valid:!1,error:"Invalid API key format"};if(i)return{valid:!0};const o=await fetch(`${t}/rest/v1/`,{method:"GET",headers:{apikey:e,Authorization:`Bearer ${e}`}});return o.ok?{valid:!0}:o.status===401||o.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${o.statusText}`}}catch(n){return{valid:!1,error:n instanceof Error?n.message:"Connection failed"}}}function cC(){return localStorage.getItem(Ya)?"ui":"none"}const Qd=Yd(),dC=Qd?.url||void 0||"https://placeholder.supabase.co",hC=Qd?.anonKey||void 0||"placeholder",me=iC(dC,hC,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),uy=!!Qd?.url;function fC({length:t=6,value:e,onChange:n,onComplete:i,disabled:o=!1,error:l=!1}){const u=R.useRef([]),[d,h]=R.useState(null),m=(w,_)=>{const b=_.replace(/[^0-9]/g,"");if(b.length===0){const E=e.split("");w<E.length&&E.splice(w,1);const P=E.join("");n(P),w>0&&u.current[w-1]?.focus();return}const S=[...e];S[w]=b[0];const k=S.join("");n(k),w<t-1&&b!==""&&u.current[w+1]?.focus(),k.length===t&&i&&i(k)},y=(w,_)=>{_.key==="Backspace"&&!e[w]&&w>0||_.key==="ArrowLeft"&&w>0?u.current[w-1]?.focus():_.key==="ArrowRight"&&w<t-1&&u.current[w+1]?.focus()},v=w=>{w.preventDefault();const b=w.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,t);n(b);const S=Math.min(b.length,t-1);u.current[S]?.focus(),b.length===t&&i&&i(b)};return p.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:t}).map((w,_)=>p.jsx("input",{ref:b=>{u.current[_]=b},type:"text",inputMode:"numeric",maxLength:1,value:e[_]||"",onChange:b=>m(_,b.target.value),onKeyDown:b=>y(_,b),onPaste:v,onFocus:()=>h(_),onBlur:()=>h(null),disabled:o,className:`
62
+ ${E}`}class Ye extends Error{constructor({message:e,code:n,cause:i,name:o}){var l;super(e,{cause:i}),this.__isWebAuthnError=!0,this.name=(l=o??(i instanceof Error?i.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=n}}class Ra extends Ye{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function Tj({error:t,options:e}){var n,i,o;const{publicKey:l}=e;if(!l)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ye({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=l.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ye({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((i=l.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Ye({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((o=l.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new Ye({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Ye({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ye({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return l.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new Ye({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ye({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const u=window.location.hostname;if(Rv(u)){if(l.rp.id!==u)return new Ye({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ye({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new Ye({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Ye({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ye({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function jj({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ye({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ye({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const i=window.location.hostname;if(Rv(i)){if(n.rpId!==i)return new Ye({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ye({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ye({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ye({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Cj{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Nj=new Cj;function Aj(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:i}=t,o=Ka(t,["challenge","user","excludeCredentials"]),l=fs(e).buffer,u=Object.assign(Object.assign({},n),{id:fs(n.id).buffer}),d=Object.assign(Object.assign({},o),{challenge:l,user:u});if(i&&i.length>0){d.excludeCredentials=new Array(i.length);for(let h=0;h<i.length;h++){const m=i[h];d.excludeCredentials[h]=Object.assign(Object.assign({},m),{id:fs(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function Pj(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,i=Ka(t,["challenge","allowCredentials"]),o=fs(e).buffer,l=Object.assign(Object.assign({},i),{challenge:o});if(n&&n.length>0){l.allowCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const d=n[u];l.allowCredentials[u]=Object.assign(Object.assign({},d),{id:fs(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function Rj(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:xr(new Uint8Array(t.response.attestationObject)),clientDataJSON:xr(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Oj(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,i=t.getClientExtensionResults(),o=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:xr(new Uint8Array(o.authenticatorData)),clientDataJSON:xr(new Uint8Array(o.clientDataJSON)),signature:xr(new Uint8Array(o.signature)),userHandle:o.userHandle?xr(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:i,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Rv(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function ay(){var t,e;return!!(ot()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Ij(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ra("Browser returned unexpected credential type",e)}:{data:null,error:new Ra("Empty credential response",e)}}catch(e){return{data:null,error:Tj({error:e,options:t})}}}async function Dj(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ra("Browser returned unexpected credential type",e)}:{data:null,error:new Ra("Empty credential response",e)}}catch(e){return{data:null,error:jj({error:e,options:t})}}}const Lj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Mj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Oa(...t){const e=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),n=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),i={};for(const o of t)if(o)for(const l in o){const u=o[l];if(u!==void 0)if(Array.isArray(u))i[l]=u;else if(n(u))i[l]=u;else if(e(u)){const d=i[l];e(d)?i[l]=Oa(d,u):i[l]=Oa(u)}else i[l]=u}return i}function Uj(t,e){return Oa(Lj,t,e||{})}function $j(t,e){return Oa(Mj,t,e||{})}class Vj{constructor(e){this.client=e,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(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:i,signal:o},l){try{const{data:u,error:d}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!u)return{data:null,error:d};const h=o??Nj.createNewAbortSignal();if(u.webauthn.type==="create"){const{user:m}=u.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${i}`),m.displayName||(m.displayName=m.name)}switch(u.webauthn.type){case"create":{const m=Uj(u.webauthn.credential_options.publicKey,l?.create),{data:y,error:v}=await Ij({publicKey:m,signal:h});return y?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}case"request":{const m=$j(u.webauthn.credential_options.publicKey,l?.request),{data:y,error:v}=await Dj(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:m,signal:h}));return y?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:y}},error:null}:{data:null,error:v}}}}catch(u){return re(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in challenge",u)}}}async _verify({challengeId:e,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:i})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new Oi("rpId is required for WebAuthn authentication")};try{if(!ay())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:i},signal:o},{request:l});if(!u)return{data:null,error:d};const{webauthn:h}=u;return this._verify({factorId:e,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:i,credential_response:h.credential_response}})}catch(u){return re(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in authenticate",u)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new Oi("rpId is required for WebAuthn registration")};try{if(!ay())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:e});if(!u)return await this.client.mfa.listFactors().then(y=>{var v;return(v=y.data)===null||v===void 0?void 0:v.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(y=>y?this.client.mfa.unenroll({factorId:y?.id}):void 0),{data:null,error:d};const{data:h,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:i},signal:o},{create:l});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:i,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:m}}catch(u){return re(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in register",u)}}}}_j();const Fj={url:LT,storageKey:MT,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:UT,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function ly(t,e,n){return await n()}const rs={};class Ii{get jwks(){var e,n;return(n=(e=rs[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){rs[this.storageKey]=Object.assign(Object.assign({},rs[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=rs[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){rs[this.storageKey]=Object.assign(Object.assign({},rs[this.storageKey]),{cachedAt:e})}constructor(e){var n,i,o;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 l=Object.assign(Object.assign({},Fj),e);if(this.storageKey=l.storageKey,this.instanceID=(n=Ii.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Ii.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!l.debug,typeof l.debug=="function"&&(this.logger=l.debug),this.instanceID>0&&ot()){const u=`${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(u),this.logDebugMessages&&console.trace(u)}if(this.persistSession=l.persistSession,this.autoRefreshToken=l.autoRefreshToken,this.admin=new wj({url:l.url,headers:l.headers,fetch:l.fetch}),this.url=l.url,this.headers=l.headers,this.fetch=Nv(l.fetch),this.lock=l.lock||ly,this.detectSessionInUrl=l.detectSessionInUrl,this.flowType=l.flowType,this.hasCustomAuthorizationHeader=l.hasCustomAuthorizationHeader,this.throwOnError=l.throwOnError,this.lockAcquireTimeout=l.lockAcquireTimeout,l.lock?this.lock=l.lock:this.persistSession&&ot()&&(!((i=globalThis?.navigator)===null||i===void 0)&&i.locks)?this.lock=bj:this.lock=ly,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 Vj(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?(l.storage?this.storage=l.storage:Cv()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=oy(this.memoryStorage)),l.userStorage&&(this.userStorage=l.userStorage)):(this.memoryStorage={},this.storage=oy(this.memoryStorage)),ot()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(u){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",u)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async u=>{this._debug("received broadcast notification from other tab or client",u),await this._notifyAllSubscribers(u.data.event,u.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Ev}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),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 e;try{let n={},i="none";if(ot()&&(n=ZT(window.location.href),this._isImplicitGrantCallback(n)?i="implicit":await this._isPKCECallback(n)&&(i="pkce")),ot()&&this.detectSessionInUrl&&i!=="none"){const{data:o,error:l}=await this._getSessionFromURL(n,i);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),qT(l)){const h=(e=l.details)===null||e===void 0?void 0:e.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:l}}return{error:l}}const{session:u,redirectType:d}=o;return this._debug("#_initialize()","detected session in URL",u,"redirect type",d),await this._saveSession(u),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return re(n)?this._returnResult({error:n}):this._returnResult({error:new yr("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,i,o;try{const l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(n=e?.options)===null||n===void 0?void 0:n.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(o=e?.options)===null||o===void 0?void 0:o.captchaToken}},xform:Yt}),{data:u,error:d}=l;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(re(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(e){var n,i,o;try{let l;if("email"in e){const{email:y,password:v,options:w}=e;let _=null,b=null;this.flowType==="pkce"&&([_,b]=await es(this.storage,this.storageKey)),l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w?.emailRedirectTo,body:{email:y,password:v,data:(n=w?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:w?.captchaToken},code_challenge:_,code_challenge_method:b},xform:Yt})}else if("phone"in e){const{phone:y,password:v,options:w}=e;l=await ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:y,password:v,data:(i=w?.data)!==null&&i!==void 0?i:{},channel:(o=w?.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:w?.captchaToken}},xform:Yt})}else throw new ha("You must provide either an email or phone number and a password");const{data:u,error:d}=l;if(d||!u)return await it(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const h=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(e){try{let n;if("email"in e){const{email:l,password:u,options:d}=e;n=await ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:sy})}else if("phone"in e){const{phone:l,password:u,options:d}=e;n=await ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:sy})}else throw new ha("You must provide either an email or phone number and a password");const{data:i,error:o}=n;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!i||!i.session||!i.user){const l=new Zr;return this._returnResult({data:{user:null,session:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:o})}catch(n){if(re(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,i,o,l;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(o=e.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(l=e.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,i,o,l,u,d,h,m,y,v,w;let _,b;if("message"in e)_=e.message,b=e.signature;else{const{chain:S,wallet:k,statement:E,options:P}=e;let N;if(ot())if(typeof k=="object")N=k;else{const Y=window;if("ethereum"in Y&&typeof Y.ethereum=="object"&&"request"in Y.ethereum&&typeof Y.ethereum.request=="function")N=Y.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"||!P?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=k}const U=new URL((n=P?.url)!==null&&n!==void 0?n:window.location.href),V=await N.request({method:"eth_requestAccounts"}).then(Y=>Y).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!V||V.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const z=Pv(V[0]);let $=(i=P?.signInWithEthereum)===null||i===void 0?void 0:i.chainId;if(!$){const Y=await N.request({method:"eth_chainId"});$=Sj(Y)}const B={domain:U.host,address:z,statement:E,uri:U.href,version:"1",chainId:$,nonce:(o=P?.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(u=(l=P?.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=P?.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(h=P?.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(m=P?.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(y=P?.signInWithEthereum)===null||y===void 0?void 0:y.resources};_=Ej(B),b=await N.request({method:"personal_sign",params:[kj(_),z]})}try{const{data:S,error:k}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:b},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Yt});if(k)throw k;if(!S||!S.session||!S.user){const E=new Zr;return this._returnResult({data:{user:null,session:null},error:E})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:k})}catch(S){if(re(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(e){var n,i,o,l,u,d,h,m,y,v,w,_;let b,S;if("message"in e)b=e.message,S=e.signature;else{const{chain:k,wallet:E,statement:P,options:N}=e;let U;if(ot())if(typeof E=="object")U=E;else{const z=window;if("solana"in z&&typeof z.solana=="object"&&("signIn"in z.solana&&typeof z.solana.signIn=="function"||"signMessage"in z.solana&&typeof z.solana.signMessage=="function"))U=z.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 E!="object"||!N?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");U=E}const V=new URL((n=N?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in U&&U.signIn){const z=await U.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N?.signInWithSolana),{version:"1",domain:V.host,uri:V.href}),P?{statement:P}:null));let $;if(Array.isArray(z)&&z[0]&&typeof z[0]=="object")$=z[0];else if(z&&typeof z=="object"&&"signedMessage"in z&&"signature"in z)$=z;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in $&&"signature"in $&&(typeof $.signedMessage=="string"||$.signedMessage instanceof Uint8Array)&&$.signature instanceof Uint8Array)b=typeof $.signedMessage=="string"?$.signedMessage:new TextDecoder().decode($.signedMessage),S=$.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in U)||typeof U.signMessage!="function"||!("publicKey"in U)||typeof U!="object"||!U.publicKey||!("toBase58"in U.publicKey)||typeof U.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${V.host} wants you to sign in with your Solana account:`,U.publicKey.toBase58(),...P?["",P,""]:[""],"Version: 1",`URI: ${V.href}`,`Issued At: ${(o=(i=N?.signInWithSolana)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((l=N?.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((u=N?.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((d=N?.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((h=N?.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((m=N?.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((v=(y=N?.signInWithSolana)===null||y===void 0?void 0:y.resources)===null||v===void 0)&&v.length?["Resources",...N.signInWithSolana.resources.map($=>`- ${$}`)]:[]].join(`
63
+ `);const z=await U.signMessage(new TextEncoder().encode(b),"utf8");if(!z||!(z instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=z}}try{const{data:k,error:E}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:xr(S)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=e.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Yt});if(E)throw E;if(!k||!k.session||!k.user){const P=new Zr;return this._returnResult({data:{user:null,session:null},error:P})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:E})}catch(k){if(re(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(e){const n=await hr(this.storage,`${this.storageKey}-code-verifier`),[i,o]=(n??"").split("/");try{if(!i&&this.flowType==="pkce")throw new WT;const{data:l,error:u}=await ce(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:Yt});if(await it(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const d=new Zr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),setTimeout(async()=>{await this._notifyAllSubscribers("SIGNED_IN",l.session)},0)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:o??null}),error:u})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(e){try{const{options:n,provider:i,token:o,access_token:l,nonce:u}=e,d=await ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:o,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Yt}),{data:h,error:m}=d;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!h||!h.session||!h.user){const y=new Zr;return this._returnResult({data:{user:null,session:null},error:y})}return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),this._returnResult({data:h,error:m})}catch(n){if(re(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,i,o,l,u;try{if("email"in e){const{email:d,options:h}=e;let m=null,y=null;this.flowType==="pkce"&&([m,y]=await es(this.storage,this.storageKey));const{error:v}=await ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(n=h?.data)!==null&&n!==void 0?n:{},create_user:(i=h?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:m,code_challenge_method:y},redirectTo:h?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:v})}if("phone"in e){const{phone:d,options:h}=e,{data:m,error:y}=await ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(o=h?.data)!==null&&o!==void 0?o:{},create_user:(l=h?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:h?.captchaToken},channel:(u=h?.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m?.message_id},error:y})}throw new ha("You must provide either an email or phone number.")}catch(d){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(e){var n,i;try{let o,l;"options"in e&&(o=(n=e.options)===null||n===void 0?void 0:n.redirectTo,l=(i=e.options)===null||i===void 0?void 0:i.captchaToken);const{data:u,error:d}=await ce(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:l}}),redirectTo:o,xform:Yt});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const h=u.session,m=u.user;return h?.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(o){if(re(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(e){var n,i,o,l,u;try{let d=null,h=null;this.flowType==="pkce"&&([d,h]=await es(this.storage,this.storageKey));const m=await ce(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&i!==void 0?i:void 0}),!((o=e?.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:d,code_challenge_method:h}),headers:this.headers,xform:gj});return!((l=m.data)===null||l===void 0)&&l.url&&ot()&&!(!((u=e.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(d))return this._returnResult({data:null,error:d});throw d}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;if(i)throw i;if(!n)throw new At;const{error:o}=await ce(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(e){if(re(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:i,type:o,options:l}=e,{error:u}=await ce(this.fetch,"POST",n,{headers:this.headers,body:{email:i,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}},redirectTo:l?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in e){const{phone:i,type:o,options:l}=e,{data:u,error:d}=await ce(this.fetch,"POST",n,{headers:this.headers,body:{phone:i,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:d})}throw new ha("You must provide either an email or phone number and a type")}catch(n){if(re(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(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await i,await n()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const i=n();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(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 e=null;const n=await hr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const i=e.expires_at?e.expires_at*1e3-Date.now()<gc:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.userStorage){const u=await hr(this.userStorage,this.storageKey+"-user");u?.user?e.user=u.user:e.user=wc()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};e.user=hj(e.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Kn}):await this._useSession(async n=>{var i,o,l;const{data:u,error:d}=n;if(d)throw d;return!(!((i=u.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new At}:await ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(o=u.session)===null||o===void 0?void 0:o.access_token)!==null&&l!==void 0?l:void 0,xform:Kn})})}catch(n){if(re(n))return zT(n)&&(await this._removeSession(),await it(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async i=>{const{data:o,error:l}=i;if(l)throw l;if(!o.session)throw new At;const u=o.session;let d=null,h=null;this.flowType==="pkce"&&e.email!=null&&([d,h]=await es(this.storage,this.storageKey));const{data:m,error:y}=await ce(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:d,code_challenge_method:h}),jwt:u.access_token,xform:Kn});if(y)throw y;return u.user=m.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(i){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(i))return this._returnResult({data:{user:null},error:i});throw i}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new At;const n=Date.now()/1e3;let i=n,o=!0,l=null;const{payload:u}=vc(e.access_token);if(u.exp&&(i=u.exp,o=i<=n),o){const{data:d,error:h}=await this._callRefreshToken(e.refresh_token);if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!d)return{data:{user:null,session:null},error:null};l=d}else{const{data:d,error:h}=await this._getUser(e.access_token);if(h)throw h;l={access_token:e.access_token,refresh_token:e.refresh_token,user:d.user,token_type:"bearer",expires_in:i-n,expires_at:i},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(n){if(re(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var i;if(!e){const{data:u,error:d}=n;if(d)throw d;e=(i=u.session)!==null&&i!==void 0?i:void 0}if(!e?.refresh_token)throw new At;const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(re(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){try{if(!ot())throw new fa("No browser detected.");if(e.error||e.error_description||e.error_code)throw new fa(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Qg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new fa("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Qg("No code detected.");const{data:P,error:N}=await this._exchangeCodeForSession(e.code);if(N)throw N;const U=new URL(window.location.href);return U.searchParams.delete("code"),window.history.replaceState(window.history.state,"",U.toString()),{data:{session:P.session,redirectType:null},error:null}}const{provider_token:i,provider_refresh_token:o,access_token:l,refresh_token:u,expires_in:d,expires_at:h,token_type:m}=e;if(!l||!d||!u||!m)throw new fa("No session defined in URL");const y=Math.round(Date.now()/1e3),v=parseInt(d);let w=y+v;h&&(w=parseInt(h));const _=w-y;_*1e3<=is&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${_}s, should have been closer to ${v}s`);const b=w-v;y-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,w,y):y-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,w,y);const{data:S,error:k}=await this._getUser(l);if(k)throw k;const E={provider_token:i,provider_refresh_token:o,access_token:l,expires_in:v,expires_at:w,refresh_token:u,token_type:m,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:E,redirectType:e.type},error:null})}catch(i){if(re(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await hr(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({error:l});const u=(i=o.session)===null||i===void 0?void 0:i.access_token;if(u){const{error:d}=await this.admin.signOut(u,e);if(d&&!(BT(d)&&(d.status===404||d.status===401||d.status===403)))return this._returnResult({error:d})}return e!=="others"&&(await this._removeSession(),await it(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=XT(),i={id:n,callback:e,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,i),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async n=>{var i,o;try{const{data:{session:l},error:u}=n;if(u)throw u;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",e,"session",l)}catch(l){await((o=this.stateChangeEmitters.get(e))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",l),console.error(l)}})}async resetPasswordForEmail(e,n={}){let i=null,o=null;this.flowType==="pkce"&&([i,o]=await es(this.storage,this.storageKey,!0));try{return await ce(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:o,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(l){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var e;try{const{data:n,error:i}=await this.getUser();if(i)throw i;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:i,error:o}=await this._useSession(async l=>{var u,d,h,m,y;const{data:v,error:w}=l;if(w)throw w;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(u=e.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=e.options)===null||d===void 0?void 0:d.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await ce(this.fetch,"GET",_,{headers:this.headers,jwt:(y=(m=v.session)===null||m===void 0?void 0:m.access_token)!==null&&y!==void 0?y:void 0})});if(o)throw o;return ot()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(i?.url),this._returnResult({data:{provider:e.provider,url:i?.url},error:null})}catch(i){if(re(i))return this._returnResult({data:{provider:e.provider,url:null},error:i});throw i}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var i;try{const{error:o,data:{session:l}}=n;if(o)throw o;const{options:u,provider:d,token:h,access_token:m,nonce:y}=e,v=await ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(i=l?.access_token)!==null&&i!==void 0?i:void 0,body:{provider:d,id_token:h,access_token:m,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:u?.captchaToken}},xform:Yt}),{data:w,error:_}=v;return _?this._returnResult({data:{user:null,session:null},error:_}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new Zr}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:_}))}catch(o){if(await it(this.storage,`${this.storageKey}-code-verifier`),re(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var i,o;const{data:l,error:u}=n;if(u)throw u;return await ce(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(o=(i=l.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0})})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const i=Date.now();return await nj(async o=>(o>0&&await tj(200*Math.pow(2,o-1)),this._debug(n,"refreshing attempt",o),await ce(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Yt})),(o,l)=>{const u=200*Math.pow(2,o);return l&&yc(l)&&Date.now()+u-i<is})}catch(i){if(this._debug(n,"error",i),re(i))return this._returnResult({data:{session:null,user:null},error:i});throw i}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const i=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",i),ot()&&!n.skipBrowserRedirect&&window.location.assign(i),{data:{provider:e,url:i},error:null}}async _recoverAndRefresh(){var e,n;const i="#_recoverAndRefresh()";this._debug(i,"begin");try{const o=await hr(this.storage,this.storageKey);if(o&&this.userStorage){let u=await hr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:o.user},await os(this.userStorage,this.storageKey+"-user",u)),o.user=(e=u?.user)!==null&&e!==void 0?e:wc()}else if(o&&!o.user&&!o.user){const u=await hr(this.storage,this.storageKey+"-user");u&&u?.user?(o.user=u.user,await it(this.storage,this.storageKey+"-user"),await os(this.storage,this.storageKey,o)):o.user=wc()}if(this._debug(i,"session from storage",o),!this._isValidSession(o)){this._debug(i,"session is not valid"),o!==null&&await this._removeSession();return}const l=((n=o.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<gc;if(this._debug(i,`session has${l?"":" not"} expired with margin of ${gc}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),yc(u)||(this._debug(i,"refresh failed with a non-retryable error, removing the session",u),await this._removeSession()))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:d}=await this._getUser(o.access_token);!d&&u?.user?(o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(i,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(i,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(i,"error",o),console.error(o);return}finally{this._debug(i,"end")}}async _callRefreshToken(e){var n,i;if(!e)throw new At;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new Ja;const{data:l,error:u}=await this._refreshAccessToken(e);if(u)throw u;if(!l.session)throw new At;await this._saveSession(l.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",l.session);const d={data:l.session,error:null};return this.refreshingDeferred.resolve(d),d}catch(l){if(this._debug(o,"error",l),re(l)){const u={data:null,error:l};return yc(l)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(u),u}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(l),l}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(e,n,i=!0){const o=`#_notifyAllSubscribers(${e})`;this._debug(o,"begin",n,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:e,session:n});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(e,n)}catch(h){l.push(h)}});if(await Promise.all(u),l.length>0){for(let d=0;d<l.length;d+=1)console.error(l[d]);throw l[0]}}finally{this._debug(o,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await it(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),i=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!i&&n.user&&await os(this.userStorage,this.storageKey+"-user",{user:n.user});const o=Object.assign({},n);delete o.user;const l=ny(o);await os(this.storage,this.storageKey,l)}else{const o=ny(n);await os(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await it(this.storage,this.storageKey),await it(this.storage,this.storageKey+"-code-verifier"),await it(this.storage,this.storageKey+"-user"),this.userStorage&&await it(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ot()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),is);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);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 e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);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 e=Date.now();try{return await this._useSession(async n=>{const{data:{session:i}}=n;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((i.expires_at*1e3-e)/is);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${is}ms, refresh threshold is ${Xc} ticks`),o<=Xc&&await this._callRefreshToken(i.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(e){if(e.isAcquireTimeout||e instanceof Av)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ot()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(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(e,n,i){const o=[`provider=${encodeURIComponent(n)}`];if(i?.redirectTo&&o.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&o.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){const[l,u]=await es(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});o.push(d.toString())}if(i?.queryParams){const l=new URLSearchParams(i.queryParams);o.push(l.toString())}return i?.skipBrowserRedirect&&o.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${o.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;return l?this._returnResult({data:null,error:l}):await ce(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token})})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var i,o;const{data:l,error:u}=n;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:h,error:m}=await ce(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(i=l?.session)===null||i===void 0?void 0:i.access_token});return m?this._returnResult({data:null,error:m}):(e.factorType==="totp"&&h.type==="totp"&&(!((o=h?.totp)===null||o===void 0)&&o.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),this._returnResult({data:h,error:null}))})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Rj(e.webauthn.credential_response):Oj(e.webauthn.credential_response)})}:{code:e.code}),{data:d,error:h}=await ce(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:u,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});return h?this._returnResult({data:null,error:h}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+d.expires_in},d)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",d),this._returnResult({data:d,error:h}))})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var i;const{data:o,error:l}=n;if(l)return this._returnResult({data:null,error:l});const u=await ce(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});if(u.error)return u;const{data:d}=u;if(d.type!=="webauthn")return{data:d,error:null};switch(d.webauthn.type){case"create":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:Aj(d.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:Pj(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(e){const{data:n,error:i}=await this._challenge({factorId:e.factorId});return i?this._returnResult({data:null,error:i}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:i}=await this.getUser();if(i)return{data:null,error:i};const o={all:[],phone:[],totp:[],webauthn:[]};for(const l of(e=n?.factors)!==null&&e!==void 0?e:[])o.all.push(l),l.status==="verified"&&o[l.factor_type].push(l);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:i},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=vc(i.access_token);let u=null;l.aal&&(u=l.aal);let d=u;((n=(e=i.user.factors)===null||e===void 0?void 0:e.filter(y=>y.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(d="aal2");const m=l.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:i},error:o}=n;return o?this._returnResult({data:null,error:o}):i?await ce(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:i.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new At})})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async i=>{const{data:{session:o},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new At});const u=await ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&ot()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(re(i))return this._returnResult({data:null,error:i});throw i}}async _denyAuthorization(e,n){try{return await this._useSession(async i=>{const{data:{session:o},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new At});const u=await ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&ot()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(re(i))return this._returnResult({data:null,error:i});throw i}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:i}=e;return i?this._returnResult({data:null,error:i}):n?await ce(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new At})})}catch(e){if(re(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:i},error:o}=n;return o?this._returnResult({data:null,error:o}):i?(await ce(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:i.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new At})})}catch(n){if(re(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let i=n.keys.find(d=>d.kid===e);if(i)return i;const o=Date.now();if(i=this.jwks.keys.find(d=>d.kid===e),i&&this.jwks_cached_at+VT>o)return i;const{data:l,error:u}=await ce(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=o,i=l.keys.find(d=>d.kid===e),!i)?null:i}async getClaims(e,n={}){try{let i=e;if(!i){const{data:_,error:b}=await this.getSession();if(b||!_.session)return this._returnResult({data:null,error:b});i=_.session.access_token}const{header:o,payload:l,signature:u,raw:{header:d,payload:h}}=vc(i);n?.allowExpired||uj(l.exp);const m=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!m){const{error:_}=await this.getUser(i);if(_)throw _;return{data:{claims:l,header:o,signature:u},error:null}}const y=cj(o.alg),v=await crypto.subtle.importKey("jwk",m,y,!0,["verify"]);if(!await crypto.subtle.verify(y,v,u,YT(`${d}.${h}`)))throw new td("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(i){if(re(i))return this._returnResult({data:null,error:i});throw i}}}Ii.nextInstanceID={};const Bj=Ii,zj="2.91.0";let mi="";typeof Deno<"u"?mi="deno":typeof document<"u"?mi="web":typeof navigator<"u"&&navigator.product==="ReactNative"?mi="react-native":mi="node";const qj={"X-Client-Info":`supabase-js-${mi}/${zj}`},Wj={headers:qj},Hj={schema:"public"},Kj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Gj={};function Di(t){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Di(t)}function Jj(t,e){if(Di(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(Di(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Yj(t){var e=Jj(t,"string");return Di(e)=="symbol"?e:e+""}function Qj(t,e,n){return(e=Yj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,i)}return n}function qe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?uy(Object(n),!0).forEach(function(i){Qj(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uy(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const Xj=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Zj=()=>Headers,eC=(t,e,n)=>{const i=Xj(n),o=Zj();return async(l,u)=>{var d;const h=(d=await e())!==null&&d!==void 0?d:t;let m=new o(u?.headers);return m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${h}`),i(l,qe(qe({},u),{},{headers:m}))}};function tC(t){return t.endsWith("/")?t:t+"/"}function nC(t,e){var n,i;const{db:o,auth:l,realtime:u,global:d}=t,{db:h,auth:m,realtime:y,global:v}=e,w={db:qe(qe({},h),o),auth:qe(qe({},m),l),realtime:qe(qe({},y),u),storage:{},global:qe(qe(qe({},v),d),{},{headers:qe(qe({},(n=v?.headers)!==null&&n!==void 0?n:{}),(i=d?.headers)!==null&&i!==void 0?i:{})}),accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function rC(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(tC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var sC=class extends Bj{constructor(t){super(t)}},iC=class{constructor(t,e,n){var i,o;this.supabaseUrl=t,this.supabaseKey=e;const l=rC(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const u=`sb-${l.hostname.split(".")[0]}-auth-token`,d={db:Hj,realtime:Gj,auth:qe(qe({},Kj),{},{storageKey:u}),global:Wj},h=nC(n??{},d);if(this.storageKey=(i=h.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=h.global.headers)!==null&&o!==void 0?o:{},h.accessToken)this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(y,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}});else{var m;this.auth=this._initSupabaseAuthClient((m=h.auth)!==null&&m!==void 0?m:{},this.headers,h.global.fetch)}this.fetch=eC(e,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(qe({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(y=>this.realtime.setAuth(y)).catch(y=>console.warn("Failed to set initial Realtime auth token:",y)),this.rest=new U2(new URL("rest/v1",l).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new DT(this.storageUrl.href,this.headers,this.fetch,n?.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new O2(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:i}=await t.auth.getSession();return(e=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:i,userStorage:o,storageKey:l,flowType:u,lock:d,debug:h,throwOnError:m},y,v){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new sC({url:this.authUrl.href,headers:qe(qe({},w),y),storageKey:l,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:i,userStorage:o,flowType:u,lock:d,debug:h,throwOnError:m,fetch:v,hasCustomAuthorizationHeader:Object.keys(this.headers).some(_=>_.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new tT(this.realtimeUrl.href,qe(qe({},t),{},{params:qe(qe({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const oC=(t,e,n)=>new iC(t,e,n);function aC(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const n=e.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}aC()&&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 Ya="alchemy_supabase_config";function Yd(){try{const t=localStorage.getItem(Ya);if(t)return JSON.parse(t)}catch(t){console.error("Error reading Supabase config:",t)}return null}function lC(t){try{localStorage.setItem(Ya,JSON.stringify(t))}catch(e){console.error("Error saving Supabase config:",e)}}function uC(){try{localStorage.removeItem(Ya)}catch(t){console.error("Error clearing Supabase config:",t)}}async function cC(t,e){try{if(!t.startsWith("http://")&&!t.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const n=e.startsWith("eyJ"),i=e.startsWith("sb_publishable_");if(!n&&!i)return{valid:!1,error:"Invalid API key format"};if(i)return{valid:!0};const o=await fetch(`${t}/rest/v1/`,{method:"GET",headers:{apikey:e,Authorization:`Bearer ${e}`}});return o.ok?{valid:!0}:o.status===401||o.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${o.statusText}`}}catch(n){return{valid:!1,error:n instanceof Error?n.message:"Connection failed"}}}function dC(){return localStorage.getItem(Ya)?"ui":"none"}const Qd=Yd(),hC=Qd?.url||void 0||"https://placeholder.supabase.co",fC=Qd?.anonKey||void 0||"placeholder",me=oC(hC,fC,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),cy=!!Qd?.url;function pC({length:t=6,value:e,onChange:n,onComplete:i,disabled:o=!1,error:l=!1}){const u=R.useRef([]),[d,h]=R.useState(null),m=(w,_)=>{const b=_.replace(/[^0-9]/g,"");if(b.length===0){const E=e.split("");w<E.length&&E.splice(w,1);const P=E.join("");n(P),w>0&&u.current[w-1]?.focus();return}const S=[...e];S[w]=b[0];const k=S.join("");n(k),w<t-1&&b!==""&&u.current[w+1]?.focus(),k.length===t&&i&&i(k)},y=(w,_)=>{_.key==="Backspace"&&!e[w]&&w>0||_.key==="ArrowLeft"&&w>0?u.current[w-1]?.focus():_.key==="ArrowRight"&&w<t-1&&u.current[w+1]?.focus()},v=w=>{w.preventDefault();const b=w.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,t);n(b);const S=Math.min(b.length,t-1);u.current[S]?.focus(),b.length===t&&i&&i(b)};return p.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:t}).map((w,_)=>p.jsx("input",{ref:b=>{u.current[_]=b},type:"text",inputMode:"numeric",maxLength:1,value:e[_]||"",onChange:b=>m(_,b.target.value),onKeyDown:b=>y(_,b),onPaste:v,onFocus:()=>h(_),onBlur:()=>h(null),disabled:o,className:`
64
64
  w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-black
65
65
  bg-black/20 border border-border/50 rounded-xl outline-none transition-all
66
66
  ${l?"border-error/50 shadow-[0_0_15px_rgba(239,68,68,0.1)]":"focus:border-primary/50"}
67
67
  ${d===_?"border-primary/50 bg-black/40 scale-105":""}
68
68
  disabled:opacity-50 disabled:cursor-not-allowed
69
- `,"aria-label":`Digit ${_+1}`},_))})}function pC({onAuthSuccess:t,isInitialized:e=!0}){const[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(""),[h,m]=R.useState(""),[y,v]=R.useState(!1),[w,_]=R.useState(!e),[b,S]=R.useState(null),[k,E]=R.useState("password"),[P,N]=R.useState("email"),[U,V]=R.useState(""),z=async B=>{B.preventDefault(),v(!0),S(null);try{if(w){const{error:Y}=await me.auth.signUp({email:n,password:o,options:{data:{first_name:u,last_name:h,full_name:`${u} ${h}`.trim()}}});if(Y)throw Y;t()}else if(k==="password"){const{error:Y}=await me.auth.signInWithPassword({email:n,password:o});if(Y)throw Y;t()}else if(k==="otp")if(P==="email"){const{error:Y}=await me.auth.signInWithOtp({email:n,options:{shouldCreateUser:!1}});if(Y)throw Y;N("verify")}else await $()}catch(Y){S(Y.message)}finally{v(!1)}},$=async()=>{v(!0),S(null);try{const{data:B,error:Y}=await me.auth.verifyOtp({email:n,token:U,type:"magiclink"});if(Y)throw Y;if(!B.session)throw new Error("Failed to create session");t()}catch(B){S(B.message||"Invalid code")}finally{v(!1)}};return p.jsx("div",{className:"flex flex-col items-center justify-center p-8 h-full bg-gradient-to-t from-bg to-bg/50",children:p.jsxs(Ne.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md glass p-8 space-y-8",children:[p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h2",{className:"text-3xl font-black italic tracking-tighter",children:!e&&w?"INITIALIZE MASTER":w?"JOIN THE CIRCLE":k==="otp"?"MYSTIC ACCESS":"ALCHEMIST LOGIN"}),p.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase",children:!e&&w?"Forge the prime alchemist account":k==="otp"?P==="email"?"Enter your essence email":"Transmute the sacred code":"Transmute your data into intelligence"})]}),p.jsx("form",{onSubmit:z,className:"space-y-4",children:p.jsxs(cn,{mode:"wait",children:[w&&p.jsxs(Ne.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-2 gap-4 overflow-hidden",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"First Name"}),p.jsx("input",{type:"text",value:u,onChange:B=>d(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"Zosimos",required:!0})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Last Name"}),p.jsx("input",{type:"text",value:h,onChange:B=>m(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"Panopolis",required:!0})]})]},"signup-fields"),k==="otp"&&P==="verify"?p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6 py-4",children:[p.jsx("div",{className:"flex justify-center",children:p.jsx(fC,{value:U,onChange:V,length:6,onComplete:B=>{V(B)},error:!!b})}),p.jsx("button",{type:"button",onClick:()=>N("email"),className:"w-full text-[10px] font-bold uppercase text-primary/40 hover:text-primary transition-colors tracking-widest",children:"Change email address"}),p.jsxs("button",{type:"button",disabled:y||U.length!==6,onClick:$,className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2",children:[y?p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):p.jsx(sm,{size:18}),"VERIFY CODE"]})]},"otp-verify"):p.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address"}),p.jsxs("div",{className:"relative",children:[p.jsx(g1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),p.jsx("input",{type:"email",value:n,onChange:B=>i(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"alchemist@example.com",required:!0})]})]}),(w||k==="password")&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Complexity Key"}),p.jsxs("div",{className:"relative",children:[p.jsx(m1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),p.jsx("input",{type:"password",value:o,onChange:B=>l(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"••••••••",required:!0})]})]}),p.jsxs("button",{type:"submit",disabled:y,className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2",children:[y&&p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),w?p.jsx(j1,{size:18}):p.jsx(sm,{size:18}),w?"INITIALIZE ACCOUNT":k==="otp"?"SEND CODE":"UNSEAL ENGINE"]})]},"base-login")]})}),b&&k==="password"&&p.jsx(Ne.p,{initial:{opacity:0},animate:{opacity:1},className:"text-xs text-error font-medium bg-error/10 p-3 rounded-lg border border-error/10",children:b}),p.jsxs("div",{className:"space-y-4",children:[!w&&p.jsx("div",{className:"flex flex-col gap-2",children:k==="password"?p.jsxs("button",{type:"button",onClick:()=>{E("otp"),N("email"),S(null)},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all text-fg/40 hover:text-primary",children:[p.jsx(d1,{size:16})," Sign in with Code"]}):p.jsxs("button",{type:"button",onClick:()=>{E("password"),S(null)},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all text-fg/40 hover:text-primary",children:[p.jsx(Jx,{size:16})," Sign in with Password"]})}),p.jsxs("p",{className:"text-center text-xs text-fg/40",children:[w?"Already an Alchemist?":"New to Alchemy?"," "," ",p.jsx("button",{onClick:()=>{_(!w),E("password"),S(null)},className:"text-primary font-bold hover:underline",children:w?"Login instead":"Create an account"})]})]})]})})}function mC(t){const e=t.trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}.supabase.co`:""}function Rv({onComplete:t,open:e=!0,canClose:n=!1}){const[i,o]=R.useState("welcome"),[l,u]=R.useState(""),[d,h]=R.useState(""),[m,y]=R.useState(null),[v,w]=R.useState(!1);if(!e)return null;const _=async()=>{y(null),w(!0),o("validating");const b=mC(l),S=d.trim(),k=await uC(b,S);k.valid?(aC({url:b,anonKey:S}),o("success"),setTimeout(()=>{window.location.reload()},1500)):(y(k.error||"Connection failed"),o("credentials"),w(!1))};return p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-bg/80 backdrop-blur-sm",children:p.jsxs(Ne.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-lg glass p-8 space-y-8 relative overflow-hidden",children:[p.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-primary/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),p.jsxs(cn,{mode:"wait",children:[i==="welcome"&&p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:p.jsx(ki,{className:"w-6 h-6 text-primary"})}),p.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Assemble Your Engine"})]}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Alchemy requires a Supabase essence to store signal fragments and intelligence patterns."})]}),p.jsxs("div",{className:"glass bg-white/5 border-white/10 p-4 rounded-xl space-y-3",children:[p.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-primary/70",children:"Requirements:"}),p.jsxs("ul",{className:"space-y-2",children:[p.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[p.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Supabase Project URL"]}),p.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[p.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Anon Public API Key"]})]})]}),p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsxs("a",{href:"https://supabase.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 py-3 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/60",children:["Forge Project at Supabase ",p.jsx(Da,{size:14})]}),p.jsxs("button",{onClick:()=>o("credentials"),className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.01] active:scale-95 transition-all flex items-center justify-center gap-2",children:["BEGIN INITIALIZATION ",p.jsx(Yx,{size:18})]})]})]},"welcome"),i==="credentials"&&p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Essence Coordinates"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium lowercase",children:"Link the alchemist engine to your cloud database"})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Project URL or ID"}),p.jsx("input",{type:"text",value:l,onChange:b=>u(b.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"https://xxx.supabase.co or project-id"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Anon Public Key"}),p.jsx("input",{type:"password",value:d,onChange:b=>h(b.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"eyJ..."})]})]}),m&&p.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[p.jsx(Li,{className:"w-5 h-5 text-error"}),p.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:m})]}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx("button",{onClick:()=>o("welcome"),className:"flex-1 py-4 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/40",children:"BACK"}),p.jsxs("button",{onClick:_,disabled:!l||!d,className:"flex-[2] py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.01] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale flex items-center justify-center gap-2",children:["CONNECT ESSENCE ",p.jsx(kr,{size:18})]})]})]},"credentials"),i==="validating"&&p.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-xl rounded-full"}),p.jsx(xn,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h3",{className:"text-xl font-bold italic uppercase tracking-tighter",children:"Validating Link"}),p.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase animate-pulse",children:"Synchronizing Resonance..."})]})]},"validating"),i==="success"&&p.jsxs(Ne.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[p.jsx("div",{className:"p-4 bg-emerald-500/20 rounded-full",children:p.jsx(rd,{className:"w-16 h-16 text-emerald-500"})}),p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h3",{className:"text-2xl font-black italic uppercase tracking-tighter",children:"Engine Aligned"}),p.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase",children:"Restarting Alchemist Subsystems..."})]})]},"success")]})]})})}const qn={chrome:{icon:p.jsx(i1,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:p.jsx(Ju,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:p.jsx(Ju,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:p.jsx(Ju,{size:18}),name:"Microsoft Edge",color:"text-cyan-500"},brave:{icon:p.jsx(kr,{size:18}),name:"Brave",color:"text-orange-400"},arc:{icon:p.jsx(kr,{size:18}),name:"Arc",color:"text-purple-500"}};function gC({sources:t,onChange:e}){const[n,i]=R.useState(!1),[o,l]=R.useState({}),[u,d]=R.useState(""),[h,m]=R.useState("chrome"),[y,v]=R.useState(!1),w=async()=>{i(!0);try{const{data:E}=await Re.get("/api/browser-paths/detect");l(E)}catch(E){console.error("Detection failed:",E)}finally{i(!1)}},_=E=>{const P=o[E];if(!P||!P.found||!P.valid||t.find(V=>V.browser===E&&V.path===P.path))return;const U={browser:E,path:P.path,enabled:!0,label:`${qn[E].name} (Auto-detected)`};e([...t,U])},b=async()=>{if(u.trim()){v(!0);try{const{data:E}=await Re.post("/api/browser-paths/validate",{path:u});if(!E.valid){alert(`Invalid path: ${E.error||"Not a browser history database"}`),v(!1);return}const P={browser:h,path:u,enabled:!0,label:`${qn[h].name} (Custom)`};e([...t,P]),d("")}catch(E){console.error("Validation failed:",E),alert("Failed to validate path")}finally{v(!1)}}},S=E=>{const P=[...t];P[E].enabled=!P[E].enabled,e(P)},k=E=>{e(t.filter((P,N)=>N!==E))};return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(Sc,{size:14})," Auto-Detect Browsers"]}),p.jsxs("button",{onClick:w,disabled:n,className:"px-3 py-1.5 text-xs font-bold uppercase tracking-widest bg-primary/10 hover:bg-primary/20 text-primary rounded-lg transition-all flex items-center gap-2",children:[n?p.jsx(xn,{size:12,className:"animate-spin"}):p.jsx(Sc,{size:12}),n?"Scanning...":"Scan System"]})]}),Object.keys(o).length>0&&p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.keys(qn).map(E=>{const P=o[E],N=qn[E],U=t.some(V=>V.browser===E&&V.path===P?.path);return p.jsxs(Ne.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`glass p-4 rounded-xl border ${P?.found&&P?.valid?"border-success/20 bg-success/5":P?.found?"border-error/20 bg-error/5":"border-border/10"}`,children:[p.jsxs("div",{className:"flex items-start justify-between mb-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:N.color,children:N.icon}),p.jsx("span",{className:"text-sm font-bold",children:N.name})]}),P?.found&&P?.valid?p.jsx(Si,{size:16,className:"text-success"}):P?.found?p.jsx(Li,{size:16,className:"text-error"}):p.jsx(Sr,{size:16,className:"text-fg/20"})]}),P?.found?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate mb-2",children:P.path}),P.valid?p.jsx("button",{onClick:()=>_(E),disabled:U,className:`w-full py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${U?"bg-fg/5 text-fg/30 cursor-not-allowed":"bg-success/10 hover:bg-success/20 text-success"}`,children:U?"Already Added":"Add Source"}):p.jsx("p",{className:"text-[10px] text-error font-medium",children:P.error})]}):p.jsx("p",{className:"text-[10px] text-fg/30 italic",children:"Not found on this system"})]},E)})})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(l1,{size:14})," Add Custom Path"]}),p.jsxs("div",{className:"glass p-4 rounded-xl space-y-3",children:[p.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[p.jsx("select",{value:h,onChange:E=>m(E.target.value),className:"bg-black/20 border border-border/5 rounded-xl py-2 px-3 text-sm focus:border-primary/30 outline-none transition-all",children:Object.keys(qn).map(E=>p.jsx("option",{value:E,children:qn[E].name},E))}),p.jsx("input",{type:"text",value:u,onChange:E=>d(E.target.value),placeholder:"/path/to/browser/History",className:"col-span-2 bg-black/20 border border-border/5 rounded-xl py-2 px-3 text-sm focus:border-primary/30 outline-none transition-all"})]}),p.jsxs("button",{onClick:b,disabled:!u.trim()||y,className:"w-full py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.01] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:grayscale",children:[y?p.jsx(xn,{size:16,className:"animate-spin"}):p.jsx(x1,{size:16}),y?"Validating...":"Add Custom Source"]})]})]}),t.length>0&&p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:["Configured Sources (",t.length,")"]}),p.jsx("div",{className:"space-y-2",children:p.jsx(cn,{children:t.map((E,P)=>p.jsxs(Ne.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:`glass p-4 rounded-xl border border-border/10 flex items-center justify-between ${!E.enabled&&"opacity-50"}`,children:[p.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[p.jsx("div",{className:qn[E.browser].color,children:qn[E.browser].icon}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("p",{className:"text-sm font-bold",children:E.label}),p.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate",children:E.path})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>S(P),className:`px-3 py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${E.enabled?"bg-success/10 text-success":"bg-fg/5 text-fg/40"}`,children:E.enabled?"Enabled":"Disabled"}),p.jsx("button",{onClick:()=>k(P),className:"p-2 hover:bg-error/10 text-error rounded-lg transition-all",children:p.jsx(Sr,{size:16})})]})]},`${E.browser}-${E.path}`))})})]})]})}const Ov=R.createContext(void 0);function yC({children:t}){const[e,n]=R.useState([]),i=R.useCallback((o,l="info")=>{const u=Math.random().toString(36).substr(2,9),d={id:u,type:l,message:o};n(h=>[...h,d]),setTimeout(()=>{n(h=>h.filter(m=>m.id!==u))},3e3)},[]);return p.jsxs(Ov.Provider,{value:{showToast:i},children:[t,p.jsx(vC,{toasts:e})]})}function Iv(){const t=R.useContext(Ov);if(!t)throw new Error("useToast must be used within ToastProvider");return t}function vC({toasts:t}){return p.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none",children:p.jsx(cn,{children:t.map(e=>p.jsx(wC,{toast:e},e.id))})})}function wC({toast:t}){const e={success:p.jsx(Si,{size:18,className:"text-success"}),error:p.jsx(Sr,{size:18,className:"text-error"}),warning:p.jsx(Li,{size:18,className:"text-accent"}),info:p.jsx(py,{size:18,className:"text-primary"})},n={success:"border-success/20 bg-success/10",error:"border-error/20 bg-error/10",warning:"border-accent/20 bg-accent/10",info:"border-primary/20 bg-primary/10"};return p.jsxs(Ne.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,x:100,scale:.95},className:`glass px-4 py-3 rounded-xl border ${n[t.type]} flex items-center gap-3 min-w-[300px] max-w-md pointer-events-auto shadow-lg`,children:[e[t.type],p.jsx("span",{className:"text-sm font-medium flex-1",children:t.message})]})}function xC(){const{showToast:t}=Iv(),[e,n]=R.useState("http://localhost:11434"),[i,o]=R.useState("llama3"),[l,u]=R.useState(""),[d,h]=R.useState([]),[m,y]=R.useState(!1),[v,w]=R.useState(!1),[_,b]=R.useState(!1);R.useEffect(()=>{S()},[]);const S=async()=>{const{data:{user:N}}=await me.auth.getUser();if(!N)return;const{data:U}=await me.from("alchemy_settings").select("*").eq("user_id",N.id).maybeSingle();U&&(n(U.llm_base_url||U.ollama_host||"http://localhost:11434"),o(U.llm_model_name||"llama3"),u(U.llm_api_key||U.openai_api_key||U.anthropic_api_key||""),h(U.custom_browser_paths||[]))},k=async()=>{y(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N){t("Please log in to save settings","error"),y(!1);return}const{error:U}=await me.from("alchemy_settings").upsert({user_id:N.id,llm_base_url:e,llm_model_name:i,llm_api_key:l},{onConflict:"user_id"});U?(console.error("[AlchemistEngine] Save error:",U),t(`Failed to save: ${U.message}`,"error")):t("LLM settings saved successfully","success")}catch(N){console.error("[AlchemistEngine] Unexpected error:",N),t(`Unexpected error: ${N.message}`,"error")}finally{y(!1)}},E=async()=>{w(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N){t("Please log in to save settings","error"),w(!1);return}const{error:U}=await me.from("alchemy_settings").upsert({user_id:N.id,custom_browser_paths:d},{onConflict:"user_id"});U?(console.error("[AlchemistEngine] Save browser sources error:",U),t(`Failed to save: ${U.message}`,"error")):t("Browser sources saved successfully","success")}catch(N){console.error("[AlchemistEngine] Unexpected error:",N),t(`Unexpected error: ${N.message}`,"error")}finally{w(!1)}},P=async()=>{b(!0);try{const{data:N}=await Re.post("/api/llm/test",{baseUrl:e,modelName:i,apiKey:l});N.success?t(`Connection successful! ${N.model?`Model: ${N.model}`:""}`,"success"):t(`Connection failed: ${N.message}`,"error")}catch(N){console.error("[AlchemistEngine] Test error:",N),t(`Test failed: ${N.message}`,"error")}finally{b(!1)}};return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Intelligence Engine"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Fine-tune the Alchemist's cognitive parameters and provider links."})]}),p.jsx("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsx("section",{className:"space-y-6",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(sd,{size:14})," LLM Configuration"]}),p.jsxs("div",{className:"glass p-8 space-y-6",children:[p.jsx(bc,{label:"Provider URL (Base)",value:e,onChange:n,placeholder:"http://localhost:11434 or https://api.openai.com/v1"}),p.jsx(bc,{label:"Intelligence Model",value:i,onChange:o,placeholder:"llama3, gpt-4o, claude-3-5-sonnet..."}),p.jsx(bc,{label:"Secret Key (Optional)",type:"password",value:l,onChange:u,placeholder:"sk-..."}),p.jsx("div",{className:"p-4 bg-primary/5 rounded-2xl",children:p.jsx("p",{className:"text-[10px] text-primary/60 font-medium leading-relaxed",children:"The Alchemist uses a unified interface. You can point this to local Ollama instances, OpenAI-compatible APIs, or any custom LLM endpoint."})}),p.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[p.jsxs("button",{onClick:P,disabled:_||m,className:"px-6 py-3 bg-surface hover:bg-surface/80 border border-border/10 text-fg font-bold rounded-xl shadow-sm hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[_?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(kr,{size:18,className:"text-accent"}),"Test Connection"]}),p.jsxs("button",{onClick:k,disabled:m,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[m?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(ba,{size:18}),"Save"]})]})]})]})}),p.jsx("section",{className:"space-y-6",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(ki,{size:14})," Browser History Sources"]}),p.jsxs("div",{className:"glass p-8 space-y-6",children:[p.jsx(gC,{sources:d,onChange:h}),p.jsx("div",{className:"flex justify-end pt-2",children:p.jsxs("button",{onClick:E,disabled:v,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[v?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(ba,{size:18}),"Save Browser Sources"]})})]})]})})]})})]})}function bc({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),p.jsx("input",{type:o,value:e,onChange:l=>n(l.target.value),className:"w-full bg-black/20 border border-border/5 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all",placeholder:i})]})}const Dv=R.createContext(null);function bC({children:t}){const[e,n]=R.useState(!1),i=()=>n(!0),o=()=>n(!1);return p.jsx(Dv.Provider,{value:{isExpanded:e,setIsExpanded:n,openTerminal:i,closeTerminal:o},children:t})}function _C(){const t=R.useContext(Dv);if(!t)throw new Error("useTerminal must be used within a TerminalProvider");return t}function SC({isExpanded:t,onToggle:e}={}){const[n,i]=R.useState([]),{isExpanded:o,setIsExpanded:l}=_C(),[u,d]=R.useState({}),h=t!==void 0?t:o,m=e||(()=>l(!o));R.useEffect(()=>{y();const _=me.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},b=>{const S=b.new;S.event_type==="error"&&d(k=>({...k,[S.id]:!0})),i(k=>{const E=[S,...k];return E.length>50?E.slice(0,50):E})}).subscribe();return()=>{me.removeChannel(_)}},[]);const y=async()=>{const{data:_}=await me.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);_&&i(_)},v=_=>{d(b=>({...b,[_]:!b[_]}))},w=(_,b)=>{if(b==="debug")return p.jsx(e1,{size:14,className:"text-fg/40"});switch(_){case"analysis":return p.jsx(dy,{size:14,className:"text-primary"});case"action":return p.jsx(kr,{size:14,className:"text-accent"});case"error":return p.jsx(Kx,{size:14,className:"text-error"});case"system":return p.jsx(id,{size:14,className:"text-success"});default:return p.jsx(py,{size:14,className:"text-fg/40"})}};return h?p.jsxs(Ne.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},className:"fixed bottom-6 right-6 z-50 w-[450px] max-h-[600px] glass shadow-2xl flex flex-col overflow-hidden border-primary/10",children:[p.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(kc,{size:18,className:"text-primary"}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:"Alchemist Engine"}),p.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold bg-success/10 text-success px-2 py-0.5 rounded-full border border-success/10 animate-pulse ml-2",children:[p.jsx(Hx,{size:10})," LIVE"]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>i([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:"Clear"}),p.jsx("button",{onClick:m,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:p.jsx(v1,{size:18})})]})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[n.length===0&&p.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:"Idle. Awaiting signal mining events..."}),n.map(_=>p.jsxs("div",{className:"relative flex items-start gap-3 group",children:[p.jsx("div",{className:"mt-1 flex-shrink-0 w-6 h-6 rounded-full bg-surface border border-white/5 flex items-center justify-center",children:w(_.event_type,_.level)}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(_.created_at||Date.now()).toLocaleTimeString()}),p.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${_.level==="error"?"text-error":_.level==="warn"?"text-orange-400":_.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:_.agent_state}),_.duration_ms&&p.jsxs("span",{className:"ml-auto text-[10px] font-mono bg-bg/50 px-1.5 py-0.5 rounded flex items-center gap-1 text-fg/40",children:[p.jsx(ps,{size:10}),_.duration_ms,"ms"]})]}),p.jsx("p",{className:`text-sm break-words leading-relaxed ${_.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:_.message}),(_.details||_.metadata)&&p.jsxs("div",{className:"mt-2 text-xs",children:[p.jsxs("button",{onClick:()=>v(_.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[u[_.id]?p.jsx(hy,{size:12}):p.jsx(xa,{size:12}),u[_.id]?"Hide Details":"View Details"]}),p.jsx(cn,{children:u[_.id]&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:p.jsx("pre",{className:"mt-2 p-3 bg-bg/50 rounded border border-white/5 font-mono text-[10px] overflow-x-auto text-fg/70",children:JSON.stringify({..._.details,..._.metadata},null,2)})})})]})]})]},_.id))]})]}):p.jsxs("button",{onClick:m,className:"fixed bottom-6 right-6 z-50 glass p-4 flex items-center gap-3 hover:bg-surface transition-all shadow-xl group border-primary/10",children:[p.jsxs("div",{className:"relative",children:[p.jsx(kc,{size:20,className:"text-primary"}),n.length>0&&p.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[p.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),p.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-widest hidden group-hover:block animate-in fade-in slide-in-from-right-2",children:"Live Engine Log"})]})}const Lv="1.0.0",kC="20260125000004";async function EC(t){try{const{data:e,error:n}=await t.rpc("get_latest_migration_timestamp");return n?n.code==="42883"?{version:null,latestMigrationTimestamp:"0"}:{version:null,latestMigrationTimestamp:null}:{version:Lv,latestMigrationTimestamp:e||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function TC(t){const e=Lv,n=kC,i=await EC(t);if(i.latestMigrationTimestamp&&i.latestMigrationTimestamp.trim()!==""){const o=n,l=i.latestMigrationTimestamp;return o>l?{needsMigration:!0,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:l,message:`New migrations available. Database is at ${l}, app has ${o}.`}:{needsMigration:!1,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:l,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:e,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function jC(){const[t,e]=R.useState("profile"),[n,i]=R.useState(!1);return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Account Configuration"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Manage your Alchemist profile and essence links."})]}),p.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[p.jsxs("aside",{className:"w-64 border-r border-border/10 p-4 space-y-1",children:[p.jsx(_c,{active:t==="profile",onClick:()=>e("profile"),icon:p.jsx(od,{size:18}),label:"Profile"}),p.jsx(_c,{active:t==="security",onClick:()=>e("security"),icon:p.jsx(my,{size:18}),label:"Security"}),p.jsx(_c,{active:t==="supabase",onClick:()=>e("supabase"),icon:p.jsx(ki,{size:18}),label:"Supabase"})]}),p.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[t==="profile"&&p.jsx(CC,{}),t==="security"&&p.jsx(NC,{}),t==="supabase"&&p.jsx(AC,{})]})]})]})}function CC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(!1),[h,m]=R.useState(!1),[y,v]=R.useState(null),[w,_]=R.useState(!0);R.useEffect(()=>{b()},[]);const b=async()=>{const{data:{user:E}}=await me.auth.getUser();if(!E)return;l(E.email||"");const{data:P}=await me.from("profiles").select("*").eq("id",E.id).maybeSingle();P&&(e(P.first_name||""),i(P.last_name||""),v(P.avatar_url));const{data:N}=await me.from("alchemy_settings").select("sound_enabled").eq("user_id",E.id).maybeSingle();N&&_(N.sound_enabled??!0)},S=async()=>{d(!0);const{data:{user:E}}=await me.auth.getUser();E&&(await me.from("profiles").upsert({id:E.id,first_name:t,last_name:n,full_name:t&&n?`${t} ${n}`:t||n||null}),await me.from("alchemy_settings").update({sound_enabled:w}).eq("user_id",E.id),d(!1))},k=async E=>{const P=E.target.files?.[0];if(P){m(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N)return;const U=P.name.split(".").pop(),V=`${N.id}/avatar-${Date.now()}.${U}`,{error:z}=await me.storage.from("avatars").upload(V,P,{upsert:!0});if(z)throw z;const{data:{publicUrl:$}}=me.storage.from("avatars").getPublicUrl(V);await me.from("profiles").update({avatar_url:$}).eq("id",N.id),v($)}catch(N){console.error("Avatar upload failed:",N)}finally{m(!1)}}};return p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsxs("section",{className:"flex items-start gap-8",children:[p.jsxs("div",{className:"relative group",children:[p.jsx("div",{className:"w-32 h-32 rounded-3xl bg-surface border border-border/20 flex items-center justify-center overflow-hidden shadow-xl",children:y?p.jsx("img",{src:y,alt:"Avatar",className:"w-full h-full object-cover"}):p.jsx(od,{size:48,className:"text-fg/20"})}),p.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer rounded-3xl",children:[p.jsx(n1,{size:24,className:"text-white"}),p.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:k,disabled:h})]}),h&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:p.jsx(xn,{size:24,className:"text-primary animate-spin"})})]}),p.jsxs("div",{className:"flex-1 space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsx(Oa,{label:"First Name",value:t,onChange:e,placeholder:"Zosimos"}),p.jsx(Oa,{label:"Last Name",value:n,onChange:i,placeholder:"of Panopolis"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address (Locked)"}),p.jsx("input",{type:"email",value:o,readOnly:!0,className:"w-full bg-black/10 border border-border/10 rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),p.jsxs("section",{className:"glass p-6 space-y-4",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[w?p.jsx(om,{size:20,className:"text-primary"}):p.jsx(am,{size:20,className:"text-fg/40"}),"Sound Effects"]}),p.jsx("p",{className:"text-xs text-fg/40",children:"Enable audio feedback for sync events and signal discoveries."}),p.jsx("button",{onClick:()=>_(!w),className:`w-full p-4 rounded-xl border-2 transition-all ${w?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border/20 text-fg/40"}`,children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"font-semibold text-sm",children:w?"Enabled":"Disabled"}),w?p.jsx(om,{size:18}):p.jsx(am,{size:18})]})})]}),p.jsxs("section",{className:"glass p-6 space-y-4",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(im,{size:20,className:"text-error"}),"Sign Out"]}),p.jsx("p",{className:"text-xs text-fg/40",children:"End your current session and return to the login screen."}),p.jsx("button",{onClick:()=>me.auth.signOut(),className:"w-full p-4 rounded-xl border-2 bg-error/10 border-error/30 text-error hover:bg-error hover:text-white transition-all",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"font-semibold text-sm",children:"Logout"}),p.jsx(im,{size:18})]})})]}),p.jsx("div",{className:"flex justify-end pt-4 border-t border-border/10",children:p.jsxs("button",{onClick:S,disabled:u,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[u?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(ba,{size:18}),"Preserve Profile"]})})]})}function NC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(!1),[u,d]=R.useState(null),[h,m]=R.useState(!1),y=async()=>{if(!t||t!==n){d("Complexity keys do not match.");return}if(t.length<8){d("Entropy too low. Minimum 8 characters.");return}l(!0),d(null),m(!1);const{error:v}=await me.auth.updateUser({password:t});v?d(v.message):(m(!0),e(""),i("")),l(!1)};return p.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:p.jsxs("div",{className:"glass p-6 space-y-6",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(h1,{size:20,className:"text-error"})," Update Entropy Key"]}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(Oa,{label:"New Password",type:"password",value:t,onChange:e,placeholder:"••••••••"}),p.jsx(Oa,{label:"Confirm Password",type:"password",value:n,onChange:i,placeholder:"••••••••"})]}),u&&p.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:u}),h&&p.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:"Key rotation successful."}),p.jsx("div",{className:"flex justify-end pt-2",children:p.jsxs("button",{onClick:y,disabled:o,className:"px-6 py-3 bg-error/10 text-error hover:bg-error hover:text-white font-bold rounded-xl border border-error/20 transition-all flex items-center gap-2",children:[o?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(my,{size:18}),"Rotate Key"]})})]})})}function AC(){const[t,e]=R.useState(!1),[n,i]=R.useState(null),o=Yd(),l=cC();R.useEffect(()=>{o&&TC(me).then(i)},[]);const u=()=>{confirm("Sever connection to this essence? This will reset local resonance.")&&(lC(),window.location.reload())};return p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsxs("section",{className:"space-y-6",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsxs("div",{children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(ki,{size:20,className:"text-primary"})," Essence Resonance"]}),p.jsx("p",{className:"text-xs text-fg/40 font-medium",children:"Bring Your Own Keys (BYOK) for intelligence persistence."})]})}),p.jsx("div",{className:"glass p-8 space-y-8",children:o?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[p.jsx(rd,{className:"w-6 h-6 text-emerald-500 mt-1"}),p.jsxs("div",{className:"flex-1 space-y-1",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:"Established Link"}),n?.latestMigrationTimestamp&&p.jsxs("span",{className:"text-[10px] font-mono bg-emerald-500/10 text-emerald-500 px-2 py-0.5 rounded-full border border-emerald-500/20",children:["v",n.latestMigrationTimestamp]})]}),p.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:o.url})]})]}),l==="env"&&p.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[p.jsx(Li,{size:16,className:"text-amber-500"}),p.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:"Active from environment variables. UI override enabled."})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("button",{onClick:()=>e(!0),className:"px-4 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[p.jsx(id,{size:14})," Realign Link"]}),l==="ui"&&p.jsxs("button",{onClick:u,className:"px-4 py-3 glass border-error/10 hover:bg-error/10 text-error/60 hover:text-error text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[p.jsx(T1,{size:14})," Sever Link"]})]}),p.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[p.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:"Anon Secret Fragment"}),p.jsxs("div",{className:"p-3 bg-black/20 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-white/5",children:[o.anonKey.substring(0,32),"..."]})]})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[p.jsx(ki,{size:48,className:"text-fg/10"}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:"No Essence Resonance"}),p.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:"The Alchemist requires a cloud core to store intelligence fragments."})]}),p.jsx("button",{onClick:()=>e(!0),className:"px-8 py-3 bg-primary text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] transition-all uppercase tracking-widest text-xs",children:"Initiate Link"})]})})]}),p.jsx(Rv,{open:t,onComplete:()=>e(!1),canClose:!0})]})}function _c({active:t,icon:e,label:n,onClick:i}){return p.jsxs("button",{onClick:i,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${t?"glass bg-primary/10 text-primary border-primary/20 shadow-sm":"text-fg/40 hover:bg-surface hover:text-fg"}`,children:[t?_i.cloneElement(e,{className:"text-primary"}):e,p.jsx("span",{className:"font-semibold text-sm",children:n})]})}function Oa({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),p.jsx("input",{type:o,value:e,onChange:l=>n(l.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:i})]})}function PC({signal:t,onClose:e}){const[n,i]=_i.useState(!1);if(!t)return null;const o=()=>{const d=`# ${t.title}
69
+ `,"aria-label":`Digit ${_+1}`},_))})}function mC({onAuthSuccess:t,isInitialized:e=!0}){const[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(""),[h,m]=R.useState(""),[y,v]=R.useState(!1),[w,_]=R.useState(!e),[b,S]=R.useState(null),[k,E]=R.useState("password"),[P,N]=R.useState("email"),[U,V]=R.useState(""),z=async B=>{B.preventDefault(),v(!0),S(null);try{if(w){const{error:Y}=await me.auth.signUp({email:n,password:o,options:{data:{first_name:u,last_name:h,full_name:`${u} ${h}`.trim()}}});if(Y)throw Y;t()}else if(k==="password"){const{error:Y}=await me.auth.signInWithPassword({email:n,password:o});if(Y)throw Y;t()}else if(k==="otp")if(P==="email"){const{error:Y}=await me.auth.signInWithOtp({email:n,options:{shouldCreateUser:!1}});if(Y)throw Y;N("verify")}else await $()}catch(Y){S(Y.message)}finally{v(!1)}},$=async()=>{v(!0),S(null);try{const{data:B,error:Y}=await me.auth.verifyOtp({email:n,token:U,type:"magiclink"});if(Y)throw Y;if(!B.session)throw new Error("Failed to create session");t()}catch(B){S(B.message||"Invalid code")}finally{v(!1)}};return p.jsx("div",{className:"flex flex-col items-center justify-center p-8 h-full bg-gradient-to-t from-bg to-bg/50",children:p.jsxs(Ne.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md glass p-8 space-y-8",children:[p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h2",{className:"text-3xl font-black italic tracking-tighter",children:!e&&w?"INITIALIZE MASTER":w?"JOIN THE CIRCLE":k==="otp"?"MYSTIC ACCESS":"ALCHEMIST LOGIN"}),p.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase",children:!e&&w?"Forge the prime alchemist account":k==="otp"?P==="email"?"Enter your essence email":"Transmute the sacred code":"Transmute your data into intelligence"})]}),p.jsx("form",{onSubmit:z,className:"space-y-4",children:p.jsxs(cn,{mode:"wait",children:[w&&p.jsxs(Ne.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-2 gap-4 overflow-hidden",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"First Name"}),p.jsx("input",{type:"text",value:u,onChange:B=>d(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"Zosimos",required:!0})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Last Name"}),p.jsx("input",{type:"text",value:h,onChange:B=>m(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"Panopolis",required:!0})]})]},"signup-fields"),k==="otp"&&P==="verify"?p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6 py-4",children:[p.jsx("div",{className:"flex justify-center",children:p.jsx(pC,{value:U,onChange:V,length:6,onComplete:B=>{V(B)},error:!!b})}),p.jsx("button",{type:"button",onClick:()=>N("email"),className:"w-full text-[10px] font-bold uppercase text-primary/40 hover:text-primary transition-colors tracking-widest",children:"Change email address"}),p.jsxs("button",{type:"button",disabled:y||U.length!==6,onClick:$,className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2",children:[y?p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):p.jsx(im,{size:18}),"VERIFY CODE"]})]},"otp-verify"):p.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address"}),p.jsxs("div",{className:"relative",children:[p.jsx(y1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),p.jsx("input",{type:"email",value:n,onChange:B=>i(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"alchemist@example.com",required:!0})]})]}),(w||k==="password")&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Complexity Key"}),p.jsxs("div",{className:"relative",children:[p.jsx(g1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),p.jsx("input",{type:"password",value:o,onChange:B=>l(B.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 pl-10 pr-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"••••••••",required:!0})]})]}),p.jsxs("button",{type:"submit",disabled:y,className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2",children:[y&&p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),w?p.jsx(C1,{size:18}):p.jsx(im,{size:18}),w?"INITIALIZE ACCOUNT":k==="otp"?"SEND CODE":"UNSEAL ENGINE"]})]},"base-login")]})}),b&&k==="password"&&p.jsx(Ne.p,{initial:{opacity:0},animate:{opacity:1},className:"text-xs text-error font-medium bg-error/10 p-3 rounded-lg border border-error/10",children:b}),p.jsxs("div",{className:"space-y-4",children:[!w&&p.jsx("div",{className:"flex flex-col gap-2",children:k==="password"?p.jsxs("button",{type:"button",onClick:()=>{E("otp"),N("email"),S(null)},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all text-fg/40 hover:text-primary",children:[p.jsx(h1,{size:16})," Sign in with Code"]}):p.jsxs("button",{type:"button",onClick:()=>{E("password"),S(null)},className:"w-full flex items-center justify-center gap-2 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all text-fg/40 hover:text-primary",children:[p.jsx(Yx,{size:16})," Sign in with Password"]})}),p.jsxs("p",{className:"text-center text-xs text-fg/40",children:[w?"Already an Alchemist?":"New to Alchemy?"," "," ",p.jsx("button",{onClick:()=>{_(!w),E("password"),S(null)},className:"text-primary font-bold hover:underline",children:w?"Login instead":"Create an account"})]})]})]})})}function gC(t){const e=t.trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}.supabase.co`:""}function Ov({onComplete:t,open:e=!0,canClose:n=!1}){const[i,o]=R.useState("welcome"),[l,u]=R.useState(""),[d,h]=R.useState(""),[m,y]=R.useState(null),[v,w]=R.useState(!1);if(!e)return null;const _=async()=>{y(null),w(!0),o("validating");const b=gC(l),S=d.trim(),k=await cC(b,S);k.valid?(lC({url:b,anonKey:S}),o("success"),setTimeout(()=>{window.location.reload()},1500)):(y(k.error||"Connection failed"),o("credentials"),w(!1))};return p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-bg/80 backdrop-blur-sm",children:p.jsxs(Ne.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"w-full max-w-lg glass p-8 space-y-8 relative overflow-hidden",children:[p.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-primary/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),p.jsxs(cn,{mode:"wait",children:[i==="welcome"&&p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:p.jsx(ki,{className:"w-6 h-6 text-primary"})}),p.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Assemble Your Engine"})]}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Alchemy requires a Supabase essence to store signal fragments and intelligence patterns."})]}),p.jsxs("div",{className:"glass bg-white/5 border-white/10 p-4 rounded-xl space-y-3",children:[p.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-primary/70",children:"Requirements:"}),p.jsxs("ul",{className:"space-y-2",children:[p.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[p.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Supabase Project URL"]}),p.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[p.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Anon Public API Key"]})]})]}),p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsxs("a",{href:"https://supabase.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 py-3 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/60",children:["Forge Project at Supabase ",p.jsx(Da,{size:14})]}),p.jsxs("button",{onClick:()=>o("credentials"),className:"w-full py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.01] active:scale-95 transition-all flex items-center justify-center gap-2",children:["BEGIN INITIALIZATION ",p.jsx(Qx,{size:18})]})]})]},"welcome"),i==="credentials"&&p.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Essence Coordinates"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium lowercase",children:"Link the alchemist engine to your cloud database"})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Project URL or ID"}),p.jsx("input",{type:"text",value:l,onChange:b=>u(b.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"https://xxx.supabase.co or project-id"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Anon Public Key"}),p.jsx("input",{type:"password",value:d,onChange:b=>h(b.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:"eyJ..."})]})]}),m&&p.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[p.jsx(Mi,{className:"w-5 h-5 text-error"}),p.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:m})]}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx("button",{onClick:()=>o("welcome"),className:"flex-1 py-4 border border-border/20 rounded-xl text-xs font-bold uppercase tracking-widest hover:bg-white/5 transition-all text-fg/40",children:"BACK"}),p.jsxs("button",{onClick:_,disabled:!l||!d,className:"flex-[2] py-4 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.01] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale flex items-center justify-center gap-2",children:["CONNECT ESSENCE ",p.jsx(kr,{size:18})]})]})]},"credentials"),i==="validating"&&p.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-xl rounded-full"}),p.jsx(xn,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h3",{className:"text-xl font-bold italic uppercase tracking-tighter",children:"Validating Link"}),p.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase animate-pulse",children:"Synchronizing Resonance..."})]})]},"validating"),i==="success"&&p.jsxs(Ne.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[p.jsx("div",{className:"p-4 bg-emerald-500/20 rounded-full",children:p.jsx(rd,{className:"w-16 h-16 text-emerald-500"})}),p.jsxs("div",{className:"text-center space-y-2",children:[p.jsx("h3",{className:"text-2xl font-black italic uppercase tracking-tighter",children:"Engine Aligned"}),p.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase",children:"Restarting Alchemist Subsystems..."})]})]},"success")]})]})})}const qn={chrome:{icon:p.jsx(o1,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:p.jsx(Ju,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:p.jsx(Ju,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:p.jsx(Ju,{size:18}),name:"Microsoft Edge",color:"text-cyan-500"},brave:{icon:p.jsx(kr,{size:18}),name:"Brave",color:"text-orange-400"},arc:{icon:p.jsx(kr,{size:18}),name:"Arc",color:"text-purple-500"}};function yC({sources:t,onChange:e}){const[n,i]=R.useState(!1),[o,l]=R.useState({}),[u,d]=R.useState(""),[h,m]=R.useState("chrome"),[y,v]=R.useState(!1),w=async()=>{i(!0);try{const{data:E}=await Re.get("/api/browser-paths/detect");l(E)}catch(E){console.error("Detection failed:",E)}finally{i(!1)}},_=E=>{const P=o[E];if(!P||!P.found||!P.valid||t.find(V=>V.browser===E&&V.path===P.path))return;const U={browser:E,path:P.path,enabled:!0,label:`${qn[E].name} (Auto-detected)`};e([...t,U])},b=async()=>{if(u.trim()){v(!0);try{const{data:E}=await Re.post("/api/browser-paths/validate",{path:u});if(!E.valid){alert(`Invalid path: ${E.error||"Not a browser history database"}`),v(!1);return}const P={browser:h,path:u,enabled:!0,label:`${qn[h].name} (Custom)`};e([...t,P]),d("")}catch(E){console.error("Validation failed:",E),alert("Failed to validate path")}finally{v(!1)}}},S=E=>{const P=[...t];P[E].enabled=!P[E].enabled,e(P)},k=E=>{e(t.filter((P,N)=>N!==E))};return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(Sc,{size:14})," Auto-Detect Browsers"]}),p.jsxs("button",{onClick:w,disabled:n,className:"px-3 py-1.5 text-xs font-bold uppercase tracking-widest bg-primary/10 hover:bg-primary/20 text-primary rounded-lg transition-all flex items-center gap-2",children:[n?p.jsx(xn,{size:12,className:"animate-spin"}):p.jsx(Sc,{size:12}),n?"Scanning...":"Scan System"]})]}),Object.keys(o).length>0&&p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.keys(qn).map(E=>{const P=o[E],N=qn[E],U=t.some(V=>V.browser===E&&V.path===P?.path);return p.jsxs(Ne.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`glass p-4 rounded-xl border ${P?.found&&P?.valid?"border-success/20 bg-success/5":P?.found?"border-error/20 bg-error/5":"border-border/10"}`,children:[p.jsxs("div",{className:"flex items-start justify-between mb-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:N.color,children:N.icon}),p.jsx("span",{className:"text-sm font-bold",children:N.name})]}),P?.found&&P?.valid?p.jsx(Si,{size:16,className:"text-success"}):P?.found?p.jsx(Mi,{size:16,className:"text-error"}):p.jsx(Sr,{size:16,className:"text-fg/20"})]}),P?.found?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate mb-2",children:P.path}),P.valid?p.jsx("button",{onClick:()=>_(E),disabled:U,className:`w-full py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${U?"bg-fg/5 text-fg/30 cursor-not-allowed":"bg-success/10 hover:bg-success/20 text-success"}`,children:U?"Already Added":"Add Source"}):p.jsx("p",{className:"text-[10px] text-error font-medium",children:P.error})]}):p.jsx("p",{className:"text-[10px] text-fg/30 italic",children:"Not found on this system"})]},E)})})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(u1,{size:14})," Add Custom Path"]}),p.jsxs("div",{className:"glass p-4 rounded-xl space-y-3",children:[p.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[p.jsx("select",{value:h,onChange:E=>m(E.target.value),className:"bg-black/20 border border-border/5 rounded-xl py-2 px-3 text-sm focus:border-primary/30 outline-none transition-all",children:Object.keys(qn).map(E=>p.jsx("option",{value:E,children:qn[E].name},E))}),p.jsx("input",{type:"text",value:u,onChange:E=>d(E.target.value),placeholder:"/path/to/browser/History",className:"col-span-2 bg-black/20 border border-border/5 rounded-xl py-2 px-3 text-sm focus:border-primary/30 outline-none transition-all"})]}),p.jsxs("button",{onClick:b,disabled:!u.trim()||y,className:"w-full py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.01] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:grayscale",children:[y?p.jsx(xn,{size:16,className:"animate-spin"}):p.jsx(b1,{size:16}),y?"Validating...":"Add Custom Source"]})]})]}),t.length>0&&p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:["Configured Sources (",t.length,")"]}),p.jsx("div",{className:"space-y-2",children:p.jsx(cn,{children:t.map((E,P)=>p.jsxs(Ne.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:`glass p-4 rounded-xl border border-border/10 flex items-center justify-between ${!E.enabled&&"opacity-50"}`,children:[p.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[p.jsx("div",{className:qn[E.browser].color,children:qn[E.browser].icon}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("p",{className:"text-sm font-bold",children:E.label}),p.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate",children:E.path})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>S(P),className:`px-3 py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${E.enabled?"bg-success/10 text-success":"bg-fg/5 text-fg/40"}`,children:E.enabled?"Enabled":"Disabled"}),p.jsx("button",{onClick:()=>k(P),className:"p-2 hover:bg-error/10 text-error rounded-lg transition-all",children:p.jsx(Sr,{size:16})})]})]},`${E.browser}-${E.path}`))})})]})]})}const Iv=R.createContext(void 0);function vC({children:t}){const[e,n]=R.useState([]),i=R.useCallback((o,l="info")=>{const u=Math.random().toString(36).substr(2,9),d={id:u,type:l,message:o};n(h=>[...h,d]),setTimeout(()=>{n(h=>h.filter(m=>m.id!==u))},3e3)},[]);return p.jsxs(Iv.Provider,{value:{showToast:i},children:[t,p.jsx(wC,{toasts:e})]})}function Dv(){const t=R.useContext(Iv);if(!t)throw new Error("useToast must be used within ToastProvider");return t}function wC({toasts:t}){return p.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none",children:p.jsx(cn,{children:t.map(e=>p.jsx(xC,{toast:e},e.id))})})}function xC({toast:t}){const e={success:p.jsx(Si,{size:18,className:"text-success"}),error:p.jsx(Sr,{size:18,className:"text-error"}),warning:p.jsx(Mi,{size:18,className:"text-accent"}),info:p.jsx(my,{size:18,className:"text-primary"})},n={success:"border-success/20 bg-success/10",error:"border-error/20 bg-error/10",warning:"border-accent/20 bg-accent/10",info:"border-primary/20 bg-primary/10"};return p.jsxs(Ne.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,x:100,scale:.95},className:`glass px-4 py-3 rounded-xl border ${n[t.type]} flex items-center gap-3 min-w-[300px] max-w-md pointer-events-auto shadow-lg`,children:[e[t.type],p.jsx("span",{className:"text-sm font-medium flex-1",children:t.message})]})}function bC(){const{showToast:t}=Dv(),[e,n]=R.useState("http://localhost:11434"),[i,o]=R.useState("llama3"),[l,u]=R.useState(""),[d,h]=R.useState([]),[m,y]=R.useState(!1),[v,w]=R.useState(!1),[_,b]=R.useState(!1);R.useEffect(()=>{S()},[]);const S=async()=>{const{data:{user:N}}=await me.auth.getUser();if(!N)return;const{data:U}=await me.from("alchemy_settings").select("*").eq("user_id",N.id).maybeSingle();U&&(n(U.llm_base_url||U.ollama_host||"http://localhost:11434"),o(U.llm_model_name||"llama3"),u(U.llm_api_key||U.openai_api_key||U.anthropic_api_key||""),h(U.custom_browser_paths||[]))},k=async()=>{y(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N){t("Please log in to save settings","error"),y(!1);return}const{error:U}=await me.from("alchemy_settings").upsert({user_id:N.id,llm_base_url:e,llm_model_name:i,llm_api_key:l},{onConflict:"user_id"});U?(console.error("[AlchemistEngine] Save error:",U),t(`Failed to save: ${U.message}`,"error")):t("LLM settings saved successfully","success")}catch(N){console.error("[AlchemistEngine] Unexpected error:",N),t(`Unexpected error: ${N.message}`,"error")}finally{y(!1)}},E=async()=>{w(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N){t("Please log in to save settings","error"),w(!1);return}const{error:U}=await me.from("alchemy_settings").upsert({user_id:N.id,custom_browser_paths:d},{onConflict:"user_id"});U?(console.error("[AlchemistEngine] Save browser sources error:",U),t(`Failed to save: ${U.message}`,"error")):t("Browser sources saved successfully","success")}catch(N){console.error("[AlchemistEngine] Unexpected error:",N),t(`Unexpected error: ${N.message}`,"error")}finally{w(!1)}},P=async()=>{b(!0);try{const{data:N}=await Re.post("/api/llm/test",{baseUrl:e,modelName:i,apiKey:l});N.success?t(`Connection successful! ${N.model?`Model: ${N.model}`:""}`,"success"):t(`Connection failed: ${N.message}`,"error")}catch(N){console.error("[AlchemistEngine] Test error:",N),t(`Test failed: ${N.message}`,"error")}finally{b(!1)}};return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Intelligence Engine"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Fine-tune the Alchemist's cognitive parameters and provider links."})]}),p.jsx("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsx("section",{className:"space-y-6",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(sd,{size:14})," LLM Configuration"]}),p.jsxs("div",{className:"glass p-8 space-y-6",children:[p.jsx(bc,{label:"Provider URL (Base)",value:e,onChange:n,placeholder:"http://localhost:11434 or https://api.openai.com/v1"}),p.jsx(bc,{label:"Intelligence Model",value:i,onChange:o,placeholder:"llama3, gpt-4o, claude-3-5-sonnet..."}),p.jsx(bc,{label:"Secret Key (Optional)",type:"password",value:l,onChange:u,placeholder:"sk-..."}),p.jsx("div",{className:"p-4 bg-primary/5 rounded-2xl",children:p.jsx("p",{className:"text-[10px] text-primary/60 font-medium leading-relaxed",children:"The Alchemist uses a unified interface. You can point this to local Ollama instances, OpenAI-compatible APIs, or any custom LLM endpoint."})}),p.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[p.jsxs("button",{onClick:P,disabled:_||m,className:"px-6 py-3 bg-surface hover:bg-surface/80 border border-border/10 text-fg font-bold rounded-xl shadow-sm hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[_?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(kr,{size:18,className:"text-accent"}),"Test Connection"]}),p.jsxs("button",{onClick:k,disabled:m,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[m?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(_a,{size:18}),"Save"]})]})]})]})}),p.jsx("section",{className:"space-y-6",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[p.jsx(ki,{size:14})," Browser History Sources"]}),p.jsxs("div",{className:"glass p-8 space-y-6",children:[p.jsx(yC,{sources:d,onChange:h}),p.jsx("div",{className:"flex justify-end pt-2",children:p.jsxs("button",{onClick:E,disabled:v,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[v?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(_a,{size:18}),"Save Browser Sources"]})})]})]})})]})})]})}function bc({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),p.jsx("input",{type:o,value:e,onChange:l=>n(l.target.value),className:"w-full bg-black/20 border border-border/5 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all",placeholder:i})]})}const Lv=R.createContext(null);function _C({children:t}){const[e,n]=R.useState(!1),i=()=>n(!0),o=()=>n(!1);return p.jsx(Lv.Provider,{value:{isExpanded:e,setIsExpanded:n,openTerminal:i,closeTerminal:o},children:t})}function SC(){const t=R.useContext(Lv);if(!t)throw new Error("useTerminal must be used within a TerminalProvider");return t}function kC({isExpanded:t,onToggle:e}={}){const[n,i]=R.useState([]),{isExpanded:o,setIsExpanded:l}=SC(),[u,d]=R.useState({}),h=t!==void 0?t:o,m=e||(()=>l(!o));R.useEffect(()=>{y();const _=me.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},b=>{const S=b.new;S.event_type==="error"&&d(k=>({...k,[S.id]:!0})),i(k=>{const E=[S,...k];return E.length>50?E.slice(0,50):E})}).subscribe();return()=>{me.removeChannel(_)}},[]);const y=async()=>{const{data:_}=await me.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);_&&i(_)},v=_=>{d(b=>({...b,[_]:!b[_]}))},w=(_,b)=>{if(b==="debug")return p.jsx(t1,{size:14,className:"text-fg/40"});switch(_){case"analysis":return p.jsx(hy,{size:14,className:"text-primary"});case"action":return p.jsx(kr,{size:14,className:"text-accent"});case"error":return p.jsx(Gx,{size:14,className:"text-error"});case"system":return p.jsx(id,{size:14,className:"text-success"});default:return p.jsx(my,{size:14,className:"text-fg/40"})}};return h?p.jsxs(Ne.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},className:"fixed bottom-6 right-6 z-50 w-[450px] max-h-[600px] glass shadow-2xl flex flex-col overflow-hidden border-primary/10",children:[p.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(kc,{size:18,className:"text-primary"}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:"Alchemist Engine"}),p.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold bg-success/10 text-success px-2 py-0.5 rounded-full border border-success/10 animate-pulse ml-2",children:[p.jsx(Kx,{size:10})," LIVE"]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>i([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:"Clear"}),p.jsx("button",{onClick:m,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:p.jsx(w1,{size:18})})]})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[n.length===0&&p.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:"Idle. Awaiting signal mining events..."}),n.map(_=>p.jsxs("div",{className:"relative flex items-start gap-3 group",children:[p.jsx("div",{className:"mt-1 flex-shrink-0 w-6 h-6 rounded-full bg-surface border border-white/5 flex items-center justify-center",children:w(_.event_type,_.level)}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(_.created_at||Date.now()).toLocaleTimeString()}),p.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${_.level==="error"?"text-error":_.level==="warn"?"text-orange-400":_.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:_.agent_state}),_.duration_ms&&p.jsxs("span",{className:"ml-auto text-[10px] font-mono bg-bg/50 px-1.5 py-0.5 rounded flex items-center gap-1 text-fg/40",children:[p.jsx(ps,{size:10}),_.duration_ms,"ms"]})]}),p.jsx("p",{className:`text-sm break-words leading-relaxed ${_.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:_.message}),(_.details||_.metadata)&&p.jsxs("div",{className:"mt-2 text-xs",children:[p.jsxs("button",{onClick:()=>v(_.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[u[_.id]?p.jsx(fy,{size:12}):p.jsx(ba,{size:12}),u[_.id]?"Hide Details":"View Details"]}),p.jsx(cn,{children:u[_.id]&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:p.jsx("pre",{className:"mt-2 p-3 bg-bg/50 rounded border border-white/5 font-mono text-[10px] overflow-x-auto text-fg/70",children:JSON.stringify({..._.details,..._.metadata},null,2)})})})]})]})]},_.id))]})]}):p.jsxs("button",{onClick:m,className:"fixed bottom-6 right-6 z-50 glass p-4 flex items-center gap-3 hover:bg-surface transition-all shadow-xl group border-primary/10",children:[p.jsxs("div",{className:"relative",children:[p.jsx(kc,{size:20,className:"text-primary"}),n.length>0&&p.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[p.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),p.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-widest hidden group-hover:block animate-in fade-in slide-in-from-right-2",children:"Live Engine Log"})]})}const Mv="1.0.0",EC="20260125000004";async function TC(t){try{const{data:e,error:n}=await t.rpc("get_latest_migration_timestamp");return n?n.code==="42883"?{version:null,latestMigrationTimestamp:"0"}:{version:null,latestMigrationTimestamp:null}:{version:Mv,latestMigrationTimestamp:e||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function jC(t){const e=Mv,n=EC,i=await TC(t);if(i.latestMigrationTimestamp&&i.latestMigrationTimestamp.trim()!==""){const o=n,l=i.latestMigrationTimestamp;return o>l?{needsMigration:!0,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:l,message:`New migrations available. Database is at ${l}, app has ${o}.`}:{needsMigration:!1,appVersion:e,dbVersion:i.version,latestMigrationTimestamp:l,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:e,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function CC(){const[t,e]=R.useState("profile"),[n,i]=R.useState(!1);return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Account Configuration"}),p.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Manage your Alchemist profile and essence links."})]}),p.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[p.jsxs("aside",{className:"w-64 border-r border-border/10 p-4 space-y-1",children:[p.jsx(_c,{active:t==="profile",onClick:()=>e("profile"),icon:p.jsx(od,{size:18}),label:"Profile"}),p.jsx(_c,{active:t==="security",onClick:()=>e("security"),icon:p.jsx(gy,{size:18}),label:"Security"}),p.jsx(_c,{active:t==="supabase",onClick:()=>e("supabase"),icon:p.jsx(ki,{size:18}),label:"Supabase"})]}),p.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[t==="profile"&&p.jsx(NC,{}),t==="security"&&p.jsx(AC,{}),t==="supabase"&&p.jsx(PC,{})]})]})]})}function NC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(!1),[h,m]=R.useState(!1),[y,v]=R.useState(null),[w,_]=R.useState(!0);R.useEffect(()=>{b()},[]);const b=async()=>{const{data:{user:E}}=await me.auth.getUser();if(!E)return;l(E.email||"");const{data:P}=await me.from("profiles").select("*").eq("id",E.id).maybeSingle();P&&(e(P.first_name||""),i(P.last_name||""),v(P.avatar_url));const{data:N}=await me.from("alchemy_settings").select("sound_enabled").eq("user_id",E.id).maybeSingle();N&&_(N.sound_enabled??!0)},S=async()=>{d(!0);const{data:{user:E}}=await me.auth.getUser();E&&(await me.from("profiles").upsert({id:E.id,first_name:t,last_name:n,full_name:t&&n?`${t} ${n}`:t||n||null}),await me.from("alchemy_settings").update({sound_enabled:w}).eq("user_id",E.id),d(!1))},k=async E=>{const P=E.target.files?.[0];if(P){m(!0);try{const{data:{user:N}}=await me.auth.getUser();if(!N)return;const U=P.name.split(".").pop(),V=`${N.id}/avatar-${Date.now()}.${U}`,{error:z}=await me.storage.from("avatars").upload(V,P,{upsert:!0});if(z)throw z;const{data:{publicUrl:$}}=me.storage.from("avatars").getPublicUrl(V);await me.from("profiles").update({avatar_url:$}).eq("id",N.id),v($)}catch(N){console.error("Avatar upload failed:",N)}finally{m(!1)}}};return p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsxs("section",{className:"flex items-start gap-8",children:[p.jsxs("div",{className:"relative group",children:[p.jsx("div",{className:"w-32 h-32 rounded-3xl bg-surface border border-border/20 flex items-center justify-center overflow-hidden shadow-xl",children:y?p.jsx("img",{src:y,alt:"Avatar",className:"w-full h-full object-cover"}):p.jsx(od,{size:48,className:"text-fg/20"})}),p.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer rounded-3xl",children:[p.jsx(r1,{size:24,className:"text-white"}),p.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:k,disabled:h})]}),h&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:p.jsx(xn,{size:24,className:"text-primary animate-spin"})})]}),p.jsxs("div",{className:"flex-1 space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsx(Ia,{label:"First Name",value:t,onChange:e,placeholder:"Zosimos"}),p.jsx(Ia,{label:"Last Name",value:n,onChange:i,placeholder:"of Panopolis"})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address (Locked)"}),p.jsx("input",{type:"email",value:o,readOnly:!0,className:"w-full bg-black/10 border border-border/10 rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),p.jsxs("section",{className:"glass p-6 space-y-4",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[w?p.jsx(am,{size:20,className:"text-primary"}):p.jsx(lm,{size:20,className:"text-fg/40"}),"Sound Effects"]}),p.jsx("p",{className:"text-xs text-fg/40",children:"Enable audio feedback for sync events and signal discoveries."}),p.jsx("button",{onClick:()=>_(!w),className:`w-full p-4 rounded-xl border-2 transition-all ${w?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border/20 text-fg/40"}`,children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"font-semibold text-sm",children:w?"Enabled":"Disabled"}),w?p.jsx(am,{size:18}):p.jsx(lm,{size:18})]})})]}),p.jsxs("section",{className:"glass p-6 space-y-4",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(om,{size:20,className:"text-error"}),"Sign Out"]}),p.jsx("p",{className:"text-xs text-fg/40",children:"End your current session and return to the login screen."}),p.jsx("button",{onClick:()=>me.auth.signOut(),className:"w-full p-4 rounded-xl border-2 bg-error/10 border-error/30 text-error hover:bg-error hover:text-white transition-all",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"font-semibold text-sm",children:"Logout"}),p.jsx(om,{size:18})]})})]}),p.jsx("div",{className:"flex justify-end pt-4 border-t border-border/10",children:p.jsxs("button",{onClick:S,disabled:u,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[u?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(_a,{size:18}),"Preserve Profile"]})})]})}function AC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(!1),[u,d]=R.useState(null),[h,m]=R.useState(!1),y=async()=>{if(!t||t!==n){d("Complexity keys do not match.");return}if(t.length<8){d("Entropy too low. Minimum 8 characters.");return}l(!0),d(null),m(!1);const{error:v}=await me.auth.updateUser({password:t});v?d(v.message):(m(!0),e(""),i("")),l(!1)};return p.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:p.jsxs("div",{className:"glass p-6 space-y-6",children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(f1,{size:20,className:"text-error"})," Update Entropy Key"]}),p.jsxs("div",{className:"space-y-4",children:[p.jsx(Ia,{label:"New Password",type:"password",value:t,onChange:e,placeholder:"••••••••"}),p.jsx(Ia,{label:"Confirm Password",type:"password",value:n,onChange:i,placeholder:"••••••••"})]}),u&&p.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:u}),h&&p.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:"Key rotation successful."}),p.jsx("div",{className:"flex justify-end pt-2",children:p.jsxs("button",{onClick:y,disabled:o,className:"px-6 py-3 bg-error/10 text-error hover:bg-error hover:text-white font-bold rounded-xl border border-error/20 transition-all flex items-center gap-2",children:[o?p.jsx(xn,{size:18,className:"animate-spin"}):p.jsx(gy,{size:18}),"Rotate Key"]})})]})})}function PC(){const[t,e]=R.useState(!1),[n,i]=R.useState(null),o=Yd(),l=dC();R.useEffect(()=>{o&&jC(me).then(i)},[]);const u=()=>{confirm("Sever connection to this essence? This will reset local resonance.")&&(uC(),window.location.reload())};return p.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[p.jsxs("section",{className:"space-y-6",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsxs("div",{children:[p.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[p.jsx(ki,{size:20,className:"text-primary"})," Essence Resonance"]}),p.jsx("p",{className:"text-xs text-fg/40 font-medium",children:"Bring Your Own Keys (BYOK) for intelligence persistence."})]})}),p.jsx("div",{className:"glass p-8 space-y-8",children:o?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[p.jsx(rd,{className:"w-6 h-6 text-emerald-500 mt-1"}),p.jsxs("div",{className:"flex-1 space-y-1",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:"Established Link"}),n?.latestMigrationTimestamp&&p.jsxs("span",{className:"text-[10px] font-mono bg-emerald-500/10 text-emerald-500 px-2 py-0.5 rounded-full border border-emerald-500/20",children:["v",n.latestMigrationTimestamp]})]}),p.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:o.url})]})]}),l==="env"&&p.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[p.jsx(Mi,{size:16,className:"text-amber-500"}),p.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:"Active from environment variables. UI override enabled."})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("button",{onClick:()=>e(!0),className:"px-4 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[p.jsx(id,{size:14})," Realign Link"]}),l==="ui"&&p.jsxs("button",{onClick:u,className:"px-4 py-3 glass border-error/10 hover:bg-error/10 text-error/60 hover:text-error text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[p.jsx(j1,{size:14})," Sever Link"]})]}),p.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[p.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:"Anon Secret Fragment"}),p.jsxs("div",{className:"p-3 bg-black/20 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-white/5",children:[o.anonKey.substring(0,32),"..."]})]})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[p.jsx(ki,{size:48,className:"text-fg/10"}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:"No Essence Resonance"}),p.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:"The Alchemist requires a cloud core to store intelligence fragments."})]}),p.jsx("button",{onClick:()=>e(!0),className:"px-8 py-3 bg-primary text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] transition-all uppercase tracking-widest text-xs",children:"Initiate Link"})]})})]}),p.jsx(Ov,{open:t,onComplete:()=>e(!1),canClose:!0})]})}function _c({active:t,icon:e,label:n,onClick:i}){return p.jsxs("button",{onClick:i,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${t?"glass bg-primary/10 text-primary border-primary/20 shadow-sm":"text-fg/40 hover:bg-surface hover:text-fg"}`,children:[t?_i.cloneElement(e,{className:"text-primary"}):e,p.jsx("span",{className:"font-semibold text-sm",children:n})]})}function Ia({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),p.jsx("input",{type:o,value:e,onChange:l=>n(l.target.value),className:"w-full bg-black/20 border border-border/20 rounded-xl py-3 px-4 text-sm focus:border-primary/50 outline-none transition-all",placeholder:i})]})}function RC({signal:t,onClose:e}){const[n,i]=_i.useState(!1);if(!t)return null;const o=()=>{const d=`# ${t.title}
70
70
 
71
71
  **Category**: ${t.category||"Research"}
72
72
  **Intelligence Score**: ${t.score}/100
@@ -98,4 +98,4 @@ ${t.entities.map(v=>`- ${v}`).join(`
98
98
  `:""}
99
99
  ${t.content?`
100
100
  ## Full Content
101
- ${t.content}`:""}`,h=new Blob([d],{type:"text/markdown"}),m=URL.createObjectURL(h),y=document.createElement("a");y.href=m,y.download=`${t.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,y.click(),URL.revokeObjectURL(m)},u=()=>{const d=JSON.stringify(t,null,2),h=new Blob([d],{type:"application/json"}),m=URL.createObjectURL(h),y=document.createElement("a");y.href=m,y.download=`signal_${t.id}.json`,y.click(),URL.revokeObjectURL(m)};return p.jsx(cn,{children:p.jsx(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-bg/80 backdrop-blur-sm",onClick:e,children:p.jsxs(Ne.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:d=>d.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[p.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[p.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[p.jsx("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold rounded border border-primary/20 uppercase tracking-wider",children:t.category||"Research"}),p.jsx("span",{className:`text-3xl font-black ${t.score>=80?"text-accent":"text-fg/40"}`,children:t.score})]}),p.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:t.title}),p.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(t.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:p.jsx(Sr,{size:24})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[t.url&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),p.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 glass hover:bg-surface transition-all rounded-xl text-sm font-mono text-primary hover:text-accent group",children:[p.jsx(Da,{size:16,className:"flex-shrink-0"}),p.jsx("span",{className:"truncate",children:t.url}),p.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),t.entities&&t.entities.length>0&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),p.jsx("div",{className:"flex flex-wrap gap-2",children:t.entities.map(d=>p.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:d},d))})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),p.jsx("div",{className:"p-4 glass rounded-xl",children:p.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:t.summary})})]}),t.content&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),p.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:p.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:t.content})})]})]}),p.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[p.jsxs("button",{onClick:o,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[n?p.jsx(Si,{size:16,className:"text-success"}):p.jsx(fy,{size:16}),n?"Copied!":"Copy"]}),p.jsxs("button",{onClick:l,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[p.jsx(rm,{size:16}),"Markdown"]}),p.jsxs("button",{onClick:u,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[p.jsx(rm,{size:16}),"JSON"]})]})]})})})}function RC({isOpen:t,onClose:e}){const{showToast:n}=Iv(),[i,o]=R.useState(""),[l,u]=R.useState(50),[d,h]=R.useState(!1),[m,y]=R.useState(!1);R.useEffect(()=>{t&&v()},[t]);const v=async()=>{const{data:{user:b}}=await me.auth.getUser();if(!b)return;const{data:S}=await me.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(S)if(u(S.max_urls_per_sync||50),S.sync_start_date){const k=new Date(S.sync_start_date),E=N=>N<10?"0"+N:N,P=k.getFullYear()+"-"+E(k.getMonth()+1)+"-"+E(k.getDate())+"T"+E(k.getHours())+":"+E(k.getMinutes());o(P)}else o("")},w=async()=>{h(!0);try{const{data:{user:b}}=await me.auth.getUser();if(!b){n("Please log in to save settings","error"),h(!1);return}const{error:S}=await me.from("alchemy_settings").update({max_urls_per_sync:l,sync_start_date:i?new Date(i).toISOString():null}).eq("user_id",b.id);S?n(`Failed to save: ${S.message}`,"error"):(n("Sync settings saved successfully","success"),e())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{h(!1)}},_=async()=>{y(!0);try{const{data:{user:b}}=await me.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),y(!1);return}const{error:S}=await me.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",b.id);S?n(`Failed to reset: ${S.message}`,"error"):n("Checkpoint reset successfully","success")}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{y(!1)}};return t?p.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:p.jsxs("div",{className:"bg-surface border border-border/20 rounded-2xl shadow-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[p.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:p.jsx(Sr,{className:"w-5 h-5"})})]}),p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[p.jsx(t1,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),p.jsx("input",{type:"datetime-local",value:i,onChange:b=>o(b.target.value),className:"w-full bg-black/20 border border-border/10 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all"}),p.jsx("p",{className:"text-xs text-fg/50",children:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward."})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[p.jsx(u1,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),p.jsx("span",{className:"text-sm font-mono text-primary",children:l})]}),p.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:l,onChange:b=>u(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),p.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[p.jsx("span",{children:"Quick (5)"}),p.jsx("span",{children:"Balanced (50)"}),p.jsx("span",{children:"Thorough (200)"})]})]}),p.jsxs("div",{className:"pt-4 border-t border-border/10",children:[p.jsxs("button",{onClick:_,disabled:m,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[p.jsx(b1,{size:16,className:m?"animate-spin":""}),m?"Resetting...":"Reset Checkpoint"]}),p.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date'})]}),p.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:p.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.'})})]}),p.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[p.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 bg-surface hover:bg-black/10 border border-border/10 rounded-xl font-medium transition-all",children:"Cancel"}),p.jsxs("button",{onClick:w,disabled:d,className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[p.jsx(ba,{size:18,className:d?"animate-spin":""}),d?"Saving...":"Save Settings"]})]})]})}):null}function OC(){const[t,e]=R.useState([]),[n,i]=R.useState(!0),[o,l]=R.useState(null),[u,d]=R.useState(null),[h,m]=R.useState([]),[y,v]=R.useState([]),[w,_]=R.useState([]),[b,S]=R.useState(!1);R.useEffect(()=>{k()},[]);const k=async()=>{i(!0);try{const{data:{user:$}}=await me.auth.getUser();if(!$)return;const{data:B,error:Y}=await me.from("processing_events").select("*").eq("user_id",$.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(Y){console.error("Error fetching sync runs:",Y);return}const oe=(B||[]).map(Te=>{const ve=Te.metadata||{},je=ve.errors||0,xe=ve.signals_found||0,Oe=ve.skipped||0;return{id:Te.id,started_at:Te.created_at,completed_at:Te.created_at,duration_ms:Te.duration_ms||0,signals_found:xe,urls_processed:ve.total_urls||0,skipped:Oe,errors:je,status:je>0?"partial":xe>0?"success":"failed"}});e(oe)}catch($){console.error("Failed to fetch sync runs:",$)}finally{i(!1)}},E=async $=>{S(!0);try{const{data:{user:B}}=await me.auth.getUser();if(!B)return;const Y=t.find(F=>F.id===$);if(!Y)return;const oe=new Date(new Date(Y.started_at).getTime()-Y.duration_ms),Te=new Date(Y.completed_at),{data:ve,error:je}=await me.from("processing_events").select("*").eq("user_id",B.id).gte("created_at",oe.toISOString()).lte("created_at",Te.toISOString()).order("created_at",{ascending:!0});if(je){console.error("Error fetching run events:",je);return}m(ve||[]);const xe=[],Oe=(ve||[]).filter(F=>F.agent_state==="Mining"&&F.message.includes("Mining source:"));for(const F of Oe){const J=F.message.match(/Mining source: (.+) \((.+)\)/);if(J){const K=J[1],j=J[2],D=(ve||[]).find(fe=>fe.agent_state==="Mining"&&fe.message.includes("Found")&&fe.message.includes(K)&&fe.created_at>F.created_at),se=D?.message.match(/Found (\d+) URLs/),ue=se?parseInt(se[1]):0;xe.push({label:K,browser:j,urls_found:ue,duration_ms:D?.duration_ms||0,status:F.event_type==="error"?"error":"success"})}}v(xe);const be=[],pe=(ve||[]).filter(F=>F.agent_state==="Reading");for(const F of pe){const J=F.message.match(/Reading content from: (.+)/);if(!J)continue;const K=J[1];let j=xe.length>0?xe[0].label:"Unknown";const D=xe.filter(ie=>ie.urls_found>0);(D.length===1||D.length>1)&&(j=D[0].label),console.log(`[SystemLogs] URL ${K} assigned to source: ${j}`);const se=(ve||[]).find(ie=>ie.agent_state==="Signal"&&ie.created_at>F.created_at&&ie.message.includes("Found signal")),ue=(ve||[]).find(ie=>ie.agent_state==="Skipped"&&ie.created_at>F.created_at&&ie.message.includes("Irrelevant content")),fe=(ve||[]).find(ie=>ie.event_type==="error"&&ie.created_at>F.created_at);if(se){const ie=se.message.match(/\((\d+)%\)/),Ee=ie?parseInt(ie[1]):0;be.push({url:K,result:"signal",score:Ee,category:se.details?.category||"Unknown",duration_ms:se.duration_ms,source_label:j})}else if(ue){const ie=ue.message.match(/\((\d+)%\): (.+)/),Ee=ie?parseInt(ie[1]):0,ke=ie?ie[2]:"Irrelevant";be.push({url:K,result:"skipped",score:Ee,reason:ke,duration_ms:ue.duration_ms,source_label:j})}else fe&&be.push({url:K,result:"error",reason:fe.message,source_label:j})}_(be)}catch(B){console.error("Failed to fetch run details:",B)}finally{S(!1)}},P=$=>{o===$?(l(null),d(null),v([]),_([])):(l($),d(null),E($))},N=$=>{d(u===$?null:$)},U=$=>{if($<1e3)return`${$}ms`;const B=Math.floor($/1e3);if(B<60)return`${B}s`;const Y=Math.floor(B/60),oe=B%60;return`${Y}m ${oe}s`},V=$=>{switch($){case"success":return p.jsx(rd,{className:"w-5 h-5 text-success"});case"failed":return p.jsx(lm,{className:"w-5 h-5 text-error"});case"partial":return p.jsx(Li,{className:"w-5 h-5 text-warning"});default:return p.jsx(ps,{className:"w-5 h-5 text-fg/40"})}},z=$=>{switch($){case"signal":return p.jsx(kr,{className:"w-4 h-4 text-primary"});case"skipped":return p.jsx(S1,{className:"w-4 h-4 text-fg/40"});case"error":return p.jsx(lm,{className:"w-4 h-4 text-error"});default:return null}};return n?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),p.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"})]}),p.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:t.length===0?p.jsxs("div",{className:"text-center py-12 text-fg/40",children:[p.jsx(ps,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),p.jsx("p",{children:"No sync runs yet"})]}):p.jsx("div",{className:"space-y-2",children:t.map($=>p.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[p.jsxs("button",{onClick:()=>P($.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[o===$.id?p.jsx(xa,{className:"w-5 h-5 text-primary shrink-0"}):p.jsx(nm,{className:"w-5 h-5 text-fg/40 shrink-0"}),V($.status),p.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),p.jsx("div",{className:"text-sm font-mono",children:new Date($.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),p.jsx("div",{className:"text-sm font-mono",children:U($.duration_ms)})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),p.jsx("div",{className:"text-sm font-semibold text-primary",children:$.signals_found})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),p.jsx("div",{className:"text-sm font-semibold text-fg/60",children:$.skipped})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),p.jsx("div",{className:"text-sm font-semibold",children:$.urls_processed})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),p.jsx("div",{className:`text-sm font-semibold ${$.errors>0?"text-error":"text-fg/40"}`,children:$.errors})]})]})]}),p.jsx(cn,{children:o===$.id&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:p.jsx("div",{className:"p-4 bg-black/10 space-y-2",children:b?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?p.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((B,Y)=>p.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[p.jsxs("button",{onClick:()=>N(B.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[u===B.label?p.jsx(xa,{className:"w-4 h-4 text-primary shrink-0"}):p.jsx(nm,{className:"w-4 h-4 text-fg/40 shrink-0"}),p.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[p.jsxs("div",{className:"flex-1",children:[p.jsx("div",{className:"text-sm font-semibold",children:B.label}),p.jsx("div",{className:"text-xs text-fg/40",children:B.browser})]}),p.jsxs("div",{className:"text-right",children:[p.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),p.jsx("div",{className:"text-sm font-semibold",children:B.urls_found})]}),p.jsxs("div",{className:"text-right",children:[p.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),p.jsx("div",{className:"text-sm font-mono",children:U(B.duration_ms)})]})]})]}),p.jsx(cn,{children:u===B.label&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:p.jsx("div",{className:"p-3 bg-black/20 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:w.filter(oe=>oe.source_label===B.label).length===0?p.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):w.filter(oe=>oe.source_label===B.label).map((oe,Te)=>p.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[z(oe.result),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:oe.url}),oe.result==="signal"&&p.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",oe.score,"%) - ",oe.category]}),oe.result==="skipped"&&p.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",oe.score,"%) - ",oe.reason]}),oe.result==="error"&&p.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",oe.reason]})]}),p.jsx("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:ve=>ve.stopPropagation(),children:p.jsx(Da,{className:"w-3 h-3 text-fg/40"})})]},Te))})})})]},Y))})})})]},$.id))})})]})}function IC({signals:t,limit:e=10,onSignalClick:n}){const i=t.slice(0,e),[o,l]=R.useState(()=>{const h=localStorage.getItem("newSignalsFeedExpanded");return h!==null?h==="true":!0});R.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const u=h=>h>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":h>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",d=h=>{const m=new Date(h),v=new Date().getTime()-m.getTime(),w=Math.floor(v/6e4),_=Math.floor(v/36e5);return w<1?"Just now":w<60?`${w}m ago`:_<24?`${_}h ago`:m.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return i.length===0?null:p.jsxs("div",{className:"mb-3",children:[p.jsxs("button",{onClick:()=>l(!o),className:"w-full flex items-center justify-between mb-2 px-1 py-1 hover:bg-surface/30 rounded-lg transition-colors",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:["New Signals (",i.length,")"]})}),o?p.jsx(hy,{size:16,className:"text-fg/40"}):p.jsx(xa,{size:16,className:"text-fg/40"})]}),p.jsx(cn,{children:o&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:p.jsx("div",{className:"overflow-x-auto pb-3 -mx-4 px-4 custom-scrollbar",children:p.jsx("div",{className:"flex gap-3 min-w-max",children:i.map(h=>p.jsxs(Ne.button,{onClick:()=>n(h.id),whileHover:{scale:1.05,y:-2},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-3 hover:border-blue-400/30 transition-all duration-300 text-left group",children:[p.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${u(h.score)}`,children:p.jsx("span",{className:"text-xl font-bold",children:h.score})}),p.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:h.title}),p.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[p.jsx(ps,{size:10}),p.jsx("span",{children:d(h.created_at)})]})]},h.id))})})})})]})}const Ia=[{id:"ai",name:"AI & ML",icon:dy,color:"blue",priority:1},{id:"business",name:"Business",icon:Zx,color:"purple",priority:1},{id:"politics",name:"Politics",icon:f1,color:"red",priority:1},{id:"technology",name:"Technology",icon:sd,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:o1,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:Qx,color:"orange",priority:1},{id:"science",name:"Science",icon:y1,color:"teal",priority:1}],Mv={id:"other",name:"Other",icon:E1,color:"gray",priority:3},DC=[...Ia,Mv];function LC(t){const e={blue:"bg-blue-500/20 text-blue-400 border-blue-500/30",purple:"bg-purple-500/20 text-purple-400 border-purple-500/30",red:"bg-red-500/20 text-red-400 border-red-500/30",cyan:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",green:"bg-green-500/20 text-green-400 border-green-500/30",orange:"bg-orange-500/20 text-orange-400 border-orange-500/30",teal:"bg-teal-500/20 text-teal-400 border-teal-500/30",gray:"bg-gray-500/20 text-gray-400 border-gray-500/30"};return e[t]||e.gray}function MC(t,e){if(e){const n=Ia.find(i=>i.id===e.toLowerCase());if(n)return n.id}for(const n of t){const i=n.toLowerCase(),o=Ia.find(l=>i.includes(l.id)||i.includes(l.name.toLowerCase()));if(o)return o.id}return null}function UC({category:t,signalCount:e,latestTimestamp:n,onClick:i}){const o=u=>{const d=new Date(u),m=new Date().getTime()-d.getTime(),y=Math.floor(m/6e4),v=Math.floor(m/36e5),w=Math.floor(m/864e5);return y<60?`${y}m ago`:v<24?`${v}h ago`:w<7?`${w}d ago`:d.toLocaleDateString("en-US",{month:"short",day:"numeric"})},l=t.icon;return p.jsxs(Ne.button,{whileHover:{scale:1.05,y:-4},whileTap:{scale:.98},onClick:i,className:"bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-6 cursor-pointer hover:border-white/20 transition-all duration-300 text-left w-full",children:[p.jsx("div",{className:"mb-4",children:p.jsx(l,{size:40,className:"text-current opacity-80"})}),p.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:t.name}),p.jsxs("div",{className:"flex items-center justify-between text-sm",children:[p.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${LC(t.color)}`,children:[e," ",e===1?"signal":"signals"]}),p.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[p.jsx(ps,{size:12}),o(n)]})]})]})}const $C=3;function VC({signals:t,onCategoryClick:e}){const{categories:n,categoryCounts:i}=R.useMemo(()=>{const o=new Map,l=new Map;t.forEach(m=>{const y=m.tags||[],v=MC(y,m.category);if(v){const w=o.get(v)||{count:0,latest:m.created_at};o.set(v,{count:w.count+1,latest:m.created_at>w.latest?m.created_at:w.latest})}else y.forEach(w=>{const _=w.toLowerCase().trim();if(_){l.set(_,(l.get(_)||0)+1);const b=o.get(_)||{count:0,latest:m.created_at};o.set(_,{count:b.count+1,latest:m.created_at>b.latest?m.created_at:b.latest})}})});const u=Array.from(l.entries()).filter(([m,y])=>y>=$C).map(([m,y])=>({id:m,name:m.charAt(0).toUpperCase()+m.slice(1),icon:c1,color:"gray",priority:2}));return{categories:[...Ia,...u,Mv].filter(m=>{const y=o.get(m.id);return y&&y.count>0}).sort((m,y)=>m.priority-y.priority),categoryCounts:o}},[t]);return n.length===0?p.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[p.jsx("p",{className:"font-medium italic",children:"No categories yet."}),p.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):p.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:n.map(o=>{const l=i.get(o.id);return p.jsx(UC,{category:o,signalCount:l.count,latestTimestamp:l.latest,onClick:()=>e(o.id)},o.id)})})}function FC({signal:t,onOpen:e,onCopy:n,onArchive:i,onBookmark:o}){const[l,u]=R.useState(!1),d=v=>v>=80?"text-yellow-400 border-yellow-400/30":v>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",h=v=>v>=80?"HIGH":v>=50?"MEDIUM":"LOW",m=v=>({AI:"🤖",Technology:"💻",Finance:"💰",Business:"📊",Crypto:"₿"})[v]||"📌",y=v=>{const w=new Date(v),b=new Date().getTime()-w.getTime(),S=Math.floor(b/6e4),k=Math.floor(b/36e5),E=Math.floor(b/864e5);return S<60?`${S}m ago`:k<24?`${k}h ago`:E<7?`${E}d ago`:w.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return p.jsxs(Ne.div,{whileHover:{scale:1.02,boxShadow:"0 8px 24px rgba(59, 130, 246, 0.3)"},onHoverStart:()=>u(!0),onHoverEnd:()=>u(!1),className:"bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-6 flex flex-col gap-4 transition-all duration-300",children:[p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsx("div",{className:"flex items-center gap-3",children:p.jsxs("div",{className:`flex flex-col items-center justify-center w-16 h-16 rounded-full border-2 ${d(t.score)}`,children:[p.jsx("span",{className:"text-2xl font-bold",children:t.score}),p.jsx("span",{className:"text-[10px] font-medium opacity-70",children:h(t.score)})]})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs font-medium rounded border border-blue-500/30",children:[m(t.category)," ",t.category]}),p.jsxs("span",{className:"text-xs text-fg/50 flex items-center gap-1",children:[p.jsx(ps,{size:12}),y(t.created_at)]})]})]}),p.jsxs("div",{className:"flex-1",children:[p.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-fg hover:text-blue-400 transition-colors line-clamp-2 mb-2 block",onClick:v=>{v.preventDefault(),e?.(t.url)},children:t.title}),p.jsx("p",{className:"text-sm text-fg/70 line-clamp-3",children:t.summary})]}),t.entities&&t.entities.length>0&&p.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.entities.slice(0,4).map((v,w)=>p.jsx("span",{className:"px-2 py-1 bg-white/5 text-fg/60 text-xs rounded border border-white/10",children:v},w)),t.entities.length>4&&p.jsxs("span",{className:"px-2 py-1 text-fg/40 text-xs",children:["+",t.entities.length-4," more"]})]}),p.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-white/5",children:[p.jsxs("button",{onClick:()=>e?.(t.url),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Open URL",children:[p.jsx(Da,{size:14}),p.jsx("span",{children:"Open"})]}),p.jsxs("button",{onClick:()=>n?.(t.summary),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Copy Summary",children:[p.jsx(fy,{size:14}),p.jsx("span",{children:"Copy"})]}),p.jsxs("button",{onClick:()=>i?.(t.id),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-red-500/20 hover:text-red-400 rounded transition-colors text-sm",title:"Archive",children:[p.jsx(Gx,{size:14}),p.jsx("span",{children:"Archive"})]}),o&&p.jsx("button",{onClick:()=>o(t.id),className:"px-3 py-2 bg-white/5 hover:bg-yellow-500/20 hover:text-yellow-400 rounded transition-colors",title:"Bookmark",children:p.jsx(Xx,{size:14})})]})]})}function BC({isOpen:t,onClose:e,categoryId:n,signals:i,onOpenUrl:o,onCopyText:l,onArchive:u}){const d=DC.find(w=>w.id===n),h=i.filter(w=>{const _=w.tags||[],b=w.category?.toLowerCase()===n,S=_.some(k=>k.toLowerCase().includes(n));return b||S}),m=w=>{o?o(w):window.open(w,"_blank","noopener,noreferrer")},y=w=>{l?l(w):navigator.clipboard.writeText(w)},v=async w=>{u&&await u(w)};return p.jsx(cn,{children:t&&p.jsxs(p.Fragment,{children:[p.jsx(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:e,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),p.jsx(Ne.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed right-0 top-0 h-full w-full md:w-2/3 lg:w-1/2 bg-bg border-l border-white/10 z-50 overflow-y-auto custom-scrollbar",children:p.jsxs("div",{className:"p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6 sticky top-0 bg-bg pb-4 border-b border-white/10",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[d?.icon&&p.jsx("div",{className:"w-10 h-10 flex items-center justify-center",children:p.jsx(d.icon,{size:40,className:"text-current opacity-80"})}),p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold",children:d?.name}),p.jsxs("p",{className:"text-sm text-fg/50",children:[h.length," ",h.length===1?"signal":"signals"]})]})]}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-white/10 rounded transition-colors","aria-label":"Close drawer",children:p.jsx(Sr,{size:24})})]}),p.jsx("div",{className:"space-y-4",children:h.length===0?p.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:p.jsx("p",{className:"italic",children:"No signals in this category yet."})}):h.map(w=>p.jsx(FC,{signal:w,onOpen:m,onCopy:y,onArchive:v},w.id))})]})})]})})}function zC({onOpenUrl:t,onCopyText:e}){const[n,i]=R.useState([]),[o,l]=R.useState(!0),[u,d]=R.useState(null),[h,m]=R.useState(""),[y,v]=R.useState(null);R.useEffect(()=>{(async()=>{l(!0);let E=me.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);y&&(E=E.ilike("category",y)),h&&(E=E.or(`title.ilike.%${h}%,summary.ilike.%${h}%,url.ilike.%${h}%`));const{data:P,error:N}=await E;N?console.error("Error fetching signals:",N):i(P||[]),l(!1)})();const k=me.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{i(P=>[E.new,...P])}).subscribe();return()=>{k.unsubscribe()}},[h,y]);const w=S=>{t?t(S):window.open(S,"_blank","noopener,noreferrer")},_=S=>{e?e(S):navigator.clipboard.writeText(S)},b=async S=>{await me.from("signals").delete().eq("id",S),i(k=>k.filter(E=>E.id!==S))};return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsx("div",{className:"px-4 pt-3",children:p.jsx(IC,{signals:n,limit:10,onSignalClick:S=>{const k=n.find(E=>E.id===S);k&&k.category&&d(k.category.toLowerCase())}})}),p.jsxs("div",{className:"px-4 pt-2 pb-2 space-y-3",children:[p.jsxs("div",{className:"relative",children:[p.jsx(Sc,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),p.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:h,onChange:S=>m(S.target.value),className:"w-full bg-surface border border-border/20 rounded-xl py-3 pl-10 pr-10 text-sm text-fg placeholder:text-fg/40 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 outline-none transition-all"}),h&&p.jsx("button",{onClick:()=>m(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:p.jsx(Sr,{size:16})})]}),p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsx(a1,{className:"w-3.5 h-3.5 text-fg/40"}),p.jsx("button",{onClick:()=>v(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${y===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:"All"}),["AI & ML","Business","Politics","Technology","Finance","Crypto","Science","Other"].map(S=>p.jsx("button",{onClick:()=>v(S),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${y===S?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:S},S))]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 custom-scrollbar",children:o?p.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:p.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):p.jsx(VC,{signals:n,onCategoryClick:S=>d(S)})}),p.jsx(BC,{isOpen:!!u,onClose:()=>d(null),categoryId:u||"",signals:n,onOpenUrl:w,onCopyText:_,onArchive:b})]})}class qC{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}playTone(e,n,i=.3){if(this.enabled)try{const o=this.getAudioContext(),l=o.createOscillator(),u=o.createGain();l.connect(u),u.connect(o.destination),l.frequency.value=e,l.type="sine",u.gain.setValueAtTime(i,o.currentTime),u.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),l.start(o.currentTime),l.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(e,n=.3){if(!this.enabled)return;let i=0;e.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},i),i+=o.delay})}syncStart(){this.playSequence([{freq:261.63,duration:.15,delay:0},{freq:329.63,duration:.15,delay:100},{freq:392,duration:.2,delay:100}],.2)}signalFound(){this.playSequence([{freq:392,duration:.1,delay:0},{freq:523.25,duration:.15,delay:80}],.25)}syncComplete(){this.playSequence([{freq:261.63,duration:.12,delay:0},{freq:329.63,duration:.12,delay:80},{freq:392,duration:.12,delay:80},{freq:523.25,duration:.2,delay:80}],.2)}error(){this.playSequence([{freq:329.63,duration:.15,delay:0},{freq:261.63,duration:.2,delay:100}],.3)}click(){this.playTone(440,.05,.15)}}const di=new qC;function WC(){const[t,e]=R.useState([]),[n,i]=R.useState([]),[o,l]=R.useState("discovery"),[u,d]=R.useState(!1),[h,m]=R.useState(null),[y,v]=R.useState(!0),[w,_]=R.useState(!uy),[b,S]=R.useState(!0),[k,E]=R.useState(!1),[P,N]=R.useState(null),[U,V]=R.useState(!1),[z,$]=R.useState(!1),[B,Y]=R.useState(!1),[oe,Te]=R.useState(!0),[ve,je]=R.useState(()=>localStorage.getItem("theme")||"dark"),xe=R.useRef(null);R.useMemo(()=>{const J=n.length;let K=0,j=0,D=null;for(const fe of n){K+=fe.score,fe.score>j&&(j=fe.score);const ie=new Date(fe.date);(!D||ie>new Date(D.date))&&(D=fe)}const se=J?Math.round(K/J):0,ue=D?new Date(D.date):null;return{total:J,average:se,top:j,latestTimestamp:ue,latestTitle:D?.title??D?.category??null}},[n]),R.useEffect(()=>{(async()=>{if(!uy){_(!0),v(!1);return}try{const{data:j,error:D}=await me.from("init_state").select("is_initialized").single();D?(console.warn("[App] Init check error (might be fresh DB):",D),D.code==="42P01"&&S(!1)):S(j.is_initialized>0);const{data:{session:se}}=await me.auth.getSession();m(se?.user??null)}catch(j){console.error("[App] Status check failed:",j)}finally{v(!1)}})();const{data:{subscription:K}}=me.auth.onAuthStateChange((j,D)=>{m(D?.user??null)});return()=>K.unsubscribe()},[]),R.useEffect(()=>{document.documentElement.setAttribute("data-theme",ve),localStorage.setItem("theme",ve)},[ve]);const[Oe,be]=R.useState({});R.useEffect(()=>{const J=async()=>{if(!h)return;const{data:j}=await me.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",h.id).maybeSingle();j&&be(j)};J();const K=setInterval(J,2e3);return()=>clearInterval(K)},[h,U]),R.useEffect(()=>{if(!h)return;(async()=>{const{data:j}=await me.from("alchemy_settings").select("sound_enabled").eq("user_id",h.id).maybeSingle();if(j){const D=j.sound_enabled??!0;Te(D),di.setEnabled(D)}})();const K=me.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${h.id}`},j=>{const D=j.new;D.agent_state==="Mining"&&!z&&($(!0),Y(!0),oe&&di.syncStart()),D.agent_state==="Signal"&&oe&&di.signalFound(),D.agent_state==="Completed"&&($(!1),oe&&(D.metadata?.errors>0?di.error():di.syncComplete()),setTimeout(()=>{Y(!1)},5e3),pe())}).subscribe();return()=>{me.removeChannel(K)}},[h,z,oe]),R.useEffect(()=>{const J=new EventSource("/events");return J.onmessage=K=>{const j=JSON.parse(K.data);j.type==="history"?e(D=>[...j.data,...D].slice(0,100)):e(D=>[j,...D].slice(0,100))},pe(),()=>J.close()},[h]),R.useEffect(()=>{xe.current&&xe.current.scrollIntoView({behavior:"smooth"})},[t]);const pe=async()=>{try{if(h){const{data:K,error:j}=await me.from("signals").select("*").order("created_at",{ascending:!1});if(!j&&K){i(K.map(D=>({id:D.id,title:D.title,score:D.score,summary:D.summary,date:D.created_at,category:D.category,entities:D.entities})));return}}const J=await Re.get("/api/signals");i(J.data)}catch(J){console.error("Failed to fetch signals",J)}},F=async()=>{d(!0);try{await Re.post("/api/mine"),pe()}catch(J){console.error("Mining failed:",J)}finally{d(!1)}};return y?p.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:p.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):w?p.jsx(Rv,{onComplete:()=>_(!1)}):h?p.jsx(yC,{children:p.jsx(bC,{children:p.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[p.jsxs(Ne.aside,{animate:{width:k?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[p.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${k?"justify-center":""}`,children:[p.jsx("div",{className:"w-10 h-10 min-w-[40px] bg-gradient-to-br from-primary to-accent rounded-xl flex items-center justify-center shadow-lg glow-primary",children:p.jsx(kr,{className:"text-white fill-current",size:24})}),!k&&p.jsx(Ne.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),p.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[p.jsx(fa,{active:o==="discovery",onClick:()=>l("discovery"),icon:p.jsx(p1,{size:20}),label:"Discovery",collapsed:k}),p.jsx(fa,{active:o==="engine",onClick:()=>l("engine"),icon:p.jsx(sd,{size:20}),label:"Engine",collapsed:k}),p.jsx(fa,{active:o==="logs",onClick:()=>l("logs"),icon:p.jsx(kc,{size:20}),label:"System Logs",collapsed:k}),p.jsx(fa,{active:o==="account",onClick:()=>l("account"),icon:p.jsx(od,{size:20}),label:"Account",collapsed:k})]}),p.jsx("div",{className:"px-3 pb-2",children:p.jsxs("button",{onClick:()=>je(ve==="dark"?"light":"dark"),className:`w-full flex items-center ${k?"justify-center":"gap-3"} px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium`,title:k?ve==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:ve==="dark"?p.jsx(k1,{size:18}):p.jsx(w1,{size:18})}),!k&&p.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:ve==="dark"?"Light Mode":"Dark Mode"})]})}),p.jsx("div",{className:"px-3 pb-3",children:p.jsx("button",{onClick:()=>E(!k),className:`w-full flex items-center px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${k?"justify-center":"gap-3"}`,children:k?p.jsx(s1,{size:20}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:p.jsx(r1,{size:20})}),p.jsx("span",{children:"Collapse"})]})})})]}),p.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&p.jsxs(p.Fragment,{children:[p.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),p.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("button",{onClick:()=>V(!0),className:"px-4 py-2 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[p.jsx(_1,{size:16}),p.jsxs("div",{className:"flex flex-col items-start",children:[p.jsx("span",{children:"Sync Settings"}),(Oe.sync_start_date||Oe.last_sync_checkpoint)&&p.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:Oe.sync_start_date?`From: ${new Date(Oe.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:Oe.last_sync_checkpoint?`Checkpoint: ${new Date(Oe.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:""})]})]}),p.jsxs("button",{onClick:F,disabled:z,className:"px-4 py-2 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:[p.jsx(id,{size:16,className:z?"animate-spin":""}),z?"Syncing...":"Sync History"]})]})]}),p.jsx(zC,{onOpenUrl:J=>window.open(J,"_blank","noopener,noreferrer"),onCopyText:J=>{navigator.clipboard.writeText(J)}})]}),o==="engine"&&p.jsx(xC,{}),o==="account"&&p.jsx(jC,{}),o==="logs"&&p.jsx(OC,{}),p.jsx(SC,{isExpanded:B,onToggle:()=>Y(!B)})]}),p.jsx(PC,{signal:P,onClose:()=>N(null)}),p.jsx(RC,{isOpen:U,onClose:()=>V(!1)})]})})}):p.jsx(pC,{onAuthSuccess:()=>pe(),isInitialized:b})}function fa({active:t,icon:e,label:n,onClick:i,collapsed:o}){return p.jsx("button",{onClick:i,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${t?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?_i.cloneElement(e,{className:t?"text-primary":""}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:_i.cloneElement(e,{className:t?"text-primary":""})}),p.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function HC(){Re.interceptors.request.use(async t=>{try{const{data:{session:e}}=await me.auth.getSession();e?.access_token&&(t.headers.Authorization=`Bearer ${e.access_token}`);const n=Yd();n&&(t.headers["x-supabase-url"]=n.url,t.headers["x-supabase-key"]=n.anonKey)}catch(e){console.error("[Axios] Error injecting headers:",e)}return t})}HC();zx.createRoot(document.getElementById("root")).render(p.jsx(_i.StrictMode,{children:p.jsx(WC,{})}));
101
+ ${t.content}`:""}`,h=new Blob([d],{type:"text/markdown"}),m=URL.createObjectURL(h),y=document.createElement("a");y.href=m,y.download=`${t.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,y.click(),URL.revokeObjectURL(m)},u=()=>{const d=JSON.stringify(t,null,2),h=new Blob([d],{type:"application/json"}),m=URL.createObjectURL(h),y=document.createElement("a");y.href=m,y.download=`signal_${t.id}.json`,y.click(),URL.revokeObjectURL(m)};return p.jsx(cn,{children:p.jsx(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-bg/80 backdrop-blur-sm",onClick:e,children:p.jsxs(Ne.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:d=>d.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[p.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[p.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[p.jsx("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold rounded border border-primary/20 uppercase tracking-wider",children:t.category||"Research"}),p.jsx("span",{className:`text-3xl font-black ${t.score>=80?"text-accent":"text-fg/40"}`,children:t.score})]}),p.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:t.title}),p.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(t.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:p.jsx(Sr,{size:24})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[t.url&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),p.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 glass hover:bg-surface transition-all rounded-xl text-sm font-mono text-primary hover:text-accent group",children:[p.jsx(Da,{size:16,className:"flex-shrink-0"}),p.jsx("span",{className:"truncate",children:t.url}),p.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),t.entities&&t.entities.length>0&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),p.jsx("div",{className:"flex flex-wrap gap-2",children:t.entities.map(d=>p.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:d},d))})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),p.jsx("div",{className:"p-4 glass rounded-xl",children:p.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:t.summary})})]}),t.content&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),p.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:p.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:t.content})})]})]}),p.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[p.jsxs("button",{onClick:o,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[n?p.jsx(Si,{size:16,className:"text-success"}):p.jsx(py,{size:16}),n?"Copied!":"Copy"]}),p.jsxs("button",{onClick:l,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[p.jsx(sm,{size:16}),"Markdown"]}),p.jsxs("button",{onClick:u,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[p.jsx(sm,{size:16}),"JSON"]})]})]})})})}function OC({isOpen:t,onClose:e}){const{showToast:n}=Dv(),[i,o]=R.useState(""),[l,u]=R.useState(50),[d,h]=R.useState(!1),[m,y]=R.useState(!1);R.useEffect(()=>{t&&v()},[t]);const v=async()=>{const{data:{user:b}}=await me.auth.getUser();if(!b)return;const{data:S}=await me.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(S)if(u(S.max_urls_per_sync||50),S.sync_start_date){const k=new Date(S.sync_start_date),E=N=>N<10?"0"+N:N,P=k.getFullYear()+"-"+E(k.getMonth()+1)+"-"+E(k.getDate())+"T"+E(k.getHours())+":"+E(k.getMinutes());o(P)}else o("")},w=async()=>{h(!0);try{const{data:{user:b}}=await me.auth.getUser();if(!b){n("Please log in to save settings","error"),h(!1);return}const{error:S}=await me.from("alchemy_settings").update({max_urls_per_sync:l,sync_start_date:i?new Date(i).toISOString():null}).eq("user_id",b.id);S?n(`Failed to save: ${S.message}`,"error"):(n("Sync settings saved successfully","success"),e())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{h(!1)}},_=async()=>{y(!0);try{const{data:{user:b}}=await me.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),y(!1);return}const{error:S}=await me.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",b.id);S?n(`Failed to reset: ${S.message}`,"error"):n("Checkpoint reset successfully","success")}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{y(!1)}};return t?p.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:p.jsxs("div",{className:"bg-surface border border-border/20 rounded-2xl shadow-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[p.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[p.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:p.jsx(Sr,{className:"w-5 h-5"})})]}),p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"space-y-3",children:[p.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[p.jsx(n1,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),p.jsx("input",{type:"datetime-local",value:i,onChange:b=>o(b.target.value),className:"w-full bg-black/20 border border-border/10 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all"}),p.jsx("p",{className:"text-xs text-fg/50",children:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward."})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[p.jsx(c1,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),p.jsx("span",{className:"text-sm font-mono text-primary",children:l})]}),p.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:l,onChange:b=>u(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),p.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[p.jsx("span",{children:"Quick (5)"}),p.jsx("span",{children:"Balanced (50)"}),p.jsx("span",{children:"Thorough (200)"})]})]}),p.jsxs("div",{className:"pt-4 border-t border-border/10",children:[p.jsxs("button",{onClick:_,disabled:m,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[p.jsx(_1,{size:16,className:m?"animate-spin":""}),m?"Resetting...":"Reset Checkpoint"]}),p.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date'})]}),p.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:p.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.'})})]}),p.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[p.jsx("button",{onClick:e,className:"flex-1 px-4 py-2.5 bg-surface hover:bg-black/10 border border-border/10 rounded-xl font-medium transition-all",children:"Cancel"}),p.jsxs("button",{onClick:w,disabled:d,className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[p.jsx(_a,{size:18,className:d?"animate-spin":""}),d?"Saving...":"Save Settings"]})]})]})}):null}function IC(){const[t,e]=R.useState([]),[n,i]=R.useState(!0),[o,l]=R.useState(null),[u,d]=R.useState(null),[h,m]=R.useState([]),[y,v]=R.useState([]),[w,_]=R.useState([]),[b,S]=R.useState(!1);R.useEffect(()=>{k()},[]);const k=async()=>{i(!0);try{const{data:{user:$}}=await me.auth.getUser();if(!$)return;const{data:B,error:Y}=await me.from("processing_events").select("*").eq("user_id",$.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(Y){console.error("Error fetching sync runs:",Y);return}const oe=(B||[]).map(Te=>{const ve=Te.metadata||{},je=ve.errors||0,xe=ve.signals_found||0,Oe=ve.skipped||0;return{id:Te.id,started_at:Te.created_at,completed_at:Te.created_at,duration_ms:Te.duration_ms||0,signals_found:xe,urls_processed:ve.total_urls||0,skipped:Oe,errors:je,status:je>0?"partial":xe>0?"success":"failed"}});e(oe)}catch($){console.error("Failed to fetch sync runs:",$)}finally{i(!1)}},E=async $=>{S(!0);try{const{data:{user:B}}=await me.auth.getUser();if(!B)return;const Y=t.find(F=>F.id===$);if(!Y)return;const oe=new Date(new Date(Y.started_at).getTime()-Y.duration_ms),Te=new Date(Y.completed_at),{data:ve,error:je}=await me.from("processing_events").select("*").eq("user_id",B.id).gte("created_at",oe.toISOString()).lte("created_at",Te.toISOString()).order("created_at",{ascending:!0});if(je){console.error("Error fetching run events:",je);return}m(ve||[]);const xe=[],Oe=(ve||[]).filter(F=>F.agent_state==="Mining"&&F.message.includes("Mining source:"));for(const F of Oe){const J=F.message.match(/Mining source: (.+) \((.+)\)/);if(J){const K=J[1],j=J[2],D=(ve||[]).find(fe=>fe.agent_state==="Mining"&&fe.message.includes("Found")&&fe.message.includes(K)&&fe.created_at>F.created_at),se=D?.message.match(/Found (\d+) URLs/),ue=se?parseInt(se[1]):0;xe.push({label:K,browser:j,urls_found:ue,duration_ms:D?.duration_ms||0,status:F.event_type==="error"?"error":"success"})}}v(xe);const be=[],pe=(ve||[]).filter(F=>F.agent_state==="Reading");for(const F of pe){const J=F.message.match(/Reading content from: (.+)/);if(!J)continue;const K=J[1];let j=xe.length>0?xe[0].label:"Unknown";const D=xe.filter(ie=>ie.urls_found>0);(D.length===1||D.length>1)&&(j=D[0].label),console.log(`[SystemLogs] URL ${K} assigned to source: ${j}`);const se=(ve||[]).find(ie=>ie.agent_state==="Signal"&&ie.created_at>F.created_at&&ie.message.includes("Found signal")),ue=(ve||[]).find(ie=>ie.agent_state==="Skipped"&&ie.created_at>F.created_at&&ie.message.includes("Irrelevant content")),fe=(ve||[]).find(ie=>ie.event_type==="error"&&ie.created_at>F.created_at);if(se){const ie=se.message.match(/\((\d+)%\)/),Ee=ie?parseInt(ie[1]):0;be.push({url:K,result:"signal",score:Ee,category:se.details?.category||"Unknown",duration_ms:se.duration_ms,source_label:j})}else if(ue){const ie=ue.message.match(/\((\d+)%\): (.+)/),Ee=ie?parseInt(ie[1]):0,ke=ie?ie[2]:"Irrelevant";be.push({url:K,result:"skipped",score:Ee,reason:ke,duration_ms:ue.duration_ms,source_label:j})}else fe&&be.push({url:K,result:"error",reason:fe.message,source_label:j})}_(be)}catch(B){console.error("Failed to fetch run details:",B)}finally{S(!1)}},P=$=>{o===$?(l(null),d(null),v([]),_([])):(l($),d(null),E($))},N=$=>{d(u===$?null:$)},U=$=>{if($<1e3)return`${$}ms`;const B=Math.floor($/1e3);if(B<60)return`${B}s`;const Y=Math.floor(B/60),oe=B%60;return`${Y}m ${oe}s`},V=$=>{switch($){case"success":return p.jsx(rd,{className:"w-5 h-5 text-success"});case"failed":return p.jsx(um,{className:"w-5 h-5 text-error"});case"partial":return p.jsx(Mi,{className:"w-5 h-5 text-warning"});default:return p.jsx(ps,{className:"w-5 h-5 text-fg/40"})}},z=$=>{switch($){case"signal":return p.jsx(kr,{className:"w-4 h-4 text-primary"});case"skipped":return p.jsx(k1,{className:"w-4 h-4 text-fg/40"});case"error":return p.jsx(um,{className:"w-4 h-4 text-error"});default:return null}};return n?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),p.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"})]}),p.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:t.length===0?p.jsxs("div",{className:"text-center py-12 text-fg/40",children:[p.jsx(ps,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),p.jsx("p",{children:"No sync runs yet"})]}):p.jsx("div",{className:"space-y-2",children:t.map($=>p.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[p.jsxs("button",{onClick:()=>P($.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[o===$.id?p.jsx(ba,{className:"w-5 h-5 text-primary shrink-0"}):p.jsx(rm,{className:"w-5 h-5 text-fg/40 shrink-0"}),V($.status),p.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),p.jsx("div",{className:"text-sm font-mono",children:new Date($.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),p.jsx("div",{className:"text-sm font-mono",children:U($.duration_ms)})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),p.jsx("div",{className:"text-sm font-semibold text-primary",children:$.signals_found})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),p.jsx("div",{className:"text-sm font-semibold text-fg/60",children:$.skipped})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),p.jsx("div",{className:"text-sm font-semibold",children:$.urls_processed})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),p.jsx("div",{className:`text-sm font-semibold ${$.errors>0?"text-error":"text-fg/40"}`,children:$.errors})]})]})]}),p.jsx(cn,{children:o===$.id&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:p.jsx("div",{className:"p-4 bg-black/10 space-y-2",children:b?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?p.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((B,Y)=>p.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[p.jsxs("button",{onClick:()=>N(B.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[u===B.label?p.jsx(ba,{className:"w-4 h-4 text-primary shrink-0"}):p.jsx(rm,{className:"w-4 h-4 text-fg/40 shrink-0"}),p.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[p.jsxs("div",{className:"flex-1",children:[p.jsx("div",{className:"text-sm font-semibold",children:B.label}),p.jsx("div",{className:"text-xs text-fg/40",children:B.browser})]}),p.jsxs("div",{className:"text-right",children:[p.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),p.jsx("div",{className:"text-sm font-semibold",children:B.urls_found})]}),p.jsxs("div",{className:"text-right",children:[p.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),p.jsx("div",{className:"text-sm font-mono",children:U(B.duration_ms)})]})]})]}),p.jsx(cn,{children:u===B.label&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:p.jsx("div",{className:"p-3 bg-black/20 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:w.filter(oe=>oe.source_label===B.label).length===0?p.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):w.filter(oe=>oe.source_label===B.label).map((oe,Te)=>p.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[z(oe.result),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:oe.url}),oe.result==="signal"&&p.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",oe.score,"%) - ",oe.category]}),oe.result==="skipped"&&p.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",oe.score,"%) - ",oe.reason]}),oe.result==="error"&&p.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",oe.reason]})]}),p.jsx("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:ve=>ve.stopPropagation(),children:p.jsx(Da,{className:"w-3 h-3 text-fg/40"})})]},Te))})})})]},Y))})})})]},$.id))})})]})}function DC({signals:t,limit:e=10,onSignalClick:n}){const i=t.slice(0,e),[o,l]=R.useState(()=>{const h=localStorage.getItem("newSignalsFeedExpanded");return h!==null?h==="true":!0});R.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const u=h=>h>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":h>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",d=h=>{const m=new Date(h),v=new Date().getTime()-m.getTime(),w=Math.floor(v/6e4),_=Math.floor(v/36e5);return w<1?"Just now":w<60?`${w}m ago`:_<24?`${_}h ago`:m.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return i.length===0?null:p.jsxs("div",{className:"mb-3",children:[p.jsxs("button",{onClick:()=>l(!o),className:"w-full flex items-center justify-between mb-2 px-1 py-1 hover:bg-surface/30 rounded-lg transition-colors",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:["New Signals (",i.length,")"]})}),o?p.jsx(fy,{size:16,className:"text-fg/40"}):p.jsx(ba,{size:16,className:"text-fg/40"})]}),p.jsx(cn,{children:o&&p.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:p.jsx("div",{className:"overflow-x-auto pb-3 -mx-4 px-4 custom-scrollbar",children:p.jsx("div",{className:"flex gap-3 min-w-max",children:i.map(h=>p.jsxs(Ne.button,{onClick:()=>n(h.id),whileHover:{scale:1.05,y:-2},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-3 hover:border-blue-400/30 transition-all duration-300 text-left group",children:[p.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${u(h.score)}`,children:p.jsx("span",{className:"text-xl font-bold",children:h.score})}),p.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:h.title}),p.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[p.jsx(ps,{size:10}),p.jsx("span",{children:d(h.created_at)})]})]},h.id))})})})})]})}const Li=[{id:"ai",name:"AI & ML",icon:hy,color:"blue",priority:1},{id:"business",name:"Business",icon:e1,color:"purple",priority:1},{id:"politics",name:"Politics",icon:p1,color:"red",priority:1},{id:"technology",name:"Technology",icon:sd,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:a1,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:Xx,color:"orange",priority:1},{id:"science",name:"Science",icon:v1,color:"teal",priority:1}],Xd={id:"other",name:"Other",icon:T1,color:"gray",priority:3},LC=[...Li,Xd];function MC(t){const e={blue:"bg-blue-500/20 text-blue-400 border-blue-500/30",purple:"bg-purple-500/20 text-purple-400 border-purple-500/30",red:"bg-red-500/20 text-red-400 border-red-500/30",cyan:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",green:"bg-green-500/20 text-green-400 border-green-500/30",orange:"bg-orange-500/20 text-orange-400 border-orange-500/30",teal:"bg-teal-500/20 text-teal-400 border-teal-500/30",gray:"bg-gray-500/20 text-gray-400 border-gray-500/30"};return e[t]||e.gray}function Uv(t,e){if(e){const n=Li.find(i=>i.id===e.toLowerCase());if(n)return n.id}for(const n of t){const i=n.toLowerCase(),o=Li.find(l=>i.includes(l.id)||i.includes(l.name.toLowerCase()));if(o)return o.id}return null}function UC({category:t,signalCount:e,latestTimestamp:n,onClick:i}){const o=u=>{const d=new Date(u),m=new Date().getTime()-d.getTime(),y=Math.floor(m/6e4),v=Math.floor(m/36e5),w=Math.floor(m/864e5);return y<60?`${y}m ago`:v<24?`${v}h ago`:w<7?`${w}d ago`:d.toLocaleDateString("en-US",{month:"short",day:"numeric"})},l=t.icon;return p.jsxs(Ne.button,{whileHover:{scale:1.05,y:-4},whileTap:{scale:.98},onClick:i,className:"bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-6 cursor-pointer hover:border-white/20 transition-all duration-300 text-left w-full",children:[p.jsx("div",{className:"mb-4",children:p.jsx(l,{size:40,className:"text-current opacity-80"})}),p.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:t.name}),p.jsxs("div",{className:"flex items-center justify-between text-sm",children:[p.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${MC(t.color)}`,children:[e," ",e===1?"signal":"signals"]}),p.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[p.jsx(ps,{size:12}),o(n)]})]})]})}const $C=3;function VC({signals:t,onCategoryClick:e}){const{categories:n,categoryCounts:i}=R.useMemo(()=>{const o=new Map,l=new Map;t.forEach(m=>{const y=m.tags||[],v=Uv(y,m.category);if(v){const w=o.get(v)||{count:0,latest:m.created_at};o.set(v,{count:w.count+1,latest:m.created_at>w.latest?m.created_at:w.latest})}else y.forEach(w=>{const _=w.toLowerCase().trim();if(_){l.set(_,(l.get(_)||0)+1);const b=o.get(_)||{count:0,latest:m.created_at};o.set(_,{count:b.count+1,latest:m.created_at>b.latest?m.created_at:b.latest})}})});const u=Array.from(l.entries()).filter(([m,y])=>y>=$C).map(([m,y])=>({id:m,name:m.charAt(0).toUpperCase()+m.slice(1),icon:d1,color:"gray",priority:2}));return{categories:[...Li,...u,Xd].filter(m=>{const y=o.get(m.id);return y&&y.count>0}).sort((m,y)=>m.priority-y.priority),categoryCounts:o}},[t]);return n.length===0?p.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[p.jsx("p",{className:"font-medium italic",children:"No categories yet."}),p.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):p.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:n.map(o=>{const l=i.get(o.id);return p.jsx(UC,{category:o,signalCount:l.count,latestTimestamp:l.latest,onClick:()=>e(o.id)},o.id)})})}function FC({signal:t,onOpen:e,onCopy:n,onArchive:i,onBookmark:o}){const[l,u]=R.useState(!1),d=v=>v>=80?"text-yellow-400 border-yellow-400/30":v>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",h=v=>v>=80?"HIGH":v>=50?"MEDIUM":"LOW",m=(v,w)=>{const _=Uv(w||[],v);if(_){const b=Li.find(S=>S.id===_);if(b)return b}return Xd},y=v=>{const w=new Date(v),b=new Date().getTime()-w.getTime(),S=Math.floor(b/6e4),k=Math.floor(b/36e5),E=Math.floor(b/864e5);return S<60?`${S}m ago`:k<24?`${k}h ago`:E<7?`${E}d ago`:w.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return p.jsxs(Ne.div,{whileHover:{scale:1.02,boxShadow:"0 8px 24px rgba(59, 130, 246, 0.3)"},onHoverStart:()=>u(!0),onHoverEnd:()=>u(!1),className:"bg-surface/50 backdrop-blur-sm border border-white/10 rounded-lg p-6 flex flex-col gap-4 transition-all duration-300",children:[p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsx("div",{className:"flex items-center gap-3",children:p.jsxs("div",{className:`flex flex-col items-center justify-center w-16 h-16 rounded-full border-2 ${d(t.score)}`,children:[p.jsx("span",{className:"text-2xl font-bold",children:t.score}),p.jsx("span",{className:"text-[10px] font-medium opacity-70",children:h(t.score)})]})}),p.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const v=m(t.category,t.tags),w=v.icon;return p.jsxs("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs font-medium rounded border border-blue-500/30 flex items-center gap-1.5",children:[p.jsx(w,{size:14}),v.name]})})(),p.jsxs("span",{className:"text-xs text-fg/50 flex items-center gap-1",children:[p.jsx(ps,{size:12}),y(t.created_at)]})]})]}),p.jsxs("div",{className:"flex-1",children:[p.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-fg hover:text-blue-400 transition-colors line-clamp-2 mb-2 block",onClick:v=>{v.preventDefault(),e?.(t.url)},children:t.title}),p.jsx("p",{className:"text-sm text-fg/70 line-clamp-3",children:t.summary})]}),t.entities&&t.entities.length>0&&p.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.entities.slice(0,4).map((v,w)=>p.jsx("span",{className:"px-2 py-1 bg-white/5 text-fg/60 text-xs rounded border border-white/10",children:v},w)),t.entities.length>4&&p.jsxs("span",{className:"px-2 py-1 text-fg/40 text-xs",children:["+",t.entities.length-4," more"]})]}),p.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-white/5",children:[p.jsxs("button",{onClick:()=>e?.(t.url),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Open URL",children:[p.jsx(Da,{size:14}),p.jsx("span",{children:"Open"})]}),p.jsxs("button",{onClick:()=>n?.(t.summary),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Copy Summary",children:[p.jsx(py,{size:14}),p.jsx("span",{children:"Copy"})]}),p.jsxs("button",{onClick:()=>i?.(t.id),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-red-500/20 hover:text-red-400 rounded transition-colors text-sm",title:"Archive",children:[p.jsx(Jx,{size:14}),p.jsx("span",{children:"Archive"})]}),o&&p.jsx("button",{onClick:()=>o(t.id),className:"px-3 py-2 bg-white/5 hover:bg-yellow-500/20 hover:text-yellow-400 rounded transition-colors",title:"Bookmark",children:p.jsx(Zx,{size:14})})]})]})}function BC({isOpen:t,onClose:e,categoryId:n,signals:i,onOpenUrl:o,onCopyText:l,onArchive:u}){const d=LC.find(w=>w.id===n),h=i.filter(w=>{const _=w.tags||[],b=w.category?.toLowerCase()===n,S=_.some(k=>k.toLowerCase().includes(n));return b||S}),m=w=>{o?o(w):window.open(w,"_blank","noopener,noreferrer")},y=w=>{l?l(w):navigator.clipboard.writeText(w)},v=async w=>{u&&await u(w)};return p.jsx(cn,{children:t&&p.jsxs(p.Fragment,{children:[p.jsx(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:e,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),p.jsx(Ne.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed right-0 top-0 h-full w-full md:w-2/3 lg:w-1/2 bg-bg border-l border-white/10 z-50 overflow-y-auto custom-scrollbar",children:p.jsxs("div",{className:"p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6 sticky top-0 bg-bg pb-4 border-b border-white/10",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[d?.icon&&p.jsx("div",{className:"w-10 h-10 flex items-center justify-center",children:p.jsx(d.icon,{size:40,className:"text-current opacity-80"})}),p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold",children:d?.name}),p.jsxs("p",{className:"text-sm text-fg/50",children:[h.length," ",h.length===1?"signal":"signals"]})]})]}),p.jsx("button",{onClick:e,className:"p-2 hover:bg-white/10 rounded transition-colors","aria-label":"Close drawer",children:p.jsx(Sr,{size:24})})]}),p.jsx("div",{className:"space-y-4",children:h.length===0?p.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:p.jsx("p",{className:"italic",children:"No signals in this category yet."})}):h.map(w=>p.jsx(FC,{signal:w,onOpen:m,onCopy:y,onArchive:v},w.id))})]})})]})})}function zC({onOpenUrl:t,onCopyText:e}){const[n,i]=R.useState([]),[o,l]=R.useState(!0),[u,d]=R.useState(null),[h,m]=R.useState(""),[y,v]=R.useState(null);R.useEffect(()=>{(async()=>{l(!0);let E=me.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);y&&(E=E.ilike("category",y)),h&&(E=E.or(`title.ilike.%${h}%,summary.ilike.%${h}%,url.ilike.%${h}%`));const{data:P,error:N}=await E;N?console.error("Error fetching signals:",N):i(P||[]),l(!1)})();const k=me.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{i(P=>[E.new,...P])}).subscribe();return()=>{k.unsubscribe()}},[h,y]);const w=S=>{t?t(S):window.open(S,"_blank","noopener,noreferrer")},_=S=>{e?e(S):navigator.clipboard.writeText(S)},b=async S=>{await me.from("signals").delete().eq("id",S),i(k=>k.filter(E=>E.id!==S))};return p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsx("div",{className:"px-4 pt-3",children:p.jsx(DC,{signals:n,limit:10,onSignalClick:S=>{const k=n.find(E=>E.id===S);k&&k.category&&d(k.category.toLowerCase())}})}),p.jsxs("div",{className:"px-4 pt-2 pb-2 space-y-3",children:[p.jsxs("div",{className:"relative",children:[p.jsx(Sc,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),p.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:h,onChange:S=>m(S.target.value),className:"w-full bg-surface border border-border/20 rounded-xl py-3 pl-10 pr-10 text-sm text-fg placeholder:text-fg/40 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 outline-none transition-all"}),h&&p.jsx("button",{onClick:()=>m(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:p.jsx(Sr,{size:16})})]}),p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsx(l1,{className:"w-3.5 h-3.5 text-fg/40"}),p.jsx("button",{onClick:()=>v(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${y===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:"All"}),["AI & ML","Business","Politics","Technology","Finance","Crypto","Science","Other"].map(S=>p.jsx("button",{onClick:()=>v(S),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${y===S?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:S},S))]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 custom-scrollbar",children:o?p.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:p.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):p.jsx(VC,{signals:n,onCategoryClick:S=>d(S)})}),p.jsx(BC,{isOpen:!!u,onClose:()=>d(null),categoryId:u||"",signals:n,onOpenUrl:w,onCopyText:_,onArchive:b})]})}class qC{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}playTone(e,n,i=.3){if(this.enabled)try{const o=this.getAudioContext(),l=o.createOscillator(),u=o.createGain();l.connect(u),u.connect(o.destination),l.frequency.value=e,l.type="sine",u.gain.setValueAtTime(i,o.currentTime),u.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),l.start(o.currentTime),l.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(e,n=.3){if(!this.enabled)return;let i=0;e.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},i),i+=o.delay})}syncStart(){this.playSequence([{freq:261.63,duration:.15,delay:0},{freq:329.63,duration:.15,delay:100},{freq:392,duration:.2,delay:100}],.2)}signalFound(){this.playSequence([{freq:392,duration:.1,delay:0},{freq:523.25,duration:.15,delay:80}],.25)}syncComplete(){this.playSequence([{freq:261.63,duration:.12,delay:0},{freq:329.63,duration:.12,delay:80},{freq:392,duration:.12,delay:80},{freq:523.25,duration:.2,delay:80}],.2)}error(){this.playSequence([{freq:329.63,duration:.15,delay:0},{freq:261.63,duration:.2,delay:100}],.3)}click(){this.playTone(440,.05,.15)}}const di=new qC;function WC(){const[t,e]=R.useState([]),[n,i]=R.useState([]),[o,l]=R.useState("discovery"),[u,d]=R.useState(!1),[h,m]=R.useState(null),[y,v]=R.useState(!0),[w,_]=R.useState(!cy),[b,S]=R.useState(!0),[k,E]=R.useState(!1),[P,N]=R.useState(null),[U,V]=R.useState(!1),[z,$]=R.useState(!1),[B,Y]=R.useState(!1),[oe,Te]=R.useState(!0),[ve,je]=R.useState(()=>localStorage.getItem("theme")||"dark"),xe=R.useRef(null);R.useMemo(()=>{const J=n.length;let K=0,j=0,D=null;for(const fe of n){K+=fe.score,fe.score>j&&(j=fe.score);const ie=new Date(fe.date);(!D||ie>new Date(D.date))&&(D=fe)}const se=J?Math.round(K/J):0,ue=D?new Date(D.date):null;return{total:J,average:se,top:j,latestTimestamp:ue,latestTitle:D?.title??D?.category??null}},[n]),R.useEffect(()=>{(async()=>{if(!cy){_(!0),v(!1);return}try{const{data:j,error:D}=await me.from("init_state").select("is_initialized").single();D?(console.warn("[App] Init check error (might be fresh DB):",D),D.code==="42P01"&&S(!1)):S(j.is_initialized>0);const{data:{session:se}}=await me.auth.getSession();m(se?.user??null)}catch(j){console.error("[App] Status check failed:",j)}finally{v(!1)}})();const{data:{subscription:K}}=me.auth.onAuthStateChange((j,D)=>{m(D?.user??null)});return()=>K.unsubscribe()},[]),R.useEffect(()=>{document.documentElement.setAttribute("data-theme",ve),localStorage.setItem("theme",ve)},[ve]);const[Oe,be]=R.useState({});R.useEffect(()=>{const J=async()=>{if(!h)return;const{data:j}=await me.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",h.id).maybeSingle();j&&be(j)};J();const K=setInterval(J,2e3);return()=>clearInterval(K)},[h,U]),R.useEffect(()=>{if(!h)return;(async()=>{const{data:j}=await me.from("alchemy_settings").select("sound_enabled").eq("user_id",h.id).maybeSingle();if(j){const D=j.sound_enabled??!0;Te(D),di.setEnabled(D)}})();const K=me.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${h.id}`},j=>{const D=j.new;D.agent_state==="Mining"&&!z&&($(!0),Y(!0),oe&&di.syncStart()),D.agent_state==="Signal"&&oe&&di.signalFound(),D.agent_state==="Completed"&&($(!1),oe&&(D.metadata?.errors>0?di.error():di.syncComplete()),setTimeout(()=>{Y(!1)},5e3),pe())}).subscribe();return()=>{me.removeChannel(K)}},[h,z,oe]),R.useEffect(()=>{const J=new EventSource("/events");return J.onmessage=K=>{const j=JSON.parse(K.data);j.type==="history"?e(D=>[...j.data,...D].slice(0,100)):e(D=>[j,...D].slice(0,100))},pe(),()=>J.close()},[h]),R.useEffect(()=>{xe.current&&xe.current.scrollIntoView({behavior:"smooth"})},[t]);const pe=async()=>{try{if(h){const{data:K,error:j}=await me.from("signals").select("*").order("created_at",{ascending:!1});if(!j&&K){i(K.map(D=>({id:D.id,title:D.title,score:D.score,summary:D.summary,date:D.created_at,category:D.category,entities:D.entities})));return}}const J=await Re.get("/api/signals");i(J.data)}catch(J){console.error("Failed to fetch signals",J)}},F=async()=>{d(!0);try{await Re.post("/api/mine"),pe()}catch(J){console.error("Mining failed:",J)}finally{d(!1)}};return y?p.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:p.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):w?p.jsx(Ov,{onComplete:()=>_(!1)}):h?p.jsx(vC,{children:p.jsx(_C,{children:p.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[p.jsxs(Ne.aside,{animate:{width:k?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[p.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${k?"justify-center":""}`,children:[p.jsx("div",{className:"w-10 h-10 min-w-[40px] bg-gradient-to-br from-primary to-accent rounded-xl flex items-center justify-center shadow-lg glow-primary",children:p.jsx(kr,{className:"text-white fill-current",size:24})}),!k&&p.jsx(Ne.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),p.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[p.jsx(pa,{active:o==="discovery",onClick:()=>l("discovery"),icon:p.jsx(m1,{size:20}),label:"Discovery",collapsed:k}),p.jsx(pa,{active:o==="engine",onClick:()=>l("engine"),icon:p.jsx(sd,{size:20}),label:"Engine",collapsed:k}),p.jsx(pa,{active:o==="logs",onClick:()=>l("logs"),icon:p.jsx(kc,{size:20}),label:"System Logs",collapsed:k}),p.jsx(pa,{active:o==="account",onClick:()=>l("account"),icon:p.jsx(od,{size:20}),label:"Account",collapsed:k})]}),p.jsx("div",{className:"px-3 pb-2",children:p.jsxs("button",{onClick:()=>je(ve==="dark"?"light":"dark"),className:`w-full flex items-center ${k?"justify-center":"gap-3"} px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium`,title:k?ve==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:ve==="dark"?p.jsx(E1,{size:18}):p.jsx(x1,{size:18})}),!k&&p.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:ve==="dark"?"Light Mode":"Dark Mode"})]})}),p.jsx("div",{className:"px-3 pb-3",children:p.jsx("button",{onClick:()=>E(!k),className:`w-full flex items-center px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${k?"justify-center":"gap-3"}`,children:k?p.jsx(i1,{size:20}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:p.jsx(s1,{size:20})}),p.jsx("span",{children:"Collapse"})]})})})]}),p.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&p.jsxs(p.Fragment,{children:[p.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),p.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("button",{onClick:()=>V(!0),className:"px-4 py-2 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[p.jsx(S1,{size:16}),p.jsxs("div",{className:"flex flex-col items-start",children:[p.jsx("span",{children:"Sync Settings"}),(Oe.sync_start_date||Oe.last_sync_checkpoint)&&p.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:Oe.sync_start_date?`From: ${new Date(Oe.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:Oe.last_sync_checkpoint?`Checkpoint: ${new Date(Oe.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:""})]})]}),p.jsxs("button",{onClick:F,disabled:z,className:"px-4 py-2 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed",children:[p.jsx(id,{size:16,className:z?"animate-spin":""}),z?"Syncing...":"Sync History"]})]})]}),p.jsx(zC,{onOpenUrl:J=>window.open(J,"_blank","noopener,noreferrer"),onCopyText:J=>{navigator.clipboard.writeText(J)}})]}),o==="engine"&&p.jsx(bC,{}),o==="account"&&p.jsx(CC,{}),o==="logs"&&p.jsx(IC,{}),p.jsx(kC,{isExpanded:B,onToggle:()=>Y(!B)})]}),p.jsx(RC,{signal:P,onClose:()=>N(null)}),p.jsx(OC,{isOpen:U,onClose:()=>V(!1)})]})})}):p.jsx(mC,{onAuthSuccess:()=>pe(),isInitialized:b})}function pa({active:t,icon:e,label:n,onClick:i,collapsed:o}){return p.jsx("button",{onClick:i,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${t?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?_i.cloneElement(e,{className:t?"text-primary":""}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:_i.cloneElement(e,{className:t?"text-primary":""})}),p.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function HC(){Re.interceptors.request.use(async t=>{try{const{data:{session:e}}=await me.auth.getSession();e?.access_token&&(t.headers.Authorization=`Bearer ${e.access_token}`);const n=Yd();n&&(t.headers["x-supabase-url"]=n.url,t.headers["x-supabase-key"]=n.anonKey)}catch(e){console.error("[Axios] Error injecting headers:",e)}return t})}HC();qx.createRoot(document.getElementById("root")).render(p.jsx(_i.StrictMode,{children:p.jsx(WC,{})}));