@realtimex/realtimex-alchemy 1.0.8 → 1.0.10
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,36 +1,36 @@
|
|
|
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 uy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var zu={exports:{}},li={},qu={exports:{}},we={};var Kp;function Px(){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 rd(){return Gp||(Gp=1,qu.exports=Px()),qu.exports}var Jp;function Rx(){if(Jp)return li;Jp=1;var t=rd(),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 Ox(){return Yp||(Yp=1,zu.exports=Rx()),zu.exports}var p=Ox(),R=rd();const _i=uy(R);var sa={},Wu={exports:{}},_t={},Hu={exports:{}},Ku={};var Qp;function Ix(){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}}}})(Ku)),Ku}var Xp;function Dx(){return Xp||(Xp=1,Hu.exports=Ix()),Hu.exports}var Zp;function Lx(){if(Zp)return _t;Zp=1;var t=rd(),e=Dx();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 cy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var zu={exports:{}},li={},qu={exports:{}},we={};var Kp;function Ox(){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"),p=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:p,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,qu.exports=Ox()),qu.exports}var Jp;function Ix(){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,p){var y,v={},w=null,_=null;p!==void 0&&(w=""+p),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 Dx(){return Yp||(Yp=1,zu.exports=Ix()),zu.exports}var m=Dx(),R=nd();const _i=cy(R);var ra={},Wu={exports:{}},_t={},Hu={exports:{}},Ku={};var Qp;function Lx(){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=[],p=[],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(p);J!==null;){if(J.callback===null)i(p);else if(J.startTime<=F)i(p),J.sortIndex=J.expirationTime,e(h,J);else break;J=n(p)}}function U(F){if(S=!1,N(F),!b)if(n(h)!==null)b=!0,be(V);else{var J=n(p);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(p);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(p,F),n(h)===null&&F===n(p)&&(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}}}})(Ku)),Ku}var Xp;function Mx(){return Xp||(Xp=1,Hu.exports=Lx()),Hu.exports}var Zp;function Ux(){if(Zp)return _t;Zp=1;var t=nd(),e=Mx();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,p=/^[: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:p.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 Ki(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 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 Ya(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 Qa(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")?Xa(r,s.type,a):s.hasOwnProperty("defaultValue")&&Xa(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 Xa(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 Za(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 el(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 Ji,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(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},D0=["Webkit","ms","Moz","O"];Object.keys(Es).forEach(function(r){D0.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 L0=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 tl(r,s){if(s){if(L0[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 nl(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 rl=null;function sl(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var il=null,Cr=null,Nr=null;function uh(r){if(r=Ks(r)){if(typeof il!="function")throw Error(n(280));var s=r.stateNode;s&&(s=wo(s),il(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 ol=!1;function ph(r,s,a){if(ol)return r(s,a);ol=!0;try{return hh(r,s,a)}finally{ol=!1,(Cr!==null||Nr!==null)&&(fh(),dh())}}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 al=!1;if(d)try{var js={};Object.defineProperty(js,"passive",{get:function(){al=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{al=!1}function M0(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,ll=null,U0={onError:function(r){Cs=!0,Yi=r}};function $0(r,s,a,c,f,g,x,T,C){Cs=!1,Yi=null,M0.apply(U0,arguments)}function V0(r,s,a,c,f,g,x,T,C){if($0.apply(this,arguments),Cs){if(Cs){var L=Yi;Cs=!1,Yi=null}else throw Error(n(198));Qi||(Qi=!0,ll=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 F0(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=F0(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,B0=e.unstable_shouldYield,z0=e.unstable_requestPaint,He=e.unstable_now,q0=e.unstable_getCurrentPriorityLevel,ul=e.unstable_ImmediatePriority,bh=e.unstable_UserBlockingPriority,Xi=e.unstable_NormalPriority,W0=e.unstable_LowPriority,_h=e.unstable_IdlePriority,Zi=null,tn=null;function H0(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:J0,K0=Math.log,G0=Math.LN2;function J0(r){return r>>>=0,r===0?32:31-(K0(r)/G0|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 Y0(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 Q0(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]=Y0(T,s)):C<=s&&(r.expiredLanes|=T),g&=~T}}function cl(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Sh(){var r=eo;return eo<<=1,(eo&4194240)===0&&(eo=64),r}function dl(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 X0(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 hl(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,fl,Th,jh,Ch,pl=!1,ro=[],En=null,Tn=null,jn=null,Ps=new Map,Rs=new Map,Cn=[],Z0="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&&fl(s)),r):(r.eventSystemFlags|=c,s=r.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),r)}function ew(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 so(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var a=gl(r.domEventName,r.eventSystemFlags,s[0],r.nativeEvent);if(a===null){a=r.nativeEvent;var c=new a.constructor(a.type,a);rl=c,a.target.dispatchEvent(c),rl=null}else return s=Ks(a),s!==null&&fl(s),r.blockedOn=a,!1;s.shift()}return!0}function Ph(r,s,a){so(r)&&a.delete(s)}function tw(){pl=!1,En!==null&&so(En)&&(En=null),Tn!==null&&so(Tn)&&(Tn=null),jn!==null&&so(jn)&&(jn=null),Ps.forEach(Ph),Rs.forEach(Ph)}function Is(r,s){r.blockedOn===s&&(r.blockedOn=null,pl||(pl=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,tw)))}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);)Ah(a),a.blockedOn===null&&Cn.shift()}var Ar=U.ReactCurrentBatchConfig,io=!0;function nw(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=1,ml(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function rw(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=4,ml(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function ml(r,s,a,c){if(io){var f=gl(r,s,a,c);if(f===null)Ol(r,s,c,oo,a),Nh(r,c);else if(ew(f,r,s,a,c))c.stopPropagation();else if(Nh(r,c),s&4&&-1<Z0.indexOf(r)){for(;f!==null;){var g=Ks(f);if(g!==null&&Eh(g),g=gl(r,s,a,c),g===null&&Ol(r,s,c,oo,a),g===f)break;f=g}f!==null&&c.stopPropagation()}else Ol(r,s,c,null,a)}}var oo=null;function gl(r,s,a,c){if(oo=null,r=sl(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 oo=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(q0()){case ul:return 1;case bh:return 4;case Xi:case W0:return 16;case _h:return 536870912;default:return 16}default:return 16}}var Nn=null,yl=null,ao=null;function Oh(){if(ao)return ao;var r,s=yl,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 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)?uo: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=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},vl=Tt(Pr),Ls=K({},Pr,{view:0,detail:0}),sw=Tt(Ls),wl,xl,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:_l,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"?(wl=r.screenX-Ms.screenX,xl=r.screenY-Ms.screenY):xl=wl=0,Ms=r),wl)},movementY:function(r){return"movementY"in r?r.movementY:xl}}),Dh=Tt(co),iw=K({},co,{dataTransfer:0}),ow=Tt(iw),aw=K({},Ls,{relatedTarget:0}),bl=Tt(aw),lw=K({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),uw=Tt(lw),cw=K({},Pr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),dw=Tt(cw),hw=K({},Pr,{data:0}),Lh=Tt(hw),fw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pw={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"},mw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gw(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=mw[r])?!!s[r]:!1}function _l(){return gw}var yw=K({},Ls,{key:function(r){if(r.key){var s=fw[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"?pw[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_l,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}}),vw=Tt(yw),ww=K({},co,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mh=Tt(ww),xw=K({},Ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_l}),bw=Tt(xw),_w=K({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sw=Tt(_w),kw=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}),Ew=Tt(kw),Tw=[9,13,27,32],Sl=d&&"CompositionEvent"in window,Us=null;d&&"documentMode"in document&&(Us=document.documentMode);var jw=d&&"TextEvent"in window&&!Us,Uh=d&&(!Sl||Us&&8<Us&&11>=Us),$h=" ",Vh=!1;function Fh(r,s){switch(r){case"keyup":return Tw.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 Cw(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 Nw(r,s){if(Rr)return r==="compositionend"||!Sl&&Fh(r,s)?(r=Oh(),ao=yl=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 Aw={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"?!!Aw[r.type]:s==="textarea"}function qh(r,s,a,c){ch(c),s=go(s,"onChange"),0<s.length&&(a=new vl("onChange","change",null,a,c),r.push({event:a,listeners:s}))}var $s=null,Vs=null;function Pw(r){uf(r,0)}function ho(r){var s=Mr(r);if(Xd(s))return r}function Rw(r,s){if(r==="change")return s}var Wh=!1;if(d){var kl;if(d){var El="oninput"in document;if(!El){var Hh=document.createElement("div");Hh.setAttribute("oninput","return;"),El=typeof Hh.oninput=="function"}kl=El}else kl=!1;Wh=kl&&(!document.documentMode||9<document.documentMode)}function Kh(){$s&&($s.detachEvent("onpropertychange",Gh),Vs=$s=null)}function Gh(r){if(r.propertyName==="value"&&ho(Vs)){var s=[];qh(s,Vs,r,sl(r)),ph(Pw,s)}}function Ow(r,s,a){r==="focusin"?(Kh(),$s=s,Vs=a,$s.attachEvent("onpropertychange",Gh)):r==="focusout"&&Kh()}function Iw(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ho(Vs)}function Dw(r,s){if(r==="click")return ho(s)}function Lw(r,s){if(r==="input"||r==="change")return ho(s)}function Mw(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var qt=typeof Object.is=="function"?Object.is:Mw;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=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 Tl(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 Uw(r){var s=Xh(),a=r.focusedElem,c=r.selectionRange;if(s!==a&&a&&a.ownerDocument&&Qh(a.ownerDocument.documentElement,a)){if(c!==null&&Tl(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 $w=d&&"documentMode"in document&&11>=document.documentMode,Or=null,jl=null,Bs=null,Cl=!1;function Zh(r,s,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Cl||Or==null||Or!==Gi(c)||(c=Or,"selectionStart"in c&&Tl(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(jl,"onSelect"),0<c.length&&(s=new vl("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")},Nl={},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 po(r){if(Nl[r])return Nl[r];if(!Ir[r])return r;var s=Ir[r],a;for(a in s)if(s.hasOwnProperty(a)&&a in ef)return Nl[r]=s[a];return r}var tf=po("animationend"),nf=po("animationiteration"),rf=po("animationstart"),sf=po("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 Al=0;Al<af.length;Al++){var Pl=af[Al],Vw=Pl.toLowerCase(),Fw=Pl[0].toUpperCase()+Pl.slice(1);An(Vw,"on"+Fw)}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(" "),Bw=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,V0(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(Qi)throw r=ll,Qi=!1,ll=null,r}function Ie(r,s){var a=s[$l];a===void 0&&(a=s[$l]=new Set);var c=r+"__bubble";a.has(c)||(cf(s,r,2,!1),a.add(c))}function Rl(r,s,a){var c=0;s&&(c|=4),cf(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"&&(Bw.has(a)||Rl(a,!1,r),Rl(a,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[mo]||(s[mo]=!0,Rl("selectionchange",!1,s))}}function cf(r,s,a,c){switch(Rh(s)){case 1:var f=nw;break;case 4:f=rw;break;default:f=ml}a=f.bind(null,s,a,r),f=void 0,!al||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 Ol(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=sl(a),H=[];e:{var q=of.get(r);if(q!==void 0){var Q=vl,Z=r;switch(r){case"keypress":if(lo(a)===0)break e;case"keydown":case"keyup":Q=vw;break;case"focusin":Z="focus",Q=bl;break;case"focusout":Z="blur",Q=bl;break;case"beforeblur":case"afterblur":Q=bl;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=ow;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=bw;break;case tf:case nf:case rf:Q=uw;break;case sf:Q=Sw;break;case"scroll":Q=sw;break;case"wheel":Q=Ew;break;case"copy":case"cut":case"paste":Q=dw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Mh}var ee=(s&4)!==0,Ke=!ee&&r==="scroll",O=ee?q!==null?q+"Capture":null:q;ee=[];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&&ee.push(Ws(A,G,I)))),Ke)break;A=A.return}0<ee.length&&(q=new Q(q,Z,null,a,W),H.push({event:q,listeners:ee}))}}if((s&7)===0){e:{if(q=r==="mouseover"||r==="pointerover",Q=r==="mouseout"||r==="pointerout",q&&a!==rl&&(Z=a.relatedTarget||a.fromElement)&&(Xn(Z)||Z[cn]))break e;if((Q||q)&&(q=W.window===W?W:(q=W.ownerDocument)?q.defaultView||q.parentWindow:window,Q?(Z=a.relatedTarget||a.toElement,Q=L,Z=Z?Xn(Z):null,Z!==null&&(Ke=Qn(Z),Z!==Ke||Z.tag!==5&&Z.tag!==6)&&(Z=null)):(Q=null,Z=L),Q!==Z)){if(ee=Dh,G="onMouseLeave",O="onMouseEnter",A="mouse",(r==="pointerout"||r==="pointerover")&&(ee=Mh,G="onPointerLeave",O="onPointerEnter",A="pointer"),Ke=Q==null?q:Mr(Q),I=Z==null?q:Mr(Z),q=new ee(G,A+"leave",Q,a,W),q.target=Ke,q.relatedTarget=I,G=null,Xn(W)===L&&(ee=new ee(O,A+"enter",Z,a,W),ee.target=I,ee.relatedTarget=Ke,G=ee),Ke=G,Q&&Z)t:{for(ee=Q,O=Z,A=0,I=ee;I;I=Dr(I))A++;for(I=0,G=O;G;G=Dr(G))I++;for(;0<A-I;)ee=Dr(ee),A--;for(;0<I-A;)O=Dr(O),I--;for(;A--;){if(ee===O||O!==null&&ee===O.alternate)break t;ee=Dr(ee),O=Dr(O)}ee=null}else ee=null;Q!==null&&df(H,q,Q,ee,!1),Z!==null&&Ke!==null&&df(H,Ke,Z,ee,!0)}}e:{if(q=L?Mr(L):window,Q=q.nodeName&&q.nodeName.toLowerCase(),Q==="select"||Q==="input"&&q.type==="file")var te=Rw;else if(zh(q))if(Wh)te=Lw;else{te=Iw;var ae=Ow}else(Q=q.nodeName)&&Q.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(te=Dw);if(te&&(te=te(r,L))){qh(H,te,a,W);break e}ae&&ae(r,q,L),r==="focusout"&&(ae=q._wrapperState)&&ae.controlled&&q.type==="number"&&Xa(q,"number",q.value)}switch(ae=L?Mr(L):window,r){case"focusin":(zh(ae)||ae.contentEditable==="true")&&(Or=ae,jl=L,Bs=null);break;case"focusout":Bs=jl=Or=null;break;case"mousedown":Cl=!0;break;case"contextmenu":case"mouseup":case"dragend":Cl=!1,Zh(H,a,W);break;case"selectionchange":if($w)break;case"keydown":case"keyup":Zh(H,a,W)}var le;if(Sl)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,yl="value"in Nn?Nn.value:Nn.textContent,Rr=!0)),ae=go(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=jw?Cw(r,a):Nw(r,a))&&(L=go(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 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 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 zw=/\r\n?/g,qw=/\u0000|\uFFFD/g;function hf(r){return(typeof r=="string"?r:""+r).replace(zw,`
|
|
6
|
-
`).replace(qw,"")}function yo(r,s,a){if(s=hf(s),hf(r)!==s&&a)throw Error(n(425))}function vo(){}var Il=null,Dl=null;function Ll(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 Ml=typeof setTimeout=="function"?setTimeout:void 0,Ww=typeof clearTimeout=="function"?clearTimeout:void 0,ff=typeof Promise=="function"?Promise:void 0,Hw=typeof queueMicrotask=="function"?queueMicrotask:typeof ff<"u"?function(r){return ff.resolve(null).then(r).catch(Kw)}:Ml;function Kw(r){setTimeout(function(){throw r})}function Ul(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,cn="__reactContainer$"+Lr,$l="__reactEvents$"+Lr,Gw="__reactListeners$"+Lr,Jw="__reactHandles$"+Lr;function Xn(r){var s=r[nn];if(s)return s;for(var a=r.parentNode;a;){if(s=a[cn]||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[cn],!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 Vl=[],Ur=-1;function Rn(r){return{current:r}}function De(r){0>Ur||(r.current=Vl[Ur],Vl[Ur]=null,Ur--)}function Ae(r,s){Ur++,Vl[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 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 bo(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 dn=null,_o=!1,Fl=!1;function vf(r){dn===null?dn=[r]:dn.push(r)}function Yw(r){_o=!0,vf(r)}function In(){if(!Fl&&dn!==null){Fl=!0;var r=0,s=Ce;try{var a=dn;for(Ce=1;r<a.length;r++){var c=a[r];do c=c(!0);while(c!==null)}dn=null,_o=!1}catch(f){throw dn!==null&&(dn=dn.slice(r+1)),wh(ul,In),f}finally{Ce=s,Fl=!1}}return null}var Vr=[],Fr=0,So=null,ko=0,Dt=[],Lt=0,er=null,hn=1,fn="";function tr(r,s){Vr[Fr++]=ko,Vr[Fr++]=So,So=r,ko=s}function wf(r,s,a){Dt[Lt++]=hn,Dt[Lt++]=fn,Dt[Lt++]=er,er=r;var c=hn;r=fn;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,hn=1<<32-zt(s)+f|a<<f|c,fn=g+r}else hn=1<<g|a<<f|c,fn=r}function Bl(r){r.return!==null&&(tr(r,1),wf(r,1,0))}function zl(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,fn=Dt[--Lt],Dt[Lt]=null,hn=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:hn,overflow:fn}: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 ql(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Wl(r){if(Ue){var s=Ct;if(s){var a=s;if(!bf(r,s)){if(ql(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(ql(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 Eo(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"&&!Ll(r.type,r.memoizedProps)),s&&(s=Ct)){if(ql(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 Hl(r){Wt===null?Wt=[r]:Wt.push(r)}var Qw=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 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=Mu(I,O.mode,G),A.return=O,A):(A=f(A,I),A.return=O,A)}function C(O,A,I,G){var te=I.type;return te===$?W(O,A,I.props.children,G,I.key):A!==null&&(A.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===be&&kf(te)===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=Uu(I,O.mode,G),A.return=O,A):(A=f(A,I.children||[]),A.return=O,A)}function W(O,A,I,G,te){return A===null||A.tag!==7?(A=ur(I,O.mode,G,te),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=Mu(""+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=Uu(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 te=A!==null?A.key:null;if(typeof I=="string"&&I!==""||typeof I=="number")return te!==null?null:T(O,A,""+I,G);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case V:return I.key===te?C(O,A,I,G):null;case z:return I.key===te?L(O,A,I,G):null;case be:return te=I._init,q(O,A,te(I._payload),G)}if(Ss(I)||J(I))return te!==null?null:W(O,A,I,G,null);To(O,I)}return null}function Q(O,A,I,G,te){if(typeof G=="string"&&G!==""||typeof G=="number")return O=O.get(I)||null,T(A,O,""+G,te);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,te);case z:return O=O.get(G.key===null?I:G.key)||null,L(A,O,G,te);case be:var ae=G._init;return Q(O,A,I,ae(G._payload),te)}if(Ss(G)||J(G))return O=O.get(I)||null,W(A,O,G,te,null);To(A,G)}return null}function Z(O,A,I,G){for(var te=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?te=Se:ae.sibling=Se,ae=Se,le=nt}if(ge===I.length)return a(O,le),Ue&&tr(O,ge),te;if(le===null){for(;ge<I.length;ge++)le=H(O,I[ge],G),le!==null&&(A=g(le,A,ge),ae===null?te=le:ae.sibling=le,ae=le);return Ue&&tr(O,ge),te}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?te=nt:ae.sibling=nt,ae=nt);return r&&le.forEach(function(zn){return s(O,zn)}),Ue&&tr(O,ge),te}function ee(O,A,I,G){var te=J(I);if(typeof te!="function")throw Error(n(150));if(I=te.call(I),I==null)throw Error(n(151));for(var ae=te=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?te=zn:ae.sibling=zn,ae=zn,le=nt}if(Se.done)return a(O,le),Ue&&tr(O,ge),te;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?te=Se:ae.sibling=Se,ae=Se);return Ue&&tr(O,ge),te}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?te=Se:ae.sibling=Se,ae=Se);return r&&le.forEach(function(Ax){return s(O,Ax)}),Ue&&tr(O,ge),te}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 te=I.key,ae=A;ae!==null;){if(ae.key===te){if(te=I.type,te===$){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===te||typeof te=="object"&&te!==null&&te.$$typeof===be&&kf(te)===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=Uu(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 Z(O,A,I,G);if(J(I))return ee(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=Mu(I,O.mode,G),A.return=O,O=A),x(O)):a(O,A)}return Ke}var zr=Ef(!0),Tf=Ef(!1),jo=Rn(null),Co=null,qr=null,Kl=null;function Gl(){Kl=qr=Co=null}function Jl(r){var s=jo.current;De(jo),r._currentValue=s}function Yl(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,Kl=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(Kl!==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 Ql(r){nr===null?nr=[r]:nr.push(r)}function jf(r,s,a,c){var f=s.interleaved;return f===null?(a.next=a,Ql(s)):(a.next=f.next,f.next=a),s.interleaved=a,pn(r,c)}function pn(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 Xl(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 mn(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,pn(r,a)}return f=c.interleaved,f===null?(s.next=s,Ql(c)):(s.next=f.next,f.next=s),c.interleaved=s,pn(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,hl(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 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 Z=r,ee=T;switch(q=s,Q=a,ee.tag){case 1:if(Z=ee.payload,typeof Z=="function"){H=Z.call(Q,H,q);break e}H=Z;break e;case 3:Z.flags=Z.flags&-65537|128;case 0:if(Z=ee.payload,q=typeof Z=="function"?Z.call(Q,H,q):Z,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 Zl(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:el(null,"");break;default:r=r===8?s.parentNode:s,s=r.namespaceURI||null,r=r.tagName,s=el(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=el(s,r.type);s!==a&&(Ae(Ys,r),Ae(rn,a))}function eu(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 tu=[];function nu(){for(var r=0;r<tu.length;r++)tu[r]._workInProgressVersionPrimary=null;tu.length=0}var Ro=U.ReactCurrentDispatcher,ru=U.ReactCurrentBatchConfig,sr=0,Ve=null,Qe=null,et=null,Oo=!1,Xs=!1,Zs=0,Xw=0;function ut(){throw Error(n(321))}function su(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 iu(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?nx:rx,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=sx,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 ou(){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 au(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 lu(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,uu(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=pn(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=tx.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 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&&su(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 Io(8390656,8,r,s)}function uu(r,s){return Do(2048,8,r,s)}function Bf(r,s){return Do(4,2,r,s)}function zf(r,s){return Do(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,Do(4,4,qf.bind(null,s,r),a)}function cu(){}function Hf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&su(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&&su(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 Zw(r,s){var a=Ce;Ce=a!==0&&4>a?a:4,r(!0);var c=ru.transition;ru.transition={};try{r(!1),s()}finally{Ce=a,ru.transition=c}}function Jf(){return Ut().memoizedState}function ex(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 tx(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,Ql(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=Oo=!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,hl(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},nx={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,Io(4194308,4,qf.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=ex.bind(null,Ve,r),[c.memoizedState,r]},useRef:function(r){var s=sn();return r={current:r},s.memoizedState=r},useState:$f,useDebugValue:cu,useDeferredValue:function(r){return sn().memoizedState=r},useTransition:function(){var r=$f(!1),s=r[0];return r=Zw.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=fn,c=hn;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=Xw++,s=":"+s+"r"+a.toString(32)+":";return r.memoizedState=s},unstable_isNewReconciler:!1},rx={readContext:Mt,useCallback:Hf,useContext:Mt,useEffect:uu,useImperativeHandle:Wf,useInsertionEffect:Bf,useLayoutEffect:zf,useMemo:Kf,useReducer:au,useRef:Vf,useState:function(){return au(ei)},useDebugValue:cu,useDeferredValue:function(r){var s=Ut();return Gf(s,Qe.memoizedState,r)},useTransition:function(){var r=au(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Rf,useSyncExternalStore:Of,useId:Jf,unstable_isNewReconciler:!1},sx={readContext:Mt,useCallback:Hf,useContext:Mt,useEffect:uu,useImperativeHandle:Wf,useInsertionEffect:Bf,useLayoutEffect:zf,useMemo:Kf,useReducer:lu,useRef:Vf,useState:function(){return lu(ei)},useDebugValue:cu,useDeferredValue:function(r){var s=Ut();return Qe===null?s.memoizedState=r: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};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 du(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=mn(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=mn(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=mn(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 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=Mo,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&&Mo.enqueueReplaceState(s,s.state,null)}function hu(r,s,a,c){var f=r.stateNode;f.props=a,f.state=r.memoizedState,f.refs={},Xl(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"&&(du(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=`
|
|
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 Ya(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 Qa(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")?Xa(r,s.type,a):s.hasOwnProperty("defaultValue")&&Xa(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 Xa(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 Za(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 el(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},Mv=["Webkit","ms","Moz","O"];Object.keys(Es).forEach(function(r){Mv.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 Uv=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 tl(r,s){if(s){if(Uv[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 nl(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 rl=null;function sl(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var il=null,Cr=null,Nr=null;function uh(r){if(r=Ks(r)){if(typeof il!="function")throw Error(n(280));var s=r.stateNode;s&&(s=vo(s),il(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 ol=!1;function ph(r,s,a){if(ol)return r(s,a);ol=!0;try{return hh(r,s,a)}finally{ol=!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 al=!1;if(d)try{var js={};Object.defineProperty(js,"passive",{get:function(){al=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{al=!1}function $v(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,ll=null,Vv={onError:function(r){Cs=!0,Ji=r}};function Fv(r,s,a,c,f,g,x,T,C){Cs=!1,Ji=null,$v.apply(Vv,arguments)}function Bv(r,s,a,c,f,g,x,T,C){if(Fv.apply(this,arguments),Cs){if(Cs){var L=Ji;Cs=!1,Ji=null}else throw Error(n(198));Yi||(Yi=!0,ll=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 zv(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=zv(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,qv=e.unstable_shouldYield,Wv=e.unstable_requestPaint,He=e.unstable_now,Hv=e.unstable_getCurrentPriorityLevel,ul=e.unstable_ImmediatePriority,bh=e.unstable_UserBlockingPriority,Qi=e.unstable_NormalPriority,Kv=e.unstable_LowPriority,_h=e.unstable_IdlePriority,Xi=null,tn=null;function Gv(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:Qv,Jv=Math.log,Yv=Math.LN2;function Qv(r){return r>>>=0,r===0?32:31-(Jv(r)/Yv|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 Xv(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 Zv(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]=Xv(T,s)):C<=s&&(r.expiredLanes|=T),g&=~T}}function cl(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 dl(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 ew(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 hl(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,fl,Th,jh,Ch,pl=!1,no=[],En=null,Tn=null,jn=null,Ps=new Map,Rs=new Map,Cn=[],tw="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&&fl(s)),r):(r.eventSystemFlags|=c,s=r.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),r)}function nw(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=gl(r.domEventName,r.eventSystemFlags,s[0],r.nativeEvent);if(a===null){a=r.nativeEvent;var c=new a.constructor(a.type,a);rl=c,a.target.dispatchEvent(c),rl=null}else return s=Ks(a),s!==null&&fl(s),r.blockedOn=a,!1;s.shift()}return!0}function Ph(r,s,a){ro(r)&&a.delete(s)}function rw(){pl=!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,pl||(pl=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rw)))}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 sw(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=1,ml(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function iw(r,s,a,c){var f=Ce,g=Ar.transition;Ar.transition=null;try{Ce=4,ml(r,s,a,c)}finally{Ce=f,Ar.transition=g}}function ml(r,s,a,c){if(so){var f=gl(r,s,a,c);if(f===null)Ol(r,s,c,io,a),Nh(r,c);else if(nw(f,r,s,a,c))c.stopPropagation();else if(Nh(r,c),s&4&&-1<tw.indexOf(r)){for(;f!==null;){var g=Ks(f);if(g!==null&&Eh(g),g=gl(r,s,a,c),g===null&&Ol(r,s,c,io,a),g===f)break;f=g}f!==null&&c.stopPropagation()}else Ol(r,s,c,null,a)}}var io=null;function gl(r,s,a,c){if(io=null,r=sl(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(Hv()){case ul:return 1;case bh:return 4;case Qi:case Kv:return 16;case _h:return 536870912;default:return 16}default:return 16}}var Nn=null,yl=null,oo=null;function Oh(){if(oo)return oo;var r,s=yl,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},vl=Tt(Pr),Ls=K({},Pr,{view:0,detail:0}),ow=Tt(Ls),wl,xl,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:_l,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"?(wl=r.screenX-Ms.screenX,xl=r.screenY-Ms.screenY):xl=wl=0,Ms=r),wl)},movementY:function(r){return"movementY"in r?r.movementY:xl}}),Dh=Tt(uo),aw=K({},uo,{dataTransfer:0}),lw=Tt(aw),uw=K({},Ls,{relatedTarget:0}),bl=Tt(uw),cw=K({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),dw=Tt(cw),hw=K({},Pr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),fw=Tt(hw),pw=K({},Pr,{data:0}),Lh=Tt(pw),mw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gw={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"},yw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vw(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=yw[r])?!!s[r]:!1}function _l(){return vw}var ww=K({},Ls,{key:function(r){if(r.key){var s=mw[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"?gw[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_l,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}}),xw=Tt(ww),bw=K({},uo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mh=Tt(bw),_w=K({},Ls,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_l}),Sw=Tt(_w),kw=K({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ew=Tt(kw),Tw=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}),jw=Tt(Tw),Cw=[9,13,27,32],Sl=d&&"CompositionEvent"in window,Us=null;d&&"documentMode"in document&&(Us=document.documentMode);var Nw=d&&"TextEvent"in window&&!Us,Uh=d&&(!Sl||Us&&8<Us&&11>=Us),$h=" ",Vh=!1;function Fh(r,s){switch(r){case"keyup":return Cw.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 Aw(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 Pw(r,s){if(Rr)return r==="compositionend"||!Sl&&Fh(r,s)?(r=Oh(),oo=yl=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 Rw={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"?!!Rw[r.type]:s==="textarea"}function qh(r,s,a,c){ch(c),s=mo(s,"onChange"),0<s.length&&(a=new vl("onChange","change",null,a,c),r.push({event:a,listeners:s}))}var $s=null,Vs=null;function Ow(r){uf(r,0)}function co(r){var s=Mr(r);if(Xd(s))return r}function Iw(r,s){if(r==="change")return s}var Wh=!1;if(d){var kl;if(d){var El="oninput"in document;if(!El){var Hh=document.createElement("div");Hh.setAttribute("oninput","return;"),El=typeof Hh.oninput=="function"}kl=El}else kl=!1;Wh=kl&&(!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,sl(r)),ph(Ow,s)}}function Dw(r,s,a){r==="focusin"?(Kh(),$s=s,Vs=a,$s.attachEvent("onpropertychange",Gh)):r==="focusout"&&Kh()}function Lw(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return co(Vs)}function Mw(r,s){if(r==="click")return co(s)}function Uw(r,s){if(r==="input"||r==="change")return co(s)}function $w(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var qt=typeof Object.is=="function"?Object.is:$w;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 Tl(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 Vw(r){var s=Xh(),a=r.focusedElem,c=r.selectionRange;if(s!==a&&a&&a.ownerDocument&&Qh(a.ownerDocument.documentElement,a)){if(c!==null&&Tl(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 Fw=d&&"documentMode"in document&&11>=document.documentMode,Or=null,jl=null,Bs=null,Cl=!1;function Zh(r,s,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Cl||Or==null||Or!==Ki(c)||(c=Or,"selectionStart"in c&&Tl(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(jl,"onSelect"),0<c.length&&(s=new vl("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")},Nl={},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(Nl[r])return Nl[r];if(!Ir[r])return r;var s=Ir[r],a;for(a in s)if(s.hasOwnProperty(a)&&a in ef)return Nl[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 Al=0;Al<af.length;Al++){var Pl=af[Al],Bw=Pl.toLowerCase(),zw=Pl[0].toUpperCase()+Pl.slice(1);An(Bw,"on"+zw)}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(" "),qw=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,Bv(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=ll,Yi=!1,ll=null,r}function Ie(r,s){var a=s[$l];a===void 0&&(a=s[$l]=new Set);var c=r+"__bubble";a.has(c)||(cf(s,r,2,!1),a.add(c))}function Rl(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"&&(qw.has(a)||Rl(a,!1,r),Rl(a,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[po]||(s[po]=!0,Rl("selectionchange",!1,s))}}function cf(r,s,a,c){switch(Rh(s)){case 1:var f=sw;break;case 4:f=iw;break;default:f=ml}a=f.bind(null,s,a,r),f=void 0,!al||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 Ol(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=sl(a),H=[];e:{var q=of.get(r);if(q!==void 0){var Q=vl,ee=r;switch(r){case"keypress":if(ao(a)===0)break e;case"keydown":case"keyup":Q=xw;break;case"focusin":ee="focus",Q=bl;break;case"focusout":ee="blur",Q=bl;break;case"beforeblur":case"afterblur":Q=bl;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=lw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=Sw;break;case tf:case nf:case rf:Q=dw;break;case sf:Q=Ew;break;case"scroll":Q=ow;break;case"wheel":Q=jw;break;case"copy":case"cut":case"paste":Q=fw;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!==rl&&(ee=a.relatedTarget||a.fromElement)&&(Xn(ee)||ee[cn]))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=Iw;else if(zh(q))if(Wh)ne=Uw;else{ne=Lw;var ae=Dw}else(Q=q.nodeName)&&Q.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(ne=Mw);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"&&Xa(q,"number",q.value)}switch(ae=L?Mr(L):window,r){case"focusin":(zh(ae)||ae.contentEditable==="true")&&(Or=ae,jl=L,Bs=null);break;case"focusout":Bs=jl=Or=null;break;case"mousedown":Cl=!0;break;case"contextmenu":case"mouseup":case"dragend":Cl=!1,Zh(H,a,W);break;case"selectionchange":if(Fw)break;case"keydown":case"keyup":Zh(H,a,W)}var le;if(Sl)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,yl="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=Nw?Aw(r,a):Pw(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 Ww=/\r\n?/g,Hw=/\u0000|\uFFFD/g;function hf(r){return(typeof r=="string"?r:""+r).replace(Ww,`
|
|
6
|
+
`).replace(Hw,"")}function go(r,s,a){if(s=hf(s),hf(r)!==s&&a)throw Error(n(425))}function yo(){}var Il=null,Dl=null;function Ll(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 Ml=typeof setTimeout=="function"?setTimeout:void 0,Kw=typeof clearTimeout=="function"?clearTimeout:void 0,ff=typeof Promise=="function"?Promise:void 0,Gw=typeof queueMicrotask=="function"?queueMicrotask:typeof ff<"u"?function(r){return ff.resolve(null).then(r).catch(Jw)}:Ml;function Jw(r){setTimeout(function(){throw r})}function Ul(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,cn="__reactContainer$"+Lr,$l="__reactEvents$"+Lr,Yw="__reactListeners$"+Lr,Qw="__reactHandles$"+Lr;function Xn(r){var s=r[nn];if(s)return s;for(var a=r.parentNode;a;){if(s=a[cn]||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[cn],!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 Vl=[],Ur=-1;function Rn(r){return{current:r}}function De(r){0>Ur||(r.current=Vl[Ur],Vl[Ur]=null,Ur--)}function Ae(r,s){Ur++,Vl[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 dn=null,bo=!1,Fl=!1;function vf(r){dn===null?dn=[r]:dn.push(r)}function Xw(r){bo=!0,vf(r)}function In(){if(!Fl&&dn!==null){Fl=!0;var r=0,s=Ce;try{var a=dn;for(Ce=1;r<a.length;r++){var c=a[r];do c=c(!0);while(c!==null)}dn=null,bo=!1}catch(f){throw dn!==null&&(dn=dn.slice(r+1)),wh(ul,In),f}finally{Ce=s,Fl=!1}}return null}var Vr=[],Fr=0,_o=null,So=0,Dt=[],Lt=0,er=null,hn=1,fn="";function tr(r,s){Vr[Fr++]=So,Vr[Fr++]=_o,_o=r,So=s}function wf(r,s,a){Dt[Lt++]=hn,Dt[Lt++]=fn,Dt[Lt++]=er,er=r;var c=hn;r=fn;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,hn=1<<32-zt(s)+f|a<<f|c,fn=g+r}else hn=1<<g|a<<f|c,fn=r}function Bl(r){r.return!==null&&(tr(r,1),wf(r,1,0))}function zl(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,fn=Dt[--Lt],Dt[Lt]=null,hn=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:hn,overflow:fn}: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 ql(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Wl(r){if(Ue){var s=Ct;if(s){var a=s;if(!bf(r,s)){if(ql(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(ql(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"&&!Ll(r.type,r.memoizedProps)),s&&(s=Ct)){if(ql(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 Hl(r){Wt===null?Wt=[r]:Wt.push(r)}var Zw=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=Mu(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=Uu(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=Mu(""+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=Uu(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(Rx){return s(O,Rx)}),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=Uu(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=Mu(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,Kl=null;function Gl(){Kl=qr=jo=null}function Jl(r){var s=To.current;De(To),r._currentValue=s}function Yl(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,Kl=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(Kl!==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 Ql(r){nr===null?nr=[r]:nr.push(r)}function jf(r,s,a,c){var f=s.interleaved;return f===null?(a.next=a,Ql(s)):(a.next=f.next,f.next=a),s.interleaved=a,pn(r,c)}function pn(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 Xl(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 mn(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,pn(r,a)}return f=c.interleaved,f===null?(s.next=s,Ql(c)):(s.next=f.next,f.next=s),c.interleaved=s,pn(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,hl(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 Zl(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:el(null,"");break;default:r=r===8?s.parentNode:s,s=r.namespaceURI||null,r=r.tagName,s=el(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=el(s,r.type);s!==a&&(Ae(Ys,r),Ae(rn,a))}function eu(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 tu=[];function nu(){for(var r=0;r<tu.length;r++)tu[r]._workInProgressVersionPrimary=null;tu.length=0}var Po=U.ReactCurrentDispatcher,ru=U.ReactCurrentBatchConfig,sr=0,Ve=null,Qe=null,et=null,Ro=!1,Xs=!1,Zs=0,ex=0;function ut(){throw Error(n(321))}function su(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 iu(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?sx:ix,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=ox,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 ou(){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 au(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 lu(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,uu(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=pn(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=rx.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&&su(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 uu(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 cu(){}function Hf(r,s){var a=Ut();s=s===void 0?null:s;var c=a.memoizedState;return c!==null&&s!==null&&su(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&&su(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 tx(r,s){var a=Ce;Ce=a!==0&&4>a?a:4,r(!0);var c=ru.transition;ru.transition={};try{r(!1),s()}finally{Ce=a,ru.transition=c}}function Jf(){return Ut().memoizedState}function nx(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 rx(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,Ql(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,hl(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},sx={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=nx.bind(null,Ve,r),[c.memoizedState,r]},useRef:function(r){var s=sn();return r={current:r},s.memoizedState=r},useState:$f,useDebugValue:cu,useDeferredValue:function(r){return sn().memoizedState=r},useTransition:function(){var r=$f(!1),s=r[0];return r=tx.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=fn,c=hn;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=ex++,s=":"+s+"r"+a.toString(32)+":";return r.memoizedState=s},unstable_isNewReconciler:!1},ix={readContext:Mt,useCallback:Hf,useContext:Mt,useEffect:uu,useImperativeHandle:Wf,useInsertionEffect:Bf,useLayoutEffect:zf,useMemo:Kf,useReducer:au,useRef:Vf,useState:function(){return au(ei)},useDebugValue:cu,useDeferredValue:function(r){var s=Ut();return Gf(s,Qe.memoizedState,r)},useTransition:function(){var r=au(ei)[0],s=Ut().memoizedState;return[r,s]},useMutableSource:Rf,useSyncExternalStore:Of,useId:Jf,unstable_isNewReconciler:!1},ox={readContext:Mt,useCallback:Hf,useContext:Mt,useEffect:uu,useImperativeHandle:Wf,useInsertionEffect:Bf,useLayoutEffect:zf,useMemo:Kf,useReducer:lu,useRef:Vf,useState:function(){return lu(ei)},useDebugValue:cu,useDeferredValue:function(r){var s=Ut();return Qe===null?s.memoizedState=r: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};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 du(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=mn(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=mn(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=mn(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 hu(r,s,a,c){var f=r.stateNode;f.props=a,f.state=r.memoizedState,f.refs={},Xl(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"&&(du(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=`
|
|
7
7
|
Error generating stack: `+g.message+`
|
|
8
|
-
`+g.stack}return{value:r,source:s,stack:f,digest:null}}function fu(r,s,a){return{value:r,source:null,stack:a??null,digest:s??null}}function pu(r,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var ix=typeof WeakMap=="function"?WeakMap:Map;function np(r,s,a){a=mn(-1,a),a.tag=3,a.payload={element:null};var c=s.value;return a.callback=function(){qo||(qo=!0,Nu=c),pu(r,s)},a}function rp(r,s,a){a=mn(-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(){pu(r,s)}}var g=r.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){pu(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 ix;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=wx.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=mn(-1,1),s.tag=2,Ln(a,s,1))),a.lanes|=1),r):(r.flags|=65536,r.lanes=f,r)}var ox=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=iu(r,s,a,c,g,f),a=ou(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,gn(r,s,f)):(Ue&&a&&Bl(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"&&!Lu(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=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 gn(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,gn(r,s,f)}return mu(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 mu(r,s,a,c,f){var g=vt(a)?Zn:lt.current;return g=$r(s,g),Wr(s,f),a=iu(r,s,a,c,g,f),c=ou(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,gn(r,s,f)):(Ue&&c&&Bl(s),s.flags|=1,mt(r,s,a,f),s.child)}function hp(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),ep(s,a,c),hu(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,Ao(s,c,x,f),C=s.memoizedState,T!==c||q!==C||yt.current||Dn?(typeof W=="function"&&(du(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,Ao(s,c,x,f);var Z=s.memoizedState;T!==H||q!==Z||yt.current||Dn?(typeof Q=="function"&&(du(s,a,Q,c),Z=s.memoizedState),(L=Dn||Zf(s,a,L,c,q,Z,C)||!1)?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(c,Z,C),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(c,Z,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=Z),x.props=c,x.state=Z,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 gu(r,s,a,c,g,f)}function gu(r,s,a,c,f,g){dp(r,s);var x=(s.flags&128)!==0;if(!c&&!x)return f&&yf(s,a,!1),gn(r,s,g);c=s.stateNode,ox.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),Zl(r,s.containerInfo)}function pp(r,s,a,c,f){return Br(),Hl(f),s.flags|=256,mt(r,s,a,c),s.child}var yu={dehydrated:null,treeContext:null,retryLane:0};function vu(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 Wl(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=vu(a),s.memoizedState=yu,r):wu(s,x));if(f=r.memoizedState,f!==null&&(T=f.dehydrated,T!==null))return ax(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?vu(a):{baseLanes:x.baseLanes|a,cachePool:null,transitions:x.transitions},g.memoizedState=x,g.childLanes=r.childLanes&~a,s.memoizedState=yu,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 wu(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&&Hl(c),zr(s,r.child,null,a),r=wu(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function ax(r,s,a,c,f,g,x){if(a)return s.flags&256?(s.flags&=-257,c=fu(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=vu(x),s.memoizedState=yu,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=fu(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,pn(r,f),Jt(c,r,f,-1))}return Du(),c=fu(Error(n(421))),Uo(r,s,x,c)}return f.data==="$?"?(s.flags|=128,s.child=r.child,s=xx.bind(null,r),f._reactRetry=s,null):(r=g.treeContext,Ct=Pn(f.nextSibling),jt=s,Ue=!0,Wt=null,r!==null&&(Dt[Lt++]=hn,Dt[Lt++]=fn,Dt[Lt++]=er,hn=r.id,fn=r.overflow,er=s),s=wu(s,c.children),s.flags|=4096,s)}function gp(r,s,a){r.lanes|=s;var c=r.alternate;c!==null&&(c.lanes|=s),Yl(r.return,s,a)}function xu(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&&Po(r)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),xu(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}xu(s,!0,a,null,g);break;case"together":xu(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 gn(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 lx(r,s,a){switch(s.tag){case 3:fp(s),Br();break;case 5:Pf(s);break;case 1:vt(s.type)&&bo(s);break;case 4:Zl(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?mp(r,s,a):(Ae($e,$e.current&1),r=gn(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 gn(r,s,a)}var vp,bu,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}},bu=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=Ya(r,f),c=Ya(r,c),g=[];break;case"select":f=K({},f,{value:void 0}),c=K({},c,{value:void 0}),g=[];break;case"textarea":f=Za(r,f),c=Za(r,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=vo)}tl(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 ux(r,s,a){var c=s.pendingProps;switch(zl(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),nu(),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&&(Ru(Wt),Wt=null))),bu(r,s),ct(s),null;case 5:eu(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),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":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)}tl(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),th(c,g,!0);break;case"textarea":Ki(c),sh(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=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=nl(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=Ya(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=Za(r,c),Ie("invalid",r);break;default:f=c}tl(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":Ki(r),th(r,c,!1);break;case"textarea":Ki(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=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)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),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)Sf(),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&&(Ru(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):Du())),s.updateQueue!==null&&(s.flags|=4),ct(s),null);case 4:return Hr(),bu(r,s),r===null&&qs(s.stateNode.containerInfo),ct(s),null;case 10:return Jl(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 Iu(),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 cx(r,s){switch(zl(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),nu(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return eu(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 Jl(s.type._context),null;case 22:case 23:return Iu(),null;case 24:return null;default:return null}}var Vo=!1,dt=!1,dx=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 _u(r,s,a){try{a()}catch(c){ze(r,s,c)}}var bp=!1;function hx(r,s){if(Il=io,r=Xh(),Tl(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(Dl={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 Z=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Z!==null){var ee=Z.memoizedProps,Ke=Z.memoizedState,O=s.stateNode,A=O.getSnapshotBeforeUpdate(s.elementType===s.type?ee:Ht(s.type,ee),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 Z=bp,bp=!1,Z}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&&_u(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 Su(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[$l],delete s[Gw],delete s[Jw])),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 ku(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(ku(r,s,a),r=r.sibling;r!==null;)ku(r,s,a),r=r.sibling}function Eu(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(Eu(r,s,a),r=r.sibling;r!==null;)Eu(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(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?Ul(r.parentNode,a):r.nodeType===1&&Ul(r,a),Ds(r)):Ul(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)&&_u(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 dx),s.forEach(function(c){var f=bx.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),Fo(3,r)}catch(ee){ze(r,r.return,ee)}try{ri(5,r,r.return)}catch(ee){ze(r,r.return,ee)}}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(ee){ze(r,r.return,ee)}}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),nl(T,x);var L=nl(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":Qa(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(ee){ze(r,r.return,ee)}}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(ee){ze(r,r.return,ee)}}break;case 3:if(Gt(s,r),on(r),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Ds(s.containerInfo)}catch(ee){ze(r,r.return,ee)}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||(Cu=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 Z=q.stateNode;if(typeof Z.componentWillUnmount=="function"){c=q,a=q.return;try{s=c,Z.props=s.memoizedProps,Z.state=s.memoizedState,Z.componentWillUnmount()}catch(ee){ze(c,a,ee)}}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(ee){ze(r,r.return,ee)}}}else if(H.tag===6){if(W===null)try{H.stateNode.nodeValue=L?"":H.memoizedProps}catch(ee){ze(r,r.return,ee)}}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);Eu(r,g,f);break;case 3:case 4:var x=c.stateNode.containerInfo,T=kp(r);ku(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 fx(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||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?Pp(f):C!==null?(C.return=x,X=C):Pp(f);for(;g!==null;)X=g,Cp(g),g=g.sibling;X=f,Vo=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||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&&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&&Su(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{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{Su(s)}catch(C){ze(s,g,C)}break;case 5:var x=s.return;try{Su(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 px=Math.ceil,Bo=U.ReactCurrentDispatcher,Tu=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,ju=0,ii=null,xt=null,Cu=0,Yr=1/0,yn=null,qo=!1,Nu=null,Un=null,Wo=!1,$n=null,Ho=0,oi=0,Au=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:Qw.transition!==null?(Go===0&&(Go=Sh()),Go):(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,Au=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;Q0(r,s);var c=no(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?Yw(Op.bind(null,r)):vf(Op.bind(null,r)),Hw(function(){(_e&6)===0&&In()}),a=null;else{switch(kh(c)){case 1:a=ul;break;case 4:a=bh;break;case 16:a=Xi;break;case 536870912:a=_h;break;default:a=Xi}a=Fp(a,Rp.bind(null,r))}r.callbackPriority=s,r.callbackNode=a}}function Rp(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=Dp();(tt!==r||st!==s)&&(yn=null,Yr=He()+500,ar(r,s));do try{yx();break}catch(T){Ip(r,T)}while(!0);Gl(),Bo.current=g,_e=f,Je!==null?s=0:(tt=null,st=0,s=Xe)}if(s!==0){if(s===2&&(f=cl(r),f!==0&&(c=f,s=Pu(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&&!mx(f)&&(s=Jo(r,c),s===2&&(g=cl(r),g!==0&&(c=g,s=Pu(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,yn);break;case 3:if(Fn(r,c),(c&130023424)===c&&(s=Cu+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=Ml(lr.bind(null,r,xt,yn),s);break}lr(r,xt,yn);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*px(c/1960))-c,10<c){r.timeoutHandle=Ml(lr.bind(null,r,xt,yn),c);break}lr(r,xt,yn);break;case 5:lr(r,xt,yn);break;default:throw Error(n(329))}}}return bt(r,He()),r.callbackNode===a?Rp.bind(null,r):null}function Pu(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&&Ru(s)),r}function Ru(r){xt===null?xt=r:xt.push.apply(xt,r)}function mx(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&=~ju,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 Op(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=cl(r);c!==0&&(s=c,a=Pu(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,yn),bt(r,He()),null}function Ou(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 Iu(){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,Ww(a)),Je!==null)for(a=Je.return;a!==null;){var c=a;switch(zl(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&xo();break;case 3:Hr(),De(yt),De(lt),nu();break;case 5:eu(c);break;case 4:Hr();break;case 13:De($e);break;case 19:De($e);break;case 10:Jl(c.type._context);break;case 22:case 23:Iu()}a=a.return}if(tt=r,Je=r=Bn(r.current,null),st=Nt=s,Xe=0,si=null,ju=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 Ip(r,s){do{var a=Je;try{if(Gl(),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,Tu.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 Z=s.updateQueue;if(Z===null){var ee=new Set;ee.add(C),s.updateQueue=ee}else Z.add(C);break e}else{if((s&1)===0){sp(g,L,s),Du();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),Hl(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(te){s=te,Je===a&&a!==null&&(Je=a=a.return);continue}break}while(!0)}function Dp(){var r=Bo.current;return Bo.current=Lo,r===null?Lo:r}function Du(){(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=Dp();(tt!==r||st!==s)&&(yn=null,ar(r,s));do try{gx();break}catch(f){Ip(r,f)}while(!0);if(Gl(),_e=a,Bo.current=c,Je!==null)throw Error(n(261));return tt=null,st=0,Xe}function gx(){for(;Je!==null;)Lp(Je)}function yx(){for(;Je!==null&&!B0();)Lp(Je)}function Lp(r){var s=Vp(r.alternate,r,Nt);r.memoizedProps=r.pendingProps,s===null?Mp(r):Je=s,Tu.current=null}function Mp(r){var s=r;do{var a=s.alternate;if(r=s.return,(s.flags&32768)===0){if(a=ux(a,s,Nt),a!==null){Je=a;return}}else{if(a=cx(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,vx(r,s,a,c)}finally{$t.transition=f,Ce=c}return null}function vx(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(X0(r,g),r===tt&&(Je=tt=null,st=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Wo||(Wo=!0,Fp(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,Tu.current=null,hx(r,a),jp(a,r),Uw(Dl),io=!!Il,Dl=Il=null,r.current=a,fx(a),z0(),_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),H0(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=Nu,Nu=null,r;return(Ho&1)!==0&&r.tag!==0&&Qr(),g=r.pendingLanes,(g&1)!==0?r===Au?oi++:(oi=0,Au=r):oi=0,In(),null}function Qr(){if($n!==null){var r=kh(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(_p(W),W===L){X=null;break}if(q!==null){q.return=Q,X=q;break}X=Q}}}var Z=g.alternate;if(Z!==null){var ee=Z.child;if(ee!==null){Z.child=null;do{var Ke=ee.sibling;ee.sibling=null,ee=Ke}while(ee!==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(te){ze(T,T.return,te)}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 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 wx(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()-Cu?ar(r,0):ju|=a),bt(r,s)}function $p(r,s){s===0&&((r.mode&1)===0?s=1:(s=to,to<<=1,(to&130023424)===0&&(to=4194304)));var a=gt();r=pn(r,s),r!==null&&(As(r,s,a),bt(r,a))}function xx(r){var s=r.memoizedState,a=0;s!==null&&(a=s.retryLane),$p(r,a)}function bx(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,lx(r,s,a);wt=(r.flags&131072)!==0}else wt=!1,Ue&&(s.flags&1048576)!==0&&wf(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=iu(null,s,c,r,f,a);var g=ou();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,Xl(s),f.updater=Mo,s.stateNode=f,f._reactInternals=s,hu(s,c,r,a),s=gu(null,s,c,!0,g,a)):(s.tag=0,Ue&&g&&Bl(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=Sx(c),r=Ht(c,r),f){case 0:s=mu(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),mu(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),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=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=gn(r,s,a);break e}mt(r,s,c,a)}s=s.child}return s;case 5:return Pf(s),r===null&&Wl(s),c=s.type,f=s.pendingProps,g=r!==null?r.memoizedProps:null,x=f.children,Ll(c,f)?x=null:g!==null&&Ll(c,g)&&(s.flags|=32),dp(r,s),mt(r,s,x,a),s.child;case 6:return r===null&&Wl(s),null;case 13:return mp(r,s,a);case 4:return Zl(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(jo,c._currentValue),c._currentValue=x,g!==null)if(qt(g.value,x)){if(g.children===f.children&&!yt.current){s=gn(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=mn(-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),Yl(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),Yl(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),$o(r,s),s.tag=1,vt(c)?(r=!0,bo(s)):r=!1,Wr(s,a),ep(s,c,f),hu(s,c,f,a),gu(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 _x(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 _x(r,s,a,c)}function Lu(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Sx(r){if(typeof r=="function")return Lu(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")Lu(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 Mu(r,s,a){return r=Vt(6,r,null,s),r.lanes=a,r}function Uu(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 kx(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=dl(0),this.expirationTimes=dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dl(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function $u(r,s,a,c,f,g,x,T,C){return r=new kx(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},Xl(g),r}function Ex(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=$u(a,c,!0,r,f,g,x,T,C),r.context=Bp(null),a=r.current,c=gt(),f=Vn(a),g=mn(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=Bp(a),s.context===null?s.context=a:s.pendingContext=a,s=mn(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 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 Vu(r,s){qp(r,s),(r=r.alternate)&&qp(r,s)}function Tx(){return null}var Wp=typeof reportError=="function"?reportError:function(r){console.error(r)};function Fu(r){this._internalRoot=r}ea.prototype.render=Fu.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(n(409));Xo(r,s,null,null)},ea.prototype.unmount=Fu.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[cn]=null}};function ea(r){this._internalRoot=r}ea.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 Bu(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 Hp(){}function jx(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=zp(s,c,r,0,null,!1,!1,"",Hp);return r._reactRootContainer=x,r[cn]=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=$u(r,0,!1,null,null,!1,!1,"",Hp);return r._reactRootContainer=C,r[cn]=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=jx(a,s,r,f,c);return Zo(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&&(hl(s,a|1),bt(s,He()),(_e&6)===0&&(Yr=He()+500,In()))}break;case 13:or(function(){var c=pn(r,1);if(c!==null){var f=gt();Jt(c,r,1,f)}}),Vu(r,1)}},fl=function(r){if(r.tag===13){var s=pn(r,134217728);if(s!==null){var a=gt();Jt(s,r,134217728,a)}Vu(r,134217728)}},Th=function(r){if(r.tag===13){var s=Vn(r),a=pn(r,s);if(a!==null){var c=gt();Jt(a,r,s,c)}Vu(r,s)}},jh=function(){return Ce},Ch=function(r,s){var a=Ce;try{return Ce=r,s()}finally{Ce=a}},il=function(r,s,a){switch(s){case"input":if(Qa(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));Xd(c),Qa(c,f)}}}break;case"textarea":rh(r,a);break;case"select":s=a.value,s!=null&&jr(r,!!a.multiple,s,!1)}},hh=Ou,fh=or;var Cx={usingClientEntryPoint:!1,Events:[Ks,Mr,wo,ch,dh,Ou]},ai={findFiberByHostInstance:Xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Nx={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||Tx,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(Nx),tn=ra}catch{}}return _t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Cx,_t.createPortal=function(r,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bu(s))throw Error(n(200));return Ex(r,s,null,a)},_t.createRoot=function(r,s){if(!Bu(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=$u(r,1,!1,null,null,a,!1,c,f),r[cn]=s.current,qs(r.nodeType===8?r.parentNode:r),new Fu(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(!ta(s))throw Error(n(200));return na(null,r,s,!0,a)},_t.hydrateRoot=function(r,s,a){if(!Bu(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[cn]=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[cn]=null})}),!0):!1},_t.unstable_batchedUpdates=Ou,_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 em;function Mx(){if(em)return Wu.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(),Wu.exports=Lx(),Wu.exports}var tm;function Ux(){if(tm)return sa;tm=1;var t=Mx();return sa.createRoot=t.createRoot,sa.hydrateRoot=t.hydrateRoot,sa}var $x=Ux();const Vx=uy($x);var Fx={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 Bx=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),re=(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,...Fx,width:o,height:o,stroke:i,strokeWidth:u?Number(l)*24/Number(o):l,className:["lucide",`lucide-${Bx(t)}`,d].join(" "),...m},[...e.map(([v,w])=>R.createElement(v,w)),...Array.isArray(h)?h:[h]]));return n.displayName=`${t}`,n};const zx=re("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);const Mi=re("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 qx=re("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 Wx=re("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 Hx=re("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Kx=re("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Gx=re("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const Jx=re("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 Yx=re("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 Qx=re("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 Xx=re("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 sd=re("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=re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const _c=re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Zx=re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const Sc=re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const e1=re("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const t1=re("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=re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const cy=re("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 dy=re("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=re("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 nm=re("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 Ia=re("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 n1=re("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const r1=re("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 s1=re("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Gu=re("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 hy=re("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 i1=re("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 o1=re("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 a1=re("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 wn=re("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const l1=re("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 rm=re("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 sm=re("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 u1=re("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 c1=re("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 d1=re("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const h1=re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const id=re("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 f1=re("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=re("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 kc=re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const p1=re("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 fy=re("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 m1=re("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 g1=re("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 Ec=re("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const y1=re("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 v1=re("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=re("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 im=re("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 om=re("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 am=re("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=re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const kr=re("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 Da=R.createContext(null),ud=R.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class w1 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 x1({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 fu(r,s,a){return{value:r,source:null,stack:a??null,digest:s??null}}function pu(r,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var ax=typeof WeakMap=="function"?WeakMap:Map;function np(r,s,a){a=mn(-1,a),a.tag=3,a.payload={element:null};var c=s.value;return a.callback=function(){zo||(zo=!0,Nu=c),pu(r,s)},a}function rp(r,s,a){a=mn(-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(){pu(r,s)}}var g=r.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){pu(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 ax;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=bx.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=mn(-1,1),s.tag=2,Ln(a,s,1))),a.lanes|=1),r):(r.flags|=65536,r.lanes=f,r)}var lx=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=iu(r,s,a,c,g,f),a=ou(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,gn(r,s,f)):(Ue&&a&&Bl(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"&&!Lu(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 gn(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,gn(r,s,f)}return mu(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 mu(r,s,a,c,f){var g=vt(a)?Zn:lt.current;return g=$r(s,g),Wr(s,f),a=iu(r,s,a,c,g,f),c=ou(),r!==null&&!wt?(s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~f,gn(r,s,f)):(Ue&&c&&Bl(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),hu(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"&&(du(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"&&(du(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 gu(r,s,a,c,g,f)}function gu(r,s,a,c,f,g){dp(r,s);var x=(s.flags&128)!==0;if(!c&&!x)return f&&yf(s,a,!1),gn(r,s,g);c=s.stateNode,lx.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),Zl(r,s.containerInfo)}function pp(r,s,a,c,f){return Br(),Hl(f),s.flags|=256,mt(r,s,a,c),s.child}var yu={dehydrated:null,treeContext:null,retryLane:0};function vu(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 Wl(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=vu(a),s.memoizedState=yu,r):wu(s,x));if(f=r.memoizedState,f!==null&&(T=f.dehydrated,T!==null))return ux(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?vu(a):{baseLanes:x.baseLanes|a,cachePool:null,transitions:x.transitions},g.memoizedState=x,g.childLanes=r.childLanes&~a,s.memoizedState=yu,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 wu(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&&Hl(c),zr(s,r.child,null,a),r=wu(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function ux(r,s,a,c,f,g,x){if(a)return s.flags&256?(s.flags&=-257,c=fu(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=vu(x),s.memoizedState=yu,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=fu(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,pn(r,f),Jt(c,r,f,-1))}return Du(),c=fu(Error(n(421))),Mo(r,s,x,c)}return f.data==="$?"?(s.flags|=128,s.child=r.child,s=_x.bind(null,r),f._reactRetry=s,null):(r=g.treeContext,Ct=Pn(f.nextSibling),jt=s,Ue=!0,Wt=null,r!==null&&(Dt[Lt++]=hn,Dt[Lt++]=fn,Dt[Lt++]=er,hn=r.id,fn=r.overflow,er=s),s=wu(s,c.children),s.flags|=4096,s)}function gp(r,s,a){r.lanes|=s;var c=r.alternate;c!==null&&(c.lanes|=s),Yl(r.return,s,a)}function xu(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),xu(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}xu(s,!0,a,null,g);break;case"together":xu(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 gn(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 cx(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:Zl(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=gn(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 gn(r,s,a)}var vp,bu,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}},bu=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=Ya(r,f),c=Ya(r,c),g=[];break;case"select":f=K({},f,{value:void 0}),c=K({},c,{value:void 0}),g=[];break;case"textarea":f=Za(r,f),c=Za(r,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=yo)}tl(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 dx(r,s,a){var c=s.pendingProps;switch(zl(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),nu(),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&&(Ru(Wt),Wt=null))),bu(r,s),ct(s),null;case 5:eu(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)}tl(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=nl(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=Ya(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=Za(r,c),Ie("invalid",r);break;default:f=c}tl(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&&(Ru(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):Du())),s.updateQueue!==null&&(s.flags|=4),ct(s),null);case 4:return Hr(),bu(r,s),r===null&&qs(s.stateNode.containerInfo),ct(s),null;case 10:return Jl(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 Iu(),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 hx(r,s){switch(zl(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),nu(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 5:return eu(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 Jl(s.type._context),null;case 22:case 23:return Iu(),null;case 24:return null;default:return null}}var $o=!1,dt=!1,fx=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 _u(r,s,a){try{a()}catch(c){ze(r,s,c)}}var bp=!1;function px(r,s){if(Il=so,r=Xh(),Tl(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(Dl={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&&_u(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 Su(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[$l],delete s[Yw],delete s[Qw])),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 ku(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(ku(r,s,a),r=r.sibling;r!==null;)ku(r,s,a),r=r.sibling}function Eu(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(Eu(r,s,a),r=r.sibling;r!==null;)Eu(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?Ul(r.parentNode,a):r.nodeType===1&&Ul(r,a),Ds(r)):Ul(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)&&_u(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 fx),s.forEach(function(c){var f=Sx.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),nl(T,x);var L=nl(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":Qa(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||(Cu=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);Eu(r,g,f);break;case 3:case 4:var x=c.stateNode.containerInfo,T=kp(r);ku(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 mx(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&&Su(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{Su(s)}catch(C){ze(s,g,C)}break;case 5:var x=s.return;try{Su(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 gx=Math.ceil,Fo=U.ReactCurrentDispatcher,Tu=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,ju=0,ii=null,xt=null,Cu=0,Yr=1/0,yn=null,zo=!1,Nu=null,Un=null,qo=!1,$n=null,Wo=0,oi=0,Au=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:Zw.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,Au=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;Zv(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?Xw(Op.bind(null,r)):vf(Op.bind(null,r)),Gw(function(){(_e&6)===0&&In()}),a=null;else{switch(kh(c)){case 1:a=ul;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)&&(yn=null,Yr=He()+500,ar(r,s));do try{wx();break}catch(T){Ip(r,T)}while(!0);Gl(),Fo.current=g,_e=f,Je!==null?s=0:(tt=null,st=0,s=Xe)}if(s!==0){if(s===2&&(f=cl(r),f!==0&&(c=f,s=Pu(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&&!yx(f)&&(s=Go(r,c),s===2&&(g=cl(r),g!==0&&(c=g,s=Pu(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,yn);break;case 3:if(Fn(r,c),(c&130023424)===c&&(s=Cu+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=Ml(lr.bind(null,r,xt,yn),s);break}lr(r,xt,yn);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*gx(c/1960))-c,10<c){r.timeoutHandle=Ml(lr.bind(null,r,xt,yn),c);break}lr(r,xt,yn);break;case 5:lr(r,xt,yn);break;default:throw Error(n(329))}}}return bt(r,He()),r.callbackNode===a?Rp.bind(null,r):null}function Pu(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&&Ru(s)),r}function Ru(r){xt===null?xt=r:xt.push.apply(xt,r)}function yx(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&=~ju,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=cl(r);c!==0&&(s=c,a=Pu(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,yn),bt(r,He()),null}function Ou(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 Iu(){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,Kw(a)),Je!==null)for(a=Je.return;a!==null;){var c=a;switch(zl(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&wo();break;case 3:Hr(),De(yt),De(lt),nu();break;case 5:eu(c);break;case 4:Hr();break;case 13:De($e);break;case 19:De($e);break;case 10:Jl(c.type._context);break;case 22:case 23:Iu()}a=a.return}if(tt=r,Je=r=Bn(r.current,null),st=Nt=s,Xe=0,si=null,ju=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(Gl(),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,Tu.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),Du();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),Hl(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 Du(){(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)&&(yn=null,ar(r,s));do try{vx();break}catch(f){Ip(r,f)}while(!0);if(Gl(),_e=a,Fo.current=c,Je!==null)throw Error(n(261));return tt=null,st=0,Xe}function vx(){for(;Je!==null;)Lp(Je)}function wx(){for(;Je!==null&&!qv();)Lp(Je)}function Lp(r){var s=Vp(r.alternate,r,Nt);r.memoizedProps=r.pendingProps,s===null?Mp(r):Je=s,Tu.current=null}function Mp(r){var s=r;do{var a=s.alternate;if(r=s.return,(s.flags&32768)===0){if(a=dx(a,s,Nt),a!==null){Je=a;return}}else{if(a=hx(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,xx(r,s,a,c)}finally{$t.transition=f,Ce=c}return null}function xx(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(ew(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,Tu.current=null,px(r,a),jp(a,r),Vw(Dl),so=!!Il,Dl=Il=null,r.current=a,mx(a),Wv(),_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),Gv(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=Nu,Nu=null,r;return(Wo&1)!==0&&r.tag!==0&&Qr(),g=r.pendingLanes,(g&1)!==0?r===Au?oi++:(oi=0,Au=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 bx(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()-Cu?ar(r,0):ju|=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=pn(r,s),r!==null&&(As(r,s,a),bt(r,a))}function _x(r){var s=r.memoizedState,a=0;s!==null&&(a=s.retryLane),$p(r,a)}function Sx(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,cx(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=iu(null,s,c,r,f,a);var g=ou();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,Xl(s),f.updater=Lo,s.stateNode=f,f._reactInternals=s,hu(s,c,r,a),s=gu(null,s,c,!0,g,a)):(s.tag=0,Ue&&g&&Bl(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=Ex(c),r=Ht(c,r),f){case 0:s=mu(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),mu(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=gn(r,s,a);break e}mt(r,s,c,a)}s=s.child}return s;case 5:return Pf(s),r===null&&Wl(s),c=s.type,f=s.pendingProps,g=r!==null?r.memoizedProps:null,x=f.children,Ll(c,f)?x=null:g!==null&&Ll(c,g)&&(s.flags|=32),dp(r,s),mt(r,s,x,a),s.child;case 6:return r===null&&Wl(s),null;case 13:return mp(r,s,a);case 4:return Zl(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=gn(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=mn(-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),Yl(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),Yl(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),hu(s,c,f,a),gu(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 kx(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 kx(r,s,a,c)}function Lu(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ex(r){if(typeof r=="function")return Lu(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")Lu(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 Mu(r,s,a){return r=Vt(6,r,null,s),r.lanes=a,r}function Uu(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 Tx(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=dl(0),this.expirationTimes=dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dl(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function $u(r,s,a,c,f,g,x,T,C){return r=new Tx(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},Xl(g),r}function jx(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=$u(a,c,!0,r,f,g,x,T,C),r.context=Bp(null),a=r.current,c=gt(),f=Vn(a),g=mn(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=mn(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 Vu(r,s){qp(r,s),(r=r.alternate)&&qp(r,s)}function Cx(){return null}var Wp=typeof reportError=="function"?reportError:function(r){console.error(r)};function Fu(r){this._internalRoot=r}Zo.prototype.render=Fu.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(n(409));Qo(r,s,null,null)},Zo.prototype.unmount=Fu.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[cn]=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 Bu(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 Nx(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[cn]=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=$u(r,0,!1,null,null,!1,!1,"",Hp);return r._reactRootContainer=C,r[cn]=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=Nx(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&&(hl(s,a|1),bt(s,He()),(_e&6)===0&&(Yr=He()+500,In()))}break;case 13:or(function(){var c=pn(r,1);if(c!==null){var f=gt();Jt(c,r,1,f)}}),Vu(r,1)}},fl=function(r){if(r.tag===13){var s=pn(r,134217728);if(s!==null){var a=gt();Jt(s,r,134217728,a)}Vu(r,134217728)}},Th=function(r){if(r.tag===13){var s=Vn(r),a=pn(r,s);if(a!==null){var c=gt();Jt(a,r,s,c)}Vu(r,s)}},jh=function(){return Ce},Ch=function(r,s){var a=Ce;try{return Ce=r,s()}finally{Ce=a}},il=function(r,s,a){switch(s){case"input":if(Qa(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),Qa(c,f)}}}break;case"textarea":rh(r,a);break;case"select":s=a.value,s!=null&&jr(r,!!a.multiple,s,!1)}},hh=Ou,fh=or;var Ax={usingClientEntryPoint:!1,Events:[Ks,Mr,vo,ch,dh,Ou]},ai={findFiberByHostInstance:Xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Px={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||Cx,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(Px),tn=na}catch{}}return _t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ax,_t.createPortal=function(r,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bu(s))throw Error(n(200));return jx(r,s,null,a)},_t.createRoot=function(r,s){if(!Bu(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=$u(r,1,!1,null,null,a,!1,c,f),r[cn]=s.current,qs(r.nodeType===8?r.parentNode:r),new Fu(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(!Bu(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[cn]=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[cn]=null})}),!0):!1},_t.unstable_batchedUpdates=Ou,_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 $x(){if(em)return Wu.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(),Wu.exports=Ux(),Wu.exports}var tm;function Vx(){if(tm)return ra;tm=1;var t=$x();return ra.createRoot=t.createRoot,ra.hydrateRoot=t.hydrateRoot,ra}var Fx=Vx();const Bx=cy(Fx);var zx={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 qx=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,...p},y)=>R.createElement("svg",{ref:y,...zx,width:o,height:o,stroke:i,strokeWidth:u?Number(l)*24/Number(o):l,className:["lucide",`lucide-${qx(t)}`,d].join(" "),...p},[...e.map(([v,w])=>R.createElement(v,w)),...Array.isArray(h)?h:[h]]));return n.displayName=`${t}`,n};const Wx=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 Hx=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 Kx=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 Gx=Z("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Jx=Z("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Yx=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 Qx=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 Xx=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 Zx=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 e1=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 t1=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 _c=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 n1=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 hy=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 Ia=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 Gu=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 fy=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 wn=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 xa=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 py=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 Da=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:p}=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;
|
|
12
12
|
height: ${d}px !important;
|
|
13
13
|
top: ${h}px !important;
|
|
14
|
-
left: ${
|
|
14
|
+
left: ${p}px !important;
|
|
15
15
|
}
|
|
16
|
-
`),()=>{document.head.removeChild(y)}},[e]),p.jsx(w1,{isPresent:e,childRef:i,sizeRef:o,children:R.cloneElement(t,{ref:i})})}const b1=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:o,presenceAffectsLayout:l,mode:u})=>{const d=ld(_1),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(x1,{isPresent:n,children:t})),p.jsx(Da.Provider,{value:y,children:t})};function _1(){return new Map}function py(t=!0){const e=R.useContext(Da);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 lm(t){const e=[];return R.Children.forEach(t,n=>{R.isValidElement(n)&&e.push(n)}),e}const cd=typeof window<"u",my=cd?R.useLayoutEffect:R.useEffect,_n=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:o=!0,mode:l="sync",propagate:u=!1})=>{const[d,h]=py(u),m=R.useMemo(()=>lm(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);my(()=>{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(lm(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(b1,{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 gy=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},xn=t=>t*1e3,bn=t=>t/1e3,S1={useManualTiming:!1};function k1(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"],E1=40;function yy(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]=k1(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,E1),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:Ju}=yy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ot,!0),vy=R.createContext({strict:!1}),um={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 um)gs[t]={isEnabled:e=>um[t].some(n=>!!e[n])};function T1(t){for(const e in t)gs[e]={...gs[e],...t[e]}}const j1=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")||j1.has(t)}let wy=t=>!_a(t);function C1(t){t&&(wy=e=>e.startsWith("on")?!_a(e):t(e))}try{C1(require("@emotion/is-prop-valid").default)}catch{}function N1(t,e,n){const i={};for(const o in t)o==="values"&&typeof t.values=="object"||(wy(o)||n===!0&&_a(o)||!e&&!_a(o)||t.draggable&&o.startsWith("onDrag"))&&(i[o]=t[o]);return i}function A1(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 La=R.createContext({});function Ei(t){return typeof t=="string"||Array.isArray(t)}function Ma(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const hd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fd=["initial",...hd];function Ua(t){return Ma(t.animate)||fd.some(e=>Ei(t[e]))}function xy(t){return!!(Ua(t)||t.variants)}function P1(t,e){if(Ua(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 R1(t){const{initial:e,animate:n}=P1(t,R.useContext(La));return R.useMemo(()=>({initial:e,animate:n}),[cm(e),cm(n)])}function cm(t){return Array.isArray(t)?t.join(" "):t}const O1=Symbol.for("motionComponentSymbol");function as(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function I1(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(),D1="framerAppearId",by="data-"+pd(D1),{schedule:md}=yy(queueMicrotask,!1),_y=R.createContext({});function L1(t,e,n,i,o){var l,u;const{visualElement:d}=R.useContext(La),h=R.useContext(vy),m=R.useContext(Da),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(_y);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&M1(v.current,n,o,_);const b=R.useRef(!1);R.useInsertionEffect(()=>{w&&b.current&&w.update(n,m)});const S=n[by],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 my(()=>{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 M1(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:Sy(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 Sy(t){if(t)return t.options.allowProjection!==!1?t.projection:Sy(t.parent)}function U1({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:i,Component:o}){var l,u;t&&T1(t);function d(m,y){let v;const w={...R.useContext(ud),...m,layoutId:$1(m)},{isStatic:_}=w,b=R1(m),S=i(m,_);if(!_&&cd){V1();const k=F1(w);v=k.MeasureLayout,b.visualElement=L1(o,S,w,e,k.ProjectionNode)}return p.jsxs(La.Provider,{value:b,children:[v&&b.visualElement?p.jsx(v,{visualElement:b.visualElement,...w}):null,n(o,m,I1(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[O1]=o,h}function $1({layoutId:t}){const e=R.useContext(ad).id;return e&&t!==void 0?e+"-"+t:t}function V1(t,e){R.useContext(vy).strict}function F1(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 B1=["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:!!(B1.indexOf(t)>-1||/[A-Z]/u.test(t))}function dm(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]=dm(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]=dm(i);e=e(n!==void 0?n:t.custom,o,l)}return e}const Tc=t=>Array.isArray(t),z1=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),q1=t=>Tc(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 W1({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},i,o,l){const u={latestValues:H1(i,o,l,t),renderState:e()};return n&&(u.onMount=d=>n({props:i,current:d,...u}),u.onUpdate=d=>n(d)),u}const ky=t=>(e,n)=>{const i=R.useContext(La),o=R.useContext(Da),l=()=>W1(t,e,i,o);return n?l():ld(l)};function H1(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=Ua(t),m=xy(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"&&!Ma(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),Ey=t=>e=>typeof e=="string"&&e.startsWith(t),Ty=Ey("--"),K1=Ey("var(--"),vd=t=>K1(t)?G1.test(t.split("/*")[0].trim()):!1,G1=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jy=(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"),J1=Ui("vh"),Y1=Ui("vw"),hm={...ln,parse:t=>ln.parse(t)/100,transform:t=>ln.transform(t*100)},Q1={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},X1={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:hm,originY:hm,originZ:de},fm={...xs,transform:Math.round},wd={...Q1,...X1,zIndex:fm,size:de,fillOpacity:Ti,strokeOpacity:Ti,numOctaves:fm},Z1={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},eb=ws.length;function tb(t,e,n){let i="",o=!0;for(let l=0;l<eb;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=jy(d,wd[u]);if(!h){o=!1;const y=Z1[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(Ty(h)){o[h]=m;continue}else{const y=jy(m,wd[h]);h.startsWith("origin")?(d=!0,l[h]=y):i[h]=y}}if(e.transform||(u||n?i.transform=tb(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 nb={offset:"stroke-dashoffset",array:"stroke-dasharray"},rb={offset:"strokeDashoffset",array:"strokeDasharray"};function sb(t,e,n=1,i=0,o=!0){t.pathLength=1;const l=o?nb:rb;t[l.offset]=de.transform(-i);const u=de.transform(e),d=de.transform(n);t[l.array]=`${u} ${d}`}function pm(t,e,n){return typeof t=="string"?t:de.transform(e+n*t)}function ib(t,e,n){const i=pm(e,t.x,t.width),o=pm(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=ib(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&&sb(w,u,d,h,!1)}const _d=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Cy=()=>({..._d(),attrs:{}}),Sd=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Ny(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 Ay=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 Py(t,e,n,i){Ny(t,e,void 0,i);for(const o in e.attrs)t.setAttribute(Ay.has(o)?o:pd(o),e.attrs[o])}const Sa={};function ob(t){Object.assign(Sa,t)}function Ry(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])||Ry(u,t)||((i=n?.getValue(u))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(l[u]=o[u]);return l}function Oy(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 ab(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 mm=["x","y","width","height","cx","cy","r"],lb={useVisualState:ky({scrapeMotionValuesFromProps:Oy,createRenderState:Cy,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<mm.length;d++){const h=mm[d];t[h]!==e[h]&&(u=!0)}u&&Le.read(()=>{ab(n,i),Le.render(()=>{bd(i,o,Sd(n.tagName),t.transformTemplate),Py(n,i)})})}})},ub={useVisualState:ky({scrapeMotionValuesFromProps:kd,createRenderState:_d})};function Iy(t,e,n){for(const i in e)!pt(e[i])&&!Ry(i,n)&&(t[i]=e[i])}function cb({transformTemplate:t},e){return R.useMemo(()=>{const n=_d();return xd(n,e,t),Object.assign({},n.vars,n.style)},[e])}function db(t,e){const n=t.style||{},i={};return Iy(i,n,t),Object.assign(i,cb(t,e)),i}function hb(t,e){const n={},i=db(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 fb(t,e,n,i){const o=R.useMemo(()=>{const l=Cy();return bd(l,e,Sd(i),t.transformTemplate),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};Iy(l,t.style,t),o.style={...l,...o.style}}return o}function pb(t=!1){return(n,i,o,{latestValues:l},u)=>{const h=(gd(n)?fb:hb)(i,l,u,n),m=N1(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 mb(t,e){return function(i,{forwardMotionProps:o}={forwardMotionProps:!1}){const u={...gd(i)?lb:ub,preloadedFeatures:t,useRender:pb(o),createVisualElement:e,Component:i};return U1(u)}}function Dy(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 $a(t,e,n){const i=t.getProps();return yd(i,e,n!==void 0?n:i.custom,t)}const gb=dd(()=>window.ScrollTimeline!==void 0);class yb{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(gb()&&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 vb extends yb{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 jc=2e4;function Ly(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<jc;)e+=n,i=t.next(e);return e>=jc?1/0:e}function Td(t){return typeof t=="function"}function gm(t,e){t.timeline=e,t.onfinish=null}const jd=t=>Array.isArray(t)&&typeof t[0]=="number",wb={linearEasing:void 0};function xb(t,e){const n=dd(t);return()=>{var i;return(i=wb[e])!==null&&i!==void 0?i:n()}}const ka=xb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),My=(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 Uy(t){return!!(typeof t=="function"&&ka()||!t||typeof t=="string"&&(t in Cc||ka())||jd(t)||Array.isArray(t)&&t.every(Uy))}const hi=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Cc={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 $y(t,e){if(t)return typeof t=="function"&&ka()?My(t,e):jd(t)?hi(t):Array.isArray(t)?t.map(n=>$y(n,e)||Cc.easeOut):Cc[t]}const Qt={x:!1,y:!1};function Vy(){return Qt.x||Qt.y}function bb(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 Fy(t,e){const n=bb(t),i=new AbortController,o={passive:!0,...e,signal:i.signal};return[n,o,()=>i.abort()]}function ym(t){return e=>{e.pointerType==="touch"||Vy()||t(e)}}function _b(t,e,n={}){const[i,o,l]=Fy(t,n),u=ym(d=>{const{target:h}=d,m=e(d);if(typeof m!="function"||!h)return;const y=ym(v=>{m(v),h.removeEventListener("pointerleave",y)});h.addEventListener("pointerleave",y,o)});return i.forEach(d=>{d.addEventListener("pointerenter",u,o)}),l}const By=(t,e)=>e?t===e?!0:By(t,e.parentElement):!1,Cd=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Sb=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function kb(t){return Sb.has(t.tagName)||t.tabIndex!==-1}const fi=new WeakSet;function vm(t){return e=>{e.key==="Enter"&&t(e)}}function Yu(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Eb=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=vm(()=>{if(fi.has(n))return;Yu(n,"down");const o=vm(()=>{Yu(n,"up")}),l=()=>Yu(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 wm(t){return Cd(t)&&!Vy()}function Tb(t,e,n={}){const[i,o,l]=Fy(t,n),u=d=>{const h=d.currentTarget;if(!wm(d)||fi.has(h))return;fi.add(h);const m=e(d),y=(_,b)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",w),!(!wm(_)||!fi.has(h))&&(fi.delete(h),typeof m=="function"&&m(_,{success:b}))},v=_=>{y(_,n.useGlobalTarget||By(h,_.target))},w=_=>{y(_,!1)};window.addEventListener("pointerup",v,o),window.addEventListener("pointercancel",w,o)};return i.forEach(d=>{!kb(d)&&d.getAttribute("tabindex")===null&&(d.tabIndex=0),(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,o),d.addEventListener("focus",m=>Eb(m,o),o)}),l}function jb(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 zy=new Set(["width","height","top","left","right","bottom",...ws]);let ga;function Cb(){ga=void 0}const un={now:()=>(ga===void 0&&un.set(at.isProcessing||S1.useManualTiming?at.timestamp:performance.now()),ga),set:t=>{ga=t,queueMicrotask(Cb)}};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 qy(t,e){return e?t*(1e3/e):0}const xm=30,Nb=t=>!isNaN(parseFloat(t));class Ab{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=Nb(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>xm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,xm);return qy(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 Ab(t,e)}function Pb(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ji(n))}function Rb(t,e){const n=$a(t,e);let{transitionEnd:i={},transition:o={},...l}=n||{};l={...l,...i};for(const u in l){const d=q1(l[u]);Pb(t,u,d)}}function Ob(t){return!!(pt(t)&&t.add)}function Nc(t,e){const n=t.getValue("willChange");if(Ob(n))return n.add(e)}function Wy(t){return t.props[by]}const Hy=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ib=1e-7,Db=12;function Lb(t,e,n,i,o){let l,u,d=0;do u=e+(n-e)/2,l=Hy(u,i,o)-t,l>0?n=u:e=u;while(Math.abs(l)>Ib&&++d<Db);return u}function $i(t,e,n,i){if(t===e&&n===i)return Ot;const o=l=>Lb(l,0,1,t,n);return l=>l===0||l===1?l:Hy(o(l),e,i)}const Ky=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Gy=t=>e=>1-t(1-e),Jy=$i(.33,1.53,.69,.99),Rd=Gy(Jy),Yy=Ky(Rd),Qy=t=>(t*=2)<1?.5*Rd(t):.5*(2-Math.pow(2,-10*(t-1))),Od=t=>1-Math.sin(Math.acos(t)),Xy=Gy(Od),Zy=Ky(Od),ev=t=>/^0[^.\s]+$/u.test(t);function Mb(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||ev(t):!0}const gi=t=>Math.round(t*1e5)/1e5,Id=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ub(t){return t==null}const $b=/^(?:#[\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"&&$b.test(n)&&n.startsWith(t)||e&&!Ub(n)&&Object.prototype.hasOwnProperty.call(n,e)),tv=(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}},Vb=t=>Sn(0,255,t),Qu={...xs,transform:t=>Math.round(Vb(t))},vr={test:Dd("rgb","red"),parse:tv("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Qu.transform(t)+", "+Qu.transform(e)+", "+Qu.transform(n)+", "+gi(Ti.transform(i))+")"};function Fb(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 Ac={test:Dd("#"),parse:Fb,transform:vr.transform},ls={test:Dd("hsl","hue"),parse:tv("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)||Ac.test(t)||ls.test(t),parse:t=>vr.test(t)?vr.parse(t):ls.test(t)?ls.parse(t):Ac.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?vr.transform(t):ls.transform(t)},Bb=/(?:#[\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(Bb))===null||n===void 0?void 0:n.length)||0)>0}const nv="number",rv="color",qb="var",Wb="var(",bm="${}",Hb=/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(Hb,h=>(ht.test(h)?(i.color.push(l),o.push(rv),n.push(ht.parse(h))):h.startsWith(Wb)?(i.var.push(l),o.push(qb),n.push(h)):(i.number.push(l),o.push(nv),n.push(parseFloat(h))),++l,bm)).split(bm);return{values:n,split:d,indexes:i,types:o}}function sv(t){return Ci(t).values}function iv(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===nv?l+=gi(o[u]):d===rv?l+=ht.transform(o[u]):l+=o[u]}return l}}const Kb=t=>typeof t=="number"?0:t;function Gb(t){const e=sv(t);return iv(t)(e.map(Kb))}const Jn={test:zb,parse:sv,createTransformer:iv,getAnimatableNone:Gb},Jb=new Set(["brightness","contrast","saturate","opacity"]);function Yb(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=Jb.has(e)?1:0;return i!==n&&(l*=100),e+"("+l+o+")"}const Qb=/\b([a-z-]*)\(.*?\)/gu,Pc={...Jn,getAnimatableNone:t=>{const e=t.match(Qb);return e?e.map(Yb).join(" "):t}},Xb={...wd,color:ht,backgroundColor:ht,outlineColor:ht,fill:ht,stroke:ht,borderColor:ht,borderTopColor:ht,borderRightColor:ht,borderBottomColor:ht,borderLeftColor:ht,filter:Pc,WebkitFilter:Pc},Ld=t=>Xb[t];function ov(t,e){let n=Ld(t);return n!==Pc&&(n=Jn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Zb=new Set(["auto","none","0"]);function e_(t,e,n){let i=0,o;for(;i<t.length&&!o;){const l=t[i];typeof l=="string"&&!Zb.has(l)&&Ci(l).values.length&&(o=t[i]),i++}if(o&&n)for(const l of e)t[l]=ov(n,o)}const _m=t=>t===xs||t===de,Sm=(t,e)=>parseFloat(t.split(", ")[e]),km=(t,e)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const o=i.match(/^matrix3d\((.+)\)$/u);if(o)return Sm(o[1],e);{const l=i.match(/^matrix\((.+)\)$/u);return l?Sm(l[1],t):0}},t_=new Set(["x","y","z"]),n_=ws.filter(t=>!t_.has(t));function r_(t){const e=[];return n_.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:km(4,13),y:km(5,14)};ys.translateX=ys.x;ys.translateY=ys.y;const br=new Set;let Rc=!1,Oc=!1;function av(){if(Oc){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=r_(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)})}Oc=!1,Rc=!1,br.forEach(t=>t.complete()),br.clear()}function lv(){br.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Oc=!0)})}function s_(){lv(),av()}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),Rc||(Rc=!0,Le.read(lv),Le.resolveKeyframes(av))):(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 uv=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),i_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function o_(t){const e=i_.exec(t);if(!e)return[,];const[,n,i,o]=e;return[`--${n??i}`,o]}function cv(t,e,n=1){const[i,o]=o_(t);if(!i)return;const l=window.getComputedStyle(e).getPropertyValue(i);if(l){const u=l.trim();return uv(u)?parseFloat(u):u}return vd(o)?cv(o,e,n+1):o}const dv=t=>e=>e.test(t),a_={test:t=>t==="auto",parse:t=>t},hv=[xs,de,ln,Wn,Y1,J1,a_],Em=t=>hv.find(dv(t));class fv 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=cv(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!zy.has(i)||e.length!==2)return;const[o,l]=e,u=Em(o),d=Em(l);if(u!==d)if(_m(u)&&_m(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++)Mb(e[o])&&i.push(o);i.length&&e_(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 Tm=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Jn.test(t)||t==="0")&&!t.startsWith("url("));function l_(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 u_(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=Tm(o,e),d=Tm(l,e);return!u||!d?!1:l_(t)||(n==="spring"||Td(n))&&i}const c_=t=>t!==null;function Va(t,{repeat:e,repeatType:n="loop"},i){const o=t.filter(c_),l=e&&n!=="loop"&&e%2===1?0:o.length-1;return!l||i===void 0?o[l]:i}const d_=40;class pv{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>d_?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&s_(),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&&!u_(e,i,o,l))if(u)this.options.duration=0;else{h&&h(Va(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 Xu(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 h_({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=Xu(h,d,t+1/3),l=Xu(h,d,t),u=Xu(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 Zu=(t,e,n)=>{const i=t*t,o=n*(e*e-i)+i;return o<0?0:Math.sqrt(o)},f_=[Ac,vr,ls],p_=t=>f_.find(e=>e.test(t));function jm(t){const e=p_(t);if(!e)return!1;let n=e.parse(t);return e===ls&&(n=h_(n)),n}const Cm=(t,e)=>{const n=jm(t),i=jm(e);if(!n||!i)return Ea(t,e);const o={...n};return l=>(o.red=Zu(n.red,i.red,l),o.green=Zu(n.green,i.green,l),o.blue=Zu(n.blue,i.blue,l),o.alpha=Be(n.alpha,i.alpha,l),vr.transform(o))},m_=(t,e)=>n=>e(t(n)),Vi=(...t)=>t.reduce(m_),Ic=new Set(["none","hidden"]);function g_(t,e){return Ic.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function y_(t,e){return n=>Be(t,e,n)}function Ud(t){return typeof t=="number"?y_:typeof t=="string"?vd(t)?Ea:ht.test(t)?Cm:x_:Array.isArray(t)?mv:typeof t=="object"?ht.test(t)?Cm:v_:Ea}function mv(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 v_(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 w_(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 x_=(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?Ic.has(t)&&!o.values.length||Ic.has(e)&&!i.values.length?g_(t,e):Vi(mv(w_(i,o),o.values),n):Ea(t,e)};function gv(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Be(t,e,n):Ud(t)(t,e)}const b_=5;function yv(t,e,n){const i=Math.max(e-b_,0);return qy(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},ec=.001;function __({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,bn(t)),u<1?(o=m=>{const y=m*u,v=y*t,w=y-n,_=Dc(m,u),b=Math.exp(-v);return ec-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=Dc(Math.pow(m,2),u);return(-o(m)+ec>0?-1:1)*((w-_)*b)/S}):(o=m=>{const y=Math.exp(-m*t),v=(m-n)*t+1;return-ec+y*v},l=m=>{const y=Math.exp(-m*t),v=(n-m)*(t*t);return y*v});const d=5/t,h=k_(o,l,d);if(t=xn(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 S_=12;function k_(t,e,n){let i=n;for(let o=1;o<S_;o++)i=i-t(i)/e(i);return i}function Dc(t,e){return t*Math.sqrt(1-e*e)}const E_=["duration","bounce"],T_=["stiffness","damping","mass"];function Nm(t,e){return e.some(n=>t[n]!==void 0)}function j_(t){let e={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...t};if(!Nm(t,T_)&&Nm(t,E_))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=__(t);e={...e,...n,mass:We.mass},e.isResolvedFromDuration=!0}return e}function vv(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:_}=j_({...n,velocity:-bn(n.velocity||0)}),b=w||0,S=m/(2*Math.sqrt(h*y)),k=u-l,E=bn(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=Dc(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?xn(b):yv(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(Ly(U),jc),z=My($=>U.next(V*$).value,V,30);return V+"ms "+z}};return U}function Am({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=vv({keyframes:[w.value,b(w.value)],velocity:yv(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 C_=$i(.42,0,1,1),N_=$i(0,0,.58,1),wv=$i(.42,0,.58,1),A_=t=>Array.isArray(t)&&typeof t[0]!="number",P_={linear:Ot,easeIn:C_,easeInOut:wv,easeOut:N_,circIn:Od,circInOut:Zy,circOut:Xy,backIn:Rd,backInOut:Yy,backOut:Jy,anticipate:Qy},Pm=t=>{if(jd(t)){gy(t.length===4);const[e,n,i,o]=t;return $i(e,n,i,o)}else if(typeof t=="string")return P_[t];return t};function R_(t,e,n){const i=[],o=n||gv,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 O_(t,e,{clamp:n=!0,ease:i,mixer:o}={}){const l=t.length;if(gy(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=R_(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 I_(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 D_(t){const e=[0];return I_(e,t.length-1),e}function L_(t,e){return t.map(n=>n*e)}function M_(t,e){return t.map(()=>e||wv).splice(0,t.length-1)}function Ta({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const o=A_(i)?i.map(Pm):Pm(i),l={done:!1,value:e[0]},u=L_(n&&n.length===e.length?n:D_(e),t),d=O_(u,e,{ease:Array.isArray(o)?o:M_(e,o)});return{calculatedDuration:t,next:h=>(l.value=d(h),l.done=h>=t,l)}}const U_=t=>{const e=({timestamp:n})=>t(n);return{start:()=>Le.update(e,!0),stop:()=>Gn(e),now:()=>at.isProcessing?at.timestamp:un.now()}},$_={decay:Am,inertia:Am,tween:Ta,keyframes:Ta,spring:vv},V_=t=>t/100;class $d extends pv{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:$_[n]||Ta;let h,m;d!==Ta&&typeof e[0]!="number"&&(h=Vi(V_,gv(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=Ly(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=Va(h,this.options,o)),k&&k(V.value),$&&this.finish(),V}get duration(){const{resolved:e}=this;return e?bn(e.calculatedDuration):0}get time(){return bn(this.currentTime)}set time(e){e=xn(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=bn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=U_,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 F_=new Set(["opacity","clipPath","filter","transform"]);function B_(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=$y(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")),ja=10,q_=2e4;function W_(t){return Td(t.type)||t.type==="spring"||!Uy(t.ease)}function H_(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<q_;)i=n.sample(l),o.push(i.value),l+=ja;return{times:void 0,keyframes:o,duration:l-ja,ease:"linear"}}const xv={anticipate:Qy,backInOut:Yy,circInOut:Zy};function K_(t){return t in xv}class Rm extends pv{constructor(e){super(e);const{name:n,motionValue:i,element:o,keyframes:l}=this.options;this.resolver=new fv(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()&&K_(l)&&(l=xv[l]),W_(this.options)){const{onComplete:v,onUpdate:w,motionValue:_,element:b,...S}=this.options,k=H_(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=B_(d.owner.current,h,e,{...this.options,duration:i,times:o,ease:l});return y.startTime=m??this.calcStartTime(),this.pendingTimeline?(gm(y,this.pendingTimeline),this.pendingTimeline=void 0):y.onfinish=()=>{const{onComplete:v}=this.options;d.set(Va(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 bn(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return bn(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=xn(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;gm(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=xn(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 z_()&&i&&F_.has(i)&&!h&&!m&&!o&&l!=="mirror"&&u!==0&&d!=="inertia"}}const G_={type:"spring",stiffness:500,damping:25,restSpeed:10},J_=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Y_={type:"keyframes",duration:.8},Q_={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},X_=(t,{keyframes:e})=>e.length>2?Y_:Tr.has(t)?t.startsWith("scale")?J_(e[1]):G_:Q_;function Z_({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-xn(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};Z_(d)||(y={...y,...X_(t,y)}),y.duration&&(y.duration=xn(y.duration)),y.repeatDelay&&(y.repeatDelay=xn(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=Va(y.keyframes,d);if(w!==void 0)return Le.update(()=>{y.onUpdate(w),y.onComplete()}),new vb([])}return!l&&Rm.supports(y)?new Rm(y):new $d(y)};function eS({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function bv(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&&eS(y,v))continue;const b={delay:n,...Ed(u||{},v)};let S=!1;if(window.MotionHandoffAnimation){const E=Wy(t);if(E){const P=window.MotionHandoffAnimation(E,v,Le);P!==null&&(b.startTime=P,S=!0)}}Nc(t,v),w.start(Vd(v,w,_,t.shouldReduceMotion&&zy.has(v)?{type:!1}:b,t,S));const k=w.animation;k&&m.push(k)}return d&&Promise.all(m).then(()=>{Le.update(()=>{d&&Rb(t,d)})}),m}function Lc(t,e,n={}){var i;const o=$a(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(bv(t,o,n)):()=>Promise.resolve(),d=t.variantChildren&&t.variantChildren.size?(m=0)=>{const{delayChildren:y=0,staggerChildren:v,staggerDirection:w}=l;return tS(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 tS(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(nS).forEach((m,y)=>{m.notify("AnimationStart",e),u.push(Lc(m,e,{...l,delay:n+h(y)}).then(()=>m.notify("AnimationComplete",e)))}),Promise.all(u)}function nS(t,e){return t.sortNodePosition(e)}function rS(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const o=e.map(l=>Lc(t,l,n));i=Promise.all(o)}else if(typeof e=="string")i=Lc(t,e,n);else{const o=typeof e=="function"?$a(t,e,n.custom):e;i=Promise.all(bv(t,o,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const sS=fd.length;function _v(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?_v(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<sS;n++){const i=fd[n],o=t.props[i];(Ei(o)||o===!1)&&(e[i]=o)}return e}const iS=[...hd].reverse(),oS=hd.length;function aS(t){return e=>Promise.all(e.map(({animation:n,options:i})=>rS(t,n,i)))}function lS(t){let e=aS(t),n=Om(),i=!0;const o=h=>(m,y)=>{var v;const w=$a(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=_v(t.parent)||{},v=[],w=new Set;let _={},b=1/0;for(let k=0;k<oS;k++){const E=iS[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||Ma(N)||typeof N=="boolean")continue;const $=uS(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;Tc(F)&&Tc(J)?K=!Dy(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=Om(),i=!0}}}function uS(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Dy(e,t):!1}function cr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Om(){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 cS extends Yn{constructor(e){super(e),e.animationState||(e.animationState=lS(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ma(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 dS=0;class hS extends Yn{constructor(){super(...arguments),this.id=dS++}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 fS={animation:{Feature:cS},exit:{Feature:hS}};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 pS=t=>e=>Cd(e)&&t(e,Fi(e));function yi(t,e,n,i){return Ni(t,e,pS(n),i)}const Im=(t,e)=>Math.abs(t-e);function mS(t,e){const n=Im(t.x,e.x),i=Im(t.y,e.y);return Math.sqrt(n**2+i**2)}class Sv{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=nc(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,_=mS(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=tc(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=nc(v.type==="pointercancel"?this.lastMoveEventInfo:tc(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=tc(u,this.transformPagePoint),{point:h}=d,{timestamp:m}=at;this.history=[{...h,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,nc(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 tc(t,e){return e?{point:e(t.point)}:t}function Dm(t,e){return{x:t.x-e.x,y:t.y-e.y}}function nc({point:t},e){return{point:t,delta:Dm(t,kv(e)),offset:Dm(t,gS(e)),velocity:yS(e,.1)}}function gS(t){return t[0]}function kv(t){return t[t.length-1]}function yS(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const o=kv(t);for(;n>=0&&(i=t[n],!(o.timestamp-i.timestamp>xn(e)));)n--;if(!i)return{x:0,y:0};const l=bn(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 Ev=1e-4,vS=1-Ev,wS=1+Ev,Tv=.01,xS=0-Tv,bS=0+Tv;function It(t){return t.max-t.min}function _S(t,e,n){return Math.abs(t-e)<=n}function Lm(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>=vS&&t.scale<=wS||isNaN(t.scale))&&(t.scale=1),(t.translate>=xS&&t.translate<=bS||isNaN(t.translate))&&(t.translate=0)}function vi(t,e,n,i){Lm(t.x,e.x,n.x,i?i.originX:void 0),Lm(t.y,e.y,n.y,i?i.originY:void 0)}function Mm(t,e,n){t.min=n.min+e.min,t.max=t.min+It(e)}function SS(t,e,n){Mm(t.x,e.x,n.x),Mm(t.y,e.y,n.y)}function Um(t,e,n){t.min=e.min-n.min,t.max=t.min+It(e)}function wi(t,e,n){Um(t.x,e.x,n.x),Um(t.y,e.y,n.y)}function kS(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 $m(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 ES(t,{top:e,left:n,bottom:i,right:o}){return{x:$m(t.x,n,o),y:$m(t.y,e,i)}}function Vm(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 TS(t,e){return{x:Vm(t.x,e.x),y:Vm(t.y,e.y)}}function jS(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 CS(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 Mc=.35;function NS(t=Mc){return t===!1?t=0:t===!0&&(t=Mc),{x:Fm(t,"left","right"),y:Fm(t,"top","bottom")}}function Fm(t,e,n){return{min:Bm(t,e),max:Bm(t,n)}}function Bm(t,e){return typeof t=="number"?t:t[e]||0}const zm=()=>({translate:0,scale:1,origin:0,originPoint:0}),us=()=>({x:zm(),y:zm()}),qm=()=>({min:0,max:0}),Ge=()=>({x:qm(),y:qm()});function Bt(t){return[t("x"),t("y")]}function jv({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function AS({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function PS(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 rc(t){return t===void 0||t===1}function Uc({scale:t,scaleX:e,scaleY:n}){return!rc(t)||!rc(e)||!rc(n)}function fr(t){return Uc(t)||Cv(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Cv(t){return Wm(t.x)||Wm(t.y)}function Wm(t){return t&&t!=="0%"}function Ca(t,e,n){const i=t-n,o=e*i;return n+o}function Hm(t,e,n,i,o){return o!==void 0&&(t=Ca(t,o,i)),Ca(t,n,i)+e}function $c(t,e=0,n=1,i,o){t.min=Hm(t.min,e,n,i,o),t.max=Hm(t.max,e,n,i,o)}function Nv(t,{x:e,y:n}){$c(t.x,e.translate,e.scale,e.originPoint),$c(t.y,n.translate,n.scale,n.originPoint)}const Km=.999999999999,Gm=1.0000000000001;function RS(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,Nv(t,u)),i&&fr(l.latestValues)&&ds(t,l.latestValues))}e.x<Gm&&e.x>Km&&(e.x=1),e.y<Gm&&e.y>Km&&(e.y=1)}function cs(t,e){t.min=t.min+e,t.max=t.max+e}function Jm(t,e,n,i,o=.5){const l=Be(t.min,t.max,o);$c(t,e,n,l,i)}function ds(t,e){Jm(t.x,e.x,e.scaleX,e.scale,e.originX),Jm(t.y,e.y,e.scaleY,e.scale,e.originY)}function Av(t,e){return jv(PS(t.getBoundingClientRect(),e))}function OS(t,e,n){const i=Av(t,n),{scroll:o}=e;return o&&(cs(i.x,o.offset.x),cs(i.y,o.offset.y)),i}const Pv=({current:t})=>t?t.ownerDocument.defaultView:null,IS=new WeakMap;class DS{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=jb(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)),Nc(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=LS(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 Sv(e,{onSessionStart:o,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:m,contextWindow:Pv(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=kS(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=ES(o.layoutBox,n):this.constraints=!1,this.elastic=NS(i),l!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&Bt(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=CS(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=OS(i,o.root,this.visualElement.getTransformPagePoint());let u=TS(o.layout.layoutBox,l);if(n){const d=n(AS(u));this.hasMutatedConstraints=!!d,d&&(u=jv(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 Nc(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]=jS({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;IS.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=Mc,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 LS(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class MS extends Yn{constructor(e){super(e),this.removeGroupControls=Ot,this.removeListeners=Ot,this.controls=new DS(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 Ym=t=>(e,n)=>{t&&Le.postRender(()=>t(e,n))};class US extends Yn{constructor(){super(...arguments),this.removePointerDownListener=Ot}onPointerDown(e){this.session=new Sv(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Pv(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:o}=this.node.getProps();return{onSessionStart:Ym(e),onStart:Ym(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 Qm(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=Qm(t,e.target.x),i=Qm(t,e.target.y);return`${n}% ${i}%`}},$S={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 VS extends R.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:o}=this.props,{projection:l}=e;ob(FS),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 Rv(t){const[e,n]=py(),i=R.useContext(ad);return p.jsx(VS,{...t,layoutGroup:i,switchLayoutGroup:R.useContext(_y),isPresent:e,safeToRemove:n})}const FS={borderRadius:{...ui,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ui,borderTopRightRadius:ui,borderBottomLeftRadius:ui,borderBottomRightRadius:ui,boxShadow:$S};function BS(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 qS=(t,e)=>t.depth-e.depth;class WS{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(qS),this.isDirty=!1,this.children.forEach(e)}}function HS(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 Ov=["TopLeft","TopRight","BottomLeft","BottomRight"],KS=Ov.length,Xm=t=>typeof t=="string"?parseFloat(t):t,Zm=t=>typeof t=="number"||de.test(t);function GS(t,e,n,i,o,l){o?(t.opacity=Be(0,n.opacity!==void 0?n.opacity:1,JS(i)),t.opacityExit=Be(e.opacity!==void 0?e.opacity:1,0,YS(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<KS;u++){const d=`border${Ov[u]}Radius`;let h=eg(e,d),m=eg(n,d);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||Zm(h)===Zm(m)?(t[d]=Math.max(Be(Xm(h),Xm(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 eg(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const JS=Iv(0,.5,Xy),YS=Iv(.5,.95,Ot);function Iv(t,e,n){return i=>i<t?0:i>e?1:n(ms(t,e,i))}function tg(t,e){t.min=e.min,t.max=e.max}function Ft(t,e){tg(t.x,e.x),tg(t.y,e.y)}function ng(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function rg(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 QS(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=rg(t.min,e,n,d,o),t.max=rg(t.max,e,n,d,o)}function sg(t,e,[n,i,o],l,u){QS(t,e[n],e[i],e[o],e.scale,l,u)}const XS=["x","scaleX","originX"],ZS=["y","scaleY","originY"];function ig(t,e,n,i){sg(t.x,e,XS,n?n.x:void 0,i?i.x:void 0),sg(t.y,e,ZS,n?n.y:void 0,i?i.y:void 0)}function og(t){return t.translate===0&&t.scale===1}function Dv(t){return og(t.x)&&og(t.y)}function ag(t,e){return t.min===e.min&&t.max===e.max}function ek(t,e){return ag(t.x,e.x)&&ag(t.y,e.y)}function lg(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Lv(t,e){return lg(t.x,e.x)&&lg(t.y,e.y)}function ug(t){return It(t.x)/It(t.y)}function cg(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class tk{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 nk(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,sc=["","X","Y","Z"],rk={visibility:"hidden"},dg=1e3;let sk=0;function ic(t,e,n,i){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),i&&(i[t]=0))}function Mv(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Wy(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&&Mv(i)}function Uv({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:o}){return class{constructor(u={},d=e?.()){this.id=sk++,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(ak),this.nodes.forEach(hk),this.nodes.forEach(fk),this.nodes.forEach(lk),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 WS)}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=HS(w,250),ya.hasAnimatedSinceResize&&(ya.hasAnimatedSinceResize=!1,this.nodes.forEach(fg))})}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()||vk,{onLayoutAnimationStart:k,onLayoutAnimationComplete:E}=y.getProps(),P=!this.targetLayout||!Lv(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||fg(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(pk),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&&Mv(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(hg);return}this.isUpdating||this.nodes.forEach(ck),this.isUpdating=!1,this.nodes.forEach(dk),this.nodes.forEach(ik),this.nodes.forEach(ok),this.clearAllSnapshots();const d=un.now();at.delta=Sn(0,1e3/60,d-at.timestamp),at.timestamp=d,at.isProcessing=!0,Ju.update.process(at),Ju.preRender.process(at),Ju.render.process(at),at.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,md.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(uk),this.sharedNodes.forEach(mk)}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&&!Dv(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)),wk(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(xk))){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;Uc(m.latestValues)&&m.updateSnapshot();const y=Ge(),v=m.measurePageBox();Ft(y,v),ig(d,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return fr(this.latestValues)&&ig(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(),SS(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ft(this.target,this.layout.layoutBox),Nv(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||Uc(this.parent.latestValues)||Cv(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;RS(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():(ng(this.prevProjectionDelta.x,this.projectionDelta.x),ng(this.prevProjectionDelta.y,this.projectionDelta.y)),vi(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==w||this.treeScale.y!==_||!cg(this.projectionDelta.x,this.prevProjectionDelta.x)||!cg(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(yk));this.animationProgress=0;let N;this.mixTargetDelta=U=>{const V=U/1e3;pg(v.x,u.x,V),pg(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),gk(this.relativeTarget,this.relativeTargetOrigin,w,V),N&&ek(this.relativeTarget,N)&&(this.isProjectionDirty=!1),N||(N=Ge()),Ft(N,this.relativeTarget)),S&&(this.animationValues=y,GS(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=BS(0,dg,{...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(dg),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&&$v(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 tk),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&&ic("z",u,m,this.animationValues);for(let y=0;y<sc.length;y++)ic(`rotate${sc[y]}`,u,m,this.animationValues),ic(`skew${sc[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 rk;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=nk(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?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(hg),this.root.sharedNodes.clear()}}}function ik(t){t.updateLayout()}function ok(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+_}):$v(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=!Dv(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),Lv(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 ak(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 lk(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function uk(t){t.clearSnapshot()}function hg(t){t.clearMeasurements()}function ck(t){t.isLayoutDirty=!1}function dk(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fg(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function hk(t){t.resolveTargetDelta()}function fk(t){t.calcProjection()}function pk(t){t.resetSkewAndRotation()}function mk(t){t.removeLeadSnapshot()}function pg(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 mg(t,e,n,i){t.min=Be(e.min,n.min,i),t.max=Be(e.max,n.max,i)}function gk(t,e,n,i){mg(t.x,e.x,n.x,i),mg(t.y,e.y,n.y,i)}function yk(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const vk={duration:.45,ease:[.4,0,.1,1]},gg=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),yg=gg("applewebkit/")&&!gg("chrome/")?Math.round:Ot;function vg(t){t.min=yg(t.min),t.max=yg(t.max)}function wk(t){vg(t.x),vg(t.y)}function $v(t,e,n){return t==="position"||t==="preserve-aspect"&&!_S(ug(e),ug(n),.2)}function xk(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const bk=Uv({attachResizeListener:(t,e)=>Ni(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),oc={current:void 0},Vv=Uv({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!oc.current){const t=new bk({});t.mount(window),t.setOptions({layoutScroll:!0}),oc.current=t}return oc.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),_k={pan:{Feature:US},drag:{Feature:MS,ProjectionNode:Vv,MeasureLayout:Rv}};function wg(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 Sk extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=_b(e,n=>(wg(this.node,n,"Start"),i=>wg(this.node,i,"End"))))}unmount(){}}class kk 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 xg(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 Ek extends Yn{mount(){const{current:e}=this.node;e&&(this.unmount=Tb(e,n=>(xg(this.node,n,"Start"),(i,{success:o})=>xg(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Vc=new WeakMap,ac=new WeakMap,Tk=t=>{const e=Vc.get(t.target);e&&e(t)},jk=t=>{t.forEach(Tk)};function Ck({root:t,...e}){const n=t||document;ac.has(n)||ac.set(n,{});const i=ac.get(n),o=JSON.stringify(e);return i[o]||(i[o]=new IntersectionObserver(jk,{root:t,...e})),i[o]}function Nk(t,e,n){const i=Ck(e);return Vc.set(t,n),i.observe(t),()=>{Vc.delete(t),i.unobserve(t)}}const Ak={some:0,all:1};class Pk 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:Ak[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 Nk(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(Rk(e,n))&&this.startObserver()}unmount(){}}function Rk({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const Ok={inView:{Feature:Pk},tap:{Feature:Ek},focus:{Feature:kk},hover:{Feature:Sk}},Ik={layout:{ProjectionNode:Vv,MeasureLayout:Rv}},Fc={current:null},Fv={current:!1};function Dk(){if(Fv.current=!0,!!cd)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Fc.current=t.matches;t.addListener(e),e()}else Fc.current=!1}const Lk=[...hv,ht,Jn],Mk=t=>Lk.find(dv(t)),bg=new WeakMap;function Uk(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 _g=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class $k{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=Ua(n),this.isVariantNode=xy(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,bg.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)),Fv.current||Dk(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Fc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){bg.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<_g.length;i++){const o=_g[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=Uk(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"&&(uv(o)||ev(o))?o=parseFloat(o):!Mk(o)&&Jn.test(n)&&(o=ov(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 Bv extends $k{constructor(){super(...arguments),this.KeyframeResolver=fv}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 Vk(t){return window.getComputedStyle(t)}class Fk extends Bv{constructor(){super(...arguments),this.type="html",this.renderInstance=Ny}readValueFromInstance(e,n){if(Tr.has(n)){const i=Ld(n);return i&&i.default||0}else{const i=Vk(e),o=(Ty(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Av(e,n)}build(e,n,i){xd(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return kd(e,n,i)}}class Bk extends Bv{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=Ay.has(n)?n:pd(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return Oy(e,n,i)}build(e,n,i){bd(e,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,i,o){Py(e,n,i,o)}mount(e){this.isSVGTag=Sd(e.tagName),super.mount(e)}}const zk=(t,e)=>gd(t)?new Bk(e):new Fk(e,{allowProjection:t!==R.Fragment}),qk=mb({...fS,...Ok,..._k,...Ik},zk),Ne=A1(qk);function zv(t,e){return function(){return t.apply(e,arguments)}}const{toString:Wk}=Object.prototype,{getPrototypeOf:Fd}=Object,{iterator:Fa,toStringTag:qv}=Symbol,Ba=(t=>e=>{const n=Wk.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),en=t=>(t=t.toLowerCase(),e=>Ba(e)===t),za=t=>e=>typeof e===t,{isArray:bs}=Array,vs=za("undefined");function Bi(t){return t!==null&&!vs(t)&&t.constructor!==null&&!vs(t.constructor)&&St(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Wv=en("ArrayBuffer");function Hk(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Wv(t.buffer),e}const Kk=za("string"),St=za("function"),Hv=za("number"),zi=t=>t!==null&&typeof t=="object",Gk=t=>t===!0||t===!1,va=t=>{if(Ba(t)!=="object")return!1;const e=Fd(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(qv in t)&&!(Fa in t)},Jk=t=>{if(!zi(t)||Bi(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Yk=en("Date"),Qk=en("File"),Xk=en("Blob"),Zk=en("FileList"),eE=t=>zi(t)&&St(t.pipe),tE=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||St(t.append)&&((e=Ba(t))==="formdata"||e==="object"&&St(t.toString)&&t.toString()==="[object FormData]"))},nE=en("URLSearchParams"),[rE,sE,iE,oE]=["ReadableStream","Request","Response","Headers"].map(en),aE=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 Kv(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,Gv=t=>!vs(t)&&t!==wr;function Bc(){const{caseless:t,skipUndefined:e}=Gv(this)&&this||{},n={},i=(o,l)=>{const u=t&&Kv(n,l)||l;va(n[u])&&va(o)?n[u]=Bc(n[u],o):va(o)?n[u]=Bc({},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 lE=(t,e,n,{allOwnKeys:i}={})=>(qi(e,(o,l)=>{n&&St(o)?t[l]=zv(o,n):t[l]=o},{allOwnKeys:i}),t),uE=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),cE=(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)},dE=(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},hE=(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},fE=t=>{if(!t)return null;if(bs(t))return t;let e=t.length;if(!Hv(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},pE=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Fd(Uint8Array)),mE=(t,e)=>{const i=(t&&t[Fa]).call(t);let o;for(;(o=i.next())&&!o.done;){const l=o.value;e.call(t,l[0],l[1])}},gE=(t,e)=>{let n;const i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},yE=en("HTMLFormElement"),vE=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),Sg=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),wE=en("RegExp"),Jv=(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)},xE=t=>{Jv(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+"'")})}})},bE=(t,e)=>{const n={},i=o=>{o.forEach(l=>{n[l]=!0})};return bs(t)?i(t):i(String(t).split(e)),n},_E=()=>{},SE=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function kE(t){return!!(t&&St(t.append)&&t[qv]==="FormData"&&t[Fa])}const EE=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)},TE=en("AsyncFunction"),jE=t=>t&&(zi(t)||St(t))&&St(t.then)&&St(t.catch),Yv=((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)),CE=typeof queueMicrotask<"u"?queueMicrotask.bind(wr):typeof process<"u"&&process.nextTick||Yv,NE=t=>t!=null&&St(t[Fa]),M={isArray:bs,isArrayBuffer:Wv,isBuffer:Bi,isFormData:tE,isArrayBufferView:Hk,isString:Kk,isNumber:Hv,isBoolean:Gk,isObject:zi,isPlainObject:va,isEmptyObject:Jk,isReadableStream:rE,isRequest:sE,isResponse:iE,isHeaders:oE,isUndefined:vs,isDate:Yk,isFile:Qk,isBlob:Xk,isRegExp:wE,isFunction:St,isStream:eE,isURLSearchParams:nE,isTypedArray:pE,isFileList:Zk,forEach:qi,merge:Bc,extend:lE,trim:aE,stripBOM:uE,inherits:cE,toFlatObject:dE,kindOf:Ba,kindOfTest:en,endsWith:hE,toArray:fE,forEachEntry:mE,matchAll:gE,isHTMLForm:yE,hasOwnProperty:Sg,hasOwnProp:Sg,reduceDescriptors:Jv,freezeMethods:xE,toObjectSet:bE,toCamelCase:vE,noop:_E,toFiniteNumber:SE,findKey:Kv,global:wr,isContextDefined:Gv,isSpecCompliantForm:kE,toJSONObject:EE,isAsyncFn:TE,isThenable:jE,setImmediate:Yv,asap:CE,isIterable:NE};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 Qv=ye.prototype,Xv={};["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=>{Xv[t]={value:t}});Object.defineProperties(ye,Xv);Object.defineProperty(Qv,"isAxiosError",{value:!0});ye.from=(t,e,n,i,o,l)=>{const u=Object.create(Qv);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 AE=null;function zc(t){return M.isPlainObject(t)||M.isArray(t)}function Zv(t){return M.endsWith(t,"[]")?t.slice(0,-2):t}function kg(t,e,n){return t?t.concat(e).map(function(o,l){return o=Zv(o),!n&&l?"["+o+"]":o}).join(n?".":""):e}function PE(t){return M.isArray(t)&&!t.some(zc)}const RE=M.toFlatObject(M,{},null,function(e){return/^is[A-Z]/.test(e)});function qa(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)&&PE(b)||(M.isFileList(b)||M.endsWith(S,"[]"))&&(E=M.toArray(b)))return S=Zv(S),E.forEach(function(N,U){!(M.isUndefined(N)||N===null)&&e.append(u===!0?kg([S],U,l):u===null?S:S+"[]",m(N))}),!1}return zc(b)?!0:(e.append(kg(k,S,l),m(b)),!1)}const v=[],w=Object.assign(RE,{defaultVisitor:y,convertValue:m,isVisitable:zc});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 Eg(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&&qa(t,this,e)}const e0=Bd.prototype;e0.append=function(e,n){this._pairs.push([e,n])};e0.toString=function(e){const n=e?function(i){return e.call(this,i,Eg)}:Eg;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function OE(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function t0(t,e,n){if(!e)return t;const i=n&&n.encode||OE;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 Tg{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 n0={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},IE=typeof URLSearchParams<"u"?URLSearchParams:Bd,DE=typeof FormData<"u"?FormData:null,LE=typeof Blob<"u"?Blob:null,ME={isBrowser:!0,classes:{URLSearchParams:IE,FormData:DE,Blob:LE},protocols:["http","https","file","blob","url","data"]},zd=typeof window<"u"&&typeof document<"u",qc=typeof navigator=="object"&&navigator||void 0,UE=zd&&(!qc||["ReactNative","NativeScript","NS"].indexOf(qc.product)<0),$E=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VE=zd&&window.location.href||"http://localhost",FE=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zd,hasStandardBrowserEnv:UE,hasStandardBrowserWebWorkerEnv:$E,navigator:qc,origin:VE},Symbol.toStringTag,{value:"Module"})),ft={...FE,...ME};function BE(t,e){return qa(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 qE(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 r0(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]=qE(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 WE(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:n0,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(r0(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 BE(e,this.formSerializer).toString();if((d=M.isFileList(e))||i.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return qa(d?{"files[]":e}:e,h&&new h,this.formSerializer)}}return l||o?(n.setContentType("application/json",!1),WE(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 HE=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"]),KE=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]&&
|
|
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[jg]=this[jg]={accessors:{}}).accessors,o=this.prototype;function l(u){const d=ci(u);i[d]||(QE(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 uc(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 s0(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 i0(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 XE(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ZE(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 eT(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=ZE(50,250);return eT(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)},Cg=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},Ng=t=>(...e)=>M.asap(()=>t(...e)),tT=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,nT=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 rT(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function sT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function o0(t,e,n){let i=!rT(e);return t&&(i||n==!1)?sT(t,e):e}const Ag=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(Ag(m),Ag(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 a0=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=t0(o0(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&&tT(e.url))){const h=o&&l&&nT.read(l);h&&u.set(o,h)}return e},iT=typeof XMLHttpRequest<"u",oT=iT&&function(t){return new Promise(function(n,i){const o=a0(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};i0(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||n0;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=XE(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)})},aT=(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}},lT=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},uT=async function*(t,e){for await(const n of cT(t))yield*lT(n,e)},cT=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()}},Pg=(t,e,n,i)=>{const o=uT(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})},Rg=64*1024,{isFunction:ua}=M,dT=(({Request:t,Response:e})=>({Request:t,Response:e}))(M.global),{ReadableStream:Og,TextEncoder:Ig}=M.global,Dg=(t,...e)=>{try{return!!t(...e)}catch{return!1}},hT=t=>{t=M.merge.call({skipUndefined:!0},dT,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(Og),h=o&&(typeof Ig=="function"?(b=>S=>b.encode(S))(new Ig):async b=>new Uint8Array(await new n(b).arrayBuffer())),m=l&&d&&Dg(()=>{let b=!1;const S=new n(ft.origin,{body:new Og,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!S}),y=u&&d&&Dg(()=>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}=a0(b),Te=e||fetch;$=$?($+"").toLowerCase():"text";let ve=aT([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]=Cg(Oe,Na(Ng(z)));E=Pg(j.body,Rg,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&&Cg(D,Na(Ng(V),!0))||[];F=new i(Pg(F.body,Rg,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)=>{i0(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)}}},fT=new Map,l0=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=fT;for(;d--;)h=l[d],m=y.get(h),m===void 0&&y.set(h,m=d?new Map:hT(e)),y=m;return m};l0();const qd={http:AE,xhr:oT,fetch:{get:l0}};M.forEach(qd,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Lg=t=>`- ${t}`,pT=t=>M.isFunction(t)||t===null||t===!1;function mT(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,!pT(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(
|
|
20
|
-
`):" "+
|
|
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=[Mg.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=Mg.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=o0(e.baseURL,e.url,e.allowAbsoluteUrls);return t0(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 yT=class d0{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 d0(function(o){e=o}),cancel:e}}};function vT(t){return function(n){return t.apply(null,n)}}function wT(t){return M.isObject(t)&&t.isAxiosError===!0}const Wc={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(Wc).forEach(([t,e])=>{Wc[e]=t});function h0(t){const e=new _r(t),n=zv(_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 h0(Er(t,o))},n}const Re=h0(Wi);Re.Axios=_r;Re.CanceledError=_s;Re.CancelToken=yT;Re.isCancel=s0;Re.VERSION=c0;Re.toFormData=qa;Re.AxiosError=ye;Re.Cancel=Re.CanceledError;Re.all=function(e){return Promise.all(e)};Re.spread=vT;Re.isAxiosError=wT;Re.mergeConfig=Er;Re.AxiosHeaders=kt;Re.formToJSON=t=>r0(M.isHTMLForm(t)?new FormData(t):t);Re.getAdapter=u0.getAdapter;Re.HttpStatusCode=Wc;Re.default=Re;const{Axios:$C,AxiosError:VC,CanceledError:FC,isCancel:BC,CancelToken:zC,VERSION:qC,all:WC,Cancel:HC,isAxiosError:KC,spread:GC,toFormData:JC,AxiosHeaders:YC,HttpStatusCode:QC,formToJSON:XC,getAdapter:ZC,mergeConfig:eN}=Re;function Ha(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 xT(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 bT=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 _T extends Wd{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class $g extends Wd{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Vg extends Wd{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Hc;(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"})(Hc||(Hc={}));class ST{constructor(e,{headers:n={},customFetch:i,region:o=Hc.Any}={}){this.url=e,this.headers=n,this.region=o,this.fetch=bT(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return xT(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 _T(V)}),P=E.headers.get("x-relay-error");if(P&&P==="true")throw new $g(E);if(!E.ok)throw new Vg(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 Vg||d instanceof $g?d.context:void 0}}finally{l&&clearTimeout(l)}})}}var kT=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},ET=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 kT(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]),m.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(),p=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:p,register:v=>(d.set(v,!1),()=>d.delete(v))}),l?[Math.random(),p]:[n,p]);return R.useMemo(()=>{d.forEach((v,w)=>d.set(w,!1))},[n]),R.useEffect(()=>{!n&&!d.size&&i&&i()},[n]),u==="popLayout"&&(t=m.jsx(N1,{isPresent:n,children:t})),m.jsx(Da.Provider,{value:y,children:t})};function P1(){return new Map}function my(t=!0){const e=R.useContext(Da);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",gy=cd?R.useLayoutEffect:R.useEffect,_n=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:o=!0,mode:l="sync",propagate:u=!1})=>{const[d,h]=my(u),p=R.useMemo(()=>um(t),[t]),y=u&&!d?[]:p.map(sa),v=R.useRef(!0),w=R.useRef(p),_=ld(()=>new Map),[b,S]=R.useState(p),[k,E]=R.useState(p);gy(()=>{v.current=!1,w.current=p;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(p!==b){let U=[...p];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(p);return}const{forceRender:N}=R.useContext(ad);return m.jsx(m.Fragment,{children:k.map(U=>{const V=sa(U),z=u&&!d?!1:p===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 m.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 yy=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},xn=t=>t*1e3,bn=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(p){l.has(p)&&(h.schedule(p),t()),p(u)}const h={schedule:(p,y=!1,v=!1)=>{const _=v&&i?e:n;return y&&l.add(p),_.has(p)||_.add(p),p},cancel:p=>{n.delete(p),l.delete(p)},process:p=>{if(u=p,i){o=!0;return}i=!0,[e,n]=[n,e],e.forEach(d),e.clear(),i=!1,o&&(o=!1,h.process(p))}};return h}const ia=["read","resolveKeyframes","update","preRender","render","postRender"],I1=40;function vy(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:p,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),p.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:Ju}=vy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ot,!0),wy=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 ba(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 xy=t=>!ba(t);function M1(t){t&&(xy=e=>e.startsWith("on")?!ba(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"||(xy(o)||n===!0&&ba(o)||!e&&!ba(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 La=R.createContext({});function Ei(t){return typeof t=="string"||Array.isArray(t)}function Ma(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const hd=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fd=["initial",...hd];function Ua(t){return Ma(t.animate)||fd.some(e=>Ei(t[e]))}function by(t){return!!(Ua(t)||t.variants)}function V1(t,e){if(Ua(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(La));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",_y="data-"+pd(q1),{schedule:md}=vy(queueMicrotask,!1),Sy=R.createContext({});function W1(t,e,n,i,o){var l,u;const{visualElement:d}=R.useContext(La),h=R.useContext(wy),p=R.useContext(Da),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:p,blockInitialAnimation:p?p.initial===!1:!1,reducedMotionConfig:y}));const w=v.current,_=R.useContext(Sy);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,p)});const S=n[_y],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 gy(()=>{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:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:ky(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:p})}function ky(t){if(t)return t.options.allowProjection!==!1?t.projection:ky(t.parent)}function K1({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:i,Component:o}){var l,u;t&&D1(t);function d(p,y){let v;const w={...R.useContext(ud),...p,layoutId:G1(p)},{isStatic:_}=w,b=F1(p),S=i(p,_);if(!_&&cd){J1();const k=Y1(w);v=k.MeasureLayout,b.visualElement=W1(o,S,w,e,k.ProjectionNode)}return m.jsxs(La.Provider,{value:b,children:[v&&b.visualElement?m.jsx(v,{visualElement:b.visualElement,...w}):null,n(o,p,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(wy).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 Ey=t=>(e,n)=>{const i=R.useContext(La),o=R.useContext(Da),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=Ua(t),p=by(t);e&&p&&!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"&&!Ma(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),Ty=t=>e=>typeof e=="string"&&e.startsWith(t),jy=Ty("--"),nb=Ty("var(--"),vd=t=>nb(t)?rb.test(t.split("/*")[0].trim()):!1,rb=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Cy=(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 p=Cy(d,wd[u]);if(!h){o=!1;const y=lb[u]||u;i+=`${y}(${p}) `}n&&(e[u]=p)}}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 p=e[h];if(Tr.has(h)){u=!0;continue}else if(jy(h)){o[h]=p;continue}else{const y=Cy(p,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:p="50%",originZ:y=0}=l;i.transformOrigin=`${h} ${p} ${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,...p},y,v){if(xd(t,p,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:{}}),Ny=()=>({..._d(),attrs:{}}),Sd=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Ay(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 Py=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 Ry(t,e,n,i){Ay(t,e,void 0,i);for(const o in e.attrs)t.setAttribute(Py.has(o)?o:pd(o),e.attrs[o])}const _a={};function mb(t){Object.assign(_a,t)}function Oy(t,{layout:e,layoutId:n}){return Tr.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!_a[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])||Oy(u,t)||((i=n?.getValue(u))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(l[u]=o[u]);return l}function Iy(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:Ey({scrapeMotionValuesFromProps:Iy,createRenderState:Ny,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),Ry(n,i)})})}})},vb={useVisualState:Ey({scrapeMotionValuesFromProps:kd,createRenderState:_d})};function Dy(t,e,n){for(const i in e)!pt(e[i])&&!Oy(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 Dy(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=Ny();return bd(l,e,Sd(i),t.transformTemplate),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};Dy(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),p=U1(i,typeof n=="string",t),y=n!==R.Fragment?{...p,...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 Ly(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 $a(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 My(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 Sa=Nb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Uy=(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 $y(t){return!!(typeof t=="function"&&Sa()||!t||typeof t=="string"&&(t in jc||Sa())||jd(t)||Array.isArray(t)&&t.every($y))}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 Vy(t,e){if(t)return typeof t=="function"&&Sa()?Uy(t,e):jd(t)?hi(t):Array.isArray(t)?t.map(n=>Vy(n,e)||jc.easeOut):jc[t]}const Qt={x:!1,y:!1};function Fy(){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 By(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"||Fy()||t(e)}}function Pb(t,e,n={}){const[i,o,l]=By(t,n),u=vm(d=>{const{target:h}=d,p=e(d);if(typeof p!="function"||!h)return;const y=vm(v=>{p(v),h.removeEventListener("pointerleave",y)});h.addEventListener("pointerleave",y,o)});return i.forEach(d=>{d.addEventListener("pointerenter",u,o)}),l}const zy=(t,e)=>e?t===e?!0:zy(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 Yu(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;Yu(n,"down");const o=wm(()=>{Yu(n,"up")}),l=()=>Yu(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)&&!Fy()}function Db(t,e,n={}){const[i,o,l]=By(t,n),u=d=>{const h=d.currentTarget;if(!xm(d)||fi.has(h))return;fi.add(h);const p=e(d),y=(_,b)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",w),!(!xm(_)||!fi.has(h))&&(fi.delete(h),typeof p=="function"&&p(_,{success:b}))},v=_=>{y(_,n.useGlobalTarget||zy(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",p=>Ib(p,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 qy=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 Wy(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 Wy(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=$a(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 Hy(t){return t.props[_y]}const Ky=(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=Ky(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:Ky(o(l),e,i)}const Gy=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Jy=t=>e=>1-t(1-e),Yy=Ui(.33,1.53,.69,.99),Rd=Jy(Yy),Qy=Gy(Rd),Xy=t=>(t*=2)<1?.5*Rd(t):.5*(2-Math.pow(2,-10*(t-1))),Od=t=>1-Math.sin(Math.acos(t)),Zy=Jy(Od),e0=Gy(Od),t0=t=>/^0[^.\s]+$/u.test(t);function Hb(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||t0(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)),n0=(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),Qu={...xs,transform:t=>Math.round(Jb(t))},vr={test:Dd("rgb","red"),parse:n0("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Qu.transform(t)+", "+Qu.transform(e)+", "+Qu.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:n0("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 r0="number",s0="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(s0),n.push(ht.parse(h))):h.startsWith(e_)?(i.var.push(l),o.push(Zb),n.push(h)):(i.number.push(l),o.push(r0),n.push(parseFloat(h))),++l,_m)).split(_m);return{values:n,split:d,indexes:i,types:o}}function i0(t){return Ci(t).values}function o0(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===r0?l+=gi(o[u]):d===s0?l+=ht.transform(o[u]):l+=o[u]}return l}}const n_=t=>typeof t=="number"?0:t;function r_(t){const e=i0(t);return o0(t)(e.map(n_))}const Jn={test:Xb,parse:i0,createTransformer:o0,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 a0(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]=a0(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 l0(){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 u0(){br.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Rc=!0)})}function f_(){u0(),l0()}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(u0),Le.resolveKeyframes(l0))):(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 c0=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 d0(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 c0(u)?parseFloat(u):u}return vd(o)?d0(o,e,n+1):o}const h0=t=>e=>e.test(t),g_={test:t=>t==="auto",parse:t=>t},f0=[xs,de,ln,Wn,ib,sb,g_],Tm=t=>f0.find(h0(t));class p0 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 p=e[h];if(typeof p=="string"&&(p=p.trim(),vd(p))){const y=d0(p,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!qy.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 p=e[h];typeof p=="string"&&(e[h]=parseFloat(p))}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,p])=>{n.getValue(h).set(p)}),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 Va(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 m0{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:p}=this.options;if(!p&&!v_(e,i,o,l))if(u)this.options.duration=0;else{h&&h(Va(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 Xu(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=Xu(h,d,t+1/3),l=Xu(h,d,t),u=Xu(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:i}}function ka(t,e){return n=>n>0?e:t}const Zu=(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 ka(t,e);const o={...n};return l=>(o.red=Zu(n.red,i.red,l),o.green=Zu(n.green,i.green,l),o.blue=Zu(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)?ka:ht.test(t)?Nm:N_:Array.isArray(t)?g0:typeof t=="object"?ht.test(t)?Nm:j_:ka}function g0(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(g0(C_(i,o),o.values),n):ka(t,e)};function y0(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 v0(t,e,n){const i=Math.max(e-A_,0);return Wy(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},ec=.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,bn(t)),u<1?(o=p=>{const y=p*u,v=y*t,w=y-n,_=Ic(p,u),b=Math.exp(-v);return ec-w/_*b},l=p=>{const v=p*u*t,w=v*n+n,_=Math.pow(u,2)*Math.pow(p,2)*t,b=Math.exp(-v),S=Ic(Math.pow(p,2),u);return(-o(p)+ec>0?-1:1)*((w-_)*b)/S}):(o=p=>{const y=Math.exp(-p*t),v=(p-n)*t+1;return-ec+y*v},l=p=>{const y=Math.exp(-p*t),v=(n-p)*(t*t);return y*v});const d=5/t,h=O_(o,l,d);if(t=xn(t),isNaN(h))return{stiffness:We.stiffness,damping:We.damping,duration:t};{const p=Math.pow(h,2)*i;return{stiffness:p,damping:u*2*Math.sqrt(i*p),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 w0(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:p,mass:y,duration:v,velocity:w,isResolvedFromDuration:_}=L_({...n,velocity:-bn(n.velocity||0)}),b=w||0,S=p/(2*Math.sqrt(h*y)),k=u-l,E=bn(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?xn(b):v0(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(My(U),Tc),z=Uy($=>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:p=.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)<=p,w.value=w.done?E:oe};let V,z;const $=B=>{_(w.value)&&(V=B,z=w0({keyframes:[w.value,b(w.value)],velocity:v0(N,B,w.value),damping:o,stiffness:l,restDelta:p,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),x0=Ui(.42,0,.58,1),$_=t=>Array.isArray(t)&&typeof t[0]!="number",V_={linear:Ot,easeIn:M_,easeInOut:x0,easeOut:U_,circIn:Od,circInOut:e0,circOut:Zy,backIn:Rd,backInOut:Qy,backOut:Yy,anticipate:Xy},Rm=t=>{if(jd(t)){yy(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||y0,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(yy(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,p=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=>p(Sn(t[0],t[l-1],y)):p}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||x0).splice(0,t.length-1)}function Ea({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:Ea,keyframes:Ea,spring:w0},J_=t=>t/100;class $d extends m0{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,p)=>this.onKeyframesResolved(h,p);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]||Ea;let h,p;d!==Ea&&typeof e[0]!="number"&&(h=$i(J_,y0(e[0],e[1])),e=[0,100]);const y=d({...this.options,keyframes:e});l==="mirror"&&(p=d({...this.options,keyframes:[...e].reverse(),velocity:-u})),y.calculatedDuration===null&&(y.calculatedDuration=My(y));const{calculatedDuration:v}=y,w=v+o,_=w*(i+1)-o;return{generator:y,mirroredGenerator:p,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:p,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&&p!==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=Va(h,this.options,o)),k&&k(V.value),$&&this.finish(),V}get duration(){const{resolved:e}=this;return e?bn(e.calculatedDuration):0}get time(){return bn(this.currentTime)}set time(e){e=xn(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=bn(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 p={[e]:n};h&&(p.offset=h);const y=Vy(d,o);return Array.isArray(y)&&(p.easing=y),t.animate(p,{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")),Ta=10,Z_=2e4;function eS(t){return Td(t.type)||t.type==="spring"||!$y(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+=Ta;return{times:void 0,keyframes:o,duration:l-Ta,ease:"linear"}}const b0={anticipate:Xy,backInOut:Qy,circInOut:e0};function nS(t){return t in b0}class Om extends m0{constructor(e){super(e);const{name:n,motionValue:i,element:o,keyframes:l}=this.options;this.resolver=new p0(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:p}=this.options;if(!d.owner||!d.owner.current)return!1;if(typeof l=="string"&&Sa()&&nS(l)&&(l=b0[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=p??this.calcStartTime(),this.pendingTimeline?(ym(y,this.pendingTimeline),this.pendingTimeline=void 0):y.onfinish=()=>{const{onComplete:v}=this.options;d.set(Va(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 bn(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return bn(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=xn(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:p,onUpdate:y,onComplete:v,element:w,..._}=this.options,b=new $d({..._,keyframes:i,duration:o,type:l,ease:u,times:d,isGenerator:!0}),S=xn(this.time);p.setWithVelocity(b.sample(S-Ta).value,b.sample(S).value,Ta)}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:p}=n.owner.getProps();return X_()&&i&&Y_.has(i)&&!h&&!p&&!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:p,...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:p=0}=i;p=p-xn(h);let y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-p,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=xn(y.duration)),y.repeatDelay&&(y.repeatDelay=xn(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=Va(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 _0(t,e,{delay:n=0,transitionOverride:i,type:o}={}){var l;let{transition:u=t.getDefaultTransition(),transitionEnd:d,...h}=e;i&&(u=i);const p=[],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=Hy(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&&qy.has(v)?{type:!1}:b,t,S));const k=w.animation;k&&p.push(k)}return d&&Promise.all(p).then(()=>{Le.update(()=>{d&&Fb(t,d)})}),p}function Dc(t,e,n={}){var i;const o=$a(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(_0(t,o,n)):()=>Promise.resolve(),d=t.variantChildren&&t.variantChildren.size?(p=0)=>{const{delayChildren:y=0,staggerChildren:v,staggerDirection:w}=l;return cS(t,e,y+p,v,w,n)}:()=>Promise.resolve(),{when:h}=l;if(h){const[p,y]=h==="beforeChildren"?[u,d]:[d,u];return p().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?(p=0)=>p*i:(p=0)=>d-p*i;return Array.from(t.variantChildren).sort(dS).forEach((p,y)=>{p.notify("AnimationStart",e),u.push(Dc(p,e,{...l,delay:n+h(y)}).then(()=>p.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"?$a(t,e,n.custom):e;i=Promise.all(_0(t,o,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const fS=fd.length;function S0(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?S0(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=>(p,y)=>{var v;const w=$a(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;p={...p,...S,...b}}return p};function l(h){e=h(t)}function u(h){const{props:p}=t,y=S0(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=p[E]!==void 0?p[E]:y[E],U=Ei(N),V=E===h?P.isActive:null;V===!1&&(b=k);let z=N===y[E]&&N!==p[E]&&U;if(z&&i&&t.manuallyAnimateOnMount&&(z=!1),P.protectedKeys={..._},!P.isActive&&V===null||!N&&!P.prevProp||Ma(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=!Ly(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&&(p.initial===!1||p.initial===p.animate)&&!t.manuallyAnimateOnMount&&(S=!1),i=!1,S?e(v):Promise.resolve()}function d(h,p){var y;if(n[h].isActive===p)return Promise.resolve();(y=t.variantChildren)===null||y===void 0||y.forEach(w=>{var _;return(_=w.animationState)===null||_===void 0?void 0:_.setActive(h,p)}),n[h].isActive=p;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)?!Ly(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();Ma(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 k0{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=nc(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=tc(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=nc(v.type==="pointercancel"?this.lastMoveEventInfo:tc(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=tc(u,this.transformPagePoint),{point:h}=d,{timestamp:p}=at;this.history=[{...h,timestamp:p}];const{onSessionStart:y}=n;y&&y(e,nc(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 tc(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 nc({point:t},e){return{point:t,delta:Lm(t,E0(e)),offset:Lm(t,ES(e)),velocity:TS(e,.1)}}function ES(t){return t[0]}function E0(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=E0(t);for(;n>=0&&(i=t[n],!(o.timestamp-i.timestamp>xn(e)));)n--;if(!i)return{x:0,y:0};const l=bn(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 T0=1e-4,jS=1-T0,CS=1+T0,j0=.01,NS=0-j0,AS=0+j0;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 C0({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 rc(t){return t===void 0||t===1}function Mc({scale:t,scaleX:e,scaleY:n}){return!rc(t)||!rc(e)||!rc(n)}function fr(t){return Mc(t)||N0(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function N0(t){return Hm(t.x)||Hm(t.y)}function Hm(t){return t&&t!=="0%"}function ja(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=ja(t,o,i)),ja(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 A0(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,A0(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 P0(t,e){return C0(VS(t.getBoundingClientRect(),e))}function BS(t,e,n){const i=P0(t,n),{scroll:o}=e;return o&&(cs(i.x,o.offset.x),cs(i.y,o.offset.y)),i}const R0=({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:p}=this.getProps();this.panSession=new k0(e,{onSessionStart:o,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,contextWindow:R0(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=C0(d))}return u}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},p=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(p).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:p}=this.constraints[u];d.set(Be(h,p,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:p,dragListener:y=!0}=this.getProps();p&&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:p})=>{this.isDragging&&p&&(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 k0(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:R0(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 p=Be(d,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=p),typeof o[3+u]=="number"&&(o[3+u]/=p),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 O0(t){const[e,n]=my(),i=R.useContext(ad);return m.jsx(JS,{...t,layoutGroup:i,switchLayoutGroup:R.useContext(Sy),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 I0=["TopLeft","TopRight","BottomLeft","BottomRight"],nk=I0.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${I0[u]}Radius`;let h=tg(e,d),p=tg(n,d);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||eg(h)===eg(p)?(t[d]=Math.max(Be(Zm(h),Zm(p),i),0),(ln.test(p)||ln.test(h))&&(t[d]+="%")):t[d]=p}(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=D0(0,.5,Zy),ik=D0(.5,.95,Ot);function D0(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=ja(t,1/n,i),o!==void 0&&(t=ja(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 L0(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 M0(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:p,rotate:y,rotateX:v,rotateY:w,skewX:_,skewY:b}=n;p&&(i=`perspective(${p}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,sc=["","X","Y","Z"],hk={visibility:"hidden"},hg=1e3;let fk=0;function ic(t,e,n,i){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),i&&(i[t]=0))}function U0(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Hy(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&&U0(i)}function $0({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:p,visualElement:y}=this.options;if(y&&!y.current&&y.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),d&&(p||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||p)&&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||!M0(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&&U0(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 p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(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,Ju.update.process(at),Ju.preRender.process(at),Ju.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&&!L0(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,y=p!==this.prevTransformTemplateValue;u&&(d||fr(this.latestValues)||y)&&(o(this.instance,p),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 p=0;p<this.path.length;p++){const y=this.path[p],{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 p=0;p<this.path.length;p++){const y=this.path[p];!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 p=this.path[h];if(!p.instance||!fr(p.latestValues))continue;Mc(p.latestValues)&&p.updateSnapshot();const y=Ge(),v=p.measurePageBox();Ft(y,v),og(d,p.latestValues,p.snapshot?p.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 p=!!this.resumingFrom||this!==h;if(!(u||p&&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),A0(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)||N0(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 p=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(p=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(p=!1),this.resolvedRelativeTargetAt===at.timestamp&&(p=!1),p)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,p=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,p,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:p,latestValues:y}=u;if(!(!d||!h||!p)){if(this!==u&&this.layout&&p&&V0(this.options.animationType,this.layout.layoutBox,p.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 p=d.options.initialPromotionConfig;d.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.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 p=this.getStack();p&&p.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 p={};h.z&&ic("z",u,p,this.animationValues);for(let y=0;y<sc.length;y++)ic(`rotate${sc[y]}`,u,p,this.animationValues),ic(`skew${sc[y]}`,u,p,this.animationValues);u.render();for(const y in p)u.setStaticValue(y,p[y]),this.animationValues&&(this.animationValues[y]=p[y]);u.scheduleRender()}getProjectionStyles(u){var d,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return hk;const p={visibility:""},y=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,p.opacity="",p.pointerEvents=pa(u?.pointerEvents)||"",p.transform=y?y(this.latestValues,""):"none",p;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(),p.transform=dk(this.projectionDeltaWithTransform,this.treeScale,w),y&&(p.transform=y(w,p.transform));const{x:_,y:b}=this.projectionDelta;p.transformOrigin=`${_.origin*100}% ${b.origin*100}% 0`,v.animationValues?p.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:p.opacity=v===this?w.opacity!==void 0?w.opacity:"":w.opacityExit!==void 0?w.opacityExit:0;for(const S in _a){if(w[S]===void 0)continue;const{correct:k,applyTo:E}=_a[S],P=p.transform==="none"?w[S]:k(w[S],v);if(E){const N=E.length;for(let U=0;U<N;U++)p[E[U]]=P}else p[S]=P}return this.options.layoutId&&(p.pointerEvents=v===this?pa(u?.pointerEvents)||"":"none"),p}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+_}):V0(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 p=!L0(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),M0(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:p,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 V0(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=$0({attachResizeListener:(t,e)=>Ni(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),oc={current:void 0},F0=$0({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!oc.current){const t=new Ak({});t.mount(window),t.setOptions({layoutScroll:!0}),oc.current=t}return oc.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:F0,MeasureLayout:O0}};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,ac=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;ac.has(n)||ac.set(n,{});const i=ac.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:p}=h;if(this.isInView===p||(this.isInView=p,l&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:y,onViewportLeave:v}=this.node.getProps(),w=p?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:F0,MeasureLayout:O0}},Vc={current:null},B0={current:!1};function qk(){if(B0.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=[...f0,ht,Jn],Hk=t=>Wk.find(h0(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:p,onUpdate:y}=u;this.onUpdate=y,this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,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=Ua(n),this.isVariantNode=by(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)),B0.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"&&(c0(o)||t0(o))?o=parseFloat(o):!Hk(o)&&Jn.test(n)&&(o=a0(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 z0 extends Gk{constructor(){super(...arguments),this.KeyframeResolver=p0}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 z0{constructor(){super(...arguments),this.type="html",this.renderInstance=Ay}readValueFromInstance(e,n){if(Tr.has(n)){const i=Ld(n);return i&&i.default||0}else{const i=Jk(e),o=(jy(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return P0(e,n)}build(e,n,i){xd(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return kd(e,n,i)}}class Qk extends z0{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=Py.has(n)?n:pd(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return Iy(e,n,i)}build(e,n,i){bd(e,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,i,o){Ry(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 q0(t,e){return function(){return t.apply(e,arguments)}}const{toString:eE}=Object.prototype,{getPrototypeOf:Fd}=Object,{iterator:Fa,toStringTag:W0}=Symbol,Ba=(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=>Ba(e)===t),za=t=>e=>typeof e===t,{isArray:bs}=Array,vs=za("undefined");function Fi(t){return t!==null&&!vs(t)&&t.constructor!==null&&!vs(t.constructor)&&St(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const H0=en("ArrayBuffer");function tE(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&H0(t.buffer),e}const nE=za("string"),St=za("function"),K0=za("number"),Bi=t=>t!==null&&typeof t=="object",rE=t=>t===!0||t===!1,ya=t=>{if(Ba(t)!=="object")return!1;const e=Fd(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(W0 in t)&&!(Fa 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=Ba(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 G0(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,J0=t=>!vs(t)&&t!==wr;function Fc(){const{caseless:t,skipUndefined:e}=J0(this)&&this||{},n={},i=(o,l)=>{const u=t&&G0(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]=q0(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(!K0(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[Fa]).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"),Y0=(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=>{Y0(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[W0]==="FormData"&&t[Fa])}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),Q0=((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||Q0,UE=t=>t!=null&&St(t[Fa]),M={isArray:bs,isArrayBuffer:H0,isBuffer:Fi,isFormData:cE,isArrayBufferView:tE,isString:nE,isNumber:K0,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:Ba,kindOfTest:en,endsWith:bE,toArray:_E,forEachEntry:kE,matchAll:EE,isHTMLForm:TE,hasOwnProperty:kg,hasOwnProp:kg,reduceDescriptors:Y0,freezeMethods:NE,toObjectSet:AE,toCamelCase:jE,noop:PE,toFiniteNumber:RE,findKey:G0,global:wr,isContextDefined:J0,isSpecCompliantForm:OE,toJSONObject:IE,isAsyncFn:DE,isThenable:LE,setImmediate:Q0,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 X0=ye.prototype,Z0={};["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=>{Z0[t]={value:t}});Object.defineProperties(ye,Z0);Object.defineProperty(X0,"isAxiosError",{value:!0});ye.from=(t,e,n,i,o,l)=>{const u=Object.create(X0);M.toFlatObject(t,u,function(y){return y!==Error.prototype},p=>p!=="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 ev(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=ev(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 qa(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 p(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=ev(S),E.forEach(function(N,U){!(M.isUndefined(N)||N===null)&&e.append(u===!0?Eg([S],U,l):u===null?S:S+"[]",p(N))}),!1}return Bc(b)?!0:(e.append(Eg(k,S,l),p(b)),!1)}const v=[],w=Object.assign(FE,{defaultVisitor:y,convertValue:p,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&&qa(t,this,e)}const tv=Bd.prototype;tv.append=function(e,n){this._pairs.push([e,n])};tv.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 nv(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 rv={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 qa(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 sv(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:rv,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(sv(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 qa(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 lc(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,p){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||p===!0||p===void 0&&o[v]!==!1)&&(o[v||h]=va(d))}const u=(d,h)=>M.forEach(d,(p,y)=>l(p,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,p;for(const y of e){if(!M.isArray(y))throw TypeError("Object iterator must return a key-value pair");d[p=y[0]]=(h=d[p])?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||lc(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||lc(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||lc(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 uc(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 iv(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 ov(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 p=Date.now(),y=i[l];u||(u=p),n[o]=h,i[o]=p;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),p-u<e)return;const _=y&&p-y;return _?Math.round(w*1e3/_):void 0}}function u2(t,e){let n=0,i=1e3/e,o,l;const u=(p,y=Date.now())=>{n=y,o=null,l&&(clearTimeout(l),l=null),t(...p)};return[(...p)=>{const y=Date.now(),v=y-n;v>=i?u(p,y):(o=p,l||(l=setTimeout(()=>{l=null,u(o)},i-v)))},()=>o&&u(o)]}const Ca=(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,p=o(h),y=u<=d;i=u;const v={loaded:u,total:d,progress:d?u/d:void 0,bytes:h,rate:p||void 0,estimated:p&&d&&y?(d-u)/p: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 av(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(p,y,v,w){return M.isPlainObject(p)&&M.isPlainObject(y)?M.merge.call({caseless:w},p,y):M.isPlainObject(y)?M.merge({},y):M.isArray(y)?y.slice():y}function o(p,y,v,w){if(M.isUndefined(y)){if(!M.isUndefined(p))return i(void 0,p,v,w)}else return i(p,y,v,w)}function l(p,y){if(!M.isUndefined(y))return i(void 0,y)}function u(p,y){if(M.isUndefined(y)){if(!M.isUndefined(p))return i(void 0,p)}else return i(void 0,y)}function d(p,y,v){if(v in e)return i(p,y);if(v in t)return i(void 0,p)}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:(p,y,v)=>o(Pg(p),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 lv=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=nv(av(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(),p=["content-type","content-length"];Object.entries(h).forEach(([y,v])=>{p.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=lv(t);let l=o.data;const u=kt.from(o.headers).normalize();let{responseType:d,onUploadProgress:h,onDownloadProgress:p}=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};ov(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||rv;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),p&&([w,b]=Ca(p,!0),k.addEventListener("progress",w)),h&&k.upload&&([v,_]=Ca(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(p){if(!o){o=!0,d();const y=p instanceof Error?p: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(p=>{p.unsubscribe?p.unsubscribe(l):p.removeEventListener("abort",l)}),t=null)};t.forEach(p=>p.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:p,value:y}=await o.next();if(p){d(),h.close();return}let v=y.byteLength;if(n){let w=l+=v;n(w)}h.enqueue(new Uint8Array(y))}catch(p){throw d(p),p}},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())),p=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}=lv(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&&p&&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,Ca(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,Ca(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)=>{ov(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,uv=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,p,y=_2;for(;d--;)h=l[d],p=y.get(h),p===void 0&&y.set(h,p=d?new Map:b2(e)),y=p;return p};uv();const qd={http:$E,xhr:m2,fetch:{get:uv}};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,p])=>`adapter ${h} `+(p===!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 cv={getAdapter:k2,adapters:qd};function cc(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _s(null,t)}function Ug(t){return cc(t),t.headers=kt.from(t.headers),t.data=uc.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),cv.getAdapter(t.adapter||qi.adapter,t)(t).then(function(i){return cc(t),i.data=uc.call(t,t.transformResponse,i),i.headers=kt.from(i.headers),i},function(i){return iv(i)||(cc(t),i&&i.response&&(i.response.data=uc.call(t,t.transformResponse,i.response),i.response.headers=kt.from(i.response.headers))),Promise.reject(i)})}const dv="1.13.2",Wa={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Wa[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const $g={};Wa.transitional=function(e,n,i){function o(l,u){return"[Axios v"+dv+"] 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}};Wa.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:Wa},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 p=[];this.interceptors.response.forEach(function(S){p.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(...p),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=p.length;v<w;)y=y.then(p[v++],p[v++]);return y}getUri(e){e=Er(this.defaults,e);const n=av(e.baseURL,e.url,e.allowAbsoluteUrls);return nv(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 hv{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 hv(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 fv(t){const e=new _r(t),n=q0(_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 fv(Er(t,o))},n}const Re=fv(qi);Re.Axios=_r;Re.CanceledError=_s;Re.CancelToken=T2;Re.isCancel=iv;Re.VERSION=dv;Re.toFormData=qa;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=>sv(M.isHTMLForm(t)?new FormData(t):t);Re.getAdapter=cv.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 Ha(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{p(i.next(y))}catch(v){u(v)}}function h(y){try{p(i.throw(y))}catch(v){u(v)}}function p(y){y.done?l(y.value):o(y.value).then(d,h)}p((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:p,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;p&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",S=p):typeof p=="string"?(w["Content-Type"]="text/plain",S=p):typeof FormData<"u"&&p instanceof FormData?S=p:(w["Content-Type"]="application/json",S=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?S=JSON.stringify(p):S=p;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,p=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,p=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,p=200,y="OK")}catch{l.status===404&&S===""?(p=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,p=200,y="OK"),u&&n.shouldThrowOnError)throw new O2(u)}return{error:u,data:d,count:h,status:p,statusText:y}});return this.shouldThrowOnError||(o=o.catch(l=>{var u;let d="";const h=l?.cause;if(h){var p,y,v,w;const b=(p=h?.message)!==null&&p!==void 0?p:"",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}},TT=class extends ET{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 Fg=new RegExp("[,()]");var ss=class extends TT{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"&&Fg.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"&&Fg.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}},jT=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})}},CT=class f0{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 jT(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new f0(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 NT{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}},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(p=>/\s/.test(p)&&!l?"":(p==='"'&&(l=!l),p)).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,p)=>h.concat(Object.keys(p)),[]);if(d.length>0){const h=[...new Set(d)].map(p=>`"${p}"`);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 p=t.reduce((y,v)=>y.concat(Object.keys(v)),[]);if(p.length>0){const y=[...new Set(p)].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 pv{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 pv(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 p;const y=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(y)),v=i&&Object.values(n).some(y);v?(d="POST",p=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",p=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:p,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:
|
|
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 AT="2.91.0",PT=`realtime-js/${AT}`,RT="1.0.0",p0="2.0.0",Bg=p0,Kc=1e4,OT=1e3,IT=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 Gc;(function(t){t.websocket="websocket"})(Gc||(Gc={}));var gr;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(gr||(gr={}));class DT{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 m0{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 zg=(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]=LT(u,t,e,o),l),{}):{}},LT=(t,e,n,i)=>{const o=e.find(d=>d.name===t),l=o?.type,u=n[t];return l&&!i.includes(l)?g0(l,u):Jc(u)},g0=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return VT(e,n)}switch(t){case Pe.bool:return MT(e);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return UT(e);case Pe.json:case Pe.jsonb:return $T(e);case Pe.timestamp:return FT(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 Jc(e);default:return Jc(e)}},Jc=t=>t,MT=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},UT=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},$T=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},VT=(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=>g0(e,d))}return t},FT=t=>typeof t=="string"?t.replace(" ","T"):t,y0=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 dc{constructor(e,n,i={},o=Kc){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 qg;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(qg||(qg={}));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 Wg;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Wg||(Wg={}));var bi;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(bi||(bi={}));var vn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(vn||(vn={}));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 dc(this,Zt.join,this.params,this.timeout),this.rejoinTimer=new m0(()=>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=y0(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?.(vn.CHANNEL_ERROR,_)),this._onClose(()=>e?.(vn.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?.(vn.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?.(vn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(vn.SUBSCRIBED);return}}).receive("error",_=>{this.state=Ze.errored,e?.(vn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(_).join(", ")||"error")))}).receive("timeout",()=>{e?.(vn.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 dc(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 dc(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>IT){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=zg(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=zg(e.columns,e.old_record)),n}}const hc=()=>{},ca={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},BT=[1e3,2e3,5e3,1e4],zT=1e4,qT=`
|
|
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",mv="2.0.0",zg=mv,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:"",p=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(p.length>255)throw new Error(`userEvent length ${p.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+p.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++,p.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(p,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 p=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:p,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 gv{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)?yv(l,u):Gc(u)},yv=(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=>yv(e,d))}return t},Y2=t=>typeof t=="string"?t.replace(" ","T"):t,vv=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 dc{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,(p,y)=>{u[p]||(h[p]=y)}),this.map(u,(p,y)=>{const v=l[p];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[p]=b),S.length>0&&(h[p]=S)}else d[p]=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 p;const y=(p=e[d])!==null&&p!==void 0?p:[];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 p=e[d];if(!p)return;const y=h.map(v=>v.presence_ref);p=p.filter(v=>y.indexOf(v.presence_ref)<0),e[d]=p,o(d,p,h),p.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 vn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(vn||(vn={}));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 dc(this,Zt.join,this.params,this.timeout),this.rejoinTimer=new gv(()=>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=vv(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,p=(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:p,private:h};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(_=>e?.(vn.CHANNEL_ERROR,_)),this._onClose(()=>e?.(vn.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?.(vn.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?.(vn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(vn.SUBSCRIBED);return}}).receive("error",_=>{this.state=Ze.errored,e?.(vn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(_).join(", ")||"error")))}).receive("timeout",()=>{e?.(vn.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 p=await d.json();h=p.error||p.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 p=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);return await((o=p.body)===null||o===void 0?void 0:o.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,d,h;const p=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"),p.receive("ok",()=>l("ok")),p.receive("error",()=>l("error")),p.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 dc(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 dc(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:p,join:y}=Zt;if(i&&[d,h,p,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 hc=()=>{},ua={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Q2=[1e3,2e3,5e3,1e4],X2=1e4,Z2=`
|
|
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
|
|
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=hc,this.ref=0,this.reconnectTimer=null,this.vsn=zg,this.logger=hc,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=vv(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}
|
|
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(OT,"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([qT],{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:PT};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 m0(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:Kc,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:hc,this.vsn=(h=e?.vsn)!==null&&h!==void 0?h:Bg,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=>BT[b-1]||zT),this.vsn){case RT: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 p0: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 HT(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 KT(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 GT(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:i,query:o,body:l,headers:u}){const d=HT(t.baseUrl,i,o),h=await KT(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 JT=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 YT=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}}},QT=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=GT({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new JT(this.client,e),this.tableOps=new YT(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)}},Ka=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 XT=class extends Ka{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}}},Yc=class extends Ka{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Hd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ZT=()=>Response,Qc=t=>{if(Array.isArray(t))return t.map(n=>Qc(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]=Qc(i)}),e},ej=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)},tj=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 nj(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 rj(t){var e=nj(t,"string");return Pi(e)=="symbol"?e:e+""}function sj(t,e,n){return(e=rj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hg(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?Hg(Object(n),!0).forEach(function(i){sj(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hg(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const fc=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)},ij=async(t,e,n)=>{t instanceof await ZT()&&!n?.noResolveJson?t.json().then(i=>{const o=t.status||500,l=i?.statusCode||o+"";e(new XT(fc(i),o,l))}).catch(i=>{e(new Yc(fc(i),i))}):e(new Yc(fc(t),t))},oj=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return t==="GET"||!i?o:(ej(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,oj(e,i,o,l)).then(h=>{if(!h.ok)throw h;return i?.noResolveJson?h:h.json()}).then(h=>u(h)).catch(h=>ij(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 Xc(t,e,n,i,o){return Hi(t,"PUT",e,i,o,n)}async function aj(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 lj=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 v0;v0=Symbol.toStringTag;var uj=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[v0]="BlobDownloadBuilder",this.promise=null}asStream(){return new lj(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 cj={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Kg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var dj=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({},Kg),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"?Xc: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:Kg.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 Xc(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 Ka("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 uj(u,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);try{return{data:Qc(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 aj(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 Yc){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({},cj),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 w0="2.91.0",x0={"X-Client-Info":`storage-js/${w0}`};var hj=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({},x0),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 Xc(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():""}},fj=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=he(he({},x0),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(!tj(t))throw new Ka("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 QT({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/${w0}`,"Content-Type":"application/json"};var b0=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 pc=class extends b0{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}}},pj=class extends b0{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const Jd=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),mj=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)},Gg=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),gj=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 pc(Gg(l),i,u))}).catch(()=>{const l=i+"";e(new pc(o.statusText||`HTTP ${i} error`,i,l))});else{const l=i+"";e(new pc(o.statusText||`HTTP ${i} error`,i,l))}}else e(new pj(Gg(t),t))},yj=(t,e,n,i)=>{const o={method:t,headers:e?.headers||{}};return i?(mj(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 vj(t,e,n,i,o,l){return new Promise((u,d)=>{t(n,yj(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=>gj(h,d,i))})}async function Rt(t,e,n,i,o){return vj(t,"POST",e,i,o,n)}var wj=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}}},xj=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}}},bj=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}}},_j=class extends bj{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Sj(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)}},Sj=class extends wj{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 kj(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},kj=class extends xj{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}))}},Ej=class extends hj{constructor(t,e={},n,i){super(t,e,n,i)}from(t){return new dj(this.url,this.headers,t,this.fetch)}get vectors(){return new _j(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new fj(this.url+"/iceberg",this.headers,this.fetch)}};const _0="2.91.0",is=30*1e3,Zc=3,mc=Zc*is,Tj="http://localhost:9999",jj="supabase.auth.token",Cj={"X-Client-Info":`gotrue-js/${_0}`},ed="X-Supabase-Api-Version",S0={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Nj=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Aj=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 ne(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Pj extends Oi{constructor(e,n,i){super(e,n,i),this.name="AuthApiError",this.status=n,this.code=i}}function Rj(t){return ne(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 Oj(t){return ne(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 Ij(t){return ne(t)&&t.name==="AuthImplicitGrantRedirectError"}class Jg 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 Dj 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 td extends kn{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function gc(t){return ne(t)&&t.name==="AuthRetryableFetchError"}class Yg extends kn{constructor(e,n,i){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=i}}class nd extends kn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Aa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Qg=`
|
|
47
|
-
\r=`.split(""),Lj=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Qg.length;e+=1)t[Qg[e].charCodeAt(0)]=-2;for(let e=0;e<Aa.length;e+=1)t[Aa[e].charCodeAt(0)]=e;return t})();function Xg(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 k0(t,e,n){const i=Lj[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 Zg(t){const e=[],n=u=>{e.push(String.fromCodePoint(u))},i={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{$j(u,i,n)};for(let u=0;u<t.length;u+=1)k0(t.charCodeAt(u),o,l);return e.join("")}function Mj(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 Uj(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}Mj(i,e)}}function $j(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)k0(t.charCodeAt(o),n,i);return new Uint8Array(e)}function Vj(t){const e=[];return Uj(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=>Xg(o,n,i)),Xg(null,n,i),e.join("")}function Fj(t){return Math.round(Date.now()/1e3)+t}function Bj(){return Symbol("auth-callback")}const ot=()=>typeof window<"u"&&typeof document<"u",dr={tested:!1,writable:!1},E0=()=>{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 zj(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 T0=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),qj=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 Ga{constructor(){this.promise=new Ga.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Ga.promiseConstructor=Promise;function yc(t){const e=t.split(".");if(e.length!==3)throw new nd("Invalid JWT structure");for(let i=0;i<e.length;i++)if(!Nj.test(e[i]))throw new nd("JWT not in base64url format");return{header:JSON.parse(Zg(e[0])),payload:JSON.parse(Zg(e[1])),signature:fs(e[2]),raw:{header:e[0],payload:e[1]}}}async function Wj(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Hj(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 Kj(t){return("0"+t.toString(16)).substr(-2)}function Gj(){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,Kj).join("")}async function Jj(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 Yj(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 Jj(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function es(t,e,n=!1){const i=Gj();let o=i;n&&(o+="/PASSWORD_RECOVERY"),await os(t,`${e}-code-verifier`,o);const l=await Yj(i);return[l,i===l?"plain":"s256"]}const Qj=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Xj(t){const e=t.headers.get(ed);if(!e||!e.match(Qj))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Zj(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 e2(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 t2=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ts(t){if(!t2.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function vc(){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 n2(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 ey(t){return JSON.parse(JSON.stringify(t))}const mr=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),r2=[502,503,504];async function ty(t){var e;if(!qj(t))throw new td(mr(t),0);if(r2.includes(t.status))throw new td(mr(t),t.status);let n;try{n=await t.json()}catch(l){throw new yr(mr(l),l)}let i;const o=Xj(t);if(o&&o.getTime()>=S0["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 Yg(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 Yg(mr(n),t.status,n.weak_password.reasons);throw new Pj(mr(n),t.status||500,i)}const s2=(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[ed]||(l[ed]=S0["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 i2(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 i2(t,e,n,i,o,l){const u=s2(e,i,o,l);let d;try{d=await t(n,Object.assign({},u))}catch(h){throw console.error(h),new td(mr(h),0)}if(d.ok||await ty(d),i?.noResolveJson)return d;try{return await d.json()}catch(h){await ty(h)}}function Yt(t){var e;let n=null;l2(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Fj(t.expires_in)));const i=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:i},error:null}}function ny(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 o2(t){return{data:t,error:null}}function a2(t){const{action_link:e,email_otp:n,hashed_token:i,redirect_to:o,verification_type:l}=t,u=Ha(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 ry(t){return t}function l2(t){return t.access_token&&t.refresh_token&&t.expires_in}const wc=["global","local","others"];class u2{constructor({url:e="",headers:n={},fetch:i}){this.url=e,this.headers=n,this.fetch=T0(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=wc[0]){if(wc.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${wc.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(ne(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(ne(i))return{data:{user:null},error:i};throw i}}async generateLink(e){try{const{options:n}=e,i=Ha(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:a2,redirectTo:n?.redirectTo})}catch(n){if(ne(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(ne(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:ry});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(ne(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(ne(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(ne(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(ne(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(ne(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(ne(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:ry});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(ne(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(ne(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(ne(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(ne(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(ne(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(ne(n))return{data:null,error:n};throw n}}}function sy(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const ns={debug:!!(globalThis&&E0()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class j0 extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class c2 extends j0{}async function d2(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 c2(`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 h2(){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 C0(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function f2(t){return parseInt(t,16)}function p2(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,i=>i.toString(16).padStart(2,"0")).join("")}function m2(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 _=
|
|
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 p=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",p)}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(p=>p._isMember(i)).forEach(p=>p._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 gv(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,p,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:hc,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=(p=e?.reconnectAfterMs)!==null&&p!==void 0?p:(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 mv: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),p=await e(d,{method:n,headers:{...l?{"Content-Type":"application/json"}:{},...h,...u},body:l?JSON.stringify(l):void 0}),y=await p.text(),v=(p.headers.get("content-type")||"").includes("application/json"),w=v&&y?JSON.parse(y):y;if(!p.ok){const _=v?w:void 0,b=_?.error;throw new Ai(b?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:b?.type,icebergCode:b?.code,details:_})}return{status:p.status,headers:p.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)}},Ka=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 Ka{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 Ka{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 fc=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(fc(i),o,l))}).catch(i=>{e(new Jc(fc(i),i))}):e(new Jc(fc(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 wv;wv=Symbol.toStringTag;var vT=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[wv]="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 p=o._removeEmptyFolders(e),y=o._getFinalPath(p),v=await(t=="PUT"?Qc:Xt)(o.fetch,`${o.url}/object/${y}`,l,he({headers:d},u?.duplex?{duplex:u.duplex}:{}));return{data:{path:p,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 p=he({upsert:Gg.upsert},i),y=he(he({},o.headers),{"x-upsert":String(p.upsert)});return typeof Blob<"u"&&n instanceof Blob?(h=new FormData,h.append("cacheControl",p.cacheControl),h.append("",n)):typeof FormData<"u"&&n instanceof FormData?(h=n,h.append("cacheControl",p.cacheControl)):(h=n,y["cache-control"]=`max-age=${p.cacheControl}`,y["content-type"]=p.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 Ka("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 xv="2.91.0",bv={"X-Client-Info":`storage-js/${xv}`};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({},bv),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({},bv),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 Ka("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/${xv}`,"Content-Type":"application/json"};var _v=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 pc=class extends _v{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 _v{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 pc(Jg(l),i,u))}).catch(()=>{const l=i+"";e(new pc(o.statusText||`HTTP ${i} error`,i,l))});else{const l=i+"";e(new pc(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 p=h.headers.get("content-type");return!p||!p.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 Sv="2.91.0",is=30*1e3,Xc=3,mc=Xc*is,DT="http://localhost:9999",LT="supabase.auth.token",MT={"X-Client-Info":`gotrue-js/${Sv}`},Zc="X-Supabase-Api-Version",kv={"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 gc(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 Na="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<Na.length;e+=1)t[Na[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(Na[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(Na[i]),e.queuedBits-=6}}function Ev(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)Ev(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)Ev(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},Tv=()=>{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 jv=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 Ga{constructor(){this.promise=new Ga.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Ga.promiseConstructor=Promise;function yc(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 vc(){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()>=kv["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]=kv["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=Ha(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 wc=["global","local","others"];class vj{constructor({url:e="",headers:n={},fetch:i}){this.url=e,this.headers=n,this.fetch=jv(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=wc[0]){if(wc.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${wc.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=Ha(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 p={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]);p[`${k}Page`]=S}),p.total=parseInt(w)),{data:Object.assign(Object.assign({},v),p),error:null}}catch(p){if(re(p))return{data:{users:[]},error:p};throw p}}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 p={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]);p[`${k}Page`]=S}),p.total=parseInt(w)),{data:Object.assign(Object.assign({},v),p),error:null}}catch(p){if(re(p))return{data:{clients:[]},error:p};throw p}}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&&Tv()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Cv extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class wj extends Cv{}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 Nv(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:p,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 _=Nv(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
|
|
|
@@ -56,17 +56,17 @@ Nonce: ${u}`:""}
|
|
|
56
56
|
Issued At: ${l.toISOString()}`;if(o&&(E+=`
|
|
57
57
|
Expiration Time: ${o.toISOString()}`),d&&(E+=`
|
|
58
58
|
Not Before: ${d.toISOString()}`),h&&(E+=`
|
|
59
|
-
Request ID: ${h}`),
|
|
60
|
-
Resources:`;for(const N of
|
|
59
|
+
Request ID: ${h}`),p){let P=`
|
|
60
|
+
Resources:`;for(const N of p){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 g2({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(N0(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 y2({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(N0(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 v2{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 w2=new v2;function x2(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=Ha(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 b2(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=Ha(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 _2(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 S2(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 N0(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function iy(){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 k2(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:g2({error:e,options:t})}}}async function E2(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:y2({error:e,options:t})}}}const T2={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},j2={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 C2(t,e){return Ra(T2,t,e||{})}function N2(t,e){return Ra(j2,t,e||{})}class A2{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??w2.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=C2(u.webauthn.credential_options.publicKey,l?.create),{data:y,error:v}=await k2({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=N2(u.webauthn.credential_options.publicKey,l?.request),{data:y,error:v}=await E2(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 ne(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(!iy())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 ne(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(!iy())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 ne(u)?{data:null,error:u}:{data:null,error:new yr("Unexpected error in register",u)}}}}h2();const P2={url:Tj,storageKey:jj,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Cj,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function oy(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({},P2),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 u2({url:l.url,headers:l.headers,fetch:l.fetch}),this.url=l.url,this.headers=l.headers,this.fetch=T0(l.fetch),this.lock=l.lock||oy,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=d2:this.lock=oy,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 A2(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:E0()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=sy(this.memoryStorage)),l.userStorage&&(this.userStorage=l.userStorage)):(this.memoryStorage={},this.storage=sy(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} (${_0}) ${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=zj(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),Ij(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 ne(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(ne(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`),ne(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:ny})}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:ny})}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(ne(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=C0(V[0]);let $=(i=P?.signInWithEthereum)===null||i===void 0?void 0:i.chainId;if(!$){const Y=await N.request({method:"eth_chainId"});$=f2(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};_=m2(B),b=await N.request({method:"personal_sign",params:[p2(_),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(ne(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(ne(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 Dj;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`),ne(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(ne(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`),ne(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(ne(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:o2});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`),ne(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(ne(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(ne(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()<mc:!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=vc()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};e.user=n2(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(ne(n))return Oj(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`),ne(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}=yc(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(ne(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(ne(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 Jg("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 Jg("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(ne(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&&!(Rj(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=Bj(),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`),ne(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(ne(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(ne(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`),ne(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(ne(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 Hj(async o=>(o>0&&await Wj(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&&gc(l)&&Date.now()+u-i<is})}catch(i){if(this._debug(n,"error",i),ne(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:vc()}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=vc()}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()<mc;if(this._debug(i,`session has${l?"":" not"} expired with margin of ${mc}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),gc(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 Ga;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),ne(l)){const u={data:null,error:l};return gc(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=ey(o);await os(this.storage,this.storageKey,l)}else{const o=ey(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 ${Zc} ticks`),o<=Zc&&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 j0)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(ne(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(ne(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"?_2(e.webauthn.credential_response):S2(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(ne(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:x2(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:b2(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(ne(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}=yc(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(ne(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(ne(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(ne(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(ne(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(ne(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+Aj>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}}=yc(i);n?.allowExpired||Zj(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=e2(o.alg),v=await crypto.subtle.importKey("jwk",m,y,!0,["verify"]);if(!await crypto.subtle.verify(y,v,u,Vj(`${d}.${h}`)))throw new nd("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(i){if(ne(i))return this._returnResult({data:null,error:i});throw i}}}Ii.nextInstanceID={};const R2=Ii,O2="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 I2={"X-Client-Info":`supabase-js-${mi}/${O2}`},D2={headers:I2},L2={schema:"public"},M2={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},U2={};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 $2(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 V2(t){var e=$2(t,"string");return Di(e)=="symbol"?e:e+""}function F2(t,e,n){return(e=V2(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ay(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?ay(Object(n),!0).forEach(function(i){F2(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ay(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}const B2=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),z2=()=>Headers,q2=(t,e,n)=>{const i=B2(n),o=z2();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 W2(t){return t.endsWith("/")?t:t+"/"}function H2(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 K2(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(W2(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var G2=class extends R2{constructor(t){super(t)}},J2=class{constructor(t,e,n){var i,o;this.supabaseUrl=t,this.supabaseKey=e;const l=K2(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:L2,realtime:U2,auth:qe(qe({},M2),{},{storageKey:u}),global:D2},h=H2(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=q2(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 CT(new URL("rest/v1",l).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new Ej(this.storageUrl.href,this.headers,this.fetch,n?.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new ST(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 G2({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 WT(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 Y2=(t,e,n)=>new J2(t,e,n);function Q2(){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}Q2()&&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 Ja="alchemy_supabase_config";function Yd(){try{const t=localStorage.getItem(Ja);if(t)return JSON.parse(t)}catch(t){console.error("Error reading Supabase config:",t)}return null}function X2(t){try{localStorage.setItem(Ja,JSON.stringify(t))}catch(e){console.error("Error saving Supabase config:",e)}}function Z2(){try{localStorage.removeItem(Ja)}catch(t){console.error("Error clearing Supabase config:",t)}}async function eC(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 tC(){return localStorage.getItem(Ja)?"ui":"none"}const Qd=Yd(),nC=Qd?.url||void 0||"https://placeholder.supabase.co",rC=Qd?.anonKey||void 0||"placeholder",me=Y2(nC,rC,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),ly=!!Qd?.url;function sC({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 Aa 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(Av(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(Av(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=Ha(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 p=i[h];d.excludeCredentials[h]=Object.assign(Object.assign({},p),{id:fs(p.id).buffer,type:p.type||"public-key",transports:p.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=Ha(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 Av(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 Aa("Browser returned unexpected credential type",e)}:{data:null,error:new Aa("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 Aa("Browser returned unexpected credential type",e)}:{data:null,error:new Aa("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 Pa(...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]=Pa(d,u):i[l]=Pa(u)}else i[l]=u}return i}function Mj(t,e){return Pa(Dj,t,e||{})}function Uj(t,e){return Pa(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:p}=u.webauthn.credential_options.publicKey;p.name||(p.name=`${p.id}:${i}`),p.displayName||(p.displayName=p.name)}switch(u.webauthn.type){case"create":{const p=Mj(u.webauthn.credential_options.publicKey,l?.create),{data:y,error:v}=await Oj({publicKey:p,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 p=Uj(u.webauthn.credential_options.publicKey,l?.request),{data:y,error:v}=await Ij(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:p,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:p}=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:p}}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=jv(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:Tv()?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} (${Sv}) ${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,p=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:p,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,p=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:p,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,p,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=Nv(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:(p=P?.signInWithEthereum)===null||p===void 0?void 0:p.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,p,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}`]:[],...!((p=N?.signInWithSolana)===null||p===void 0)&&p.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:p}=d;if(p)return this._returnResult({data:{user:null,session:null},error:p});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:p})}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 p=null,y=null;this.flowType==="pkce"&&([p,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:p,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:p,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:p?.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,p=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:p,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 p=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=p.data)===null||l===void 0)&&l.url&&ot()&&!(!((u=e.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}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()<mc:!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=vc()}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:p,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=p.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}=yc(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:p}=e;if(!l||!d||!u||!p)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:p,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,p,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=(p=v.session)===null||p===void 0?void 0:p.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:p,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:p,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&&gc(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:vc()}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=vc()}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()<mc;if(this._debug(i,`session has${l?"":" not"} expired with margin of ${mc}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(console.error(u),gc(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 Ga;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 gc(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 Cv)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:p}=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 p?this._returnResult({data:null,error:p}):(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}=yc(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 p=l.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:p},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}}=yc(i);n?.allowExpired||lj(l.exp);const p=!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(!p){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",p,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 p=new o(u?.headers);return p.has("apikey")||p.set("apikey",t),p.has("Authorization")||p.set("Authorization",`Bearer ${h}`),i(l,qe(qe({},u),{},{headers:p}))}};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:p,realtime:y,global:v}=e,w={db:qe(qe({},h),o),auth:qe(qe({},p),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 p;this.auth=this._initSupabaseAuthClient((p=h.auth)!==null&&p!==void 0?p:{},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:p},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:p,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 Ja="alchemy_supabase_config";function Yd(){try{const t=localStorage.getItem(Ja);if(t)return JSON.parse(t)}catch(t){console.error("Error reading Supabase config:",t)}return null}function aC(t){try{localStorage.setItem(Ja,JSON.stringify(t))}catch(e){console.error("Error saving Supabase config:",e)}}function lC(){try{localStorage.removeItem(Ja)}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(Ja)?"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),p=(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 m.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:t}).map((w,_)=>m.jsx("input",{ref:b=>{u.current[_]=b},type:"text",inputMode:"numeric",maxLength:1,value:e[_]||"",onChange:b=>p(_,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 iC({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(_n,{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(sC,{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(rm,{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(u1,{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(l1,{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(v1,{size:18}):p.jsx(rm,{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(i1,{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(Hx,{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 oC(t){const e=t.trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}.supabase.co`:""}function A0({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=oC(l),S=d.trim(),k=await eC(b,S);k.valid?(X2({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(_n,{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(Ia,{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(Kx,{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(wn,{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(sd,{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(t1,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:p.jsx(Gu,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:p.jsx(Gu,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:p.jsx(Gu,{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 aC({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(kc,{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(wn,{size:12,className:"animate-spin"}):p.jsx(kc,{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(r1,{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(wn,{size:16,className:"animate-spin"}):p.jsx(h1,{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(_n,{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 P0=R.createContext(void 0);function lC({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(P0.Provider,{value:{showToast:i},children:[t,p.jsx(uC,{toasts:e})]})}function R0(){const t=R.useContext(P0);if(!t)throw new Error("useToast must be used within ToastProvider");return t}function uC({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(_n,{children:t.map(e=>p.jsx(cC,{toast:e},e.id))})})}function cC({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(hy,{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 dC(){const{showToast:t}=R0(),[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(dy,{size:14})," LLM Configuration"]}),p.jsxs("div",{className:"glass p-8 space-y-6",children:[p.jsx(xc,{label:"Provider URL (Base)",value:e,onChange:n,placeholder:"http://localhost:11434 or https://api.openai.com/v1"}),p.jsx(xc,{label:"Intelligence Model",value:i,onChange:o,placeholder:"llama3, gpt-4o, claude-3-5-sonnet..."}),p.jsx(xc,{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(wn,{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(wn,{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(aC,{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(wn,{size:18,className:"animate-spin"}):p.jsx(ba,{size:18}),"Save Browser Sources"]})})]})]})})]})})]})}function xc({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 O0=R.createContext(null);function hC({children:t}){const[e,n]=R.useState(!1),i=()=>n(!0),o=()=>n(!1);return p.jsx(O0.Provider,{value:{isExpanded:e,setIsExpanded:n,openTerminal:i,closeTerminal:o},children:t})}function fC(){const t=R.useContext(O0);if(!t)throw new Error("useTerminal must be used within a TerminalProvider");return t}function pC({isExpanded:t,onToggle:e}={}){const[n,i]=R.useState([]),{isExpanded:o,setIsExpanded:l}=fC(),[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(Yx,{size:14,className:"text-fg/40"});switch(_){case"analysis":return p.jsx(Jx,{size:14,className:"text-primary"});case"action":return p.jsx(kr,{size:14,className:"text-accent"});case"error":return p.jsx(qx,{size:14,className:"text-error"});case"system":return p.jsx(id,{size:14,className:"text-success"});default:return p.jsx(hy,{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(Ec,{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(zx,{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(c1,{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(e1,{size:12}):p.jsx(_c,{size:12}),u[_.id]?"Hide Details":"View Details"]}),p.jsx(_n,{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(Ec,{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 I0="1.0.0",mC="20260125000004";async function gC(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:I0,latestMigrationTimestamp:e||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function yC(t){const e=I0,n=mC,i=await gC(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 vC(){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(bc,{active:t==="profile",onClick:()=>e("profile"),icon:p.jsx(od,{size:18}),label:"Profile"}),p.jsx(bc,{active:t==="security",onClick:()=>e("security"),icon:p.jsx(fy,{size:18}),label:"Security"}),p.jsx(bc,{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(wC,{}),t==="security"&&p.jsx(xC,{}),t==="supabase"&&p.jsx(bC,{})]})]})]})}function wC(){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(Xx,{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(wn,{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(im,{size:20,className:"text-primary"}):p.jsx(om,{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(im,{size:18}):p.jsx(om,{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(sm,{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(sm,{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(wn,{size:18,className:"animate-spin"}):p.jsx(ba,{size:18}),"Preserve Profile"]})})]})}function xC(){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(o1,{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(wn,{size:18,className:"animate-spin"}):p.jsx(fy,{size:18}),"Rotate Key"]})})]})})}function bC(){const[t,e]=R.useState(!1),[n,i]=R.useState(null),o=Yd(),l=tC();R.useEffect(()=>{o&&yC(me).then(i)},[]);const u=()=>{confirm("Sever connection to this essence? This will reset local resonance.")&&(Z2(),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(sd,{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(y1,{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(A0,{open:t,onComplete:()=>e(!1),canClose:!0})]})}function bc({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 _C({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 pC({onAuthSuccess:t,isInitialized:e=!0}){const[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(""),[h,p]=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 m.jsx("div",{className:"flex flex-col items-center justify-center p-8 h-full bg-gradient-to-t from-bg to-bg/50",children:m.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:[m.jsxs("div",{className:"text-center space-y-2",children:[m.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"}),m.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"})]}),m.jsx("form",{onSubmit:z,className:"space-y-4",children:m.jsxs(_n,{mode:"wait",children:[w&&m.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:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"First Name"}),m.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})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Last Name"}),m.jsx("input",{type:"text",value:h,onChange:B=>p(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"?m.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:[m.jsx("div",{className:"flex justify-center",children:m.jsx(fC,{value:U,onChange:V,length:6,onComplete:B=>{V(B)},error:!!b})}),m.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"}),m.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?m.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):m.jsx(sm,{size:18}),"VERIFY CODE"]})]},"otp-verify"):m.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address"}),m.jsxs("div",{className:"relative",children:[m.jsx(g1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),m.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")&&m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Complexity Key"}),m.jsxs("div",{className:"relative",children:[m.jsx(m1,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),m.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})]})]}),m.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&&m.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),w?m.jsx(j1,{size:18}):m.jsx(sm,{size:18}),w?"INITIALIZE ACCOUNT":k==="otp"?"SEND CODE":"UNSEAL ENGINE"]})]},"base-login")]})}),b&&k==="password"&&m.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}),m.jsxs("div",{className:"space-y-4",children:[!w&&m.jsx("div",{className:"flex flex-col gap-2",children:k==="password"?m.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:[m.jsx(d1,{size:16})," Sign in with Code"]}):m.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:[m.jsx(Gx,{size:16})," Sign in with Password"]})}),m.jsxs("p",{className:"text-center text-xs text-fg/40",children:[w?"Already an Alchemist?":"New to Alchemy?"," "," ",m.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 Pv({onComplete:t,open:e=!0,canClose:n=!1}){const[i,o]=R.useState("welcome"),[l,u]=R.useState(""),[d,h]=R.useState(""),[p,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 m.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-bg/80 backdrop-blur-sm",children:m.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:[m.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"}),m.jsxs(_n,{mode:"wait",children:[i==="welcome"&&m.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:m.jsx(ki,{className:"w-6 h-6 text-primary"})}),m.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Assemble Your Engine"})]}),m.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Alchemy requires a Supabase essence to store signal fragments and intelligence patterns."})]}),m.jsxs("div",{className:"glass bg-white/5 border-white/10 p-4 rounded-xl space-y-3",children:[m.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-primary/70",children:"Requirements:"}),m.jsxs("ul",{className:"space-y-2",children:[m.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[m.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Supabase Project URL"]}),m.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[m.jsx(Si,{className:"w-4 h-4 text-emerald-500"})," Anon Public API Key"]})]})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.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 ",m.jsx(Ia,{size:14})]}),m.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 ",m.jsx(Jx,{size:18})]})]})]},"welcome"),i==="credentials"&&m.jsxs(Ne.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Essence Coordinates"}),m.jsx("p",{className:"text-sm text-fg/50 font-medium lowercase",children:"Link the alchemist engine to your cloud database"})]}),m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Project URL or ID"}),m.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"})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Anon Public Key"}),m.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..."})]})]}),p&&m.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[m.jsx(Li,{className:"w-5 h-5 text-error"}),m.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:p})]}),m.jsxs("div",{className:"flex gap-3",children:[m.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"}),m.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 ",m.jsx(kr,{size:18})]})]})]},"credentials"),i==="validating"&&m.jsxs(Ne.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[m.jsxs("div",{className:"relative",children:[m.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-xl rounded-full"}),m.jsx(wn,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),m.jsxs("div",{className:"text-center space-y-2",children:[m.jsx("h3",{className:"text-xl font-bold italic uppercase tracking-tighter",children:"Validating Link"}),m.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase animate-pulse",children:"Synchronizing Resonance..."})]})]},"validating"),i==="success"&&m.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:[m.jsx("div",{className:"p-4 bg-emerald-500/20 rounded-full",children:m.jsx(rd,{className:"w-16 h-16 text-emerald-500"})}),m.jsxs("div",{className:"text-center space-y-2",children:[m.jsx("h3",{className:"text-2xl font-black italic uppercase tracking-tighter",children:"Engine Aligned"}),m.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase",children:"Restarting Alchemist Subsystems..."})]})]},"success")]})]})})}const qn={chrome:{icon:m.jsx(i1,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:m.jsx(Gu,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:m.jsx(Gu,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:m.jsx(Gu,{size:18}),name:"Microsoft Edge",color:"text-cyan-500"},brave:{icon:m.jsx(kr,{size:18}),name:"Brave",color:"text-orange-400"},arc:{icon:m.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,p]=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 m.jsxs("div",{className:"space-y-6",children:[m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[m.jsx(Sc,{size:14})," Auto-Detect Browsers"]}),m.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?m.jsx(wn,{size:12,className:"animate-spin"}):m.jsx(Sc,{size:12}),n?"Scanning...":"Scan System"]})]}),Object.keys(o).length>0&&m.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 m.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:[m.jsxs("div",{className:"flex items-start justify-between mb-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("div",{className:N.color,children:N.icon}),m.jsx("span",{className:"text-sm font-bold",children:N.name})]}),P?.found&&P?.valid?m.jsx(Si,{size:16,className:"text-success"}):P?.found?m.jsx(Li,{size:16,className:"text-error"}):m.jsx(Sr,{size:16,className:"text-fg/20"})]}),P?.found?m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate mb-2",children:P.path}),P.valid?m.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"}):m.jsx("p",{className:"text-[10px] text-error font-medium",children:P.error})]}):m.jsx("p",{className:"text-[10px] text-fg/30 italic",children:"Not found on this system"})]},E)})})]}),m.jsxs("div",{className:"space-y-3",children:[m.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[m.jsx(l1,{size:14})," Add Custom Path"]}),m.jsxs("div",{className:"glass p-4 rounded-xl space-y-3",children:[m.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[m.jsx("select",{value:h,onChange:E=>p(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=>m.jsx("option",{value:E,children:qn[E].name},E))}),m.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"})]}),m.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?m.jsx(wn,{size:16,className:"animate-spin"}):m.jsx(x1,{size:16}),y?"Validating...":"Add Custom Source"]})]})]}),t.length>0&&m.jsxs("div",{className:"space-y-3",children:[m.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:["Configured Sources (",t.length,")"]}),m.jsx("div",{className:"space-y-2",children:m.jsx(_n,{children:t.map((E,P)=>m.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:[m.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[m.jsx("div",{className:qn[E.browser].color,children:qn[E.browser].icon}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"text-sm font-bold",children:E.label}),m.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate",children:E.path})]})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.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"}),m.jsx("button",{onClick:()=>k(P),className:"p-2 hover:bg-error/10 text-error rounded-lg transition-all",children:m.jsx(Sr,{size:16})})]})]},`${E.browser}-${E.path}`))})})]})]})}const Rv=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(p=>p.id!==u))},3e3)},[]);return m.jsxs(Rv.Provider,{value:{showToast:i},children:[t,m.jsx(vC,{toasts:e})]})}function Ov(){const t=R.useContext(Rv);if(!t)throw new Error("useToast must be used within ToastProvider");return t}function vC({toasts:t}){return m.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none",children:m.jsx(_n,{children:t.map(e=>m.jsx(wC,{toast:e},e.id))})})}function wC({toast:t}){const e={success:m.jsx(Si,{size:18,className:"text-success"}),error:m.jsx(Sr,{size:18,className:"text-error"}),warning:m.jsx(Li,{size:18,className:"text-accent"}),info:m.jsx(fy,{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 m.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],m.jsx("span",{className:"text-sm font-medium flex-1",children:t.message})]})}function xC(){const{showToast:t}=Ov(),[e,n]=R.useState("http://localhost:11434"),[i,o]=R.useState("llama3"),[l,u]=R.useState(""),[d,h]=R.useState([]),[p,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 m.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[m.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Intelligence Engine"}),m.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Fine-tune the Alchemist's cognitive parameters and provider links."})]}),m.jsx("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:m.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[m.jsx("section",{className:"space-y-6",children:m.jsxs("div",{className:"space-y-4",children:[m.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[m.jsx(sd,{size:14})," LLM Configuration"]}),m.jsxs("div",{className:"glass p-8 space-y-6",children:[m.jsx(xc,{label:"Provider URL (Base)",value:e,onChange:n,placeholder:"http://localhost:11434 or https://api.openai.com/v1"}),m.jsx(xc,{label:"Intelligence Model",value:i,onChange:o,placeholder:"llama3, gpt-4o, claude-3-5-sonnet..."}),m.jsx(xc,{label:"Secret Key (Optional)",type:"password",value:l,onChange:u,placeholder:"sk-..."}),m.jsx("div",{className:"p-4 bg-primary/5 rounded-2xl",children:m.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."})}),m.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[m.jsxs("button",{onClick:P,disabled:_||p,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:[_?m.jsx(wn,{size:18,className:"animate-spin"}):m.jsx(kr,{size:18,className:"text-accent"}),"Test Connection"]}),m.jsxs("button",{onClick:k,disabled:p,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:[p?m.jsx(wn,{size:18,className:"animate-spin"}):m.jsx(xa,{size:18}),"Save"]})]})]})]})}),m.jsx("section",{className:"space-y-6",children:m.jsxs("div",{className:"space-y-4",children:[m.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[m.jsx(ki,{size:14})," Browser History Sources"]}),m.jsxs("div",{className:"glass p-8 space-y-6",children:[m.jsx(gC,{sources:d,onChange:h}),m.jsx("div",{className:"flex justify-end pt-2",children:m.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?m.jsx(wn,{size:18,className:"animate-spin"}):m.jsx(xa,{size:18}),"Save Browser Sources"]})})]})]})})]})})]})}function xc({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),m.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 Iv=R.createContext(null);function bC({children:t}){const[e,n]=R.useState(!1),i=()=>n(!0),o=()=>n(!1);return m.jsx(Iv.Provider,{value:{isExpanded:e,setIsExpanded:n,openTerminal:i,closeTerminal:o},children:t})}function _C(){const t=R.useContext(Iv);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,p=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 m.jsx(Zx,{size:14,className:"text-fg/40"});switch(_){case"analysis":return m.jsx(dy,{size:14,className:"text-primary"});case"action":return m.jsx(kr,{size:14,className:"text-accent"});case"error":return m.jsx(Hx,{size:14,className:"text-error"});case"system":return m.jsx(id,{size:14,className:"text-success"});default:return m.jsx(fy,{size:14,className:"text-fg/40"})}};return h?m.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:[m.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(kc,{size:18,className:"text-primary"}),m.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:"Alchemist Engine"}),m.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:[m.jsx(Wx,{size:10})," LIVE"]})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("button",{onClick:()=>i([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:"Clear"}),m.jsx("button",{onClick:p,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:m.jsx(v1,{size:18})})]})]}),m.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[n.length===0&&m.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:"Idle. Awaiting signal mining events..."}),n.map(_=>m.jsxs("div",{className:"relative flex items-start gap-3 group",children:[m.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)}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[m.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(_.created_at||Date.now()).toLocaleTimeString()}),m.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&&m.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:[m.jsx(ps,{size:10}),_.duration_ms,"ms"]})]}),m.jsx("p",{className:`text-sm break-words leading-relaxed ${_.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:_.message}),(_.details||_.metadata)&&m.jsxs("div",{className:"mt-2 text-xs",children:[m.jsxs("button",{onClick:()=>v(_.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[u[_.id]?m.jsx(n1,{size:12}):m.jsx(_c,{size:12}),u[_.id]?"Hide Details":"View Details"]}),m.jsx(_n,{children:u[_.id]&&m.jsx(Ne.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:m.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))]})]}):m.jsxs("button",{onClick:p,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:[m.jsxs("div",{className:"relative",children:[m.jsx(kc,{size:20,className:"text-primary"}),n.length>0&&m.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[m.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),m.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),m.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 Dv="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:Dv,latestMigrationTimestamp:e||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function TC(t){const e=Dv,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 m.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m.jsxs("header",{className:"px-8 py-6 border-b border-border/10",children:[m.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Account Configuration"}),m.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Manage your Alchemist profile and essence links."})]}),m.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[m.jsxs("aside",{className:"w-64 border-r border-border/10 p-4 space-y-1",children:[m.jsx(bc,{active:t==="profile",onClick:()=>e("profile"),icon:m.jsx(od,{size:18}),label:"Profile"}),m.jsx(bc,{active:t==="security",onClick:()=>e("security"),icon:m.jsx(py,{size:18}),label:"Security"}),m.jsx(bc,{active:t==="supabase",onClick:()=>e("supabase"),icon:m.jsx(ki,{size:18}),label:"Supabase"})]}),m.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[t==="profile"&&m.jsx(CC,{}),t==="security"&&m.jsx(NC,{}),t==="supabase"&&m.jsx(AC,{})]})]})]})}function CC(){const[t,e]=R.useState(""),[n,i]=R.useState(""),[o,l]=R.useState(""),[u,d]=R.useState(!1),[h,p]=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){p(!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{p(!1)}}};return m.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[m.jsxs("section",{className:"flex items-start gap-8",children:[m.jsxs("div",{className:"relative group",children:[m.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?m.jsx("img",{src:y,alt:"Avatar",className:"w-full h-full object-cover"}):m.jsx(od,{size:48,className:"text-fg/20"})}),m.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:[m.jsx(t1,{size:24,className:"text-white"}),m.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:k,disabled:h})]}),h&&m.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:m.jsx(wn,{size:24,className:"text-primary animate-spin"})})]}),m.jsxs("div",{className:"flex-1 space-y-4",children:[m.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[m.jsx(Ra,{label:"First Name",value:t,onChange:e,placeholder:"Zosimos"}),m.jsx(Ra,{label:"Last Name",value:n,onChange:i,placeholder:"of Panopolis"})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address (Locked)"}),m.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"})]})]})]}),m.jsxs("section",{className:"glass p-6 space-y-4",children:[m.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[w?m.jsx(om,{size:20,className:"text-primary"}):m.jsx(am,{size:20,className:"text-fg/40"}),"Sound Effects"]}),m.jsx("p",{className:"text-xs text-fg/40",children:"Enable audio feedback for sync events and signal discoveries."}),m.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:m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"font-semibold text-sm",children:w?"Enabled":"Disabled"}),w?m.jsx(om,{size:18}):m.jsx(am,{size:18})]})})]}),m.jsxs("section",{className:"glass p-6 space-y-4",children:[m.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[m.jsx(im,{size:20,className:"text-error"}),"Sign Out"]}),m.jsx("p",{className:"text-xs text-fg/40",children:"End your current session and return to the login screen."}),m.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:m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"font-semibold text-sm",children:"Logout"}),m.jsx(im,{size:18})]})})]}),m.jsx("div",{className:"flex justify-end pt-4 border-t border-border/10",children:m.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?m.jsx(wn,{size:18,className:"animate-spin"}):m.jsx(xa,{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,p]=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),p(!1);const{error:v}=await me.auth.updateUser({password:t});v?d(v.message):(p(!0),e(""),i("")),l(!1)};return m.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:m.jsxs("div",{className:"glass p-6 space-y-6",children:[m.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[m.jsx(h1,{size:20,className:"text-error"})," Update Entropy Key"]}),m.jsxs("div",{className:"space-y-4",children:[m.jsx(Ra,{label:"New Password",type:"password",value:t,onChange:e,placeholder:"••••••••"}),m.jsx(Ra,{label:"Confirm Password",type:"password",value:n,onChange:i,placeholder:"••••••••"})]}),u&&m.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:u}),h&&m.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:"Key rotation successful."}),m.jsx("div",{className:"flex justify-end pt-2",children:m.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?m.jsx(wn,{size:18,className:"animate-spin"}):m.jsx(py,{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 m.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[m.jsxs("section",{className:"space-y-6",children:[m.jsx("div",{className:"flex items-center justify-between",children:m.jsxs("div",{children:[m.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[m.jsx(ki,{size:20,className:"text-primary"})," Essence Resonance"]}),m.jsx("p",{className:"text-xs text-fg/40 font-medium",children:"Bring Your Own Keys (BYOK) for intelligence persistence."})]})}),m.jsx("div",{className:"glass p-8 space-y-8",children:o?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[m.jsx(rd,{className:"w-6 h-6 text-emerald-500 mt-1"}),m.jsxs("div",{className:"flex-1 space-y-1",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:"Established Link"}),n?.latestMigrationTimestamp&&m.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]})]}),m.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:o.url})]})]}),l==="env"&&m.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[m.jsx(Li,{size:16,className:"text-amber-500"}),m.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:"Active from environment variables. UI override enabled."})]}),m.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[m.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:[m.jsx(id,{size:14})," Realign Link"]}),l==="ui"&&m.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:[m.jsx(T1,{size:14})," Sever Link"]})]}),m.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[m.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:"Anon Secret Fragment"}),m.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),"..."]})]})]}):m.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[m.jsx(ki,{size:48,className:"text-fg/10"}),m.jsxs("div",{className:"space-y-2",children:[m.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:"No Essence Resonance"}),m.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:"The Alchemist requires a cloud core to store intelligence fragments."})]}),m.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"})]})})]}),m.jsx(Pv,{open:t,onComplete:()=>e(!1),canClose:!0})]})}function bc({active:t,icon:e,label:n,onClick:i}){return m.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,m.jsx("span",{className:"font-semibold text-sm",children:n})]})}function Ra({label:t,value:e,onChange:n,placeholder:i,type:o="text"}){return m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:t}),m.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}
|
|
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(_n,{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(Ia,{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(cy,{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(nm,{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(nm,{size:16}),"JSON"]})]})]})})})}function SC({isOpen:t,onClose:e}){const{showToast:n}=R0(),[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(Qx,{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(s1,{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(f1,{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 kC(){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(sd,{className:"w-5 h-5 text-success"});case"failed":return p.jsx(am,{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(m1,{className:"w-4 h-4 text-fg/40"});case"error":return p.jsx(am,{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(_c,{className:"w-5 h-5 text-primary shrink-0"}):p.jsx(Sc,{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(_n,{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(_c,{className:"w-4 h-4 text-primary shrink-0"}):p.jsx(Sc,{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(_n,{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(Ia,{className:"w-3 h-3 text-fg/40"})})]},Te))})})})]},Y))})})})]},$.id))})})]})}function EC({signals:t,limit:e=10,onSignalClick:n}){const i=t.slice(0,e),o=u=>u>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":u>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",l=u=>{const d=new Date(u),m=new Date().getTime()-d.getTime(),y=Math.floor(m/6e4),v=Math.floor(m/36e5);return y<1?"Just now":y<60?`${y}m ago`:v<24?`${v}h ago`:d.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return i.length===0?null:p.jsxs("div",{className:"mb-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-3",children:[p.jsx("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:"New Signals"}),p.jsx("button",{className:"text-xs text-blue-400 hover:text-blue-300 transition-colors",children:"View All →"})]}),p.jsx("div",{className:"overflow-x-auto pb-4 -mx-4 px-4",children:p.jsx("div",{className:"flex gap-3 min-w-max",children:i.map(u=>p.jsxs(Ne.button,{onClick:()=>n(u.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 ${o(u.score)}`,children:p.jsx("span",{className:"text-xl font-bold",children:u.score})}),p.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:u.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:l(u.created_at)})]})]},u.id))})})]})}const Li=[{id:"ai",name:"AI & ML",icon:"🤖",color:"blue"},{id:"business",name:"Business",icon:"📊",color:"purple"},{id:"politics",name:"Politics",icon:"🏛️",color:"red"},{id:"technology",name:"Technology",icon:"💻",color:"cyan"},{id:"finance",name:"Finance",icon:"💰",color:"green"},{id:"crypto",name:"Crypto",icon:"₿",color:"orange"},{id:"science",name:"Science",icon:"🔬",color:"teal"},{id:"other",name:"Other",icon:"📌",color:"gray"}];function TC(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 jC(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"other"}function CC({category:t,signalCount:e,latestTimestamp:n,onClick:i}){const o=l=>{const u=new Date(l),h=new Date().getTime()-u.getTime(),m=Math.floor(h/6e4),y=Math.floor(h/36e5),v=Math.floor(h/864e5);return m<60?`${m}m ago`:y<24?`${y}h ago`:v<7?`${v}d ago`:u.toLocaleDateString("en-US",{month:"short",day:"numeric"})};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:"text-5xl mb-4",children:t.icon}),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 ${TC(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)]})]})]})}function NC({signals:t,onCategoryClick:e}){const n=R.useMemo(()=>{const o=new Map;return t.forEach(l=>{const u=l.tags||[],d=jC(u,l.category);if(d){const h=o.get(d)||{count:0,latest:l.created_at};o.set(d,{count:h.count+1,latest:l.created_at>h.latest?l.created_at:h.latest})}u.forEach(h=>{const m=h.toLowerCase();Li.forEach(y=>{if(m.includes(y.id)||m.includes(y.name.toLowerCase())){const v=o.get(y.id)||{count:0,latest:l.created_at};o.set(y.id,{count:v.count+1,latest:l.created_at>v.latest?l.created_at:v.latest})}})})}),o},[t]),i=Li.filter(o=>{const l=n.get(o.id);return l&&l.count>0});return i.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:i.map(o=>{const l=n.get(o.id);return p.jsx(CC,{category:o,signalCount:l.count,latestTimestamp:l.latest,onClick:()=>e(o.id)},o.id)})})}function AC({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(Ia,{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(cy,{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(Wx,{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(Gx,{size:14})})]})]})}function PC({isOpen:t,onClose:e,categoryId:n,signals:i,onOpenUrl:o,onCopyText:l,onArchive:u}){const d=Li.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(_n,{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:[p.jsx("span",{className:"text-4xl",children:d?.icon}),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(AC,{signal:w,onOpen:m,onCopy:y,onArchive:v},w.id))})]})})]})})}function RC({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-4",children:p.jsx(EC,{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-4 pb-2 space-y-3",children:[p.jsxs("div",{className:"relative",children:[p.jsx(kc,{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(n1,{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(NC,{signals:n,onCategoryClick:S=>d(S)})}),p.jsx(PC,{isOpen:!!u,onClose:()=>d(null),categoryId:u||"",signals:n,onOpenUrl:w,onCopyText:_,onArchive:b})]})}class OC{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 OC;function IC(){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(!ly),[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(!ly){_(!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(A0,{onComplete:()=>_(!1)}):h?p.jsx(lC,{children:p.jsx(hC,{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(a1,{size:20}),label:"Discovery",collapsed:k}),p.jsx(pa,{active:o==="engine",onClick:()=>l("engine"),icon:p.jsx(dy,{size:20}),label:"Engine",collapsed:k}),p.jsx(pa,{active:o==="logs",onClick:()=>l("logs"),icon:p.jsx(Ec,{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(g1,{size:18}):p.jsx(d1,{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(Sc,{size:20}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"min-w-[20px] flex justify-center",children:p.jsx(Zx,{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(p1,{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(RC,{onOpenUrl:J=>window.open(J,"_blank","noopener,noreferrer"),onCopyText:J=>{navigator.clipboard.writeText(J)}})]}),o==="engine"&&p.jsx(dC,{}),o==="account"&&p.jsx(vC,{}),o==="logs"&&p.jsx(kC,{}),p.jsx(pC,{isExpanded:B,onToggle:()=>Y(!B)})]}),p.jsx(_C,{signal:P,onClose:()=>N(null)}),p.jsx(SC,{isOpen:U,onClose:()=>V(!1)})]})})}):p.jsx(iC,{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 DC(){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})}DC();Vx.createRoot(document.getElementById("root")).render(p.jsx(_i.StrictMode,{children:p.jsx(IC,{})}));
|
|
101
|
+
${t.content}`:""}`,h=new Blob([d],{type:"text/markdown"}),p=URL.createObjectURL(h),y=document.createElement("a");y.href=p,y.download=`${t.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,y.click(),URL.revokeObjectURL(p)},u=()=>{const d=JSON.stringify(t,null,2),h=new Blob([d],{type:"application/json"}),p=URL.createObjectURL(h),y=document.createElement("a");y.href=p,y.download=`signal_${t.id}.json`,y.click(),URL.revokeObjectURL(p)};return m.jsx(_n,{children:m.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:m.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:[m.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[m.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[m.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[m.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"}),m.jsx("span",{className:`text-3xl font-black ${t.score>=80?"text-accent":"text-fg/40"}`,children:t.score})]}),m.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:t.title}),m.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(t.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),m.jsx("button",{onClick:e,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:m.jsx(Sr,{size:24})})]}),m.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[t.url&&m.jsxs("div",{className:"space-y-2",children:[m.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),m.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:[m.jsx(Ia,{size:16,className:"flex-shrink-0"}),m.jsx("span",{className:"truncate",children:t.url}),m.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),t.entities&&t.entities.length>0&&m.jsxs("div",{className:"space-y-2",children:[m.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),m.jsx("div",{className:"flex flex-wrap gap-2",children:t.entities.map(d=>m.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:d},d))})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),m.jsx("div",{className:"p-4 glass rounded-xl",children:m.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:t.summary})})]}),t.content&&m.jsxs("div",{className:"space-y-2",children:[m.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),m.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:m.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:t.content})})]})]}),m.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[m.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?m.jsx(Si,{size:16,className:"text-success"}):m.jsx(hy,{size:16}),n?"Copied!":"Copy"]}),m.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:[m.jsx(rm,{size:16}),"Markdown"]}),m.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:[m.jsx(rm,{size:16}),"JSON"]})]})]})})})}function RC({isOpen:t,onClose:e}){const{showToast:n}=Ov(),[i,o]=R.useState(""),[l,u]=R.useState(50),[d,h]=R.useState(!1),[p,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?m.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:m.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:[m.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[m.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),m.jsx("button",{onClick:e,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:m.jsx(Sr,{className:"w-5 h-5"})})]}),m.jsxs("div",{className:"p-6 space-y-6",children:[m.jsxs("div",{className:"space-y-3",children:[m.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[m.jsx(e1,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),m.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"}),m.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."})]}),m.jsxs("div",{className:"space-y-3",children:[m.jsxs("div",{className:"flex justify-between items-center",children:[m.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[m.jsx(u1,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),m.jsx("span",{className:"text-sm font-mono text-primary",children:l})]}),m.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"}),m.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[m.jsx("span",{children:"Quick (5)"}),m.jsx("span",{children:"Balanced (50)"}),m.jsx("span",{children:"Thorough (200)"})]})]}),m.jsxs("div",{className:"pt-4 border-t border-border/10",children:[m.jsxs("button",{onClick:_,disabled:p,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:[m.jsx(b1,{size:16,className:p?"animate-spin":""}),p?"Resetting...":"Reset Checkpoint"]}),m.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'})]}),m.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:m.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.'})})]}),m.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[m.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"}),m.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:[m.jsx(xa,{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,p]=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}p(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 m.jsx(rd,{className:"w-5 h-5 text-success"});case"failed":return m.jsx(lm,{className:"w-5 h-5 text-error"});case"partial":return m.jsx(Li,{className:"w-5 h-5 text-warning"});default:return m.jsx(ps,{className:"w-5 h-5 text-fg/40"})}},z=$=>{switch($){case"signal":return m.jsx(kr,{className:"w-4 h-4 text-primary"});case"skipped":return m.jsx(S1,{className:"w-4 h-4 text-fg/40"});case"error":return m.jsx(lm,{className:"w-4 h-4 text-error"});default:return null}};return n?m.jsx("div",{className:"flex items-center justify-center h-full",children:m.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):m.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[m.jsxs("div",{className:"mb-6",children:[m.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),m.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"})]}),m.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:t.length===0?m.jsxs("div",{className:"text-center py-12 text-fg/40",children:[m.jsx(ps,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),m.jsx("p",{children:"No sync runs yet"})]}):m.jsx("div",{className:"space-y-2",children:t.map($=>m.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[m.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?m.jsx(_c,{className:"w-5 h-5 text-primary shrink-0"}):m.jsx(nm,{className:"w-5 h-5 text-fg/40 shrink-0"}),V($.status),m.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),m.jsx("div",{className:"text-sm font-mono",children:new Date($.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),m.jsx("div",{className:"text-sm font-mono",children:U($.duration_ms)})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),m.jsx("div",{className:"text-sm font-semibold text-primary",children:$.signals_found})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),m.jsx("div",{className:"text-sm font-semibold text-fg/60",children:$.skipped})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),m.jsx("div",{className:"text-sm font-semibold",children:$.urls_processed})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),m.jsx("div",{className:`text-sm font-semibold ${$.errors>0?"text-error":"text-fg/40"}`,children:$.errors})]})]})]}),m.jsx(_n,{children:o===$.id&&m.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:m.jsx("div",{className:"p-4 bg-black/10 space-y-2",children:b?m.jsx("div",{className:"flex items-center justify-center py-8",children:m.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?m.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((B,Y)=>m.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[m.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?m.jsx(_c,{className:"w-4 h-4 text-primary shrink-0"}):m.jsx(nm,{className:"w-4 h-4 text-fg/40 shrink-0"}),m.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[m.jsxs("div",{className:"flex-1",children:[m.jsx("div",{className:"text-sm font-semibold",children:B.label}),m.jsx("div",{className:"text-xs text-fg/40",children:B.browser})]}),m.jsxs("div",{className:"text-right",children:[m.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),m.jsx("div",{className:"text-sm font-semibold",children:B.urls_found})]}),m.jsxs("div",{className:"text-right",children:[m.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),m.jsx("div",{className:"text-sm font-mono",children:U(B.duration_ms)})]})]})]}),m.jsx(_n,{children:u===B.label&&m.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:m.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?m.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)=>m.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[z(oe.result),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:oe.url}),oe.result==="signal"&&m.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",oe.score,"%) - ",oe.category]}),oe.result==="skipped"&&m.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",oe.score,"%) - ",oe.reason]}),oe.result==="error"&&m.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",oe.reason]})]}),m.jsx("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:ve=>ve.stopPropagation(),children:m.jsx(Ia,{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=u=>u>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":u>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",l=u=>{const d=new Date(u),p=new Date().getTime()-d.getTime(),y=Math.floor(p/6e4),v=Math.floor(p/36e5);return y<1?"Just now":y<60?`${y}m ago`:v<24?`${v}h ago`:d.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return i.length===0?null:m.jsxs("div",{className:"mb-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsx("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:"New Signals"}),m.jsx("button",{className:"text-xs text-blue-400 hover:text-blue-300 transition-colors",children:"View All →"})]}),m.jsx("div",{className:"overflow-x-auto pb-4 -mx-4 px-4",children:m.jsx("div",{className:"flex gap-3 min-w-max",children:i.map(u=>m.jsxs(Ne.button,{onClick:()=>n(u.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:[m.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${o(u.score)}`,children:m.jsx("span",{className:"text-xl font-bold",children:u.score})}),m.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:u.title}),m.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[m.jsx(ps,{size:10}),m.jsx("span",{children:l(u.created_at)})]})]},u.id))})})]})}const Oa=[{id:"ai",name:"AI & ML",icon:dy,color:"blue",priority:1},{id:"business",name:"Business",icon:Xx,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:Yx,color:"orange",priority:1},{id:"science",name:"Science",icon:y1,color:"teal",priority:1}],Lv={id:"other",name:"Other",icon:E1,color:"gray",priority:3},DC=[...Oa,Lv];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=Oa.find(i=>i.id===e.toLowerCase());if(n)return n.id}for(const n of t){const i=n.toLowerCase(),o=Oa.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),p=new Date().getTime()-d.getTime(),y=Math.floor(p/6e4),v=Math.floor(p/36e5),w=Math.floor(p/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 m.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:[m.jsx("div",{className:"mb-4",children:m.jsx(l,{size:40,className:"text-current opacity-80"})}),m.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:t.name}),m.jsxs("div",{className:"flex items-center justify-between text-sm",children:[m.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${LC(t.color)}`,children:[e," ",e===1?"signal":"signals"]}),m.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[m.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(p=>{const y=p.tags||[],v=MC(y,p.category);if(v){const w=o.get(v)||{count:0,latest:p.created_at};o.set(v,{count:w.count+1,latest:p.created_at>w.latest?p.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:p.created_at};o.set(_,{count:b.count+1,latest:p.created_at>b.latest?p.created_at:b.latest})}})});const u=Array.from(l.entries()).filter(([p,y])=>y>=$C).map(([p,y])=>({id:p,name:p.charAt(0).toUpperCase()+p.slice(1),icon:c1,color:"gray",priority:2}));return{categories:[...Oa,...u,Lv].filter(p=>{const y=o.get(p.id);return y&&y.count>0}).sort((p,y)=>p.priority-y.priority),categoryCounts:o}},[t]);return n.length===0?m.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[m.jsx("p",{className:"font-medium italic",children:"No categories yet."}),m.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):m.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 m.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",p=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 m.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:[m.jsxs("div",{className:"flex items-start justify-between",children:[m.jsx("div",{className:"flex items-center gap-3",children:m.jsxs("div",{className:`flex flex-col items-center justify-center w-16 h-16 rounded-full border-2 ${d(t.score)}`,children:[m.jsx("span",{className:"text-2xl font-bold",children:t.score}),m.jsx("span",{className:"text-[10px] font-medium opacity-70",children:h(t.score)})]})}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.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:[p(t.category)," ",t.category]}),m.jsxs("span",{className:"text-xs text-fg/50 flex items-center gap-1",children:[m.jsx(ps,{size:12}),y(t.created_at)]})]})]}),m.jsxs("div",{className:"flex-1",children:[m.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}),m.jsx("p",{className:"text-sm text-fg/70 line-clamp-3",children:t.summary})]}),t.entities&&t.entities.length>0&&m.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.entities.slice(0,4).map((v,w)=>m.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&&m.jsxs("span",{className:"px-2 py-1 text-fg/40 text-xs",children:["+",t.entities.length-4," more"]})]}),m.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-white/5",children:[m.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:[m.jsx(Ia,{size:14}),m.jsx("span",{children:"Open"})]}),m.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:[m.jsx(hy,{size:14}),m.jsx("span",{children:"Copy"})]}),m.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:[m.jsx(Kx,{size:14}),m.jsx("span",{children:"Archive"})]}),o&&m.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:m.jsx(Qx,{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}),p=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 m.jsx(_n,{children:t&&m.jsxs(m.Fragment,{children:[m.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"}),m.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:m.jsxs("div",{className:"p-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-6 sticky top-0 bg-bg pb-4 border-b border-white/10",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("span",{className:"text-4xl",children:d?.icon}),m.jsxs("div",{children:[m.jsx("h2",{className:"text-2xl font-bold",children:d?.name}),m.jsxs("p",{className:"text-sm text-fg/50",children:[h.length," ",h.length===1?"signal":"signals"]})]})]}),m.jsx("button",{onClick:e,className:"p-2 hover:bg-white/10 rounded transition-colors","aria-label":"Close drawer",children:m.jsx(Sr,{size:24})})]}),m.jsx("div",{className:"space-y-4",children:h.length===0?m.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:m.jsx("p",{className:"italic",children:"No signals in this category yet."})}):h.map(w=>m.jsx(FC,{signal:w,onOpen:p,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,p]=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 m.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m.jsx("div",{className:"px-4 pt-4",children:m.jsx(IC,{signals:n,limit:10,onSignalClick:S=>{const k=n.find(E=>E.id===S);k&&k.category&&d(k.category.toLowerCase())}})}),m.jsxs("div",{className:"px-4 pt-4 pb-2 space-y-3",children:[m.jsxs("div",{className:"relative",children:[m.jsx(Sc,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),m.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:h,onChange:S=>p(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&&m.jsx("button",{onClick:()=>p(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:m.jsx(Sr,{size:16})})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx(a1,{className:"w-3.5 h-3.5 text-fg/40"}),m.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=>m.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))]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 custom-scrollbar",children:o?m.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:m.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):m.jsx(VC,{signals:n,onCategoryClick:S=>d(S)})}),m.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,p]=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();p(se?.user??null)}catch(j){console.error("[App] Status check failed:",j)}finally{v(!1)}})();const{data:{subscription:K}}=me.auth.onAuthStateChange((j,D)=>{p(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?m.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:m.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):w?m.jsx(Pv,{onComplete:()=>_(!1)}):h?m.jsx(yC,{children:m.jsx(bC,{children:m.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[m.jsxs(Ne.aside,{animate:{width:k?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[m.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${k?"justify-center":""}`,children:[m.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:m.jsx(kr,{className:"text-white fill-current",size:24})}),!k&&m.jsx(Ne.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),m.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[m.jsx(fa,{active:o==="discovery",onClick:()=>l("discovery"),icon:m.jsx(p1,{size:20}),label:"Discovery",collapsed:k}),m.jsx(fa,{active:o==="engine",onClick:()=>l("engine"),icon:m.jsx(sd,{size:20}),label:"Engine",collapsed:k}),m.jsx(fa,{active:o==="logs",onClick:()=>l("logs"),icon:m.jsx(kc,{size:20}),label:"System Logs",collapsed:k}),m.jsx(fa,{active:o==="account",onClick:()=>l("account"),icon:m.jsx(od,{size:20}),label:"Account",collapsed:k})]}),m.jsx("div",{className:"px-3 pb-2",children:m.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:[m.jsx("div",{className:"min-w-[20px] flex justify-center",children:ve==="dark"?m.jsx(k1,{size:18}):m.jsx(w1,{size:18})}),!k&&m.jsx(Ne.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:ve==="dark"?"Light Mode":"Dark Mode"})]})}),m.jsx("div",{className:"px-3 pb-3",children:m.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?m.jsx(s1,{size:20}):m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"min-w-[20px] flex justify-center",children:m.jsx(r1,{size:20})}),m.jsx("span",{children:"Collapse"})]})})})]}),m.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&m.jsxs(m.Fragment,{children:[m.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[m.jsxs("div",{children:[m.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),m.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),m.jsxs("div",{className:"flex gap-2",children:[m.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:[m.jsx(_1,{size:16}),m.jsxs("div",{className:"flex flex-col items-start",children:[m.jsx("span",{children:"Sync Settings"}),(Oe.sync_start_date||Oe.last_sync_checkpoint)&&m.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"})}`:""})]})]}),m.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:[m.jsx(id,{size:16,className:z?"animate-spin":""}),z?"Syncing...":"Sync History"]})]})]}),m.jsx(zC,{onOpenUrl:J=>window.open(J,"_blank","noopener,noreferrer"),onCopyText:J=>{navigator.clipboard.writeText(J)}})]}),o==="engine"&&m.jsx(xC,{}),o==="account"&&m.jsx(jC,{}),o==="logs"&&m.jsx(OC,{}),m.jsx(SC,{isExpanded:B,onToggle:()=>Y(!B)})]}),m.jsx(PC,{signal:P,onClose:()=>N(null)}),m.jsx(RC,{isOpen:U,onClose:()=>V(!1)})]})})}):m.jsx(pC,{onAuthSuccess:()=>pe(),isInitialized:b})}function fa({active:t,icon:e,label:n,onClick:i,collapsed:o}){return m.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":""}):m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"min-w-[20px] flex justify-center",children:_i.cloneElement(e,{className:t?"text-primary":""})}),m.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();Bx.createRoot(document.getElementById("root")).render(m.jsx(_i.StrictMode,{children:m.jsx(WC,{})}));
|