@realtimex/realtimex-alchemy 1.0.14 → 1.0.16
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.
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();function ql(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jc={exports:{}},Zi={},Yc={exports:{}},Oe={};var Tg;function Ak(){if(Tg)return Oe;Tg=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.iterator;function v(N){return N===null||typeof N!="object"?null:(N=y&&N[y]||N["@@iterator"],typeof N=="function"?N:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,S={};function _(N,V,C){this.props=N,this.context=V,this.refs=S,this.updater=C||w}_.prototype.isReactComponent={},_.prototype.setState=function(N,V){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,V,"setState")},_.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function E(){}E.prototype=_.prototype;function P(N,V,C){this.props=N,this.context=V,this.refs=S,this.updater=C||w}var j=P.prototype=new E;j.constructor=P,b(j,_.prototype),j.isPureReactComponent=!0;var D=Array.isArray,$=Object.prototype.hasOwnProperty,O={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function q(N,V,C){var X,ve={},ae=null,je=null;if(V!=null)for(X in V.ref!==void 0&&(je=V.ref),V.key!==void 0&&(ae=""+V.key),V)$.call(V,X)&&!z.hasOwnProperty(X)&&(ve[X]=V[X]);var Ae=arguments.length-2;if(Ae===1)ve.children=C;else if(1<Ae){for(var Me=Array(Ae),ot=0;ot<Ae;ot++)Me[ot]=arguments[ot+2];ve.children=Me}if(N&&N.defaultProps)for(X in Ae=N.defaultProps,Ae)ve[X]===void 0&&(ve[X]=Ae[X]);return{$$typeof:e,type:N,key:ae,ref:je,props:ve,_owner:O.current}}function J(N,V){return{$$typeof:e,type:N.type,key:V,ref:N.ref,props:N.props,_owner:N._owner}}function ie(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function re(N){var V={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(C){return V[C]})}var Q=/\/+/g;function ye(N,V){return typeof N=="object"&&N!==null&&N.key!=null?re(""+N.key):V.toString(36)}function ne(N,V,C,X,ve){var ae=typeof N;(ae==="undefined"||ae==="boolean")&&(N=null);var je=!1;if(N===null)je=!0;else switch(ae){case"string":case"number":je=!0;break;case"object":switch(N.$$typeof){case e:case t:je=!0}}if(je)return je=N,ve=ve(je),N=X===""?"."+ye(je,0):X,D(ve)?(C="",N!=null&&(C=N.replace(Q,"$&/")+"/"),ne(ve,V,C,"",function(ot){return ot})):ve!=null&&(ie(ve)&&(ve=J(ve,C+(!ve.key||je&&je.key===ve.key?"":(""+ve.key).replace(Q,"$&/")+"/")+N)),V.push(ve)),1;if(je=0,X=X===""?".":X+":",D(N))for(var Ae=0;Ae<N.length;Ae++){ae=N[Ae];var Me=X+ye(ae,Ae);je+=ne(ae,V,C,Me,ve)}else if(Me=v(N),typeof Me=="function")for(N=Me.call(N),Ae=0;!(ae=N.next()).done;)ae=ae.value,Me=X+ye(ae,Ae++),je+=ne(ae,V,C,Me,ve);else if(ae==="object")throw V=String(N),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return je}function Z(N,V,C){if(N==null)return N;var X=[],ve=0;return ne(N,X,"","",function(ae){return V.call(C,ae,ve++)}),X}function fe(N){if(N._status===-1){var V=N._result;V=V(),V.then(function(C){(N._status===0||N._status===-1)&&(N._status=1,N._result=C)},function(C){(N._status===0||N._status===-1)&&(N._status=2,N._result=C)}),N._status===-1&&(N._status=0,N._result=V)}if(N._status===1)return N._result.default;throw N._result}var le={current:null},H={transition:null},oe={ReactCurrentDispatcher:le,ReactCurrentBatchConfig:H,ReactCurrentOwner:O};function T(){throw Error("act(...) is not supported in production builds of React.")}return Oe.Children={map:Z,forEach:function(N,V,C){Z(N,function(){V.apply(this,arguments)},C)},count:function(N){var V=0;return Z(N,function(){V++}),V},toArray:function(N){return Z(N,function(V){return V})||[]},only:function(N){if(!ie(N))throw Error("React.Children.only expected to receive a single React element child.");return N}},Oe.Component=_,Oe.Fragment=n,Oe.Profiler=o,Oe.PureComponent=P,Oe.StrictMode=r,Oe.Suspense=d,Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=oe,Oe.act=T,Oe.cloneElement=function(N,V,C){if(N==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+N+".");var X=b({},N.props),ve=N.key,ae=N.ref,je=N._owner;if(V!=null){if(V.ref!==void 0&&(ae=V.ref,je=O.current),V.key!==void 0&&(ve=""+V.key),N.type&&N.type.defaultProps)var Ae=N.type.defaultProps;for(Me in V)$.call(V,Me)&&!z.hasOwnProperty(Me)&&(X[Me]=V[Me]===void 0&&Ae!==void 0?Ae[Me]:V[Me])}var Me=arguments.length-2;if(Me===1)X.children=C;else if(1<Me){Ae=Array(Me);for(var ot=0;ot<Me;ot++)Ae[ot]=arguments[ot+2];X.children=Ae}return{$$typeof:e,type:N.type,key:ve,ref:ae,props:X,_owner:je}},Oe.createContext=function(N){return N={$$typeof:l,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},N.Provider={$$typeof:a,_context:N},N.Consumer=N},Oe.createElement=q,Oe.createFactory=function(N){var V=q.bind(null,N);return V.type=N,V},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(N){return{$$typeof:c,render:N}},Oe.isValidElement=ie,Oe.lazy=function(N){return{$$typeof:p,_payload:{_status:-1,_result:N},_init:fe}},Oe.memo=function(N,V){return{$$typeof:f,type:N,compare:V===void 0?null:V}},Oe.startTransition=function(N){var V=H.transition;H.transition={};try{N()}finally{H.transition=V}},Oe.unstable_act=T,Oe.useCallback=function(N,V){return le.current.useCallback(N,V)},Oe.useContext=function(N){return le.current.useContext(N)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(N){return le.current.useDeferredValue(N)},Oe.useEffect=function(N,V){return le.current.useEffect(N,V)},Oe.useId=function(){return le.current.useId()},Oe.useImperativeHandle=function(N,V,C){return le.current.useImperativeHandle(N,V,C)},Oe.useInsertionEffect=function(N,V){return le.current.useInsertionEffect(N,V)},Oe.useLayoutEffect=function(N,V){return le.current.useLayoutEffect(N,V)},Oe.useMemo=function(N,V){return le.current.useMemo(N,V)},Oe.useReducer=function(N,V,C){return le.current.useReducer(N,V,C)},Oe.useRef=function(N){return le.current.useRef(N)},Oe.useState=function(N){return le.current.useState(N)},Oe.useSyncExternalStore=function(N,V,C){return le.current.useSyncExternalStore(N,V,C)},Oe.useTransition=function(){return le.current.useTransition()},Oe.version="18.3.1",Oe}var Cg;function Nh(){return Cg||(Cg=1,Yc.exports=Ak()),Yc.exports}var jg;function Pk(){if(jg)return Zi;jg=1;var e=Nh(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(c,d,f){var p,y={},v=null,w=null;f!==void 0&&(v=""+f),d.key!==void 0&&(v=""+d.key),d.ref!==void 0&&(w=d.ref);for(p in d)r.call(d,p)&&!a.hasOwnProperty(p)&&(y[p]=d[p]);if(c&&c.defaultProps)for(p in d=c.defaultProps,d)y[p]===void 0&&(y[p]=d[p]);return{$$typeof:t,type:c,key:v,ref:w,props:y,_owner:o.current}}return Zi.Fragment=n,Zi.jsx=l,Zi.jsxs=l,Zi}var Ag;function Nk(){return Ag||(Ag=1,Jc.exports=Pk()),Jc.exports}var g=Nk(),L=Nh();const bo=ql(L);var al={},Xc={exports:{}},Ut={},Qc={exports:{}},Zc={};var Pg;function Rk(){return Pg||(Pg=1,(function(e){function t(H,oe){var T=H.length;H.push(oe);e:for(;0<T;){var N=T-1>>>1,V=H[N];if(0<o(V,oe))H[N]=oe,H[T]=V,T=N;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var oe=H[0],T=H.pop();if(T!==oe){H[0]=T;e:for(var N=0,V=H.length,C=V>>>1;N<C;){var X=2*(N+1)-1,ve=H[X],ae=X+1,je=H[ae];if(0>o(ve,T))ae<V&&0>o(je,ve)?(H[N]=je,H[ae]=T,N=ae):(H[N]=ve,H[X]=T,N=X);else if(ae<V&&0>o(je,T))H[N]=je,H[ae]=T,N=ae;else break e}}return oe}function o(H,oe){var T=H.sortIndex-oe.sortIndex;return T!==0?T:H.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var d=[],f=[],p=1,y=null,v=3,w=!1,b=!1,S=!1,_=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 j(H){for(var oe=n(f);oe!==null;){if(oe.callback===null)r(f);else if(oe.startTime<=H)r(f),oe.sortIndex=oe.expirationTime,t(d,oe);else break;oe=n(f)}}function D(H){if(S=!1,j(H),!b)if(n(d)!==null)b=!0,fe($);else{var oe=n(f);oe!==null&&le(D,oe.startTime-H)}}function $(H,oe){b=!1,S&&(S=!1,E(q),q=-1),w=!0;var T=v;try{for(j(oe),y=n(d);y!==null&&(!(y.expirationTime>oe)||H&&!re());){var N=y.callback;if(typeof N=="function"){y.callback=null,v=y.priorityLevel;var V=N(y.expirationTime<=oe);oe=e.unstable_now(),typeof V=="function"?y.callback=V:y===n(d)&&r(d),j(oe)}else r(d);y=n(d)}if(y!==null)var C=!0;else{var X=n(f);X!==null&&le(D,X.startTime-oe),C=!1}return C}finally{y=null,v=T,w=!1}}var O=!1,z=null,q=-1,J=5,ie=-1;function re(){return!(e.unstable_now()-ie<J)}function Q(){if(z!==null){var H=e.unstable_now();ie=H;var oe=!0;try{oe=z(!0,H)}finally{oe?ye():(O=!1,z=null)}}else O=!1}var ye;if(typeof P=="function")ye=function(){P(Q)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,Z=ne.port2;ne.port1.onmessage=Q,ye=function(){Z.postMessage(null)}}else ye=function(){_(Q,0)};function fe(H){z=H,O||(O=!0,ye())}function le(H,oe){q=_(function(){H(e.unstable_now())},oe)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_continueExecution=function(){b||w||(b=!0,fe($))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(H){switch(v){case 1:case 2:case 3:var oe=3;break;default:oe=v}var T=v;v=oe;try{return H()}finally{v=T}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,oe){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var T=v;v=H;try{return oe()}finally{v=T}},e.unstable_scheduleCallback=function(H,oe,T){var N=e.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?N+T:N):T=N,H){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=T+V,H={id:p++,callback:oe,priorityLevel:H,startTime:T,expirationTime:V,sortIndex:-1},T>N?(H.sortIndex=T,t(f,H),n(d)===null&&H===n(f)&&(S?(E(q),q=-1):S=!0,le(D,T-N))):(H.sortIndex=V,t(d,H),b||w||(b=!0,fe($))),H},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(H){var oe=v;return function(){var T=v;v=oe;try{return H.apply(this,arguments)}finally{v=T}}}})(Zc)),Zc}var Ng;function Ok(){return Ng||(Ng=1,Qc.exports=Rk()),Qc.exports}var Rg;function Ik(){if(Rg)return Ut;Rg=1;var e=Nh(),t=Ok();function n(s){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+s,u=1;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,o={};function a(s,i){l(s,i),l(s+"Capture",i)}function l(s,i){for(o[s]=i,s=0;s<i.length;s++)r.add(i[s])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[: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]*$/,p={},y={};function v(s){return d.call(y,s)?!0:d.call(p,s)?!1:f.test(s)?y[s]=!0:(p[s]=!0,!1)}function w(s,i,u,h){if(u!==null&&u.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return h?!1:u!==null?!u.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function b(s,i,u,h){if(i===null||typeof i>"u"||w(s,i,u,h))return!0;if(h)return!1;if(u!==null)switch(u.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function S(s,i,u,h,m,x,k){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=h,this.attributeNamespace=m,this.mustUseProperty=u,this.propertyName=s,this.type=i,this.sanitizeURL=x,this.removeEmptyString=k}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){_[s]=new S(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var i=s[0];_[i]=new S(i,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){_[s]=new S(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){_[s]=new S(s,2,!1,s,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(s){_[s]=new S(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){_[s]=new S(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){_[s]=new S(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){_[s]=new S(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){_[s]=new S(s,5,!1,s.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function P(s){return s[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(s){var i=s.replace(E,P);_[i]=new S(i,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var i=s.replace(E,P);_[i]=new S(i,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var i=s.replace(E,P);_[i]=new S(i,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){_[s]=new S(s,1,!1,s.toLowerCase(),null,!1,!1)}),_.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){_[s]=new S(s,1,!1,s.toLowerCase(),null,!0,!0)});function j(s,i,u,h){var m=_.hasOwnProperty(i)?_[i]:null;(m!==null?m.type!==0:h||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(b(i,u,m,h)&&(u=null),h||m===null?v(i)&&(u===null?s.removeAttribute(i):s.setAttribute(i,""+u)):m.mustUseProperty?s[m.propertyName]=u===null?m.type===3?!1:"":u:(i=m.attributeName,h=m.attributeNamespace,u===null?s.removeAttribute(i):(m=m.type,u=m===3||m===4&&u===!0?"":""+u,h?s.setAttributeNS(h,i,u):s.setAttribute(i,u))))}var D=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$=Symbol.for("react.element"),O=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),ie=Symbol.for("react.provider"),re=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),ye=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),fe=Symbol.for("react.lazy"),le=Symbol.for("react.offscreen"),H=Symbol.iterator;function oe(s){return s===null||typeof s!="object"?null:(s=H&&s[H]||s["@@iterator"],typeof s=="function"?s:null)}var T=Object.assign,N;function V(s){if(N===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);N=i&&i[1]||""}return`
|
|
2
|
+
`+N+s}var C=!1;function X(s,i){if(!s||C)return"";C=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(F){var h=F}Reflect.construct(s,[],i)}else{try{i.call()}catch(F){h=F}s.call(i.prototype)}else{try{throw Error()}catch(F){h=F}s()}}catch(F){if(F&&h&&typeof F.stack=="string"){for(var m=F.stack.split(`
|
|
3
|
+
`),x=h.stack.split(`
|
|
4
|
+
`),k=m.length-1,A=x.length-1;1<=k&&0<=A&&m[k]!==x[A];)A--;for(;1<=k&&0<=A;k--,A--)if(m[k]!==x[A]){if(k!==1||A!==1)do if(k--,A--,0>A||m[k]!==x[A]){var R=`
|
|
5
|
+
`+m[k].replace(" at new "," at ");return s.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",s.displayName)),R}while(1<=k&&0<=A);break}}}finally{C=!1,Error.prepareStackTrace=u}return(s=s?s.displayName||s.name:"")?V(s):""}function ve(s){switch(s.tag){case 5:return V(s.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return s=X(s.type,!1),s;case 11:return s=X(s.type.render,!1),s;case 1:return s=X(s.type,!0),s;default:return""}}function ae(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case z:return"Fragment";case O:return"Portal";case J:return"Profiler";case q:return"StrictMode";case ye:return"Suspense";case ne:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case re:return(s.displayName||"Context")+".Consumer";case ie:return(s._context.displayName||"Context")+".Provider";case Q:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Z:return i=s.displayName||null,i!==null?i:ae(s.type)||"Memo";case fe:i=s._payload,s=s._init;try{return ae(s(i))}catch{}}return null}function je(s){var i=s.type;switch(s.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=i.render,s=s.displayName||s.name||"",i.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(i);case 8:return i===q?"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 i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function Ae(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Me(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function ot(s){var i=Me(s)?"checked":"value",u=Object.getOwnPropertyDescriptor(s.constructor.prototype,i),h=""+s[i];if(!s.hasOwnProperty(i)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var m=u.get,x=u.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return m.call(this)},set:function(k){h=""+k,x.call(this,k)}}),Object.defineProperty(s,i,{enumerable:u.enumerable}),{getValue:function(){return h},setValue:function(k){h=""+k},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function Un(s){s._valueTracker||(s._valueTracker=ot(s))}function Jo(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var u=i.getValue(),h="";return s&&(h=Me(s)?s.checked?"true":"false":s.value),s=h,s!==u?(i.setValue(s),!0):!1}function us(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function fi(s,i){var u=i.checked;return T({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??s._wrapperState.initialChecked})}function pi(s,i){var u=i.defaultValue==null?"":i.defaultValue,h=i.checked!=null?i.checked:i.defaultChecked;u=Ae(i.value!=null?i.value:u),s._wrapperState={initialChecked:h,initialValue:u,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function mi(s,i){i=i.checked,i!=null&&j(s,"checked",i,!1)}function cs(s,i){mi(s,i);var u=Ae(i.value),h=i.type;if(u!=null)h==="number"?(u===0&&s.value===""||s.value!=u)&&(s.value=""+u):s.value!==""+u&&(s.value=""+u);else if(h==="submit"||h==="reset"){s.removeAttribute("value");return}i.hasOwnProperty("value")?ds(s,i.type,u):i.hasOwnProperty("defaultValue")&&ds(s,i.type,Ae(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(s.defaultChecked=!!i.defaultChecked)}function Yo(s,i,u){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var h=i.type;if(!(h!=="submit"&&h!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+s._wrapperState.initialValue,u||i===s.value||(s.value=i),s.defaultValue=i}u=s.name,u!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,u!==""&&(s.name=u)}function ds(s,i,u){(i!=="number"||us(s.ownerDocument)!==s)&&(u==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+u&&(s.defaultValue=""+u))}var er=Array.isArray;function tr(s,i,u,h){if(s=s.options,i){i={};for(var m=0;m<u.length;m++)i["$"+u[m]]=!0;for(u=0;u<s.length;u++)m=i.hasOwnProperty("$"+s[u].value),s[u].selected!==m&&(s[u].selected=m),m&&h&&(s[u].defaultSelected=!0)}else{for(u=""+Ae(u),i=null,m=0;m<s.length;m++){if(s[m].value===u){s[m].selected=!0,h&&(s[m].defaultSelected=!0);return}i!==null||s[m].disabled||(i=s[m])}i!==null&&(i.selected=!0)}}function gi(s,i){if(i.dangerouslySetInnerHTML!=null)throw Error(n(91));return T({},i,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Xo(s,i){var u=i.value;if(u==null){if(u=i.children,i=i.defaultValue,u!=null){if(i!=null)throw Error(n(92));if(er(u)){if(1<u.length)throw Error(n(93));u=u[0]}i=u}i==null&&(i=""),u=i}s._wrapperState={initialValue:Ae(u)}}function Qo(s,i){var u=Ae(i.value),h=Ae(i.defaultValue);u!=null&&(u=""+u,u!==s.value&&(s.value=u),i.defaultValue==null&&s.defaultValue!==u&&(s.defaultValue=u)),h!=null&&(s.defaultValue=""+h)}function Zo(s){var i=s.textContent;i===s._wrapperState.initialValue&&i!==""&&i!==null&&(s.value=i)}function W(s){switch(s){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 se(s,i){return s==null||s==="http://www.w3.org/1999/xhtml"?W(i):s==="http://www.w3.org/2000/svg"&&i==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var _e,Re=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(i,u,h,m){MSApp.execUnsafeLocalFunction(function(){return s(i,u,h,m)})}:s})(function(s,i){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=i;else{for(_e=_e||document.createElement("div"),_e.innerHTML="<svg>"+i.valueOf().toString()+"</svg>",i=_e.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;i.firstChild;)s.appendChild(i.firstChild)}});function Ie(s,i){if(i){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=i;return}}s.textContent=i}var gt={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},zn=["Webkit","ms","Moz","O"];Object.keys(gt).forEach(function(s){zn.forEach(function(i){i=i+s.charAt(0).toUpperCase()+s.substring(1),gt[i]=gt[s]})});function nn(s,i,u){return i==null||typeof i=="boolean"||i===""?"":u||typeof i!="number"||i===0||gt.hasOwnProperty(s)&>[s]?(""+i).trim():i+"px"}function nr(s,i){s=s.style;for(var u in i)if(i.hasOwnProperty(u)){var h=u.indexOf("--")===0,m=nn(u,i[u],h);u==="float"&&(u="cssFloat"),h?s.setProperty(u,m):s[u]=m}}var Rr=T({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 yt(s,i){if(i){if(Rr[s]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,s));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function Tn(s,i){if(s.indexOf("-")===-1)return typeof i.is=="string";switch(s){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 qt=null;function cu(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var du=null,hs=null,fs=null;function Vf(s){if(s=Ui(s)){if(typeof du!="function")throw Error(n(280));var i=s.stateNode;i&&(i=ka(i),du(s.stateNode,s.type,i))}}function qf(s){hs?fs?fs.push(s):fs=[s]:hs=s}function Hf(){if(hs){var s=hs,i=fs;if(fs=hs=null,Vf(s),i)for(s=0;s<i.length;s++)Vf(i[s])}}function Wf(s,i){return s(i)}function Kf(){}var hu=!1;function Gf(s,i,u){if(hu)return s(i,u);hu=!0;try{return Wf(s,i,u)}finally{hu=!1,(hs!==null||fs!==null)&&(Kf(),Hf())}}function yi(s,i){var u=s.stateNode;if(u===null)return null;var h=ka(u);if(h===null)return null;u=h[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(n(231,i,typeof u));return u}var fu=!1;if(c)try{var vi={};Object.defineProperty(vi,"passive",{get:function(){fu=!0}}),window.addEventListener("test",vi,vi),window.removeEventListener("test",vi,vi)}catch{fu=!1}function L1(s,i,u,h,m,x,k,A,R){var F=Array.prototype.slice.call(arguments,3);try{i.apply(u,F)}catch(G){this.onError(G)}}var xi=!1,ea=null,ta=!1,pu=null,D1={onError:function(s){xi=!0,ea=s}};function M1(s,i,u,h,m,x,k,A,R){xi=!1,ea=null,L1.apply(D1,arguments)}function U1(s,i,u,h,m,x,k,A,R){if(M1.apply(this,arguments),xi){if(xi){var F=ea;xi=!1,ea=null}else throw Error(n(198));ta||(ta=!0,pu=F)}}function Or(s){var i=s,u=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(u=i.return),s=i.return;while(s)}return i.tag===3?u:null}function Jf(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function Yf(s){if(Or(s)!==s)throw Error(n(188))}function z1(s){var i=s.alternate;if(!i){if(i=Or(s),i===null)throw Error(n(188));return i!==s?null:s}for(var u=s,h=i;;){var m=u.return;if(m===null)break;var x=m.alternate;if(x===null){if(h=m.return,h!==null){u=h;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===u)return Yf(m),s;if(x===h)return Yf(m),i;x=x.sibling}throw Error(n(188))}if(u.return!==h.return)u=m,h=x;else{for(var k=!1,A=m.child;A;){if(A===u){k=!0,u=m,h=x;break}if(A===h){k=!0,h=m,u=x;break}A=A.sibling}if(!k){for(A=x.child;A;){if(A===u){k=!0,u=x,h=m;break}if(A===h){k=!0,h=x,u=m;break}A=A.sibling}if(!k)throw Error(n(189))}}if(u.alternate!==h)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?s:i}function Xf(s){return s=z1(s),s!==null?Qf(s):null}function Qf(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var i=Qf(s);if(i!==null)return i;s=s.sibling}return null}var Zf=t.unstable_scheduleCallback,ep=t.unstable_cancelCallback,F1=t.unstable_shouldYield,$1=t.unstable_requestPaint,rt=t.unstable_now,B1=t.unstable_getCurrentPriorityLevel,mu=t.unstable_ImmediatePriority,tp=t.unstable_UserBlockingPriority,na=t.unstable_NormalPriority,V1=t.unstable_LowPriority,np=t.unstable_IdlePriority,ra=null,Cn=null;function q1(s){if(Cn&&typeof Cn.onCommitFiberRoot=="function")try{Cn.onCommitFiberRoot(ra,s,void 0,(s.current.flags&128)===128)}catch{}}var fn=Math.clz32?Math.clz32:K1,H1=Math.log,W1=Math.LN2;function K1(s){return s>>>=0,s===0?32:31-(H1(s)/W1|0)|0}var sa=64,ia=4194304;function wi(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function oa(s,i){var u=s.pendingLanes;if(u===0)return 0;var h=0,m=s.suspendedLanes,x=s.pingedLanes,k=u&268435455;if(k!==0){var A=k&~m;A!==0?h=wi(A):(x&=k,x!==0&&(h=wi(x)))}else k=u&~m,k!==0?h=wi(k):x!==0&&(h=wi(x));if(h===0)return 0;if(i!==0&&i!==h&&(i&m)===0&&(m=h&-h,x=i&-i,m>=x||m===16&&(x&4194240)!==0))return i;if((h&4)!==0&&(h|=u&16),i=s.entangledLanes,i!==0)for(s=s.entanglements,i&=h;0<i;)u=31-fn(i),m=1<<u,h|=s[u],i&=~m;return h}function G1(s,i){switch(s){case 1:case 2:case 4:return i+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 i+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 J1(s,i){for(var u=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,x=s.pendingLanes;0<x;){var k=31-fn(x),A=1<<k,R=m[k];R===-1?((A&u)===0||(A&h)!==0)&&(m[k]=G1(A,i)):R<=i&&(s.expiredLanes|=A),x&=~A}}function gu(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function rp(){var s=sa;return sa<<=1,(sa&4194240)===0&&(sa=64),s}function yu(s){for(var i=[],u=0;31>u;u++)i.push(s);return i}function bi(s,i,u){s.pendingLanes|=i,i!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,i=31-fn(i),s[i]=u}function Y1(s,i){var u=s.pendingLanes&~i;s.pendingLanes=i,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=i,s.mutableReadLanes&=i,s.entangledLanes&=i,i=s.entanglements;var h=s.eventTimes;for(s=s.expirationTimes;0<u;){var m=31-fn(u),x=1<<m;i[m]=0,h[m]=-1,s[m]=-1,u&=~x}}function vu(s,i){var u=s.entangledLanes|=i;for(s=s.entanglements;u;){var h=31-fn(u),m=1<<h;m&i|s[h]&i&&(s[h]|=i),u&=~m}}var Fe=0;function sp(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var ip,xu,op,ap,lp,wu=!1,aa=[],rr=null,sr=null,ir=null,ki=new Map,Si=new Map,or=[],X1="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 up(s,i){switch(s){case"focusin":case"focusout":rr=null;break;case"dragenter":case"dragleave":sr=null;break;case"mouseover":case"mouseout":ir=null;break;case"pointerover":case"pointerout":ki.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Si.delete(i.pointerId)}}function _i(s,i,u,h,m,x){return s===null||s.nativeEvent!==x?(s={blockedOn:i,domEventName:u,eventSystemFlags:h,nativeEvent:x,targetContainers:[m]},i!==null&&(i=Ui(i),i!==null&&xu(i)),s):(s.eventSystemFlags|=h,i=s.targetContainers,m!==null&&i.indexOf(m)===-1&&i.push(m),s)}function Q1(s,i,u,h,m){switch(i){case"focusin":return rr=_i(rr,s,i,u,h,m),!0;case"dragenter":return sr=_i(sr,s,i,u,h,m),!0;case"mouseover":return ir=_i(ir,s,i,u,h,m),!0;case"pointerover":var x=m.pointerId;return ki.set(x,_i(ki.get(x)||null,s,i,u,h,m)),!0;case"gotpointercapture":return x=m.pointerId,Si.set(x,_i(Si.get(x)||null,s,i,u,h,m)),!0}return!1}function cp(s){var i=Ir(s.target);if(i!==null){var u=Or(i);if(u!==null){if(i=u.tag,i===13){if(i=Jf(u),i!==null){s.blockedOn=i,lp(s.priority,function(){op(u)});return}}else if(i===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function la(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var u=ku(s.domEventName,s.eventSystemFlags,i[0],s.nativeEvent);if(u===null){u=s.nativeEvent;var h=new u.constructor(u.type,u);qt=h,u.target.dispatchEvent(h),qt=null}else return i=Ui(u),i!==null&&xu(i),s.blockedOn=u,!1;i.shift()}return!0}function dp(s,i,u){la(s)&&u.delete(i)}function Z1(){wu=!1,rr!==null&&la(rr)&&(rr=null),sr!==null&&la(sr)&&(sr=null),ir!==null&&la(ir)&&(ir=null),ki.forEach(dp),Si.forEach(dp)}function Ei(s,i){s.blockedOn===i&&(s.blockedOn=null,wu||(wu=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Z1)))}function Ti(s){function i(m){return Ei(m,s)}if(0<aa.length){Ei(aa[0],s);for(var u=1;u<aa.length;u++){var h=aa[u];h.blockedOn===s&&(h.blockedOn=null)}}for(rr!==null&&Ei(rr,s),sr!==null&&Ei(sr,s),ir!==null&&Ei(ir,s),ki.forEach(i),Si.forEach(i),u=0;u<or.length;u++)h=or[u],h.blockedOn===s&&(h.blockedOn=null);for(;0<or.length&&(u=or[0],u.blockedOn===null);)cp(u),u.blockedOn===null&&or.shift()}var ps=D.ReactCurrentBatchConfig,ua=!0;function eb(s,i,u,h){var m=Fe,x=ps.transition;ps.transition=null;try{Fe=1,bu(s,i,u,h)}finally{Fe=m,ps.transition=x}}function tb(s,i,u,h){var m=Fe,x=ps.transition;ps.transition=null;try{Fe=4,bu(s,i,u,h)}finally{Fe=m,ps.transition=x}}function bu(s,i,u,h){if(ua){var m=ku(s,i,u,h);if(m===null)zu(s,i,h,ca,u),up(s,h);else if(Q1(m,s,i,u,h))h.stopPropagation();else if(up(s,h),i&4&&-1<X1.indexOf(s)){for(;m!==null;){var x=Ui(m);if(x!==null&&ip(x),x=ku(s,i,u,h),x===null&&zu(s,i,h,ca,u),x===m)break;m=x}m!==null&&h.stopPropagation()}else zu(s,i,h,null,u)}}var ca=null;function ku(s,i,u,h){if(ca=null,s=cu(h),s=Ir(s),s!==null)if(i=Or(s),i===null)s=null;else if(u=i.tag,u===13){if(s=Jf(i),s!==null)return s;s=null}else if(u===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null);return ca=s,null}function hp(s){switch(s){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(B1()){case mu:return 1;case tp:return 4;case na:case V1:return 16;case np:return 536870912;default:return 16}default:return 16}}var ar=null,Su=null,da=null;function fp(){if(da)return da;var s,i=Su,u=i.length,h,m="value"in ar?ar.value:ar.textContent,x=m.length;for(s=0;s<u&&i[s]===m[s];s++);var k=u-s;for(h=1;h<=k&&i[u-h]===m[x-h];h++);return da=m.slice(s,1<h?1-h:void 0)}function ha(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function fa(){return!0}function pp(){return!1}function Ht(s){function i(u,h,m,x,k){this._reactName=u,this._targetInst=m,this.type=h,this.nativeEvent=x,this.target=k,this.currentTarget=null;for(var A in s)s.hasOwnProperty(A)&&(u=s[A],this[A]=u?u(x):x[A]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fa:pp,this.isPropagationStopped=pp,this}return T(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=fa)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=fa)},persist:function(){},isPersistent:fa}),i}var ms={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_u=Ht(ms),Ci=T({},ms,{view:0,detail:0}),nb=Ht(Ci),Eu,Tu,ji,pa=T({},Ci,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ju,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==ji&&(ji&&s.type==="mousemove"?(Eu=s.screenX-ji.screenX,Tu=s.screenY-ji.screenY):Tu=Eu=0,ji=s),Eu)},movementY:function(s){return"movementY"in s?s.movementY:Tu}}),mp=Ht(pa),rb=T({},pa,{dataTransfer:0}),sb=Ht(rb),ib=T({},Ci,{relatedTarget:0}),Cu=Ht(ib),ob=T({},ms,{animationName:0,elapsedTime:0,pseudoElement:0}),ab=Ht(ob),lb=T({},ms,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),ub=Ht(lb),cb=T({},ms,{data:0}),gp=Ht(cb),db={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hb={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"},fb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pb(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=fb[s])?!!i[s]:!1}function ju(){return pb}var mb=T({},Ci,{key:function(s){if(s.key){var i=db[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=ha(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?hb[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ju,charCode:function(s){return s.type==="keypress"?ha(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?ha(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),gb=Ht(mb),yb=T({},pa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yp=Ht(yb),vb=T({},Ci,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ju}),xb=Ht(vb),wb=T({},ms,{propertyName:0,elapsedTime:0,pseudoElement:0}),bb=Ht(wb),kb=T({},pa,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Sb=Ht(kb),_b=[9,13,27,32],Au=c&&"CompositionEvent"in window,Ai=null;c&&"documentMode"in document&&(Ai=document.documentMode);var Eb=c&&"TextEvent"in window&&!Ai,vp=c&&(!Au||Ai&&8<Ai&&11>=Ai),xp=" ",wp=!1;function bp(s,i){switch(s){case"keyup":return _b.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kp(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var gs=!1;function Tb(s,i){switch(s){case"compositionend":return kp(i);case"keypress":return i.which!==32?null:(wp=!0,xp);case"textInput":return s=i.data,s===xp&&wp?null:s;default:return null}}function Cb(s,i){if(gs)return s==="compositionend"||!Au&&bp(s,i)?(s=fp(),da=Su=ar=null,gs=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return vp&&i.locale!=="ko"?null:i.data;default:return null}}var jb={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 Sp(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!jb[s.type]:i==="textarea"}function _p(s,i,u,h){qf(h),i=xa(i,"onChange"),0<i.length&&(u=new _u("onChange","change",null,u,h),s.push({event:u,listeners:i}))}var Pi=null,Ni=null;function Ab(s){Bp(s,0)}function ma(s){var i=bs(s);if(Jo(i))return s}function Pb(s,i){if(s==="change")return i}var Ep=!1;if(c){var Pu;if(c){var Nu="oninput"in document;if(!Nu){var Tp=document.createElement("div");Tp.setAttribute("oninput","return;"),Nu=typeof Tp.oninput=="function"}Pu=Nu}else Pu=!1;Ep=Pu&&(!document.documentMode||9<document.documentMode)}function Cp(){Pi&&(Pi.detachEvent("onpropertychange",jp),Ni=Pi=null)}function jp(s){if(s.propertyName==="value"&&ma(Ni)){var i=[];_p(i,Ni,s,cu(s)),Gf(Ab,i)}}function Nb(s,i,u){s==="focusin"?(Cp(),Pi=i,Ni=u,Pi.attachEvent("onpropertychange",jp)):s==="focusout"&&Cp()}function Rb(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return ma(Ni)}function Ob(s,i){if(s==="click")return ma(i)}function Ib(s,i){if(s==="input"||s==="change")return ma(i)}function Lb(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var pn=typeof Object.is=="function"?Object.is:Lb;function Ri(s,i){if(pn(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var u=Object.keys(s),h=Object.keys(i);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var m=u[h];if(!d.call(i,m)||!pn(s[m],i[m]))return!1}return!0}function Ap(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Pp(s,i){var u=Ap(s);s=0;for(var h;u;){if(u.nodeType===3){if(h=s+u.textContent.length,s<=i&&h>=i)return{node:u,offset:i-s};s=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Ap(u)}}function Np(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?Np(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Rp(){for(var s=window,i=us();i instanceof s.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)s=i.contentWindow;else break;i=us(s.document)}return i}function Ru(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}function Db(s){var i=Rp(),u=s.focusedElem,h=s.selectionRange;if(i!==u&&u&&u.ownerDocument&&Np(u.ownerDocument.documentElement,u)){if(h!==null&&Ru(u)){if(i=h.start,s=h.end,s===void 0&&(s=i),"selectionStart"in u)u.selectionStart=i,u.selectionEnd=Math.min(s,u.value.length);else if(s=(i=u.ownerDocument||document)&&i.defaultView||window,s.getSelection){s=s.getSelection();var m=u.textContent.length,x=Math.min(h.start,m);h=h.end===void 0?x:Math.min(h.end,m),!s.extend&&x>h&&(m=h,h=x,x=m),m=Pp(u,x);var k=Pp(u,h);m&&k&&(s.rangeCount!==1||s.anchorNode!==m.node||s.anchorOffset!==m.offset||s.focusNode!==k.node||s.focusOffset!==k.offset)&&(i=i.createRange(),i.setStart(m.node,m.offset),s.removeAllRanges(),x>h?(s.addRange(i),s.extend(k.node,k.offset)):(i.setEnd(k.node,k.offset),s.addRange(i)))}}for(i=[],s=u;s=s.parentNode;)s.nodeType===1&&i.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<i.length;u++)s=i[u],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var Mb=c&&"documentMode"in document&&11>=document.documentMode,ys=null,Ou=null,Oi=null,Iu=!1;function Op(s,i,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Iu||ys==null||ys!==us(h)||(h=ys,"selectionStart"in h&&Ru(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Oi&&Ri(Oi,h)||(Oi=h,h=xa(Ou,"onSelect"),0<h.length&&(i=new _u("onSelect","select",null,i,u),s.push({event:i,listeners:h}),i.target=ys)))}function ga(s,i){var u={};return u[s.toLowerCase()]=i.toLowerCase(),u["Webkit"+s]="webkit"+i,u["Moz"+s]="moz"+i,u}var vs={animationend:ga("Animation","AnimationEnd"),animationiteration:ga("Animation","AnimationIteration"),animationstart:ga("Animation","AnimationStart"),transitionend:ga("Transition","TransitionEnd")},Lu={},Ip={};c&&(Ip=document.createElement("div").style,"AnimationEvent"in window||(delete vs.animationend.animation,delete vs.animationiteration.animation,delete vs.animationstart.animation),"TransitionEvent"in window||delete vs.transitionend.transition);function ya(s){if(Lu[s])return Lu[s];if(!vs[s])return s;var i=vs[s],u;for(u in i)if(i.hasOwnProperty(u)&&u in Ip)return Lu[s]=i[u];return s}var Lp=ya("animationend"),Dp=ya("animationiteration"),Mp=ya("animationstart"),Up=ya("transitionend"),zp=new Map,Fp="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 lr(s,i){zp.set(s,i),a(i,[s])}for(var Du=0;Du<Fp.length;Du++){var Mu=Fp[Du],Ub=Mu.toLowerCase(),zb=Mu[0].toUpperCase()+Mu.slice(1);lr(Ub,"on"+zb)}lr(Lp,"onAnimationEnd"),lr(Dp,"onAnimationIteration"),lr(Mp,"onAnimationStart"),lr("dblclick","onDoubleClick"),lr("focusin","onFocus"),lr("focusout","onBlur"),lr(Up,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ii="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(" "),Fb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ii));function $p(s,i,u){var h=s.type||"unknown-event";s.currentTarget=u,U1(h,i,void 0,s),s.currentTarget=null}function Bp(s,i){i=(i&4)!==0;for(var u=0;u<s.length;u++){var h=s[u],m=h.event;h=h.listeners;e:{var x=void 0;if(i)for(var k=h.length-1;0<=k;k--){var A=h[k],R=A.instance,F=A.currentTarget;if(A=A.listener,R!==x&&m.isPropagationStopped())break e;$p(m,A,F),x=R}else for(k=0;k<h.length;k++){if(A=h[k],R=A.instance,F=A.currentTarget,A=A.listener,R!==x&&m.isPropagationStopped())break e;$p(m,A,F),x=R}}}if(ta)throw s=pu,ta=!1,pu=null,s}function We(s,i){var u=i[Hu];u===void 0&&(u=i[Hu]=new Set);var h=s+"__bubble";u.has(h)||(Vp(i,s,2,!1),u.add(h))}function Uu(s,i,u){var h=0;i&&(h|=4),Vp(u,s,h,i)}var va="_reactListening"+Math.random().toString(36).slice(2);function Li(s){if(!s[va]){s[va]=!0,r.forEach(function(u){u!=="selectionchange"&&(Fb.has(u)||Uu(u,!1,s),Uu(u,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[va]||(i[va]=!0,Uu("selectionchange",!1,i))}}function Vp(s,i,u,h){switch(hp(i)){case 1:var m=eb;break;case 4:m=tb;break;default:m=bu}u=m.bind(null,i,u,s),m=void 0,!fu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(m=!0),h?m!==void 0?s.addEventListener(i,u,{capture:!0,passive:m}):s.addEventListener(i,u,!0):m!==void 0?s.addEventListener(i,u,{passive:m}):s.addEventListener(i,u,!1)}function zu(s,i,u,h,m){var x=h;if((i&1)===0&&(i&2)===0&&h!==null)e:for(;;){if(h===null)return;var k=h.tag;if(k===3||k===4){var A=h.stateNode.containerInfo;if(A===m||A.nodeType===8&&A.parentNode===m)break;if(k===4)for(k=h.return;k!==null;){var R=k.tag;if((R===3||R===4)&&(R=k.stateNode.containerInfo,R===m||R.nodeType===8&&R.parentNode===m))return;k=k.return}for(;A!==null;){if(k=Ir(A),k===null)return;if(R=k.tag,R===5||R===6){h=x=k;continue e}A=A.parentNode}}h=h.return}Gf(function(){var F=x,G=cu(u),Y=[];e:{var K=zp.get(s);if(K!==void 0){var ue=_u,he=s;switch(s){case"keypress":if(ha(u)===0)break e;case"keydown":case"keyup":ue=gb;break;case"focusin":he="focus",ue=Cu;break;case"focusout":he="blur",ue=Cu;break;case"beforeblur":case"afterblur":ue=Cu;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=mp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=sb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=xb;break;case Lp:case Dp:case Mp:ue=ab;break;case Up:ue=bb;break;case"scroll":ue=nb;break;case"wheel":ue=Sb;break;case"copy":case"cut":case"paste":ue=ub;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=yp}var pe=(i&4)!==0,st=!pe&&s==="scroll",M=pe?K!==null?K+"Capture":null:K;pe=[];for(var I=F,U;I!==null;){U=I;var te=U.stateNode;if(U.tag===5&&te!==null&&(U=te,M!==null&&(te=yi(I,M),te!=null&&pe.push(Di(I,te,U)))),st)break;I=I.return}0<pe.length&&(K=new ue(K,he,null,u,G),Y.push({event:K,listeners:pe}))}}if((i&7)===0){e:{if(K=s==="mouseover"||s==="pointerover",ue=s==="mouseout"||s==="pointerout",K&&u!==qt&&(he=u.relatedTarget||u.fromElement)&&(Ir(he)||he[Fn]))break e;if((ue||K)&&(K=G.window===G?G:(K=G.ownerDocument)?K.defaultView||K.parentWindow:window,ue?(he=u.relatedTarget||u.toElement,ue=F,he=he?Ir(he):null,he!==null&&(st=Or(he),he!==st||he.tag!==5&&he.tag!==6)&&(he=null)):(ue=null,he=F),ue!==he)){if(pe=mp,te="onMouseLeave",M="onMouseEnter",I="mouse",(s==="pointerout"||s==="pointerover")&&(pe=yp,te="onPointerLeave",M="onPointerEnter",I="pointer"),st=ue==null?K:bs(ue),U=he==null?K:bs(he),K=new pe(te,I+"leave",ue,u,G),K.target=st,K.relatedTarget=U,te=null,Ir(G)===F&&(pe=new pe(M,I+"enter",he,u,G),pe.target=U,pe.relatedTarget=st,te=pe),st=te,ue&&he)t:{for(pe=ue,M=he,I=0,U=pe;U;U=xs(U))I++;for(U=0,te=M;te;te=xs(te))U++;for(;0<I-U;)pe=xs(pe),I--;for(;0<U-I;)M=xs(M),U--;for(;I--;){if(pe===M||M!==null&&pe===M.alternate)break t;pe=xs(pe),M=xs(M)}pe=null}else pe=null;ue!==null&&qp(Y,K,ue,pe,!1),he!==null&&st!==null&&qp(Y,st,he,pe,!0)}}e:{if(K=F?bs(F):window,ue=K.nodeName&&K.nodeName.toLowerCase(),ue==="select"||ue==="input"&&K.type==="file")var me=Pb;else if(Sp(K))if(Ep)me=Ib;else{me=Rb;var xe=Nb}else(ue=K.nodeName)&&ue.toLowerCase()==="input"&&(K.type==="checkbox"||K.type==="radio")&&(me=Ob);if(me&&(me=me(s,F))){_p(Y,me,u,G);break e}xe&&xe(s,K,F),s==="focusout"&&(xe=K._wrapperState)&&xe.controlled&&K.type==="number"&&ds(K,"number",K.value)}switch(xe=F?bs(F):window,s){case"focusin":(Sp(xe)||xe.contentEditable==="true")&&(ys=xe,Ou=F,Oi=null);break;case"focusout":Oi=Ou=ys=null;break;case"mousedown":Iu=!0;break;case"contextmenu":case"mouseup":case"dragend":Iu=!1,Op(Y,u,G);break;case"selectionchange":if(Mb)break;case"keydown":case"keyup":Op(Y,u,G)}var we;if(Au)e:{switch(s){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else gs?bp(s,u)&&(Te="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(Te="onCompositionStart");Te&&(vp&&u.locale!=="ko"&&(gs||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&gs&&(we=fp()):(ar=G,Su="value"in ar?ar.value:ar.textContent,gs=!0)),xe=xa(F,Te),0<xe.length&&(Te=new gp(Te,s,null,u,G),Y.push({event:Te,listeners:xe}),we?Te.data=we:(we=kp(u),we!==null&&(Te.data=we)))),(we=Eb?Tb(s,u):Cb(s,u))&&(F=xa(F,"onBeforeInput"),0<F.length&&(G=new gp("onBeforeInput","beforeinput",null,u,G),Y.push({event:G,listeners:F}),G.data=we))}Bp(Y,i)})}function Di(s,i,u){return{instance:s,listener:i,currentTarget:u}}function xa(s,i){for(var u=i+"Capture",h=[];s!==null;){var m=s,x=m.stateNode;m.tag===5&&x!==null&&(m=x,x=yi(s,u),x!=null&&h.unshift(Di(s,x,m)),x=yi(s,i),x!=null&&h.push(Di(s,x,m))),s=s.return}return h}function xs(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function qp(s,i,u,h,m){for(var x=i._reactName,k=[];u!==null&&u!==h;){var A=u,R=A.alternate,F=A.stateNode;if(R!==null&&R===h)break;A.tag===5&&F!==null&&(A=F,m?(R=yi(u,x),R!=null&&k.unshift(Di(u,R,A))):m||(R=yi(u,x),R!=null&&k.push(Di(u,R,A)))),u=u.return}k.length!==0&&s.push({event:i,listeners:k})}var $b=/\r\n?/g,Bb=/\u0000|\uFFFD/g;function Hp(s){return(typeof s=="string"?s:""+s).replace($b,`
|
|
6
|
+
`).replace(Bb,"")}function wa(s,i,u){if(i=Hp(i),Hp(s)!==i&&u)throw Error(n(425))}function ba(){}var Fu=null,$u=null;function Bu(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Vu=typeof setTimeout=="function"?setTimeout:void 0,Vb=typeof clearTimeout=="function"?clearTimeout:void 0,Wp=typeof Promise=="function"?Promise:void 0,qb=typeof queueMicrotask=="function"?queueMicrotask:typeof Wp<"u"?function(s){return Wp.resolve(null).then(s).catch(Hb)}:Vu;function Hb(s){setTimeout(function(){throw s})}function qu(s,i){var u=i,h=0;do{var m=u.nextSibling;if(s.removeChild(u),m&&m.nodeType===8)if(u=m.data,u==="/$"){if(h===0){s.removeChild(m),Ti(i);return}h--}else u!=="$"&&u!=="$?"&&u!=="$!"||h++;u=m}while(u);Ti(i)}function ur(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return s}function Kp(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"){if(i===0)return s;i--}else u==="/$"&&i++}s=s.previousSibling}return null}var ws=Math.random().toString(36).slice(2),jn="__reactFiber$"+ws,Mi="__reactProps$"+ws,Fn="__reactContainer$"+ws,Hu="__reactEvents$"+ws,Wb="__reactListeners$"+ws,Kb="__reactHandles$"+ws;function Ir(s){var i=s[jn];if(i)return i;for(var u=s.parentNode;u;){if(i=u[Fn]||u[jn]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(s=Kp(s);s!==null;){if(u=s[jn])return u;s=Kp(s)}return i}s=u,u=s.parentNode}return null}function Ui(s){return s=s[jn]||s[Fn],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function bs(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function ka(s){return s[Mi]||null}var Wu=[],ks=-1;function cr(s){return{current:s}}function Ke(s){0>ks||(s.current=Wu[ks],Wu[ks]=null,ks--)}function $e(s,i){ks++,Wu[ks]=s.current,s.current=i}var dr={},St=cr(dr),Ot=cr(!1),Lr=dr;function Ss(s,i){var u=s.type.contextTypes;if(!u)return dr;var h=s.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===i)return h.__reactInternalMemoizedMaskedChildContext;var m={},x;for(x in u)m[x]=i[x];return h&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=i,s.__reactInternalMemoizedMaskedChildContext=m),m}function It(s){return s=s.childContextTypes,s!=null}function Sa(){Ke(Ot),Ke(St)}function Gp(s,i,u){if(St.current!==dr)throw Error(n(168));$e(St,i),$e(Ot,u)}function Jp(s,i,u){var h=s.stateNode;if(i=i.childContextTypes,typeof h.getChildContext!="function")return u;h=h.getChildContext();for(var m in h)if(!(m in i))throw Error(n(108,je(s)||"Unknown",m));return T({},u,h)}function _a(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||dr,Lr=St.current,$e(St,s),$e(Ot,Ot.current),!0}function Yp(s,i,u){var h=s.stateNode;if(!h)throw Error(n(169));u?(s=Jp(s,i,Lr),h.__reactInternalMemoizedMergedChildContext=s,Ke(Ot),Ke(St),$e(St,s)):Ke(Ot),$e(Ot,u)}var $n=null,Ea=!1,Ku=!1;function Xp(s){$n===null?$n=[s]:$n.push(s)}function Gb(s){Ea=!0,Xp(s)}function hr(){if(!Ku&&$n!==null){Ku=!0;var s=0,i=Fe;try{var u=$n;for(Fe=1;s<u.length;s++){var h=u[s];do h=h(!0);while(h!==null)}$n=null,Ea=!1}catch(m){throw $n!==null&&($n=$n.slice(s+1)),Zf(mu,hr),m}finally{Fe=i,Ku=!1}}return null}var _s=[],Es=0,Ta=null,Ca=0,rn=[],sn=0,Dr=null,Bn=1,Vn="";function Mr(s,i){_s[Es++]=Ca,_s[Es++]=Ta,Ta=s,Ca=i}function Qp(s,i,u){rn[sn++]=Bn,rn[sn++]=Vn,rn[sn++]=Dr,Dr=s;var h=Bn;s=Vn;var m=32-fn(h)-1;h&=~(1<<m),u+=1;var x=32-fn(i)+m;if(30<x){var k=m-m%5;x=(h&(1<<k)-1).toString(32),h>>=k,m-=k,Bn=1<<32-fn(i)+m|u<<m|h,Vn=x+s}else Bn=1<<x|u<<m|h,Vn=s}function Gu(s){s.return!==null&&(Mr(s,1),Qp(s,1,0))}function Ju(s){for(;s===Ta;)Ta=_s[--Es],_s[Es]=null,Ca=_s[--Es],_s[Es]=null;for(;s===Dr;)Dr=rn[--sn],rn[sn]=null,Vn=rn[--sn],rn[sn]=null,Bn=rn[--sn],rn[sn]=null}var Wt=null,Kt=null,Je=!1,mn=null;function Zp(s,i){var u=un(5,null,null,0);u.elementType="DELETED",u.stateNode=i,u.return=s,i=s.deletions,i===null?(s.deletions=[u],s.flags|=16):i.push(u)}function em(s,i){switch(s.tag){case 5:var u=s.type;return i=i.nodeType!==1||u.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(s.stateNode=i,Wt=s,Kt=ur(i.firstChild),!0):!1;case 6:return i=s.pendingProps===""||i.nodeType!==3?null:i,i!==null?(s.stateNode=i,Wt=s,Kt=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(u=Dr!==null?{id:Bn,overflow:Vn}:null,s.memoizedState={dehydrated:i,treeContext:u,retryLane:1073741824},u=un(18,null,null,0),u.stateNode=i,u.return=s,s.child=u,Wt=s,Kt=null,!0):!1;default:return!1}}function Yu(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Xu(s){if(Je){var i=Kt;if(i){var u=i;if(!em(s,i)){if(Yu(s))throw Error(n(418));i=ur(u.nextSibling);var h=Wt;i&&em(s,i)?Zp(h,u):(s.flags=s.flags&-4097|2,Je=!1,Wt=s)}}else{if(Yu(s))throw Error(n(418));s.flags=s.flags&-4097|2,Je=!1,Wt=s}}}function tm(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Wt=s}function ja(s){if(s!==Wt)return!1;if(!Je)return tm(s),Je=!0,!1;var i;if((i=s.tag!==3)&&!(i=s.tag!==5)&&(i=s.type,i=i!=="head"&&i!=="body"&&!Bu(s.type,s.memoizedProps)),i&&(i=Kt)){if(Yu(s))throw nm(),Error(n(418));for(;i;)Zp(s,i),i=ur(i.nextSibling)}if(tm(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,i=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"){if(i===0){Kt=ur(s.nextSibling);break e}i--}else u!=="$"&&u!=="$!"&&u!=="$?"||i++}s=s.nextSibling}Kt=null}}else Kt=Wt?ur(s.stateNode.nextSibling):null;return!0}function nm(){for(var s=Kt;s;)s=ur(s.nextSibling)}function Ts(){Kt=Wt=null,Je=!1}function Qu(s){mn===null?mn=[s]:mn.push(s)}var Jb=D.ReactCurrentBatchConfig;function zi(s,i,u){if(s=u.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var h=u.stateNode}if(!h)throw Error(n(147,s));var m=h,x=""+s;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===x?i.ref:(i=function(k){var A=m.refs;k===null?delete A[x]:A[x]=k},i._stringRef=x,i)}if(typeof s!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,s))}return s}function Aa(s,i){throw s=Object.prototype.toString.call(i),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s))}function rm(s){var i=s._init;return i(s._payload)}function sm(s){function i(M,I){if(s){var U=M.deletions;U===null?(M.deletions=[I],M.flags|=16):U.push(I)}}function u(M,I){if(!s)return null;for(;I!==null;)i(M,I),I=I.sibling;return null}function h(M,I){for(M=new Map;I!==null;)I.key!==null?M.set(I.key,I):M.set(I.index,I),I=I.sibling;return M}function m(M,I){return M=wr(M,I),M.index=0,M.sibling=null,M}function x(M,I,U){return M.index=U,s?(U=M.alternate,U!==null?(U=U.index,U<I?(M.flags|=2,I):U):(M.flags|=2,I)):(M.flags|=1048576,I)}function k(M){return s&&M.alternate===null&&(M.flags|=2),M}function A(M,I,U,te){return I===null||I.tag!==6?(I=Vc(U,M.mode,te),I.return=M,I):(I=m(I,U),I.return=M,I)}function R(M,I,U,te){var me=U.type;return me===z?G(M,I,U.props.children,te,U.key):I!==null&&(I.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===fe&&rm(me)===I.type)?(te=m(I,U.props),te.ref=zi(M,I,U),te.return=M,te):(te=Za(U.type,U.key,U.props,null,M.mode,te),te.ref=zi(M,I,U),te.return=M,te)}function F(M,I,U,te){return I===null||I.tag!==4||I.stateNode.containerInfo!==U.containerInfo||I.stateNode.implementation!==U.implementation?(I=qc(U,M.mode,te),I.return=M,I):(I=m(I,U.children||[]),I.return=M,I)}function G(M,I,U,te,me){return I===null||I.tag!==7?(I=Hr(U,M.mode,te,me),I.return=M,I):(I=m(I,U),I.return=M,I)}function Y(M,I,U){if(typeof I=="string"&&I!==""||typeof I=="number")return I=Vc(""+I,M.mode,U),I.return=M,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case $:return U=Za(I.type,I.key,I.props,null,M.mode,U),U.ref=zi(M,null,I),U.return=M,U;case O:return I=qc(I,M.mode,U),I.return=M,I;case fe:var te=I._init;return Y(M,te(I._payload),U)}if(er(I)||oe(I))return I=Hr(I,M.mode,U,null),I.return=M,I;Aa(M,I)}return null}function K(M,I,U,te){var me=I!==null?I.key:null;if(typeof U=="string"&&U!==""||typeof U=="number")return me!==null?null:A(M,I,""+U,te);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case $:return U.key===me?R(M,I,U,te):null;case O:return U.key===me?F(M,I,U,te):null;case fe:return me=U._init,K(M,I,me(U._payload),te)}if(er(U)||oe(U))return me!==null?null:G(M,I,U,te,null);Aa(M,U)}return null}function ue(M,I,U,te,me){if(typeof te=="string"&&te!==""||typeof te=="number")return M=M.get(U)||null,A(I,M,""+te,me);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case $:return M=M.get(te.key===null?U:te.key)||null,R(I,M,te,me);case O:return M=M.get(te.key===null?U:te.key)||null,F(I,M,te,me);case fe:var xe=te._init;return ue(M,I,U,xe(te._payload),me)}if(er(te)||oe(te))return M=M.get(U)||null,G(I,M,te,me,null);Aa(I,te)}return null}function he(M,I,U,te){for(var me=null,xe=null,we=I,Te=I=0,mt=null;we!==null&&Te<U.length;Te++){we.index>Te?(mt=we,we=null):mt=we.sibling;var De=K(M,we,U[Te],te);if(De===null){we===null&&(we=mt);break}s&&we&&De.alternate===null&&i(M,we),I=x(De,I,Te),xe===null?me=De:xe.sibling=De,xe=De,we=mt}if(Te===U.length)return u(M,we),Je&&Mr(M,Te),me;if(we===null){for(;Te<U.length;Te++)we=Y(M,U[Te],te),we!==null&&(I=x(we,I,Te),xe===null?me=we:xe.sibling=we,xe=we);return Je&&Mr(M,Te),me}for(we=h(M,we);Te<U.length;Te++)mt=ue(we,M,Te,U[Te],te),mt!==null&&(s&&mt.alternate!==null&&we.delete(mt.key===null?Te:mt.key),I=x(mt,I,Te),xe===null?me=mt:xe.sibling=mt,xe=mt);return s&&we.forEach(function(br){return i(M,br)}),Je&&Mr(M,Te),me}function pe(M,I,U,te){var me=oe(U);if(typeof me!="function")throw Error(n(150));if(U=me.call(U),U==null)throw Error(n(151));for(var xe=me=null,we=I,Te=I=0,mt=null,De=U.next();we!==null&&!De.done;Te++,De=U.next()){we.index>Te?(mt=we,we=null):mt=we.sibling;var br=K(M,we,De.value,te);if(br===null){we===null&&(we=mt);break}s&&we&&br.alternate===null&&i(M,we),I=x(br,I,Te),xe===null?me=br:xe.sibling=br,xe=br,we=mt}if(De.done)return u(M,we),Je&&Mr(M,Te),me;if(we===null){for(;!De.done;Te++,De=U.next())De=Y(M,De.value,te),De!==null&&(I=x(De,I,Te),xe===null?me=De:xe.sibling=De,xe=De);return Je&&Mr(M,Te),me}for(we=h(M,we);!De.done;Te++,De=U.next())De=ue(we,M,Te,De.value,te),De!==null&&(s&&De.alternate!==null&&we.delete(De.key===null?Te:De.key),I=x(De,I,Te),xe===null?me=De:xe.sibling=De,xe=De);return s&&we.forEach(function(jk){return i(M,jk)}),Je&&Mr(M,Te),me}function st(M,I,U,te){if(typeof U=="object"&&U!==null&&U.type===z&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case $:e:{for(var me=U.key,xe=I;xe!==null;){if(xe.key===me){if(me=U.type,me===z){if(xe.tag===7){u(M,xe.sibling),I=m(xe,U.props.children),I.return=M,M=I;break e}}else if(xe.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===fe&&rm(me)===xe.type){u(M,xe.sibling),I=m(xe,U.props),I.ref=zi(M,xe,U),I.return=M,M=I;break e}u(M,xe);break}else i(M,xe);xe=xe.sibling}U.type===z?(I=Hr(U.props.children,M.mode,te,U.key),I.return=M,M=I):(te=Za(U.type,U.key,U.props,null,M.mode,te),te.ref=zi(M,I,U),te.return=M,M=te)}return k(M);case O:e:{for(xe=U.key;I!==null;){if(I.key===xe)if(I.tag===4&&I.stateNode.containerInfo===U.containerInfo&&I.stateNode.implementation===U.implementation){u(M,I.sibling),I=m(I,U.children||[]),I.return=M,M=I;break e}else{u(M,I);break}else i(M,I);I=I.sibling}I=qc(U,M.mode,te),I.return=M,M=I}return k(M);case fe:return xe=U._init,st(M,I,xe(U._payload),te)}if(er(U))return he(M,I,U,te);if(oe(U))return pe(M,I,U,te);Aa(M,U)}return typeof U=="string"&&U!==""||typeof U=="number"?(U=""+U,I!==null&&I.tag===6?(u(M,I.sibling),I=m(I,U),I.return=M,M=I):(u(M,I),I=Vc(U,M.mode,te),I.return=M,M=I),k(M)):u(M,I)}return st}var Cs=sm(!0),im=sm(!1),Pa=cr(null),Na=null,js=null,Zu=null;function ec(){Zu=js=Na=null}function tc(s){var i=Pa.current;Ke(Pa),s._currentValue=i}function nc(s,i,u){for(;s!==null;){var h=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,h!==null&&(h.childLanes|=i)):h!==null&&(h.childLanes&i)!==i&&(h.childLanes|=i),s===u)break;s=s.return}}function As(s,i){Na=s,Zu=js=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&i)!==0&&(Lt=!0),s.firstContext=null)}function on(s){var i=s._currentValue;if(Zu!==s)if(s={context:s,memoizedValue:i,next:null},js===null){if(Na===null)throw Error(n(308));js=s,Na.dependencies={lanes:0,firstContext:s}}else js=js.next=s;return i}var Ur=null;function rc(s){Ur===null?Ur=[s]:Ur.push(s)}function om(s,i,u,h){var m=i.interleaved;return m===null?(u.next=u,rc(i)):(u.next=m.next,m.next=u),i.interleaved=u,qn(s,h)}function qn(s,i){s.lanes|=i;var u=s.alternate;for(u!==null&&(u.lanes|=i),u=s,s=s.return;s!==null;)s.childLanes|=i,u=s.alternate,u!==null&&(u.childLanes|=i),u=s,s=s.return;return u.tag===3?u.stateNode:null}var fr=!1;function sc(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function am(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Hn(s,i){return{eventTime:s,lane:i,tag:0,payload:null,callback:null,next:null}}function pr(s,i,u){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(Le&2)!==0){var m=h.pending;return m===null?i.next=i:(i.next=m.next,m.next=i),h.pending=i,qn(s,u)}return m=h.interleaved,m===null?(i.next=i,rc(h)):(i.next=m.next,m.next=i),h.interleaved=i,qn(s,u)}function Ra(s,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194240)!==0)){var h=i.lanes;h&=s.pendingLanes,u|=h,i.lanes=u,vu(s,u)}}function lm(s,i){var u=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var m=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var k={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};x===null?m=x=k:x=x.next=k,u=u.next}while(u!==null);x===null?m=x=i:x=x.next=i}else m=x=i;u={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:h.shared,effects:h.effects},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=i:s.next=i,u.lastBaseUpdate=i}function Oa(s,i,u,h){var m=s.updateQueue;fr=!1;var x=m.firstBaseUpdate,k=m.lastBaseUpdate,A=m.shared.pending;if(A!==null){m.shared.pending=null;var R=A,F=R.next;R.next=null,k===null?x=F:k.next=F,k=R;var G=s.alternate;G!==null&&(G=G.updateQueue,A=G.lastBaseUpdate,A!==k&&(A===null?G.firstBaseUpdate=F:A.next=F,G.lastBaseUpdate=R))}if(x!==null){var Y=m.baseState;k=0,G=F=R=null,A=x;do{var K=A.lane,ue=A.eventTime;if((h&K)===K){G!==null&&(G=G.next={eventTime:ue,lane:0,tag:A.tag,payload:A.payload,callback:A.callback,next:null});e:{var he=s,pe=A;switch(K=i,ue=u,pe.tag){case 1:if(he=pe.payload,typeof he=="function"){Y=he.call(ue,Y,K);break e}Y=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=pe.payload,K=typeof he=="function"?he.call(ue,Y,K):he,K==null)break e;Y=T({},Y,K);break e;case 2:fr=!0}}A.callback!==null&&A.lane!==0&&(s.flags|=64,K=m.effects,K===null?m.effects=[A]:K.push(A))}else ue={eventTime:ue,lane:K,tag:A.tag,payload:A.payload,callback:A.callback,next:null},G===null?(F=G=ue,R=Y):G=G.next=ue,k|=K;if(A=A.next,A===null){if(A=m.shared.pending,A===null)break;K=A,A=K.next,K.next=null,m.lastBaseUpdate=K,m.shared.pending=null}}while(!0);if(G===null&&(R=Y),m.baseState=R,m.firstBaseUpdate=F,m.lastBaseUpdate=G,i=m.shared.interleaved,i!==null){m=i;do k|=m.lane,m=m.next;while(m!==i)}else x===null&&(m.shared.lanes=0);$r|=k,s.lanes=k,s.memoizedState=Y}}function um(s,i,u){if(s=i.effects,i.effects=null,s!==null)for(i=0;i<s.length;i++){var h=s[i],m=h.callback;if(m!==null){if(h.callback=null,h=u,typeof m!="function")throw Error(n(191,m));m.call(h)}}}var Fi={},An=cr(Fi),$i=cr(Fi),Bi=cr(Fi);function zr(s){if(s===Fi)throw Error(n(174));return s}function ic(s,i){switch($e(Bi,i),$e($i,s),$e(An,Fi),s=i.nodeType,s){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:se(null,"");break;default:s=s===8?i.parentNode:i,i=s.namespaceURI||null,s=s.tagName,i=se(i,s)}Ke(An),$e(An,i)}function Ps(){Ke(An),Ke($i),Ke(Bi)}function cm(s){zr(Bi.current);var i=zr(An.current),u=se(i,s.type);i!==u&&($e($i,s),$e(An,u))}function oc(s){$i.current===s&&(Ke(An),Ke($i))}var Ye=cr(0);function Ia(s){for(var i=s;i!==null;){if(i.tag===13){var u=i.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var ac=[];function lc(){for(var s=0;s<ac.length;s++)ac[s]._workInProgressVersionPrimary=null;ac.length=0}var La=D.ReactCurrentDispatcher,uc=D.ReactCurrentBatchConfig,Fr=0,Xe=null,ct=null,ft=null,Da=!1,Vi=!1,qi=0,Yb=0;function _t(){throw Error(n(321))}function cc(s,i){if(i===null)return!1;for(var u=0;u<i.length&&u<s.length;u++)if(!pn(s[u],i[u]))return!1;return!0}function dc(s,i,u,h,m,x){if(Fr=x,Xe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,La.current=s===null||s.memoizedState===null?ek:tk,s=u(h,m),Vi){x=0;do{if(Vi=!1,qi=0,25<=x)throw Error(n(301));x+=1,ft=ct=null,i.updateQueue=null,La.current=nk,s=u(h,m)}while(Vi)}if(La.current=za,i=ct!==null&&ct.next!==null,Fr=0,ft=ct=Xe=null,Da=!1,i)throw Error(n(300));return s}function hc(){var s=qi!==0;return qi=0,s}function Pn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ft===null?Xe.memoizedState=ft=s:ft=ft.next=s,ft}function an(){if(ct===null){var s=Xe.alternate;s=s!==null?s.memoizedState:null}else s=ct.next;var i=ft===null?Xe.memoizedState:ft.next;if(i!==null)ft=i,ct=s;else{if(s===null)throw Error(n(310));ct=s,s={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},ft===null?Xe.memoizedState=ft=s:ft=ft.next=s}return ft}function Hi(s,i){return typeof i=="function"?i(s):i}function fc(s){var i=an(),u=i.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var h=ct,m=h.baseQueue,x=u.pending;if(x!==null){if(m!==null){var k=m.next;m.next=x.next,x.next=k}h.baseQueue=m=x,u.pending=null}if(m!==null){x=m.next,h=h.baseState;var A=k=null,R=null,F=x;do{var G=F.lane;if((Fr&G)===G)R!==null&&(R=R.next={lane:0,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),h=F.hasEagerState?F.eagerState:s(h,F.action);else{var Y={lane:G,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null};R===null?(A=R=Y,k=h):R=R.next=Y,Xe.lanes|=G,$r|=G}F=F.next}while(F!==null&&F!==x);R===null?k=h:R.next=A,pn(h,i.memoizedState)||(Lt=!0),i.memoizedState=h,i.baseState=k,i.baseQueue=R,u.lastRenderedState=h}if(s=u.interleaved,s!==null){m=s;do x=m.lane,Xe.lanes|=x,$r|=x,m=m.next;while(m!==s)}else m===null&&(u.lanes=0);return[i.memoizedState,u.dispatch]}function pc(s){var i=an(),u=i.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var h=u.dispatch,m=u.pending,x=i.memoizedState;if(m!==null){u.pending=null;var k=m=m.next;do x=s(x,k.action),k=k.next;while(k!==m);pn(x,i.memoizedState)||(Lt=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),u.lastRenderedState=x}return[x,h]}function dm(){}function hm(s,i){var u=Xe,h=an(),m=i(),x=!pn(h.memoizedState,m);if(x&&(h.memoizedState=m,Lt=!0),h=h.queue,mc(mm.bind(null,u,h,s),[s]),h.getSnapshot!==i||x||ft!==null&&ft.memoizedState.tag&1){if(u.flags|=2048,Wi(9,pm.bind(null,u,h,m,i),void 0,null),pt===null)throw Error(n(349));(Fr&30)!==0||fm(u,i,m)}return m}function fm(s,i,u){s.flags|=16384,s={getSnapshot:i,value:u},i=Xe.updateQueue,i===null?(i={lastEffect:null,stores:null},Xe.updateQueue=i,i.stores=[s]):(u=i.stores,u===null?i.stores=[s]:u.push(s))}function pm(s,i,u,h){i.value=u,i.getSnapshot=h,gm(i)&&ym(s)}function mm(s,i,u){return u(function(){gm(i)&&ym(s)})}function gm(s){var i=s.getSnapshot;s=s.value;try{var u=i();return!pn(s,u)}catch{return!0}}function ym(s){var i=qn(s,1);i!==null&&xn(i,s,1,-1)}function vm(s){var i=Pn();return typeof s=="function"&&(s=s()),i.memoizedState=i.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Hi,lastRenderedState:s},i.queue=s,s=s.dispatch=Zb.bind(null,Xe,s),[i.memoizedState,s]}function Wi(s,i,u,h){return s={tag:s,create:i,destroy:u,deps:h,next:null},i=Xe.updateQueue,i===null?(i={lastEffect:null,stores:null},Xe.updateQueue=i,i.lastEffect=s.next=s):(u=i.lastEffect,u===null?i.lastEffect=s.next=s:(h=u.next,u.next=s,s.next=h,i.lastEffect=s)),s}function xm(){return an().memoizedState}function Ma(s,i,u,h){var m=Pn();Xe.flags|=s,m.memoizedState=Wi(1|i,u,void 0,h===void 0?null:h)}function Ua(s,i,u,h){var m=an();h=h===void 0?null:h;var x=void 0;if(ct!==null){var k=ct.memoizedState;if(x=k.destroy,h!==null&&cc(h,k.deps)){m.memoizedState=Wi(i,u,x,h);return}}Xe.flags|=s,m.memoizedState=Wi(1|i,u,x,h)}function wm(s,i){return Ma(8390656,8,s,i)}function mc(s,i){return Ua(2048,8,s,i)}function bm(s,i){return Ua(4,2,s,i)}function km(s,i){return Ua(4,4,s,i)}function Sm(s,i){if(typeof i=="function")return s=s(),i(s),function(){i(null)};if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function _m(s,i,u){return u=u!=null?u.concat([s]):null,Ua(4,4,Sm.bind(null,i,s),u)}function gc(){}function Em(s,i){var u=an();i=i===void 0?null:i;var h=u.memoizedState;return h!==null&&i!==null&&cc(i,h[1])?h[0]:(u.memoizedState=[s,i],s)}function Tm(s,i){var u=an();i=i===void 0?null:i;var h=u.memoizedState;return h!==null&&i!==null&&cc(i,h[1])?h[0]:(s=s(),u.memoizedState=[s,i],s)}function Cm(s,i,u){return(Fr&21)===0?(s.baseState&&(s.baseState=!1,Lt=!0),s.memoizedState=u):(pn(u,i)||(u=rp(),Xe.lanes|=u,$r|=u,s.baseState=!0),i)}function Xb(s,i){var u=Fe;Fe=u!==0&&4>u?u:4,s(!0);var h=uc.transition;uc.transition={};try{s(!1),i()}finally{Fe=u,uc.transition=h}}function jm(){return an().memoizedState}function Qb(s,i,u){var h=vr(s);if(u={lane:h,action:u,hasEagerState:!1,eagerState:null,next:null},Am(s))Pm(i,u);else if(u=om(s,i,u,h),u!==null){var m=Rt();xn(u,s,h,m),Nm(u,i,h)}}function Zb(s,i,u){var h=vr(s),m={lane:h,action:u,hasEagerState:!1,eagerState:null,next:null};if(Am(s))Pm(i,m);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var k=i.lastRenderedState,A=x(k,u);if(m.hasEagerState=!0,m.eagerState=A,pn(A,k)){var R=i.interleaved;R===null?(m.next=m,rc(i)):(m.next=R.next,R.next=m),i.interleaved=m;return}}catch{}u=om(s,i,m,h),u!==null&&(m=Rt(),xn(u,s,h,m),Nm(u,i,h))}}function Am(s){var i=s.alternate;return s===Xe||i!==null&&i===Xe}function Pm(s,i){Vi=Da=!0;var u=s.pending;u===null?i.next=i:(i.next=u.next,u.next=i),s.pending=i}function Nm(s,i,u){if((u&4194240)!==0){var h=i.lanes;h&=s.pendingLanes,u|=h,i.lanes=u,vu(s,u)}}var za={readContext:on,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useInsertionEffect:_t,useLayoutEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useMutableSource:_t,useSyncExternalStore:_t,useId:_t,unstable_isNewReconciler:!1},ek={readContext:on,useCallback:function(s,i){return Pn().memoizedState=[s,i===void 0?null:i],s},useContext:on,useEffect:wm,useImperativeHandle:function(s,i,u){return u=u!=null?u.concat([s]):null,Ma(4194308,4,Sm.bind(null,i,s),u)},useLayoutEffect:function(s,i){return Ma(4194308,4,s,i)},useInsertionEffect:function(s,i){return Ma(4,2,s,i)},useMemo:function(s,i){var u=Pn();return i=i===void 0?null:i,s=s(),u.memoizedState=[s,i],s},useReducer:function(s,i,u){var h=Pn();return i=u!==void 0?u(i):i,h.memoizedState=h.baseState=i,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:i},h.queue=s,s=s.dispatch=Qb.bind(null,Xe,s),[h.memoizedState,s]},useRef:function(s){var i=Pn();return s={current:s},i.memoizedState=s},useState:vm,useDebugValue:gc,useDeferredValue:function(s){return Pn().memoizedState=s},useTransition:function(){var s=vm(!1),i=s[0];return s=Xb.bind(null,s[1]),Pn().memoizedState=s,[i,s]},useMutableSource:function(){},useSyncExternalStore:function(s,i,u){var h=Xe,m=Pn();if(Je){if(u===void 0)throw Error(n(407));u=u()}else{if(u=i(),pt===null)throw Error(n(349));(Fr&30)!==0||fm(h,i,u)}m.memoizedState=u;var x={value:u,getSnapshot:i};return m.queue=x,wm(mm.bind(null,h,x,s),[s]),h.flags|=2048,Wi(9,pm.bind(null,h,x,u,i),void 0,null),u},useId:function(){var s=Pn(),i=pt.identifierPrefix;if(Je){var u=Vn,h=Bn;u=(h&~(1<<32-fn(h)-1)).toString(32)+u,i=":"+i+"R"+u,u=qi++,0<u&&(i+="H"+u.toString(32)),i+=":"}else u=Yb++,i=":"+i+"r"+u.toString(32)+":";return s.memoizedState=i},unstable_isNewReconciler:!1},tk={readContext:on,useCallback:Em,useContext:on,useEffect:mc,useImperativeHandle:_m,useInsertionEffect:bm,useLayoutEffect:km,useMemo:Tm,useReducer:fc,useRef:xm,useState:function(){return fc(Hi)},useDebugValue:gc,useDeferredValue:function(s){var i=an();return Cm(i,ct.memoizedState,s)},useTransition:function(){var s=fc(Hi)[0],i=an().memoizedState;return[s,i]},useMutableSource:dm,useSyncExternalStore:hm,useId:jm,unstable_isNewReconciler:!1},nk={readContext:on,useCallback:Em,useContext:on,useEffect:mc,useImperativeHandle:_m,useInsertionEffect:bm,useLayoutEffect:km,useMemo:Tm,useReducer:pc,useRef:xm,useState:function(){return pc(Hi)},useDebugValue:gc,useDeferredValue:function(s){var i=an();return ct===null?i.memoizedState=s:Cm(i,ct.memoizedState,s)},useTransition:function(){var s=pc(Hi)[0],i=an().memoizedState;return[s,i]},useMutableSource:dm,useSyncExternalStore:hm,useId:jm,unstable_isNewReconciler:!1};function gn(s,i){if(s&&s.defaultProps){i=T({},i),s=s.defaultProps;for(var u in s)i[u]===void 0&&(i[u]=s[u]);return i}return i}function yc(s,i,u,h){i=s.memoizedState,u=u(h,i),u=u==null?i:T({},i,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var Fa={isMounted:function(s){return(s=s._reactInternals)?Or(s)===s:!1},enqueueSetState:function(s,i,u){s=s._reactInternals;var h=Rt(),m=vr(s),x=Hn(h,m);x.payload=i,u!=null&&(x.callback=u),i=pr(s,x,m),i!==null&&(xn(i,s,m,h),Ra(i,s,m))},enqueueReplaceState:function(s,i,u){s=s._reactInternals;var h=Rt(),m=vr(s),x=Hn(h,m);x.tag=1,x.payload=i,u!=null&&(x.callback=u),i=pr(s,x,m),i!==null&&(xn(i,s,m,h),Ra(i,s,m))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var u=Rt(),h=vr(s),m=Hn(u,h);m.tag=2,i!=null&&(m.callback=i),i=pr(s,m,h),i!==null&&(xn(i,s,h,u),Ra(i,s,h))}};function Rm(s,i,u,h,m,x,k){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,x,k):i.prototype&&i.prototype.isPureReactComponent?!Ri(u,h)||!Ri(m,x):!0}function Om(s,i,u){var h=!1,m=dr,x=i.contextType;return typeof x=="object"&&x!==null?x=on(x):(m=It(i)?Lr:St.current,h=i.contextTypes,x=(h=h!=null)?Ss(s,m):dr),i=new i(u,x),s.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Fa,s.stateNode=i,i._reactInternals=s,h&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=m,s.__reactInternalMemoizedMaskedChildContext=x),i}function Im(s,i,u,h){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(u,h),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(u,h),i.state!==s&&Fa.enqueueReplaceState(i,i.state,null)}function vc(s,i,u,h){var m=s.stateNode;m.props=u,m.state=s.memoizedState,m.refs={},sc(s);var x=i.contextType;typeof x=="object"&&x!==null?m.context=on(x):(x=It(i)?Lr:St.current,m.context=Ss(s,x)),m.state=s.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&(yc(s,i,x,u),m.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(i=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),i!==m.state&&Fa.enqueueReplaceState(m,m.state,null),Oa(s,u,m,h),m.state=s.memoizedState),typeof m.componentDidMount=="function"&&(s.flags|=4194308)}function Ns(s,i){try{var u="",h=i;do u+=ve(h),h=h.return;while(h);var m=u}catch(x){m=`
|
|
7
|
+
Error generating stack: `+x.message+`
|
|
8
|
+
`+x.stack}return{value:s,source:i,stack:m,digest:null}}function xc(s,i,u){return{value:s,source:null,stack:u??null,digest:i??null}}function wc(s,i){try{console.error(i.value)}catch(u){setTimeout(function(){throw u})}}var rk=typeof WeakMap=="function"?WeakMap:Map;function Lm(s,i,u){u=Hn(-1,u),u.tag=3,u.payload={element:null};var h=i.value;return u.callback=function(){Ka||(Ka=!0,Lc=h),wc(s,i)},u}function Dm(s,i,u){u=Hn(-1,u),u.tag=3;var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var m=i.value;u.payload=function(){return h(m)},u.callback=function(){wc(s,i)}}var x=s.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(u.callback=function(){wc(s,i),typeof h!="function"&&(gr===null?gr=new Set([this]):gr.add(this));var k=i.stack;this.componentDidCatch(i.value,{componentStack:k!==null?k:""})}),u}function Mm(s,i,u){var h=s.pingCache;if(h===null){h=s.pingCache=new rk;var m=new Set;h.set(i,m)}else m=h.get(i),m===void 0&&(m=new Set,h.set(i,m));m.has(u)||(m.add(u),s=yk.bind(null,s,i,u),i.then(s,s))}function Um(s){do{var i;if((i=s.tag===13)&&(i=s.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return s;s=s.return}while(s!==null);return null}function zm(s,i,u,h,m){return(s.mode&1)===0?(s===i?s.flags|=65536:(s.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(i=Hn(-1,1),i.tag=2,pr(u,i,1))),u.lanes|=1),s):(s.flags|=65536,s.lanes=m,s)}var sk=D.ReactCurrentOwner,Lt=!1;function Nt(s,i,u,h){i.child=s===null?im(i,null,u,h):Cs(i,s.child,u,h)}function Fm(s,i,u,h,m){u=u.render;var x=i.ref;return As(i,m),h=dc(s,i,u,h,x,m),u=hc(),s!==null&&!Lt?(i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~m,Wn(s,i,m)):(Je&&u&&Gu(i),i.flags|=1,Nt(s,i,h,m),i.child)}function $m(s,i,u,h,m){if(s===null){var x=u.type;return typeof x=="function"&&!Bc(x)&&x.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(i.tag=15,i.type=x,Bm(s,i,x,h,m)):(s=Za(u.type,null,h,i,i.mode,m),s.ref=i.ref,s.return=i,i.child=s)}if(x=s.child,(s.lanes&m)===0){var k=x.memoizedProps;if(u=u.compare,u=u!==null?u:Ri,u(k,h)&&s.ref===i.ref)return Wn(s,i,m)}return i.flags|=1,s=wr(x,h),s.ref=i.ref,s.return=i,i.child=s}function Bm(s,i,u,h,m){if(s!==null){var x=s.memoizedProps;if(Ri(x,h)&&s.ref===i.ref)if(Lt=!1,i.pendingProps=h=x,(s.lanes&m)!==0)(s.flags&131072)!==0&&(Lt=!0);else return i.lanes=s.lanes,Wn(s,i,m)}return bc(s,i,u,h,m)}function Vm(s,i,u){var h=i.pendingProps,m=h.children,x=s!==null?s.memoizedState:null;if(h.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},$e(Os,Gt),Gt|=u;else{if((u&1073741824)===0)return s=x!==null?x.baseLanes|u:u,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:s,cachePool:null,transitions:null},i.updateQueue=null,$e(Os,Gt),Gt|=s,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},h=x!==null?x.baseLanes:u,$e(Os,Gt),Gt|=h}else x!==null?(h=x.baseLanes|u,i.memoizedState=null):h=u,$e(Os,Gt),Gt|=h;return Nt(s,i,m,u),i.child}function qm(s,i){var u=i.ref;(s===null&&u!==null||s!==null&&s.ref!==u)&&(i.flags|=512,i.flags|=2097152)}function bc(s,i,u,h,m){var x=It(u)?Lr:St.current;return x=Ss(i,x),As(i,m),u=dc(s,i,u,h,x,m),h=hc(),s!==null&&!Lt?(i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~m,Wn(s,i,m)):(Je&&h&&Gu(i),i.flags|=1,Nt(s,i,u,m),i.child)}function Hm(s,i,u,h,m){if(It(u)){var x=!0;_a(i)}else x=!1;if(As(i,m),i.stateNode===null)Ba(s,i),Om(i,u,h),vc(i,u,h,m),h=!0;else if(s===null){var k=i.stateNode,A=i.memoizedProps;k.props=A;var R=k.context,F=u.contextType;typeof F=="object"&&F!==null?F=on(F):(F=It(u)?Lr:St.current,F=Ss(i,F));var G=u.getDerivedStateFromProps,Y=typeof G=="function"||typeof k.getSnapshotBeforeUpdate=="function";Y||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(A!==h||R!==F)&&Im(i,k,h,F),fr=!1;var K=i.memoizedState;k.state=K,Oa(i,h,k,m),R=i.memoizedState,A!==h||K!==R||Ot.current||fr?(typeof G=="function"&&(yc(i,u,G,h),R=i.memoizedState),(A=fr||Rm(i,u,A,h,K,R,F))?(Y||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(i.flags|=4194308)):(typeof k.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=h,i.memoizedState=R),k.props=h,k.state=R,k.context=F,h=A):(typeof k.componentDidMount=="function"&&(i.flags|=4194308),h=!1)}else{k=i.stateNode,am(s,i),A=i.memoizedProps,F=i.type===i.elementType?A:gn(i.type,A),k.props=F,Y=i.pendingProps,K=k.context,R=u.contextType,typeof R=="object"&&R!==null?R=on(R):(R=It(u)?Lr:St.current,R=Ss(i,R));var ue=u.getDerivedStateFromProps;(G=typeof ue=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(A!==Y||K!==R)&&Im(i,k,h,R),fr=!1,K=i.memoizedState,k.state=K,Oa(i,h,k,m);var he=i.memoizedState;A!==Y||K!==he||Ot.current||fr?(typeof ue=="function"&&(yc(i,u,ue,h),he=i.memoizedState),(F=fr||Rm(i,u,F,h,K,he,R)||!1)?(G||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(h,he,R),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(h,he,R)),typeof k.componentDidUpdate=="function"&&(i.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof k.componentDidUpdate!="function"||A===s.memoizedProps&&K===s.memoizedState||(i.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||A===s.memoizedProps&&K===s.memoizedState||(i.flags|=1024),i.memoizedProps=h,i.memoizedState=he),k.props=h,k.state=he,k.context=R,h=F):(typeof k.componentDidUpdate!="function"||A===s.memoizedProps&&K===s.memoizedState||(i.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||A===s.memoizedProps&&K===s.memoizedState||(i.flags|=1024),h=!1)}return kc(s,i,u,h,x,m)}function kc(s,i,u,h,m,x){qm(s,i);var k=(i.flags&128)!==0;if(!h&&!k)return m&&Yp(i,u,!1),Wn(s,i,x);h=i.stateNode,sk.current=i;var A=k&&typeof u.getDerivedStateFromError!="function"?null:h.render();return i.flags|=1,s!==null&&k?(i.child=Cs(i,s.child,null,x),i.child=Cs(i,null,A,x)):Nt(s,i,A,x),i.memoizedState=h.state,m&&Yp(i,u,!0),i.child}function Wm(s){var i=s.stateNode;i.pendingContext?Gp(s,i.pendingContext,i.pendingContext!==i.context):i.context&&Gp(s,i.context,!1),ic(s,i.containerInfo)}function Km(s,i,u,h,m){return Ts(),Qu(m),i.flags|=256,Nt(s,i,u,h),i.child}var Sc={dehydrated:null,treeContext:null,retryLane:0};function _c(s){return{baseLanes:s,cachePool:null,transitions:null}}function Gm(s,i,u){var h=i.pendingProps,m=Ye.current,x=!1,k=(i.flags&128)!==0,A;if((A=k)||(A=s!==null&&s.memoizedState===null?!1:(m&2)!==0),A?(x=!0,i.flags&=-129):(s===null||s.memoizedState!==null)&&(m|=1),$e(Ye,m&1),s===null)return Xu(i),s=i.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((i.mode&1)===0?i.lanes=1:s.data==="$!"?i.lanes=8:i.lanes=1073741824,null):(k=h.children,s=h.fallback,x?(h=i.mode,x=i.child,k={mode:"hidden",children:k},(h&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=k):x=el(k,h,0,null),s=Hr(s,h,u,null),x.return=i,s.return=i,x.sibling=s,i.child=x,i.child.memoizedState=_c(u),i.memoizedState=Sc,s):Ec(i,k));if(m=s.memoizedState,m!==null&&(A=m.dehydrated,A!==null))return ik(s,i,k,h,A,m,u);if(x){x=h.fallback,k=i.mode,m=s.child,A=m.sibling;var R={mode:"hidden",children:h.children};return(k&1)===0&&i.child!==m?(h=i.child,h.childLanes=0,h.pendingProps=R,i.deletions=null):(h=wr(m,R),h.subtreeFlags=m.subtreeFlags&14680064),A!==null?x=wr(A,x):(x=Hr(x,k,u,null),x.flags|=2),x.return=i,h.return=i,h.sibling=x,i.child=h,h=x,x=i.child,k=s.child.memoizedState,k=k===null?_c(u):{baseLanes:k.baseLanes|u,cachePool:null,transitions:k.transitions},x.memoizedState=k,x.childLanes=s.childLanes&~u,i.memoizedState=Sc,h}return x=s.child,s=x.sibling,h=wr(x,{mode:"visible",children:h.children}),(i.mode&1)===0&&(h.lanes=u),h.return=i,h.sibling=null,s!==null&&(u=i.deletions,u===null?(i.deletions=[s],i.flags|=16):u.push(s)),i.child=h,i.memoizedState=null,h}function Ec(s,i){return i=el({mode:"visible",children:i},s.mode,0,null),i.return=s,s.child=i}function $a(s,i,u,h){return h!==null&&Qu(h),Cs(i,s.child,null,u),s=Ec(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function ik(s,i,u,h,m,x,k){if(u)return i.flags&256?(i.flags&=-257,h=xc(Error(n(422))),$a(s,i,k,h)):i.memoizedState!==null?(i.child=s.child,i.flags|=128,null):(x=h.fallback,m=i.mode,h=el({mode:"visible",children:h.children},m,0,null),x=Hr(x,m,k,null),x.flags|=2,h.return=i,x.return=i,h.sibling=x,i.child=h,(i.mode&1)!==0&&Cs(i,s.child,null,k),i.child.memoizedState=_c(k),i.memoizedState=Sc,x);if((i.mode&1)===0)return $a(s,i,k,null);if(m.data==="$!"){if(h=m.nextSibling&&m.nextSibling.dataset,h)var A=h.dgst;return h=A,x=Error(n(419)),h=xc(x,h,void 0),$a(s,i,k,h)}if(A=(k&s.childLanes)!==0,Lt||A){if(h=pt,h!==null){switch(k&-k){case 4:m=2;break;case 16:m=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:m=32;break;case 536870912:m=268435456;break;default:m=0}m=(m&(h.suspendedLanes|k))!==0?0:m,m!==0&&m!==x.retryLane&&(x.retryLane=m,qn(s,m),xn(h,s,m,-1))}return $c(),h=xc(Error(n(421))),$a(s,i,k,h)}return m.data==="$?"?(i.flags|=128,i.child=s.child,i=vk.bind(null,s),m._reactRetry=i,null):(s=x.treeContext,Kt=ur(m.nextSibling),Wt=i,Je=!0,mn=null,s!==null&&(rn[sn++]=Bn,rn[sn++]=Vn,rn[sn++]=Dr,Bn=s.id,Vn=s.overflow,Dr=i),i=Ec(i,h.children),i.flags|=4096,i)}function Jm(s,i,u){s.lanes|=i;var h=s.alternate;h!==null&&(h.lanes|=i),nc(s.return,i,u)}function Tc(s,i,u,h,m){var x=s.memoizedState;x===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:m}:(x.isBackwards=i,x.rendering=null,x.renderingStartTime=0,x.last=h,x.tail=u,x.tailMode=m)}function Ym(s,i,u){var h=i.pendingProps,m=h.revealOrder,x=h.tail;if(Nt(s,i,h.children,u),h=Ye.current,(h&2)!==0)h=h&1|2,i.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Jm(s,u,i);else if(s.tag===19)Jm(s,u,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}h&=1}if($e(Ye,h),(i.mode&1)===0)i.memoizedState=null;else switch(m){case"forwards":for(u=i.child,m=null;u!==null;)s=u.alternate,s!==null&&Ia(s)===null&&(m=u),u=u.sibling;u=m,u===null?(m=i.child,i.child=null):(m=u.sibling,u.sibling=null),Tc(i,!1,m,u,x);break;case"backwards":for(u=null,m=i.child,i.child=null;m!==null;){if(s=m.alternate,s!==null&&Ia(s)===null){i.child=m;break}s=m.sibling,m.sibling=u,u=m,m=s}Tc(i,!0,u,null,x);break;case"together":Tc(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function Ba(s,i){(i.mode&1)===0&&s!==null&&(s.alternate=null,i.alternate=null,i.flags|=2)}function Wn(s,i,u){if(s!==null&&(i.dependencies=s.dependencies),$r|=i.lanes,(u&i.childLanes)===0)return null;if(s!==null&&i.child!==s.child)throw Error(n(153));if(i.child!==null){for(s=i.child,u=wr(s,s.pendingProps),i.child=u,u.return=i;s.sibling!==null;)s=s.sibling,u=u.sibling=wr(s,s.pendingProps),u.return=i;u.sibling=null}return i.child}function ok(s,i,u){switch(i.tag){case 3:Wm(i),Ts();break;case 5:cm(i);break;case 1:It(i.type)&&_a(i);break;case 4:ic(i,i.stateNode.containerInfo);break;case 10:var h=i.type._context,m=i.memoizedProps.value;$e(Pa,h._currentValue),h._currentValue=m;break;case 13:if(h=i.memoizedState,h!==null)return h.dehydrated!==null?($e(Ye,Ye.current&1),i.flags|=128,null):(u&i.child.childLanes)!==0?Gm(s,i,u):($e(Ye,Ye.current&1),s=Wn(s,i,u),s!==null?s.sibling:null);$e(Ye,Ye.current&1);break;case 19:if(h=(u&i.childLanes)!==0,(s.flags&128)!==0){if(h)return Ym(s,i,u);i.flags|=128}if(m=i.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),$e(Ye,Ye.current),h)break;return null;case 22:case 23:return i.lanes=0,Vm(s,i,u)}return Wn(s,i,u)}var Xm,Cc,Qm,Zm;Xm=function(s,i){for(var u=i.child;u!==null;){if(u.tag===5||u.tag===6)s.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===i)break;for(;u.sibling===null;){if(u.return===null||u.return===i)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Cc=function(){},Qm=function(s,i,u,h){var m=s.memoizedProps;if(m!==h){s=i.stateNode,zr(An.current);var x=null;switch(u){case"input":m=fi(s,m),h=fi(s,h),x=[];break;case"select":m=T({},m,{value:void 0}),h=T({},h,{value:void 0}),x=[];break;case"textarea":m=gi(s,m),h=gi(s,h),x=[];break;default:typeof m.onClick!="function"&&typeof h.onClick=="function"&&(s.onclick=ba)}yt(u,h);var k;u=null;for(F in m)if(!h.hasOwnProperty(F)&&m.hasOwnProperty(F)&&m[F]!=null)if(F==="style"){var A=m[F];for(k in A)A.hasOwnProperty(k)&&(u||(u={}),u[k]="")}else F!=="dangerouslySetInnerHTML"&&F!=="children"&&F!=="suppressContentEditableWarning"&&F!=="suppressHydrationWarning"&&F!=="autoFocus"&&(o.hasOwnProperty(F)?x||(x=[]):(x=x||[]).push(F,null));for(F in h){var R=h[F];if(A=m?.[F],h.hasOwnProperty(F)&&R!==A&&(R!=null||A!=null))if(F==="style")if(A){for(k in A)!A.hasOwnProperty(k)||R&&R.hasOwnProperty(k)||(u||(u={}),u[k]="");for(k in R)R.hasOwnProperty(k)&&A[k]!==R[k]&&(u||(u={}),u[k]=R[k])}else u||(x||(x=[]),x.push(F,u)),u=R;else F==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,A=A?A.__html:void 0,R!=null&&A!==R&&(x=x||[]).push(F,R)):F==="children"?typeof R!="string"&&typeof R!="number"||(x=x||[]).push(F,""+R):F!=="suppressContentEditableWarning"&&F!=="suppressHydrationWarning"&&(o.hasOwnProperty(F)?(R!=null&&F==="onScroll"&&We("scroll",s),x||A===R||(x=[])):(x=x||[]).push(F,R))}u&&(x=x||[]).push("style",u);var F=x;(i.updateQueue=F)&&(i.flags|=4)}},Zm=function(s,i,u,h){u!==h&&(i.flags|=4)};function Ki(s,i){if(!Je)switch(s.tailMode){case"hidden":i=s.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function Et(s){var i=s.alternate!==null&&s.alternate.child===s.child,u=0,h=0;if(i)for(var m=s.child;m!==null;)u|=m.lanes|m.childLanes,h|=m.subtreeFlags&14680064,h|=m.flags&14680064,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)u|=m.lanes|m.childLanes,h|=m.subtreeFlags,h|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=h,s.childLanes=u,i}function ak(s,i,u){var h=i.pendingProps;switch(Ju(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(i),null;case 1:return It(i.type)&&Sa(),Et(i),null;case 3:return h=i.stateNode,Ps(),Ke(Ot),Ke(St),lc(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(s===null||s.child===null)&&(ja(i)?i.flags|=4:s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,mn!==null&&(Uc(mn),mn=null))),Cc(s,i),Et(i),null;case 5:oc(i);var m=zr(Bi.current);if(u=i.type,s!==null&&i.stateNode!=null)Qm(s,i,u,h,m),s.ref!==i.ref&&(i.flags|=512,i.flags|=2097152);else{if(!h){if(i.stateNode===null)throw Error(n(166));return Et(i),null}if(s=zr(An.current),ja(i)){h=i.stateNode,u=i.type;var x=i.memoizedProps;switch(h[jn]=i,h[Mi]=x,s=(i.mode&1)!==0,u){case"dialog":We("cancel",h),We("close",h);break;case"iframe":case"object":case"embed":We("load",h);break;case"video":case"audio":for(m=0;m<Ii.length;m++)We(Ii[m],h);break;case"source":We("error",h);break;case"img":case"image":case"link":We("error",h),We("load",h);break;case"details":We("toggle",h);break;case"input":pi(h,x),We("invalid",h);break;case"select":h._wrapperState={wasMultiple:!!x.multiple},We("invalid",h);break;case"textarea":Xo(h,x),We("invalid",h)}yt(u,x),m=null;for(var k in x)if(x.hasOwnProperty(k)){var A=x[k];k==="children"?typeof A=="string"?h.textContent!==A&&(x.suppressHydrationWarning!==!0&&wa(h.textContent,A,s),m=["children",A]):typeof A=="number"&&h.textContent!==""+A&&(x.suppressHydrationWarning!==!0&&wa(h.textContent,A,s),m=["children",""+A]):o.hasOwnProperty(k)&&A!=null&&k==="onScroll"&&We("scroll",h)}switch(u){case"input":Un(h),Yo(h,x,!0);break;case"textarea":Un(h),Zo(h);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(h.onclick=ba)}h=m,i.updateQueue=h,h!==null&&(i.flags|=4)}else{k=m.nodeType===9?m:m.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=W(u)),s==="http://www.w3.org/1999/xhtml"?u==="script"?(s=k.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof h.is=="string"?s=k.createElement(u,{is:h.is}):(s=k.createElement(u),u==="select"&&(k=s,h.multiple?k.multiple=!0:h.size&&(k.size=h.size))):s=k.createElementNS(s,u),s[jn]=i,s[Mi]=h,Xm(s,i,!1,!1),i.stateNode=s;e:{switch(k=Tn(u,h),u){case"dialog":We("cancel",s),We("close",s),m=h;break;case"iframe":case"object":case"embed":We("load",s),m=h;break;case"video":case"audio":for(m=0;m<Ii.length;m++)We(Ii[m],s);m=h;break;case"source":We("error",s),m=h;break;case"img":case"image":case"link":We("error",s),We("load",s),m=h;break;case"details":We("toggle",s),m=h;break;case"input":pi(s,h),m=fi(s,h),We("invalid",s);break;case"option":m=h;break;case"select":s._wrapperState={wasMultiple:!!h.multiple},m=T({},h,{value:void 0}),We("invalid",s);break;case"textarea":Xo(s,h),m=gi(s,h),We("invalid",s);break;default:m=h}yt(u,m),A=m;for(x in A)if(A.hasOwnProperty(x)){var R=A[x];x==="style"?nr(s,R):x==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,R!=null&&Re(s,R)):x==="children"?typeof R=="string"?(u!=="textarea"||R!=="")&&Ie(s,R):typeof R=="number"&&Ie(s,""+R):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?R!=null&&x==="onScroll"&&We("scroll",s):R!=null&&j(s,x,R,k))}switch(u){case"input":Un(s),Yo(s,h,!1);break;case"textarea":Un(s),Zo(s);break;case"option":h.value!=null&&s.setAttribute("value",""+Ae(h.value));break;case"select":s.multiple=!!h.multiple,x=h.value,x!=null?tr(s,!!h.multiple,x,!1):h.defaultValue!=null&&tr(s,!!h.multiple,h.defaultValue,!0);break;default:typeof m.onClick=="function"&&(s.onclick=ba)}switch(u){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}}h&&(i.flags|=4)}i.ref!==null&&(i.flags|=512,i.flags|=2097152)}return Et(i),null;case 6:if(s&&i.stateNode!=null)Zm(s,i,s.memoizedProps,h);else{if(typeof h!="string"&&i.stateNode===null)throw Error(n(166));if(u=zr(Bi.current),zr(An.current),ja(i)){if(h=i.stateNode,u=i.memoizedProps,h[jn]=i,(x=h.nodeValue!==u)&&(s=Wt,s!==null))switch(s.tag){case 3:wa(h.nodeValue,u,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&wa(h.nodeValue,u,(s.mode&1)!==0)}x&&(i.flags|=4)}else h=(u.nodeType===9?u:u.ownerDocument).createTextNode(h),h[jn]=i,i.stateNode=h}return Et(i),null;case 13:if(Ke(Ye),h=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Je&&Kt!==null&&(i.mode&1)!==0&&(i.flags&128)===0)nm(),Ts(),i.flags|=98560,x=!1;else if(x=ja(i),h!==null&&h.dehydrated!==null){if(s===null){if(!x)throw Error(n(318));if(x=i.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[jn]=i}else Ts(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Et(i),x=!1}else mn!==null&&(Uc(mn),mn=null),x=!0;if(!x)return i.flags&65536?i:null}return(i.flags&128)!==0?(i.lanes=u,i):(h=h!==null,h!==(s!==null&&s.memoizedState!==null)&&h&&(i.child.flags|=8192,(i.mode&1)!==0&&(s===null||(Ye.current&1)!==0?dt===0&&(dt=3):$c())),i.updateQueue!==null&&(i.flags|=4),Et(i),null);case 4:return Ps(),Cc(s,i),s===null&&Li(i.stateNode.containerInfo),Et(i),null;case 10:return tc(i.type._context),Et(i),null;case 17:return It(i.type)&&Sa(),Et(i),null;case 19:if(Ke(Ye),x=i.memoizedState,x===null)return Et(i),null;if(h=(i.flags&128)!==0,k=x.rendering,k===null)if(h)Ki(x,!1);else{if(dt!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(k=Ia(s),k!==null){for(i.flags|=128,Ki(x,!1),h=k.updateQueue,h!==null&&(i.updateQueue=h,i.flags|=4),i.subtreeFlags=0,h=u,u=i.child;u!==null;)x=u,s=h,x.flags&=14680066,k=x.alternate,k===null?(x.childLanes=0,x.lanes=s,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=k.childLanes,x.lanes=k.lanes,x.child=k.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=k.memoizedProps,x.memoizedState=k.memoizedState,x.updateQueue=k.updateQueue,x.type=k.type,s=k.dependencies,x.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),u=u.sibling;return $e(Ye,Ye.current&1|2),i.child}s=s.sibling}x.tail!==null&&rt()>Is&&(i.flags|=128,h=!0,Ki(x,!1),i.lanes=4194304)}else{if(!h)if(s=Ia(k),s!==null){if(i.flags|=128,h=!0,u=s.updateQueue,u!==null&&(i.updateQueue=u,i.flags|=4),Ki(x,!0),x.tail===null&&x.tailMode==="hidden"&&!k.alternate&&!Je)return Et(i),null}else 2*rt()-x.renderingStartTime>Is&&u!==1073741824&&(i.flags|=128,h=!0,Ki(x,!1),i.lanes=4194304);x.isBackwards?(k.sibling=i.child,i.child=k):(u=x.last,u!==null?u.sibling=k:i.child=k,x.last=k)}return x.tail!==null?(i=x.tail,x.rendering=i,x.tail=i.sibling,x.renderingStartTime=rt(),i.sibling=null,u=Ye.current,$e(Ye,h?u&1|2:u&1),i):(Et(i),null);case 22:case 23:return Fc(),h=i.memoizedState!==null,s!==null&&s.memoizedState!==null!==h&&(i.flags|=8192),h&&(i.mode&1)!==0?(Gt&1073741824)!==0&&(Et(i),i.subtreeFlags&6&&(i.flags|=8192)):Et(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function lk(s,i){switch(Ju(i),i.tag){case 1:return It(i.type)&&Sa(),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Ps(),Ke(Ot),Ke(St),lc(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 5:return oc(i),null;case 13:if(Ke(Ye),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(n(340));Ts()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return Ke(Ye),null;case 4:return Ps(),null;case 10:return tc(i.type._context),null;case 22:case 23:return Fc(),null;case 24:return null;default:return null}}var Va=!1,Tt=!1,uk=typeof WeakSet=="function"?WeakSet:Set,ce=null;function Rs(s,i){var u=s.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(h){et(s,i,h)}else u.current=null}function jc(s,i,u){try{u()}catch(h){et(s,i,h)}}var eg=!1;function ck(s,i){if(Fu=ua,s=Rp(),Ru(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var m=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var k=0,A=-1,R=-1,F=0,G=0,Y=s,K=null;t:for(;;){for(var ue;Y!==u||m!==0&&Y.nodeType!==3||(A=k+m),Y!==x||h!==0&&Y.nodeType!==3||(R=k+h),Y.nodeType===3&&(k+=Y.nodeValue.length),(ue=Y.firstChild)!==null;)K=Y,Y=ue;for(;;){if(Y===s)break t;if(K===u&&++F===m&&(A=k),K===x&&++G===h&&(R=k),(ue=Y.nextSibling)!==null)break;Y=K,K=Y.parentNode}Y=ue}u=A===-1||R===-1?null:{start:A,end:R}}else u=null}u=u||{start:0,end:0}}else u=null;for($u={focusedElem:s,selectionRange:u},ua=!1,ce=i;ce!==null;)if(i=ce,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,ce=s;else for(;ce!==null;){i=ce;try{var he=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(he!==null){var pe=he.memoizedProps,st=he.memoizedState,M=i.stateNode,I=M.getSnapshotBeforeUpdate(i.elementType===i.type?pe:gn(i.type,pe),st);M.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var U=i.stateNode.containerInfo;U.nodeType===1?U.textContent="":U.nodeType===9&&U.documentElement&&U.removeChild(U.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(te){et(i,i.return,te)}if(s=i.sibling,s!==null){s.return=i.return,ce=s;break}ce=i.return}return he=eg,eg=!1,he}function Gi(s,i,u){var h=i.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var m=h=h.next;do{if((m.tag&s)===s){var x=m.destroy;m.destroy=void 0,x!==void 0&&jc(i,u,x)}m=m.next}while(m!==h)}}function qa(s,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var u=i=i.next;do{if((u.tag&s)===s){var h=u.create;u.destroy=h()}u=u.next}while(u!==i)}}function Ac(s){var i=s.ref;if(i!==null){var u=s.stateNode;s.tag,s=u,typeof i=="function"?i(s):i.current=s}}function tg(s){var i=s.alternate;i!==null&&(s.alternate=null,tg(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&(delete i[jn],delete i[Mi],delete i[Hu],delete i[Wb],delete i[Kb])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function ng(s){return s.tag===5||s.tag===3||s.tag===4}function rg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||ng(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Pc(s,i,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?u.nodeType===8?u.parentNode.insertBefore(s,i):u.insertBefore(s,i):(u.nodeType===8?(i=u.parentNode,i.insertBefore(s,u)):(i=u,i.appendChild(s)),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=ba));else if(h!==4&&(s=s.child,s!==null))for(Pc(s,i,u),s=s.sibling;s!==null;)Pc(s,i,u),s=s.sibling}function Nc(s,i,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?u.insertBefore(s,i):u.appendChild(s);else if(h!==4&&(s=s.child,s!==null))for(Nc(s,i,u),s=s.sibling;s!==null;)Nc(s,i,u),s=s.sibling}var vt=null,yn=!1;function mr(s,i,u){for(u=u.child;u!==null;)sg(s,i,u),u=u.sibling}function sg(s,i,u){if(Cn&&typeof Cn.onCommitFiberUnmount=="function")try{Cn.onCommitFiberUnmount(ra,u)}catch{}switch(u.tag){case 5:Tt||Rs(u,i);case 6:var h=vt,m=yn;vt=null,mr(s,i,u),vt=h,yn=m,vt!==null&&(yn?(s=vt,u=u.stateNode,s.nodeType===8?s.parentNode.removeChild(u):s.removeChild(u)):vt.removeChild(u.stateNode));break;case 18:vt!==null&&(yn?(s=vt,u=u.stateNode,s.nodeType===8?qu(s.parentNode,u):s.nodeType===1&&qu(s,u),Ti(s)):qu(vt,u.stateNode));break;case 4:h=vt,m=yn,vt=u.stateNode.containerInfo,yn=!0,mr(s,i,u),vt=h,yn=m;break;case 0:case 11:case 14:case 15:if(!Tt&&(h=u.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){m=h=h.next;do{var x=m,k=x.destroy;x=x.tag,k!==void 0&&((x&2)!==0||(x&4)!==0)&&jc(u,i,k),m=m.next}while(m!==h)}mr(s,i,u);break;case 1:if(!Tt&&(Rs(u,i),h=u.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=u.memoizedProps,h.state=u.memoizedState,h.componentWillUnmount()}catch(A){et(u,i,A)}mr(s,i,u);break;case 21:mr(s,i,u);break;case 22:u.mode&1?(Tt=(h=Tt)||u.memoizedState!==null,mr(s,i,u),Tt=h):mr(s,i,u);break;default:mr(s,i,u)}}function ig(s){var i=s.updateQueue;if(i!==null){s.updateQueue=null;var u=s.stateNode;u===null&&(u=s.stateNode=new uk),i.forEach(function(h){var m=xk.bind(null,s,h);u.has(h)||(u.add(h),h.then(m,m))})}}function vn(s,i){var u=i.deletions;if(u!==null)for(var h=0;h<u.length;h++){var m=u[h];try{var x=s,k=i,A=k;e:for(;A!==null;){switch(A.tag){case 5:vt=A.stateNode,yn=!1;break e;case 3:vt=A.stateNode.containerInfo,yn=!0;break e;case 4:vt=A.stateNode.containerInfo,yn=!0;break e}A=A.return}if(vt===null)throw Error(n(160));sg(x,k,m),vt=null,yn=!1;var R=m.alternate;R!==null&&(R.return=null),m.return=null}catch(F){et(m,i,F)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)og(i,s),i=i.sibling}function og(s,i){var u=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(vn(i,s),Nn(s),h&4){try{Gi(3,s,s.return),qa(3,s)}catch(pe){et(s,s.return,pe)}try{Gi(5,s,s.return)}catch(pe){et(s,s.return,pe)}}break;case 1:vn(i,s),Nn(s),h&512&&u!==null&&Rs(u,u.return);break;case 5:if(vn(i,s),Nn(s),h&512&&u!==null&&Rs(u,u.return),s.flags&32){var m=s.stateNode;try{Ie(m,"")}catch(pe){et(s,s.return,pe)}}if(h&4&&(m=s.stateNode,m!=null)){var x=s.memoizedProps,k=u!==null?u.memoizedProps:x,A=s.type,R=s.updateQueue;if(s.updateQueue=null,R!==null)try{A==="input"&&x.type==="radio"&&x.name!=null&&mi(m,x),Tn(A,k);var F=Tn(A,x);for(k=0;k<R.length;k+=2){var G=R[k],Y=R[k+1];G==="style"?nr(m,Y):G==="dangerouslySetInnerHTML"?Re(m,Y):G==="children"?Ie(m,Y):j(m,G,Y,F)}switch(A){case"input":cs(m,x);break;case"textarea":Qo(m,x);break;case"select":var K=m._wrapperState.wasMultiple;m._wrapperState.wasMultiple=!!x.multiple;var ue=x.value;ue!=null?tr(m,!!x.multiple,ue,!1):K!==!!x.multiple&&(x.defaultValue!=null?tr(m,!!x.multiple,x.defaultValue,!0):tr(m,!!x.multiple,x.multiple?[]:"",!1))}m[Mi]=x}catch(pe){et(s,s.return,pe)}}break;case 6:if(vn(i,s),Nn(s),h&4){if(s.stateNode===null)throw Error(n(162));m=s.stateNode,x=s.memoizedProps;try{m.nodeValue=x}catch(pe){et(s,s.return,pe)}}break;case 3:if(vn(i,s),Nn(s),h&4&&u!==null&&u.memoizedState.isDehydrated)try{Ti(i.containerInfo)}catch(pe){et(s,s.return,pe)}break;case 4:vn(i,s),Nn(s);break;case 13:vn(i,s),Nn(s),m=s.child,m.flags&8192&&(x=m.memoizedState!==null,m.stateNode.isHidden=x,!x||m.alternate!==null&&m.alternate.memoizedState!==null||(Ic=rt())),h&4&&ig(s);break;case 22:if(G=u!==null&&u.memoizedState!==null,s.mode&1?(Tt=(F=Tt)||G,vn(i,s),Tt=F):vn(i,s),Nn(s),h&8192){if(F=s.memoizedState!==null,(s.stateNode.isHidden=F)&&!G&&(s.mode&1)!==0)for(ce=s,G=s.child;G!==null;){for(Y=ce=G;ce!==null;){switch(K=ce,ue=K.child,K.tag){case 0:case 11:case 14:case 15:Gi(4,K,K.return);break;case 1:Rs(K,K.return);var he=K.stateNode;if(typeof he.componentWillUnmount=="function"){h=K,u=K.return;try{i=h,he.props=i.memoizedProps,he.state=i.memoizedState,he.componentWillUnmount()}catch(pe){et(h,u,pe)}}break;case 5:Rs(K,K.return);break;case 22:if(K.memoizedState!==null){ug(Y);continue}}ue!==null?(ue.return=K,ce=ue):ug(Y)}G=G.sibling}e:for(G=null,Y=s;;){if(Y.tag===5){if(G===null){G=Y;try{m=Y.stateNode,F?(x=m.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(A=Y.stateNode,R=Y.memoizedProps.style,k=R!=null&&R.hasOwnProperty("display")?R.display:null,A.style.display=nn("display",k))}catch(pe){et(s,s.return,pe)}}}else if(Y.tag===6){if(G===null)try{Y.stateNode.nodeValue=F?"":Y.memoizedProps}catch(pe){et(s,s.return,pe)}}else if((Y.tag!==22&&Y.tag!==23||Y.memoizedState===null||Y===s)&&Y.child!==null){Y.child.return=Y,Y=Y.child;continue}if(Y===s)break e;for(;Y.sibling===null;){if(Y.return===null||Y.return===s)break e;G===Y&&(G=null),Y=Y.return}G===Y&&(G=null),Y.sibling.return=Y.return,Y=Y.sibling}}break;case 19:vn(i,s),Nn(s),h&4&&ig(s);break;case 21:break;default:vn(i,s),Nn(s)}}function Nn(s){var i=s.flags;if(i&2){try{e:{for(var u=s.return;u!==null;){if(ng(u)){var h=u;break e}u=u.return}throw Error(n(160))}switch(h.tag){case 5:var m=h.stateNode;h.flags&32&&(Ie(m,""),h.flags&=-33);var x=rg(s);Nc(s,x,m);break;case 3:case 4:var k=h.stateNode.containerInfo,A=rg(s);Pc(s,A,k);break;default:throw Error(n(161))}}catch(R){et(s,s.return,R)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function dk(s,i,u){ce=s,ag(s)}function ag(s,i,u){for(var h=(s.mode&1)!==0;ce!==null;){var m=ce,x=m.child;if(m.tag===22&&h){var k=m.memoizedState!==null||Va;if(!k){var A=m.alternate,R=A!==null&&A.memoizedState!==null||Tt;A=Va;var F=Tt;if(Va=k,(Tt=R)&&!F)for(ce=m;ce!==null;)k=ce,R=k.child,k.tag===22&&k.memoizedState!==null?cg(m):R!==null?(R.return=k,ce=R):cg(m);for(;x!==null;)ce=x,ag(x),x=x.sibling;ce=m,Va=A,Tt=F}lg(s)}else(m.subtreeFlags&8772)!==0&&x!==null?(x.return=m,ce=x):lg(s)}}function lg(s){for(;ce!==null;){var i=ce;if((i.flags&8772)!==0){var u=i.alternate;try{if((i.flags&8772)!==0)switch(i.tag){case 0:case 11:case 15:Tt||qa(5,i);break;case 1:var h=i.stateNode;if(i.flags&4&&!Tt)if(u===null)h.componentDidMount();else{var m=i.elementType===i.type?u.memoizedProps:gn(i.type,u.memoizedProps);h.componentDidUpdate(m,u.memoizedState,h.__reactInternalSnapshotBeforeUpdate)}var x=i.updateQueue;x!==null&&um(i,x,h);break;case 3:var k=i.updateQueue;if(k!==null){if(u=null,i.child!==null)switch(i.child.tag){case 5:u=i.child.stateNode;break;case 1:u=i.child.stateNode}um(i,k,u)}break;case 5:var A=i.stateNode;if(u===null&&i.flags&4){u=A;var R=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":R.autoFocus&&u.focus();break;case"img":R.src&&(u.src=R.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(i.memoizedState===null){var F=i.alternate;if(F!==null){var G=F.memoizedState;if(G!==null){var Y=G.dehydrated;Y!==null&&Ti(Y)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Tt||i.flags&512&&Ac(i)}catch(K){et(i,i.return,K)}}if(i===s){ce=null;break}if(u=i.sibling,u!==null){u.return=i.return,ce=u;break}ce=i.return}}function ug(s){for(;ce!==null;){var i=ce;if(i===s){ce=null;break}var u=i.sibling;if(u!==null){u.return=i.return,ce=u;break}ce=i.return}}function cg(s){for(;ce!==null;){var i=ce;try{switch(i.tag){case 0:case 11:case 15:var u=i.return;try{qa(4,i)}catch(R){et(i,u,R)}break;case 1:var h=i.stateNode;if(typeof h.componentDidMount=="function"){var m=i.return;try{h.componentDidMount()}catch(R){et(i,m,R)}}var x=i.return;try{Ac(i)}catch(R){et(i,x,R)}break;case 5:var k=i.return;try{Ac(i)}catch(R){et(i,k,R)}}}catch(R){et(i,i.return,R)}if(i===s){ce=null;break}var A=i.sibling;if(A!==null){A.return=i.return,ce=A;break}ce=i.return}}var hk=Math.ceil,Ha=D.ReactCurrentDispatcher,Rc=D.ReactCurrentOwner,ln=D.ReactCurrentBatchConfig,Le=0,pt=null,at=null,xt=0,Gt=0,Os=cr(0),dt=0,Ji=null,$r=0,Wa=0,Oc=0,Yi=null,Dt=null,Ic=0,Is=1/0,Kn=null,Ka=!1,Lc=null,gr=null,Ga=!1,yr=null,Ja=0,Xi=0,Dc=null,Ya=-1,Xa=0;function Rt(){return(Le&6)!==0?rt():Ya!==-1?Ya:Ya=rt()}function vr(s){return(s.mode&1)===0?1:(Le&2)!==0&&xt!==0?xt&-xt:Jb.transition!==null?(Xa===0&&(Xa=rp()),Xa):(s=Fe,s!==0||(s=window.event,s=s===void 0?16:hp(s.type)),s)}function xn(s,i,u,h){if(50<Xi)throw Xi=0,Dc=null,Error(n(185));bi(s,u,h),((Le&2)===0||s!==pt)&&(s===pt&&((Le&2)===0&&(Wa|=u),dt===4&&xr(s,xt)),Mt(s,h),u===1&&Le===0&&(i.mode&1)===0&&(Is=rt()+500,Ea&&hr()))}function Mt(s,i){var u=s.callbackNode;J1(s,i);var h=oa(s,s===pt?xt:0);if(h===0)u!==null&&ep(u),s.callbackNode=null,s.callbackPriority=0;else if(i=h&-h,s.callbackPriority!==i){if(u!=null&&ep(u),i===1)s.tag===0?Gb(hg.bind(null,s)):Xp(hg.bind(null,s)),qb(function(){(Le&6)===0&&hr()}),u=null;else{switch(sp(h)){case 1:u=mu;break;case 4:u=tp;break;case 16:u=na;break;case 536870912:u=np;break;default:u=na}u=wg(u,dg.bind(null,s))}s.callbackPriority=i,s.callbackNode=u}}function dg(s,i){if(Ya=-1,Xa=0,(Le&6)!==0)throw Error(n(327));var u=s.callbackNode;if(Ls()&&s.callbackNode!==u)return null;var h=oa(s,s===pt?xt:0);if(h===0)return null;if((h&30)!==0||(h&s.expiredLanes)!==0||i)i=Qa(s,h);else{i=h;var m=Le;Le|=2;var x=pg();(pt!==s||xt!==i)&&(Kn=null,Is=rt()+500,Vr(s,i));do try{mk();break}catch(A){fg(s,A)}while(!0);ec(),Ha.current=x,Le=m,at!==null?i=0:(pt=null,xt=0,i=dt)}if(i!==0){if(i===2&&(m=gu(s),m!==0&&(h=m,i=Mc(s,m))),i===1)throw u=Ji,Vr(s,0),xr(s,h),Mt(s,rt()),u;if(i===6)xr(s,h);else{if(m=s.current.alternate,(h&30)===0&&!fk(m)&&(i=Qa(s,h),i===2&&(x=gu(s),x!==0&&(h=x,i=Mc(s,x))),i===1))throw u=Ji,Vr(s,0),xr(s,h),Mt(s,rt()),u;switch(s.finishedWork=m,s.finishedLanes=h,i){case 0:case 1:throw Error(n(345));case 2:qr(s,Dt,Kn);break;case 3:if(xr(s,h),(h&130023424)===h&&(i=Ic+500-rt(),10<i)){if(oa(s,0)!==0)break;if(m=s.suspendedLanes,(m&h)!==h){Rt(),s.pingedLanes|=s.suspendedLanes&m;break}s.timeoutHandle=Vu(qr.bind(null,s,Dt,Kn),i);break}qr(s,Dt,Kn);break;case 4:if(xr(s,h),(h&4194240)===h)break;for(i=s.eventTimes,m=-1;0<h;){var k=31-fn(h);x=1<<k,k=i[k],k>m&&(m=k),h&=~x}if(h=m,h=rt()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*hk(h/1960))-h,10<h){s.timeoutHandle=Vu(qr.bind(null,s,Dt,Kn),h);break}qr(s,Dt,Kn);break;case 5:qr(s,Dt,Kn);break;default:throw Error(n(329))}}}return Mt(s,rt()),s.callbackNode===u?dg.bind(null,s):null}function Mc(s,i){var u=Yi;return s.current.memoizedState.isDehydrated&&(Vr(s,i).flags|=256),s=Qa(s,i),s!==2&&(i=Dt,Dt=u,i!==null&&Uc(i)),s}function Uc(s){Dt===null?Dt=s:Dt.push.apply(Dt,s)}function fk(s){for(var i=s;;){if(i.flags&16384){var u=i.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var h=0;h<u.length;h++){var m=u[h],x=m.getSnapshot;m=m.value;try{if(!pn(x(),m))return!1}catch{return!1}}}if(u=i.child,i.subtreeFlags&16384&&u!==null)u.return=i,i=u;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function xr(s,i){for(i&=~Oc,i&=~Wa,s.suspendedLanes|=i,s.pingedLanes&=~i,s=s.expirationTimes;0<i;){var u=31-fn(i),h=1<<u;s[u]=-1,i&=~h}}function hg(s){if((Le&6)!==0)throw Error(n(327));Ls();var i=oa(s,0);if((i&1)===0)return Mt(s,rt()),null;var u=Qa(s,i);if(s.tag!==0&&u===2){var h=gu(s);h!==0&&(i=h,u=Mc(s,h))}if(u===1)throw u=Ji,Vr(s,0),xr(s,i),Mt(s,rt()),u;if(u===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=i,qr(s,Dt,Kn),Mt(s,rt()),null}function zc(s,i){var u=Le;Le|=1;try{return s(i)}finally{Le=u,Le===0&&(Is=rt()+500,Ea&&hr())}}function Br(s){yr!==null&&yr.tag===0&&(Le&6)===0&&Ls();var i=Le;Le|=1;var u=ln.transition,h=Fe;try{if(ln.transition=null,Fe=1,s)return s()}finally{Fe=h,ln.transition=u,Le=i,(Le&6)===0&&hr()}}function Fc(){Gt=Os.current,Ke(Os)}function Vr(s,i){s.finishedWork=null,s.finishedLanes=0;var u=s.timeoutHandle;if(u!==-1&&(s.timeoutHandle=-1,Vb(u)),at!==null)for(u=at.return;u!==null;){var h=u;switch(Ju(h),h.tag){case 1:h=h.type.childContextTypes,h!=null&&Sa();break;case 3:Ps(),Ke(Ot),Ke(St),lc();break;case 5:oc(h);break;case 4:Ps();break;case 13:Ke(Ye);break;case 19:Ke(Ye);break;case 10:tc(h.type._context);break;case 22:case 23:Fc()}u=u.return}if(pt=s,at=s=wr(s.current,null),xt=Gt=i,dt=0,Ji=null,Oc=Wa=$r=0,Dt=Yi=null,Ur!==null){for(i=0;i<Ur.length;i++)if(u=Ur[i],h=u.interleaved,h!==null){u.interleaved=null;var m=h.next,x=u.pending;if(x!==null){var k=x.next;x.next=m,h.next=k}u.pending=h}Ur=null}return s}function fg(s,i){do{var u=at;try{if(ec(),La.current=za,Da){for(var h=Xe.memoizedState;h!==null;){var m=h.queue;m!==null&&(m.pending=null),h=h.next}Da=!1}if(Fr=0,ft=ct=Xe=null,Vi=!1,qi=0,Rc.current=null,u===null||u.return===null){dt=1,Ji=i,at=null;break}e:{var x=s,k=u.return,A=u,R=i;if(i=xt,A.flags|=32768,R!==null&&typeof R=="object"&&typeof R.then=="function"){var F=R,G=A,Y=G.tag;if((G.mode&1)===0&&(Y===0||Y===11||Y===15)){var K=G.alternate;K?(G.updateQueue=K.updateQueue,G.memoizedState=K.memoizedState,G.lanes=K.lanes):(G.updateQueue=null,G.memoizedState=null)}var ue=Um(k);if(ue!==null){ue.flags&=-257,zm(ue,k,A,x,i),ue.mode&1&&Mm(x,F,i),i=ue,R=F;var he=i.updateQueue;if(he===null){var pe=new Set;pe.add(R),i.updateQueue=pe}else he.add(R);break e}else{if((i&1)===0){Mm(x,F,i),$c();break e}R=Error(n(426))}}else if(Je&&A.mode&1){var st=Um(k);if(st!==null){(st.flags&65536)===0&&(st.flags|=256),zm(st,k,A,x,i),Qu(Ns(R,A));break e}}x=R=Ns(R,A),dt!==4&&(dt=2),Yi===null?Yi=[x]:Yi.push(x),x=k;do{switch(x.tag){case 3:x.flags|=65536,i&=-i,x.lanes|=i;var M=Lm(x,R,i);lm(x,M);break e;case 1:A=R;var I=x.type,U=x.stateNode;if((x.flags&128)===0&&(typeof I.getDerivedStateFromError=="function"||U!==null&&typeof U.componentDidCatch=="function"&&(gr===null||!gr.has(U)))){x.flags|=65536,i&=-i,x.lanes|=i;var te=Dm(x,A,i);lm(x,te);break e}}x=x.return}while(x!==null)}gg(u)}catch(me){i=me,at===u&&u!==null&&(at=u=u.return);continue}break}while(!0)}function pg(){var s=Ha.current;return Ha.current=za,s===null?za:s}function $c(){(dt===0||dt===3||dt===2)&&(dt=4),pt===null||($r&268435455)===0&&(Wa&268435455)===0||xr(pt,xt)}function Qa(s,i){var u=Le;Le|=2;var h=pg();(pt!==s||xt!==i)&&(Kn=null,Vr(s,i));do try{pk();break}catch(m){fg(s,m)}while(!0);if(ec(),Le=u,Ha.current=h,at!==null)throw Error(n(261));return pt=null,xt=0,dt}function pk(){for(;at!==null;)mg(at)}function mk(){for(;at!==null&&!F1();)mg(at)}function mg(s){var i=xg(s.alternate,s,Gt);s.memoizedProps=s.pendingProps,i===null?gg(s):at=i,Rc.current=null}function gg(s){var i=s;do{var u=i.alternate;if(s=i.return,(i.flags&32768)===0){if(u=ak(u,i,Gt),u!==null){at=u;return}}else{if(u=lk(u,i),u!==null){u.flags&=32767,at=u;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{dt=6,at=null;return}}if(i=i.sibling,i!==null){at=i;return}at=i=s}while(i!==null);dt===0&&(dt=5)}function qr(s,i,u){var h=Fe,m=ln.transition;try{ln.transition=null,Fe=1,gk(s,i,u,h)}finally{ln.transition=m,Fe=h}return null}function gk(s,i,u,h){do Ls();while(yr!==null);if((Le&6)!==0)throw Error(n(327));u=s.finishedWork;var m=s.finishedLanes;if(u===null)return null;if(s.finishedWork=null,s.finishedLanes=0,u===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var x=u.lanes|u.childLanes;if(Y1(s,x),s===pt&&(at=pt=null,xt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Ga||(Ga=!0,wg(na,function(){return Ls(),null})),x=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||x){x=ln.transition,ln.transition=null;var k=Fe;Fe=1;var A=Le;Le|=4,Rc.current=null,ck(s,u),og(u,s),Db($u),ua=!!Fu,$u=Fu=null,s.current=u,dk(u),$1(),Le=A,Fe=k,ln.transition=x}else s.current=u;if(Ga&&(Ga=!1,yr=s,Ja=m),x=s.pendingLanes,x===0&&(gr=null),q1(u.stateNode),Mt(s,rt()),i!==null)for(h=s.onRecoverableError,u=0;u<i.length;u++)m=i[u],h(m.value,{componentStack:m.stack,digest:m.digest});if(Ka)throw Ka=!1,s=Lc,Lc=null,s;return(Ja&1)!==0&&s.tag!==0&&Ls(),x=s.pendingLanes,(x&1)!==0?s===Dc?Xi++:(Xi=0,Dc=s):Xi=0,hr(),null}function Ls(){if(yr!==null){var s=sp(Ja),i=ln.transition,u=Fe;try{if(ln.transition=null,Fe=16>s?16:s,yr===null)var h=!1;else{if(s=yr,yr=null,Ja=0,(Le&6)!==0)throw Error(n(331));var m=Le;for(Le|=4,ce=s.current;ce!==null;){var x=ce,k=x.child;if((ce.flags&16)!==0){var A=x.deletions;if(A!==null){for(var R=0;R<A.length;R++){var F=A[R];for(ce=F;ce!==null;){var G=ce;switch(G.tag){case 0:case 11:case 15:Gi(8,G,x)}var Y=G.child;if(Y!==null)Y.return=G,ce=Y;else for(;ce!==null;){G=ce;var K=G.sibling,ue=G.return;if(tg(G),G===F){ce=null;break}if(K!==null){K.return=ue,ce=K;break}ce=ue}}}var he=x.alternate;if(he!==null){var pe=he.child;if(pe!==null){he.child=null;do{var st=pe.sibling;pe.sibling=null,pe=st}while(pe!==null)}}ce=x}}if((x.subtreeFlags&2064)!==0&&k!==null)k.return=x,ce=k;else e:for(;ce!==null;){if(x=ce,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Gi(9,x,x.return)}var M=x.sibling;if(M!==null){M.return=x.return,ce=M;break e}ce=x.return}}var I=s.current;for(ce=I;ce!==null;){k=ce;var U=k.child;if((k.subtreeFlags&2064)!==0&&U!==null)U.return=k,ce=U;else e:for(k=I;ce!==null;){if(A=ce,(A.flags&2048)!==0)try{switch(A.tag){case 0:case 11:case 15:qa(9,A)}}catch(me){et(A,A.return,me)}if(A===k){ce=null;break e}var te=A.sibling;if(te!==null){te.return=A.return,ce=te;break e}ce=A.return}}if(Le=m,hr(),Cn&&typeof Cn.onPostCommitFiberRoot=="function")try{Cn.onPostCommitFiberRoot(ra,s)}catch{}h=!0}return h}finally{Fe=u,ln.transition=i}}return!1}function yg(s,i,u){i=Ns(u,i),i=Lm(s,i,1),s=pr(s,i,1),i=Rt(),s!==null&&(bi(s,1,i),Mt(s,i))}function et(s,i,u){if(s.tag===3)yg(s,s,u);else for(;i!==null;){if(i.tag===3){yg(i,s,u);break}else if(i.tag===1){var h=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(gr===null||!gr.has(h))){s=Ns(u,s),s=Dm(i,s,1),i=pr(i,s,1),s=Rt(),i!==null&&(bi(i,1,s),Mt(i,s));break}}i=i.return}}function yk(s,i,u){var h=s.pingCache;h!==null&&h.delete(i),i=Rt(),s.pingedLanes|=s.suspendedLanes&u,pt===s&&(xt&u)===u&&(dt===4||dt===3&&(xt&130023424)===xt&&500>rt()-Ic?Vr(s,0):Oc|=u),Mt(s,i)}function vg(s,i){i===0&&((s.mode&1)===0?i=1:(i=ia,ia<<=1,(ia&130023424)===0&&(ia=4194304)));var u=Rt();s=qn(s,i),s!==null&&(bi(s,i,u),Mt(s,u))}function vk(s){var i=s.memoizedState,u=0;i!==null&&(u=i.retryLane),vg(s,u)}function xk(s,i){var u=0;switch(s.tag){case 13:var h=s.stateNode,m=s.memoizedState;m!==null&&(u=m.retryLane);break;case 19:h=s.stateNode;break;default:throw Error(n(314))}h!==null&&h.delete(i),vg(s,u)}var xg;xg=function(s,i,u){if(s!==null)if(s.memoizedProps!==i.pendingProps||Ot.current)Lt=!0;else{if((s.lanes&u)===0&&(i.flags&128)===0)return Lt=!1,ok(s,i,u);Lt=(s.flags&131072)!==0}else Lt=!1,Je&&(i.flags&1048576)!==0&&Qp(i,Ca,i.index);switch(i.lanes=0,i.tag){case 2:var h=i.type;Ba(s,i),s=i.pendingProps;var m=Ss(i,St.current);As(i,u),m=dc(null,i,h,s,m,u);var x=hc();return i.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,It(h)?(x=!0,_a(i)):x=!1,i.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,sc(i),m.updater=Fa,i.stateNode=m,m._reactInternals=i,vc(i,h,s,u),i=kc(null,i,h,!0,x,u)):(i.tag=0,Je&&x&&Gu(i),Nt(null,i,m,u),i=i.child),i;case 16:h=i.elementType;e:{switch(Ba(s,i),s=i.pendingProps,m=h._init,h=m(h._payload),i.type=h,m=i.tag=bk(h),s=gn(h,s),m){case 0:i=bc(null,i,h,s,u);break e;case 1:i=Hm(null,i,h,s,u);break e;case 11:i=Fm(null,i,h,s,u);break e;case 14:i=$m(null,i,h,gn(h.type,s),u);break e}throw Error(n(306,h,""))}return i;case 0:return h=i.type,m=i.pendingProps,m=i.elementType===h?m:gn(h,m),bc(s,i,h,m,u);case 1:return h=i.type,m=i.pendingProps,m=i.elementType===h?m:gn(h,m),Hm(s,i,h,m,u);case 3:e:{if(Wm(i),s===null)throw Error(n(387));h=i.pendingProps,x=i.memoizedState,m=x.element,am(s,i),Oa(i,h,null,u);var k=i.memoizedState;if(h=k.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:k.cache,pendingSuspenseBoundaries:k.pendingSuspenseBoundaries,transitions:k.transitions},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){m=Ns(Error(n(423)),i),i=Km(s,i,h,u,m);break e}else if(h!==m){m=Ns(Error(n(424)),i),i=Km(s,i,h,u,m);break e}else for(Kt=ur(i.stateNode.containerInfo.firstChild),Wt=i,Je=!0,mn=null,u=im(i,null,h,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Ts(),h===m){i=Wn(s,i,u);break e}Nt(s,i,h,u)}i=i.child}return i;case 5:return cm(i),s===null&&Xu(i),h=i.type,m=i.pendingProps,x=s!==null?s.memoizedProps:null,k=m.children,Bu(h,m)?k=null:x!==null&&Bu(h,x)&&(i.flags|=32),qm(s,i),Nt(s,i,k,u),i.child;case 6:return s===null&&Xu(i),null;case 13:return Gm(s,i,u);case 4:return ic(i,i.stateNode.containerInfo),h=i.pendingProps,s===null?i.child=Cs(i,null,h,u):Nt(s,i,h,u),i.child;case 11:return h=i.type,m=i.pendingProps,m=i.elementType===h?m:gn(h,m),Fm(s,i,h,m,u);case 7:return Nt(s,i,i.pendingProps,u),i.child;case 8:return Nt(s,i,i.pendingProps.children,u),i.child;case 12:return Nt(s,i,i.pendingProps.children,u),i.child;case 10:e:{if(h=i.type._context,m=i.pendingProps,x=i.memoizedProps,k=m.value,$e(Pa,h._currentValue),h._currentValue=k,x!==null)if(pn(x.value,k)){if(x.children===m.children&&!Ot.current){i=Wn(s,i,u);break e}}else for(x=i.child,x!==null&&(x.return=i);x!==null;){var A=x.dependencies;if(A!==null){k=x.child;for(var R=A.firstContext;R!==null;){if(R.context===h){if(x.tag===1){R=Hn(-1,u&-u),R.tag=2;var F=x.updateQueue;if(F!==null){F=F.shared;var G=F.pending;G===null?R.next=R:(R.next=G.next,G.next=R),F.pending=R}}x.lanes|=u,R=x.alternate,R!==null&&(R.lanes|=u),nc(x.return,u,i),A.lanes|=u;break}R=R.next}}else if(x.tag===10)k=x.type===i.type?null:x.child;else if(x.tag===18){if(k=x.return,k===null)throw Error(n(341));k.lanes|=u,A=k.alternate,A!==null&&(A.lanes|=u),nc(k,u,i),k=x.sibling}else k=x.child;if(k!==null)k.return=x;else for(k=x;k!==null;){if(k===i){k=null;break}if(x=k.sibling,x!==null){x.return=k.return,k=x;break}k=k.return}x=k}Nt(s,i,m.children,u),i=i.child}return i;case 9:return m=i.type,h=i.pendingProps.children,As(i,u),m=on(m),h=h(m),i.flags|=1,Nt(s,i,h,u),i.child;case 14:return h=i.type,m=gn(h,i.pendingProps),m=gn(h.type,m),$m(s,i,h,m,u);case 15:return Bm(s,i,i.type,i.pendingProps,u);case 17:return h=i.type,m=i.pendingProps,m=i.elementType===h?m:gn(h,m),Ba(s,i),i.tag=1,It(h)?(s=!0,_a(i)):s=!1,As(i,u),Om(i,h,m),vc(i,h,m,u),kc(null,i,h,!0,s,u);case 19:return Ym(s,i,u);case 22:return Vm(s,i,u)}throw Error(n(156,i.tag))};function wg(s,i){return Zf(s,i)}function wk(s,i,u,h){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function un(s,i,u,h){return new wk(s,i,u,h)}function Bc(s){return s=s.prototype,!(!s||!s.isReactComponent)}function bk(s){if(typeof s=="function")return Bc(s)?1:0;if(s!=null){if(s=s.$$typeof,s===Q)return 11;if(s===Z)return 14}return 2}function wr(s,i){var u=s.alternate;return u===null?(u=un(s.tag,i,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=i,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&14680064,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,i=s.dependencies,u.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u}function Za(s,i,u,h,m,x){var k=2;if(h=s,typeof s=="function")Bc(s)&&(k=1);else if(typeof s=="string")k=5;else e:switch(s){case z:return Hr(u.children,m,x,i);case q:k=8,m|=8;break;case J:return s=un(12,u,i,m|2),s.elementType=J,s.lanes=x,s;case ye:return s=un(13,u,i,m),s.elementType=ye,s.lanes=x,s;case ne:return s=un(19,u,i,m),s.elementType=ne,s.lanes=x,s;case le:return el(u,m,x,i);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case ie:k=10;break e;case re:k=9;break e;case Q:k=11;break e;case Z:k=14;break e;case fe:k=16,h=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return i=un(k,u,i,m),i.elementType=s,i.type=h,i.lanes=x,i}function Hr(s,i,u,h){return s=un(7,s,h,i),s.lanes=u,s}function el(s,i,u,h){return s=un(22,s,h,i),s.elementType=le,s.lanes=u,s.stateNode={isHidden:!1},s}function Vc(s,i,u){return s=un(6,s,null,i),s.lanes=u,s}function qc(s,i,u){return i=un(4,s.children!==null?s.children:[],s.key,i),i.lanes=u,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}function kk(s,i,u,h,m){this.tag=i,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yu(0),this.expirationTimes=yu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yu(0),this.identifierPrefix=h,this.onRecoverableError=m,this.mutableSourceEagerHydrationData=null}function Hc(s,i,u,h,m,x,k,A,R){return s=new kk(s,i,u,A,R),i===1?(i=1,x===!0&&(i|=8)):i=0,x=un(3,null,null,i),s.current=x,x.stateNode=s,x.memoizedState={element:h,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},sc(x),s}function Sk(s,i,u){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:h==null?null:""+h,children:s,containerInfo:i,implementation:u}}function bg(s){if(!s)return dr;s=s._reactInternals;e:{if(Or(s)!==s||s.tag!==1)throw Error(n(170));var i=s;do{switch(i.tag){case 3:i=i.stateNode.context;break e;case 1:if(It(i.type)){i=i.stateNode.__reactInternalMemoizedMergedChildContext;break e}}i=i.return}while(i!==null);throw Error(n(171))}if(s.tag===1){var u=s.type;if(It(u))return Jp(s,u,i)}return i}function kg(s,i,u,h,m,x,k,A,R){return s=Hc(u,h,!0,s,m,x,k,A,R),s.context=bg(null),u=s.current,h=Rt(),m=vr(u),x=Hn(h,m),x.callback=i??null,pr(u,x,m),s.current.lanes=m,bi(s,m,h),Mt(s,h),s}function tl(s,i,u,h){var m=i.current,x=Rt(),k=vr(m);return u=bg(u),i.context===null?i.context=u:i.pendingContext=u,i=Hn(x,k),i.payload={element:s},h=h===void 0?null:h,h!==null&&(i.callback=h),s=pr(m,i,k),s!==null&&(xn(s,m,k,x),Ra(s,m,k)),k}function nl(s){return s=s.current,s.child?(s.child.tag===5,s.child.stateNode):null}function Sg(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<i?u:i}}function Wc(s,i){Sg(s,i),(s=s.alternate)&&Sg(s,i)}function _k(){return null}var _g=typeof reportError=="function"?reportError:function(s){console.error(s)};function Kc(s){this._internalRoot=s}rl.prototype.render=Kc.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(n(409));tl(s,i,null,null)},rl.prototype.unmount=Kc.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;Br(function(){tl(null,s,null,null)}),i[Fn]=null}};function rl(s){this._internalRoot=s}rl.prototype.unstable_scheduleHydration=function(s){if(s){var i=ap();s={blockedOn:null,target:s,priority:i};for(var u=0;u<or.length&&i!==0&&i<or[u].priority;u++);or.splice(u,0,s),u===0&&cp(s)}};function Gc(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function sl(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function Eg(){}function Ek(s,i,u,h,m){if(m){if(typeof h=="function"){var x=h;h=function(){var F=nl(k);x.call(F)}}var k=kg(i,h,s,0,null,!1,!1,"",Eg);return s._reactRootContainer=k,s[Fn]=k.current,Li(s.nodeType===8?s.parentNode:s),Br(),k}for(;m=s.lastChild;)s.removeChild(m);if(typeof h=="function"){var A=h;h=function(){var F=nl(R);A.call(F)}}var R=Hc(s,0,!1,null,null,!1,!1,"",Eg);return s._reactRootContainer=R,s[Fn]=R.current,Li(s.nodeType===8?s.parentNode:s),Br(function(){tl(i,R,u,h)}),R}function il(s,i,u,h,m){var x=u._reactRootContainer;if(x){var k=x;if(typeof m=="function"){var A=m;m=function(){var R=nl(k);A.call(R)}}tl(i,k,s,m)}else k=Ek(u,i,s,m,h);return nl(k)}ip=function(s){switch(s.tag){case 3:var i=s.stateNode;if(i.current.memoizedState.isDehydrated){var u=wi(i.pendingLanes);u!==0&&(vu(i,u|1),Mt(i,rt()),(Le&6)===0&&(Is=rt()+500,hr()))}break;case 13:Br(function(){var h=qn(s,1);if(h!==null){var m=Rt();xn(h,s,1,m)}}),Wc(s,1)}},xu=function(s){if(s.tag===13){var i=qn(s,134217728);if(i!==null){var u=Rt();xn(i,s,134217728,u)}Wc(s,134217728)}},op=function(s){if(s.tag===13){var i=vr(s),u=qn(s,i);if(u!==null){var h=Rt();xn(u,s,i,h)}Wc(s,i)}},ap=function(){return Fe},lp=function(s,i){var u=Fe;try{return Fe=s,i()}finally{Fe=u}},du=function(s,i,u){switch(i){case"input":if(cs(s,u),i=u.name,u.type==="radio"&&i!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),i=0;i<u.length;i++){var h=u[i];if(h!==s&&h.form===s.form){var m=ka(h);if(!m)throw Error(n(90));Jo(h),cs(h,m)}}}break;case"textarea":Qo(s,u);break;case"select":i=u.value,i!=null&&tr(s,!!u.multiple,i,!1)}},Wf=zc,Kf=Br;var Tk={usingClientEntryPoint:!1,Events:[Ui,bs,ka,qf,Hf,zc]},Qi={findFiberByHostInstance:Ir,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ck={bundleType:Qi.bundleType,version:Qi.version,rendererPackageName:Qi.rendererPackageName,rendererConfig:Qi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:D.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Xf(s),s===null?null:s.stateNode},findFiberByHostInstance:Qi.findFiberByHostInstance||_k,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 ol=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ol.isDisabled&&ol.supportsFiber)try{ra=ol.inject(Ck),Cn=ol}catch{}}return Ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tk,Ut.createPortal=function(s,i){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Gc(i))throw Error(n(200));return Sk(s,i,null,u)},Ut.createRoot=function(s,i){if(!Gc(s))throw Error(n(299));var u=!1,h="",m=_g;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onRecoverableError!==void 0&&(m=i.onRecoverableError)),i=Hc(s,1,!1,null,null,u,!1,h,m),s[Fn]=i.current,Li(s.nodeType===8?s.parentNode:s),new Kc(i)},Ut.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=Xf(i),s=s===null?null:s.stateNode,s},Ut.flushSync=function(s){return Br(s)},Ut.hydrate=function(s,i,u){if(!sl(i))throw Error(n(200));return il(null,s,i,!0,u)},Ut.hydrateRoot=function(s,i,u){if(!Gc(s))throw Error(n(405));var h=u!=null&&u.hydratedSources||null,m=!1,x="",k=_g;if(u!=null&&(u.unstable_strictMode===!0&&(m=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onRecoverableError!==void 0&&(k=u.onRecoverableError)),i=kg(i,null,s,1,u??null,m,!1,x,k),s[Fn]=i.current,Li(s),h)for(s=0;s<h.length;s++)u=h[s],m=u._getVersion,m=m(u._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[u,m]:i.mutableSourceEagerHydrationData.push(u,m);return new rl(i)},Ut.render=function(s,i,u){if(!sl(i))throw Error(n(200));return il(null,s,i,!1,u)},Ut.unmountComponentAtNode=function(s){if(!sl(s))throw Error(n(40));return s._reactRootContainer?(Br(function(){il(null,null,s,!1,function(){s._reactRootContainer=null,s[Fn]=null})}),!0):!1},Ut.unstable_batchedUpdates=zc,Ut.unstable_renderSubtreeIntoContainer=function(s,i,u,h){if(!sl(u))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return il(s,i,u,!1,h)},Ut.version="18.3.1-next-f1338f8080-20240426",Ut}var Og;function Lk(){if(Og)return Xc.exports;Og=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Xc.exports=Ik(),Xc.exports}var Ig;function Dk(){if(Ig)return al;Ig=1;var e=Lk();return al.createRoot=e.createRoot,al.hydrateRoot=e.hydrateRoot,al}var Mk=Dk();const Uk=ql(Mk);var zk={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 Fk=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),de=(e,t)=>{const n=L.forwardRef(({color:r="currentColor",size:o=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:c="",children:d,...f},p)=>L.createElement("svg",{ref:p,...zk,width:o,height:o,stroke:r,strokeWidth:l?Number(a)*24/Number(o):a,className:["lucide",`lucide-${Fk(e)}`,c].join(" "),...f},[...t.map(([y,v])=>L.createElement(y,v)),...Array.isArray(d)?d:[d]]));return n.displayName=`${e}`,n};const $k=de("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);const Mo=de("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 Bk=de("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 Vk=de("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 qk=de("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Hk=de("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Wk=de("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 Kk=de("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);const Gk=de("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const Cv=de("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 Jk=de("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 Yk=de("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 Xk=de("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 Qk=de("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 Rh=de("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 ko=de("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const jl=de("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Lg=de("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const jv=de("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Zk=de("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const eS=de("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const tS=de("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 ni=de("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Av=de("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 Oh=de("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 So=de("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 nS=de("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 Dg=de("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 Hl=de("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 rS=de("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const sS=de("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 iS=de("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const ed=de("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 oS=de("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 Pv=de("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 aS=de("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 lS=de("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 uS=de("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 cS=de("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 Jn=de("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const dS=de("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 Mg=de("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 Ug=de("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 hS=de("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 fS=de("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 pS=de("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 mS=de("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const gS=de("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Ih=de("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 yS=de("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 Al=de("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 $d=de("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const vS=de("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 Nv=de("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 xS=de("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 wS=de("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 Bd=de("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 Vd=de("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const bS=de("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 kS=de("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 Lh=de("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 zg=de("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 Fg=de("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 $g=de("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 Cr=de("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const is=de("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Dh=L.createContext({});function Mh(e){const t=L.useRef(null);return t.current===null&&(t.current=e()),t.current}const Wl=L.createContext(null),Uh=L.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class SS extends L.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function _S({children:e,isPresent:t}){const n=L.useId(),r=L.useRef(null),o=L.useRef({width:0,height:0,top:0,left:0}),{nonce:a}=L.useContext(Uh);return L.useInsertionEffect(()=>{const{width:l,height:c,top:d,left:f}=o.current;if(t||!r.current||!l||!c)return;r.current.dataset.motionPopId=n;const p=document.createElement("style");return a&&(p.nonce=a),document.head.appendChild(p),p.sheet&&p.sheet.insertRule(`
|
|
9
|
+
[data-motion-pop-id="${n}"] {
|
|
10
|
+
position: absolute !important;
|
|
11
|
+
width: ${l}px !important;
|
|
12
|
+
height: ${c}px !important;
|
|
13
|
+
top: ${d}px !important;
|
|
14
|
+
left: ${f}px !important;
|
|
15
|
+
}
|
|
16
|
+
`),()=>{document.head.removeChild(p)}},[t]),g.jsx(SS,{isPresent:t,childRef:r,sizeRef:o,children:L.cloneElement(e,{ref:r})})}const ES=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:a,mode:l})=>{const c=Mh(TS),d=L.useId(),f=L.useCallback(y=>{c.set(y,!0);for(const v of c.values())if(!v)return;r&&r()},[c,r]),p=L.useMemo(()=>({id:d,initial:t,isPresent:n,custom:o,onExitComplete:f,register:y=>(c.set(y,!1),()=>c.delete(y))}),a?[Math.random(),f]:[n,f]);return L.useMemo(()=>{c.forEach((y,v)=>c.set(v,!1))},[n]),L.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),l==="popLayout"&&(e=g.jsx(_S,{isPresent:n,children:e})),g.jsx(Wl.Provider,{value:p,children:e})};function TS(){return new Map}function Rv(e=!0){const t=L.useContext(Wl);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,a=L.useId();L.useEffect(()=>{e&&o(a)},[e]);const l=L.useCallback(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,l]:[!0]}const ll=e=>e.key||"";function Bg(e){const t=[];return L.Children.forEach(e,n=>{L.isValidElement(n)&&t.push(n)}),t}const zh=typeof window<"u",Ov=zh?L.useLayoutEffect:L.useEffect,_n=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:a="sync",propagate:l=!1})=>{const[c,d]=Rv(l),f=L.useMemo(()=>Bg(e),[e]),p=l&&!c?[]:f.map(ll),y=L.useRef(!0),v=L.useRef(f),w=Mh(()=>new Map),[b,S]=L.useState(f),[_,E]=L.useState(f);Ov(()=>{y.current=!1,v.current=f;for(let D=0;D<_.length;D++){const $=ll(_[D]);p.includes($)?w.delete($):w.get($)!==!0&&w.set($,!1)}},[_,p.length,p.join("-")]);const P=[];if(f!==b){let D=[...f];for(let $=0;$<_.length;$++){const O=_[$],z=ll(O);p.includes(z)||(D.splice($,0,O),P.push(O))}a==="wait"&&P.length&&(D=P),E(Bg(D)),S(f);return}const{forceRender:j}=L.useContext(Dh);return g.jsx(g.Fragment,{children:_.map(D=>{const $=ll(D),O=l&&!c?!1:f===_||p.includes($),z=()=>{if(w.has($))w.set($,!0);else return;let q=!0;w.forEach(J=>{J||(q=!1)}),q&&(j?.(),E(v.current),l&&d?.(),r&&r())};return g.jsx(ES,{isPresent:O,initial:!y.current||n?void 0:!1,custom:O?void 0:t,presenceAffectsLayout:o,mode:a,onExitComplete:O?void 0:z,children:D},$)})})},en=e=>e;let Iv=en;function Fh(e){let t;return()=>(t===void 0&&(t=e()),t)}const ri=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},Yn=e=>e*1e3,Xn=e=>e/1e3,CS={useManualTiming:!1};function jS(e){let t=new Set,n=new Set,r=!1,o=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(f){a.has(f)&&(d.schedule(f),e()),f(l)}const d={schedule:(f,p=!1,y=!1)=>{const w=y&&r?t:n;return p&&a.add(f),w.has(f)||w.add(f),f},cancel:f=>{n.delete(f),a.delete(f)},process:f=>{if(l=f,r){o=!0;return}r=!0,[t,n]=[n,t],t.forEach(c),t.clear(),r=!1,o&&(o=!1,d.process(f))}};return d}const ul=["read","resolveKeyframes","update","preRender","render","postRender"],AS=40;function Lv(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,l=ul.reduce((E,P)=>(E[P]=jS(a),E),{}),{read:c,resolveKeyframes:d,update:f,preRender:p,render:y,postRender:v}=l,w=()=>{const E=performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(E-o.timestamp,AS),1),o.timestamp=E,o.isProcessing=!0,c.process(o),d.process(o),f.process(o),p.process(o),y.process(o),v.process(o),o.isProcessing=!1,n&&t&&(r=!1,e(w))},b=()=>{n=!0,r=!0,o.isProcessing||e(w)};return{schedule:ul.reduce((E,P)=>{const j=l[P];return E[P]=(D,$=!1,O=!1)=>(n||b(),j.schedule(D,$,O)),E},{}),cancel:E=>{for(let P=0;P<ul.length;P++)l[ul[P]].cancel(E)},state:o,steps:l}}const{schedule:Ge,cancel:jr,state:kt,steps:td}=Lv(typeof requestAnimationFrame<"u"?requestAnimationFrame:en,!0),Dv=L.createContext({strict:!1}),Vg={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"]},si={};for(const e in Vg)si[e]={isEnabled:t=>Vg[e].some(n=>!!t[n])};function PS(e){for(const t in e)si[t]={...si[t],...e[t]}}const NS=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 Pl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||NS.has(e)}let Mv=e=>!Pl(e);function RS(e){e&&(Mv=t=>t.startsWith("on")?!Pl(t):e(t))}try{RS(require("@emotion/is-prop-valid").default)}catch{}function OS(e,t,n){const r={};for(const o in e)o==="values"&&typeof e.values=="object"||(Mv(o)||n===!0&&Pl(o)||!t&&!Pl(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}function IS(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,o)=>o==="create"?e:(t.has(o)||t.set(o,e(o)),t.get(o))})}const Kl=L.createContext({});function _o(e){return typeof e=="string"||Array.isArray(e)}function Gl(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const $h=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Bh=["initial",...$h];function Jl(e){return Gl(e.animate)||Bh.some(t=>_o(e[t]))}function Uv(e){return!!(Jl(e)||e.variants)}function LS(e,t){if(Jl(e)){const{initial:n,animate:r}=e;return{initial:n===!1||_o(n)?n:void 0,animate:_o(r)?r:void 0}}return e.inherit!==!1?t:{}}function DS(e){const{initial:t,animate:n}=LS(e,L.useContext(Kl));return L.useMemo(()=>({initial:t,animate:n}),[qg(t),qg(n)])}function qg(e){return Array.isArray(e)?e.join(" "):e}const MS=Symbol.for("motionComponentSymbol");function Ks(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function US(e,t,n){return L.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Ks(n)&&(n.current=r))},[t])}const Vh=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),zS="framerAppearId",zv="data-"+Vh(zS),{schedule:qh}=Lv(queueMicrotask,!1),Fv=L.createContext({});function FS(e,t,n,r,o){var a,l;const{visualElement:c}=L.useContext(Kl),d=L.useContext(Dv),f=L.useContext(Wl),p=L.useContext(Uh).reducedMotion,y=L.useRef(null);r=r||d.renderer,!y.current&&r&&(y.current=r(e,{visualState:t,parent:c,props:n,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:p}));const v=y.current,w=L.useContext(Fv);v&&!v.projection&&o&&(v.type==="html"||v.type==="svg")&&$S(y.current,n,o,w);const b=L.useRef(!1);L.useInsertionEffect(()=>{v&&b.current&&v.update(n,f)});const S=n[zv],_=L.useRef(!!S&&!(!((a=window.MotionHandoffIsComplete)===null||a===void 0)&&a.call(window,S))&&((l=window.MotionHasOptimisedAnimation)===null||l===void 0?void 0:l.call(window,S)));return Ov(()=>{v&&(b.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),qh.render(v.render),_.current&&v.animationState&&v.animationState.animateChanges())}),L.useEffect(()=>{v&&(!_.current&&v.animationState&&v.animationState.animateChanges(),_.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)===null||E===void 0||E.call(window,S)}),_.current=!1))}),v}function $S(e,t,n,r){const{layoutId:o,layout:a,drag:l,dragConstraints:c,layoutScroll:d,layoutRoot:f}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:$v(e.parent)),e.projection.setOptions({layoutId:o,layout:a,alwaysMeasureLayout:!!l||c&&Ks(c),visualElement:e,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,layoutScroll:d,layoutRoot:f})}function $v(e){if(e)return e.options.allowProjection!==!1?e.projection:$v(e.parent)}function BS({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:o}){var a,l;e&&PS(e);function c(f,p){let y;const v={...L.useContext(Uh),...f,layoutId:VS(f)},{isStatic:w}=v,b=DS(f),S=r(f,w);if(!w&&zh){qS();const _=HS(v);y=_.MeasureLayout,b.visualElement=FS(o,S,v,t,_.ProjectionNode)}return g.jsxs(Kl.Provider,{value:b,children:[y&&b.visualElement?g.jsx(y,{visualElement:b.visualElement,...v}):null,n(o,f,US(S,b.visualElement,p),S,w,b.visualElement)]})}c.displayName=`motion.${typeof o=="string"?o:`create(${(l=(a=o.displayName)!==null&&a!==void 0?a:o.name)!==null&&l!==void 0?l:""})`}`;const d=L.forwardRef(c);return d[MS]=o,d}function VS({layoutId:e}){const t=L.useContext(Dh).id;return t&&e!==void 0?t+"-"+e:e}function qS(e,t){L.useContext(Dv).strict}function HS(e){const{drag:t,layout:n}=si;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const WS=["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 Hh(e){return typeof e!="string"||e.includes("-")?!1:!!(WS.indexOf(e)>-1||/[A-Z]/u.test(e))}function Hg(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Wh(e,t,n,r){if(typeof t=="function"){const[o,a]=Hg(r);t=t(n!==void 0?n:e.custom,o,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,a]=Hg(r);t=t(n!==void 0?n:e.custom,o,a)}return t}const qd=e=>Array.isArray(e),KS=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),GS=e=>qd(e)?e[e.length-1]||0:e,At=e=>!!(e&&e.getVelocity);function bl(e){const t=At(e)?e.get():e;return KS(t)?t.toValue():t}function JS({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,o,a){const l={latestValues:YS(r,o,a,e),renderState:t()};return n&&(l.onMount=c=>n({props:r,current:c,...l}),l.onUpdate=c=>n(c)),l}const Bv=e=>(t,n)=>{const r=L.useContext(Kl),o=L.useContext(Wl),a=()=>JS(e,t,r,o);return n?a():Mh(a)};function YS(e,t,n,r){const o={},a=r(e,{});for(const v in a)o[v]=bl(a[v]);let{initial:l,animate:c}=e;const d=Jl(e),f=Uv(e);t&&f&&!d&&e.inherit!==!1&&(l===void 0&&(l=t.initial),c===void 0&&(c=t.animate));let p=n?n.initial===!1:!1;p=p||l===!1;const y=p?c:l;if(y&&typeof y!="boolean"&&!Gl(y)){const v=Array.isArray(y)?y:[y];for(let w=0;w<v.length;w++){const b=Wh(e,v[w]);if(b){const{transitionEnd:S,transition:_,...E}=b;for(const P in E){let j=E[P];if(Array.isArray(j)){const D=p?j.length-1:0;j=j[D]}j!==null&&(o[P]=j)}for(const P in S)o[P]=S[P]}}}return o}const ai=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],as=new Set(ai),Vv=e=>t=>typeof t=="string"&&t.startsWith(e),qv=Vv("--"),XS=Vv("var(--"),Kh=e=>XS(e)?QS.test(e.split("/*")[0].trim()):!1,QS=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Hv=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Qn=(e,t,n)=>n>t?t:n<e?e:n,li={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Eo={...li,transform:e=>Qn(0,1,e)},cl={...li,default:1},Uo=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),_r=Uo("deg"),Ln=Uo("%"),ke=Uo("px"),ZS=Uo("vh"),e_=Uo("vw"),Wg={...Ln,parse:e=>Ln.parse(e)/100,transform:e=>Ln.transform(e*100)},t_={borderWidth:ke,borderTopWidth:ke,borderRightWidth:ke,borderBottomWidth:ke,borderLeftWidth:ke,borderRadius:ke,radius:ke,borderTopLeftRadius:ke,borderTopRightRadius:ke,borderBottomRightRadius:ke,borderBottomLeftRadius:ke,width:ke,maxWidth:ke,height:ke,maxHeight:ke,top:ke,right:ke,bottom:ke,left:ke,padding:ke,paddingTop:ke,paddingRight:ke,paddingBottom:ke,paddingLeft:ke,margin:ke,marginTop:ke,marginRight:ke,marginBottom:ke,marginLeft:ke,backgroundPositionX:ke,backgroundPositionY:ke},n_={rotate:_r,rotateX:_r,rotateY:_r,rotateZ:_r,scale:cl,scaleX:cl,scaleY:cl,scaleZ:cl,skew:_r,skewX:_r,skewY:_r,distance:ke,translateX:ke,translateY:ke,translateZ:ke,x:ke,y:ke,z:ke,perspective:ke,transformPerspective:ke,opacity:Eo,originX:Wg,originY:Wg,originZ:ke},Kg={...li,transform:Math.round},Gh={...t_,...n_,zIndex:Kg,size:ke,fillOpacity:Eo,strokeOpacity:Eo,numOctaves:Kg},r_={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},s_=ai.length;function i_(e,t,n){let r="",o=!0;for(let a=0;a<s_;a++){const l=ai[a],c=e[l];if(c===void 0)continue;let d=!0;if(typeof c=="number"?d=c===(l.startsWith("scale")?1:0):d=parseFloat(c)===0,!d||n){const f=Hv(c,Gh[l]);if(!d){o=!1;const p=r_[l]||l;r+=`${p}(${f}) `}n&&(t[l]=f)}}return r=r.trim(),n?r=n(t,o?"":r):o&&(r="none"),r}function Jh(e,t,n){const{style:r,vars:o,transformOrigin:a}=e;let l=!1,c=!1;for(const d in t){const f=t[d];if(as.has(d)){l=!0;continue}else if(qv(d)){o[d]=f;continue}else{const p=Hv(f,Gh[d]);d.startsWith("origin")?(c=!0,a[d]=p):r[d]=p}}if(t.transform||(l||n?r.transform=i_(t,e.transform,n):r.transform&&(r.transform="none")),c){const{originX:d="50%",originY:f="50%",originZ:p=0}=a;r.transformOrigin=`${d} ${f} ${p}`}}const o_={offset:"stroke-dashoffset",array:"stroke-dasharray"},a_={offset:"strokeDashoffset",array:"strokeDasharray"};function l_(e,t,n=1,r=0,o=!0){e.pathLength=1;const a=o?o_:a_;e[a.offset]=ke.transform(-r);const l=ke.transform(t),c=ke.transform(n);e[a.array]=`${l} ${c}`}function Gg(e,t,n){return typeof e=="string"?e:ke.transform(t+n*e)}function u_(e,t,n){const r=Gg(t,e.x,e.width),o=Gg(n,e.y,e.height);return`${r} ${o}`}function Yh(e,{attrX:t,attrY:n,attrScale:r,originX:o,originY:a,pathLength:l,pathSpacing:c=1,pathOffset:d=0,...f},p,y){if(Jh(e,f,y),p){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:v,style:w,dimensions:b}=e;v.transform&&(b&&(w.transform=v.transform),delete v.transform),b&&(o!==void 0||a!==void 0||w.transform)&&(w.transformOrigin=u_(b,o!==void 0?o:.5,a!==void 0?a:.5)),t!==void 0&&(v.x=t),n!==void 0&&(v.y=n),r!==void 0&&(v.scale=r),l!==void 0&&l_(v,l,c,d,!1)}const Xh=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Wv=()=>({...Xh(),attrs:{}}),Qh=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Kv(e,{style:t,vars:n},r,o){Object.assign(e.style,t,o&&o.getProjectionStyles(r));for(const a in n)e.style.setProperty(a,n[a])}const Gv=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 Jv(e,t,n,r){Kv(e,t,void 0,r);for(const o in t.attrs)e.setAttribute(Gv.has(o)?o:Vh(o),t.attrs[o])}const Nl={};function c_(e){Object.assign(Nl,e)}function Yv(e,{layout:t,layoutId:n}){return as.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Nl[e]||e==="opacity")}function Zh(e,t,n){var r;const{style:o}=e,a={};for(const l in o)(At(o[l])||t.style&&At(t.style[l])||Yv(l,e)||((r=n?.getValue(l))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(a[l]=o[l]);return a}function Xv(e,t,n){const r=Zh(e,t,n);for(const o in e)if(At(e[o])||At(t[o])){const a=ai.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[a]=e[o]}return r}function d_(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Jg=["x","y","width","height","cx","cy","r"],h_={useVisualState:Bv({scrapeMotionValuesFromProps:Xv,createRenderState:Wv,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:o})=>{if(!n)return;let a=!!e.drag;if(!a){for(const c in o)if(as.has(c)){a=!0;break}}if(!a)return;let l=!t;if(t)for(let c=0;c<Jg.length;c++){const d=Jg[c];e[d]!==t[d]&&(l=!0)}l&&Ge.read(()=>{d_(n,r),Ge.render(()=>{Yh(r,o,Qh(n.tagName),e.transformTemplate),Jv(n,r)})})}})},f_={useVisualState:Bv({scrapeMotionValuesFromProps:Zh,createRenderState:Xh})};function Qv(e,t,n){for(const r in t)!At(t[r])&&!Yv(r,n)&&(e[r]=t[r])}function p_({transformTemplate:e},t){return L.useMemo(()=>{const n=Xh();return Jh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function m_(e,t){const n=e.style||{},r={};return Qv(r,n,e),Object.assign(r,p_(e,t)),r}function g_(e,t){const n={},r=m_(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function y_(e,t,n,r){const o=L.useMemo(()=>{const a=Wv();return Yh(a,t,Qh(r),e.transformTemplate),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};Qv(a,e.style,e),o.style={...a,...o.style}}return o}function v_(e=!1){return(n,r,o,{latestValues:a},l)=>{const d=(Hh(n)?y_:g_)(r,a,l,n),f=OS(r,typeof n=="string",e),p=n!==L.Fragment?{...f,...d,ref:o}:{},{children:y}=r,v=L.useMemo(()=>At(y)?y.get():y,[y]);return L.createElement(n,{...p,children:v})}}function x_(e,t){return function(r,{forwardMotionProps:o}={forwardMotionProps:!1}){const l={...Hh(r)?h_:f_,preloadedFeatures:e,useRender:v_(o),createVisualElement:t,Component:r};return BS(l)}}function Zv(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Yl(e,t,n){const r=e.getProps();return Wh(r,t,n!==void 0?n:r.custom,e)}const w_=Fh(()=>window.ScrollTimeline!==void 0);class b_{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t,n){const r=this.animations.map(o=>{if(w_()&&o.attachTimeline)return o.attachTimeline(t);if(typeof n=="function")return n(o)});return()=>{r.forEach((o,a)=>{o&&o(),this.animations[a].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class k_ extends b_{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function ef(e,t){return e?e[t]||e.default||e:void 0}const Hd=2e4;function ex(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Hd;)t+=n,r=e.next(t);return t>=Hd?1/0:t}function tf(e){return typeof e=="function"}function Yg(e,t){e.timeline=t,e.onfinish=null}const nf=e=>Array.isArray(e)&&typeof e[0]=="number",S_={linearEasing:void 0};function __(e,t){const n=Fh(e);return()=>{var r;return(r=S_[t])!==null&&r!==void 0?r:n()}}const Rl=__(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),tx=(e,t,n=10)=>{let r="";const o=Math.max(Math.round(t/n),2);for(let a=0;a<o;a++)r+=e(ri(0,o-1,a))+", ";return`linear(${r.substring(0,r.length-2)})`};function nx(e){return!!(typeof e=="function"&&Rl()||!e||typeof e=="string"&&(e in Wd||Rl())||nf(e)||Array.isArray(e)&&e.every(nx))}const ao=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Wd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ao([0,.65,.55,1]),circOut:ao([.55,0,1,.45]),backIn:ao([.31,.01,.66,-.59]),backOut:ao([.33,1.53,.69,.99])};function rx(e,t){if(e)return typeof e=="function"&&Rl()?tx(e,t):nf(e)?ao(e):Array.isArray(e)?e.map(n=>rx(n,t)||Wd.easeOut):Wd[e]}const bn={x:!1,y:!1};function sx(){return bn.x||bn.y}function E_(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let o=document;const a=(r=void 0)!==null&&r!==void 0?r:o.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}function ix(e,t){const n=E_(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[n,o,()=>r.abort()]}function Xg(e){return t=>{t.pointerType==="touch"||sx()||e(t)}}function T_(e,t,n={}){const[r,o,a]=ix(e,n),l=Xg(c=>{const{target:d}=c,f=t(c);if(typeof f!="function"||!d)return;const p=Xg(y=>{f(y),d.removeEventListener("pointerleave",p)});d.addEventListener("pointerleave",p,o)});return r.forEach(c=>{c.addEventListener("pointerenter",l,o)}),a}const ox=(e,t)=>t?e===t?!0:ox(e,t.parentElement):!1,rf=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,C_=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function j_(e){return C_.has(e.tagName)||e.tabIndex!==-1}const lo=new WeakSet;function Qg(e){return t=>{t.key==="Enter"&&e(t)}}function nd(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const A_=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Qg(()=>{if(lo.has(n))return;nd(n,"down");const o=Qg(()=>{nd(n,"up")}),a=()=>nd(n,"cancel");n.addEventListener("keyup",o,t),n.addEventListener("blur",a,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Zg(e){return rf(e)&&!sx()}function P_(e,t,n={}){const[r,o,a]=ix(e,n),l=c=>{const d=c.currentTarget;if(!Zg(c)||lo.has(d))return;lo.add(d);const f=t(c),p=(w,b)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",v),!(!Zg(w)||!lo.has(d))&&(lo.delete(d),typeof f=="function"&&f(w,{success:b}))},y=w=>{p(w,n.useGlobalTarget||ox(d,w.target))},v=w=>{p(w,!1)};window.addEventListener("pointerup",y,o),window.addEventListener("pointercancel",v,o)};return r.forEach(c=>{!j_(c)&&c.getAttribute("tabindex")===null&&(c.tabIndex=0),(n.useGlobalTarget?window:c).addEventListener("pointerdown",l,o),c.addEventListener("focus",f=>A_(f,o),o)}),a}function N_(e){return e==="x"||e==="y"?bn[e]?null:(bn[e]=!0,()=>{bn[e]=!1}):bn.x||bn.y?null:(bn.x=bn.y=!0,()=>{bn.x=bn.y=!1})}const ax=new Set(["width","height","top","left","right","bottom",...ai]);let kl;function R_(){kl=void 0}const Dn={now:()=>(kl===void 0&&Dn.set(kt.isProcessing||CS.useManualTiming?kt.timestamp:performance.now()),kl),set:e=>{kl=e,queueMicrotask(R_)}};function sf(e,t){e.indexOf(t)===-1&&e.push(t)}function of(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class af{constructor(){this.subscriptions=[]}add(t){return sf(this.subscriptions,t),()=>of(this.subscriptions,t)}notify(t,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,n,r);else for(let a=0;a<o;a++){const l=this.subscriptions[a];l&&l(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function lx(e,t){return t?e*(1e3/t):0}const ey=30,O_=e=>!isNaN(parseFloat(e));class I_{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{const a=Dn.now();this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),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(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Dn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=O_(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new af);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ge.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Dn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>ey)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,ey);return lx(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(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 To(e,t){return new I_(e,t)}function L_(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,To(n))}function D_(e,t){const n=Yl(e,t);let{transitionEnd:r={},transition:o={},...a}=n||{};a={...a,...r};for(const l in a){const c=GS(a[l]);L_(e,l,c)}}function M_(e){return!!(At(e)&&e.add)}function Kd(e,t){const n=e.getValue("willChange");if(M_(n))return n.add(t)}function ux(e){return e.props[zv]}const cx=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,U_=1e-7,z_=12;function F_(e,t,n,r,o){let a,l,c=0;do l=t+(n-t)/2,a=cx(l,r,o)-e,a>0?n=l:t=l;while(Math.abs(a)>U_&&++c<z_);return l}function zo(e,t,n,r){if(e===t&&n===r)return en;const o=a=>F_(a,0,1,e,n);return a=>a===0||a===1?a:cx(o(a),t,r)}const dx=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,hx=e=>t=>1-e(1-t),fx=zo(.33,1.53,.69,.99),lf=hx(fx),px=dx(lf),mx=e=>(e*=2)<1?.5*lf(e):.5*(2-Math.pow(2,-10*(e-1))),uf=e=>1-Math.sin(Math.acos(e)),gx=hx(uf),yx=dx(uf),vx=e=>/^0[^.\s]+$/u.test(e);function $_(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||vx(e):!0}const ho=e=>Math.round(e*1e5)/1e5,cf=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function B_(e){return e==null}const V_=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,df=(e,t)=>n=>!!(typeof n=="string"&&V_.test(n)&&n.startsWith(e)||t&&!B_(n)&&Object.prototype.hasOwnProperty.call(n,t)),xx=(e,t,n)=>r=>{if(typeof r!="string")return r;const[o,a,l,c]=r.match(cf);return{[e]:parseFloat(o),[t]:parseFloat(a),[n]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},q_=e=>Qn(0,255,e),rd={...li,transform:e=>Math.round(q_(e))},es={test:df("rgb","red"),parse:xx("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+rd.transform(e)+", "+rd.transform(t)+", "+rd.transform(n)+", "+ho(Eo.transform(r))+")"};function H_(e){let t="",n="",r="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const Gd={test:df("#"),parse:H_,transform:es.transform},Gs={test:df("hsl","hue"),parse:xx("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Ln.transform(ho(t))+", "+Ln.transform(ho(n))+", "+ho(Eo.transform(r))+")"},Ct={test:e=>es.test(e)||Gd.test(e)||Gs.test(e),parse:e=>es.test(e)?es.parse(e):Gs.test(e)?Gs.parse(e):Gd.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?es.transform(e):Gs.transform(e)},W_=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function K_(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(cf))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(W_))===null||n===void 0?void 0:n.length)||0)>0}const wx="number",bx="color",G_="var",J_="var(",ty="${}",Y_=/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 Co(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},o=[];let a=0;const c=t.replace(Y_,d=>(Ct.test(d)?(r.color.push(a),o.push(bx),n.push(Ct.parse(d))):d.startsWith(J_)?(r.var.push(a),o.push(G_),n.push(d)):(r.number.push(a),o.push(wx),n.push(parseFloat(d))),++a,ty)).split(ty);return{values:n,split:c,indexes:r,types:o}}function kx(e){return Co(e).values}function Sx(e){const{split:t,types:n}=Co(e),r=t.length;return o=>{let a="";for(let l=0;l<r;l++)if(a+=t[l],o[l]!==void 0){const c=n[l];c===wx?a+=ho(o[l]):c===bx?a+=Ct.transform(o[l]):a+=o[l]}return a}}const X_=e=>typeof e=="number"?0:e;function Q_(e){const t=kx(e);return Sx(e)(t.map(X_))}const Ar={test:K_,parse:kx,createTransformer:Sx,getAnimatableNone:Q_},Z_=new Set(["brightness","contrast","saturate","opacity"]);function eE(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(cf)||[];if(!r)return e;const o=n.replace(r,"");let a=Z_.has(t)?1:0;return r!==n&&(a*=100),t+"("+a+o+")"}const tE=/\b([a-z-]*)\(.*?\)/gu,Jd={...Ar,getAnimatableNone:e=>{const t=e.match(tE);return t?t.map(eE).join(" "):e}},nE={...Gh,color:Ct,backgroundColor:Ct,outlineColor:Ct,fill:Ct,stroke:Ct,borderColor:Ct,borderTopColor:Ct,borderRightColor:Ct,borderBottomColor:Ct,borderLeftColor:Ct,filter:Jd,WebkitFilter:Jd},hf=e=>nE[e];function _x(e,t){let n=hf(e);return n!==Jd&&(n=Ar),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const rE=new Set(["auto","none","0"]);function sE(e,t,n){let r=0,o;for(;r<e.length&&!o;){const a=e[r];typeof a=="string"&&!rE.has(a)&&Co(a).values.length&&(o=e[r]),r++}if(o&&n)for(const a of t)e[a]=_x(n,o)}const ny=e=>e===li||e===ke,ry=(e,t)=>parseFloat(e.split(", ")[t]),sy=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return ry(o[1],t);{const a=r.match(/^matrix\((.+)\)$/u);return a?ry(a[1],e):0}},iE=new Set(["x","y","z"]),oE=ai.filter(e=>!iE.has(e));function aE(e){const t=[];return oE.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ii={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:sy(4,13),y:sy(5,14)};ii.translateX=ii.x;ii.translateY=ii.y;const rs=new Set;let Yd=!1,Xd=!1;function Ex(){if(Xd){const e=Array.from(rs).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const o=aE(r);o.length&&(n.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([a,l])=>{var c;(c=r.getValue(a))===null||c===void 0||c.set(l)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Xd=!1,Yd=!1,rs.forEach(e=>e.complete()),rs.clear()}function Tx(){rs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Xd=!0)})}function lE(){Tx(),Ex()}class ff{constructor(t,n,r,o,a,l=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=o,this.element=a,this.isAsync=l}scheduleResolve(){this.isScheduled=!0,this.isAsync?(rs.add(this),Yd||(Yd=!0,Ge.read(Tx),Ge.resolveKeyframes(Ex))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:o}=this;for(let a=0;a<t.length;a++)if(t[a]===null)if(a===0){const l=o?.get(),c=t[t.length-1];if(l!==void 0)t[0]=l;else if(r&&n){const d=r.readValue(n,c);d!=null&&(t[0]=d)}t[0]===void 0&&(t[0]=c),o&&l===void 0&&o.set(t[0])}else t[a]=t[a-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),rs.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,rs.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Cx=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),uE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cE(e){const t=uE.exec(e);if(!t)return[,];const[,n,r,o]=t;return[`--${n??r}`,o]}function jx(e,t,n=1){const[r,o]=cE(e);if(!r)return;const a=window.getComputedStyle(t).getPropertyValue(r);if(a){const l=a.trim();return Cx(l)?parseFloat(l):l}return Kh(o)?jx(o,t,n+1):o}const Ax=e=>t=>t.test(e),dE={test:e=>e==="auto",parse:e=>e},Px=[li,ke,Ln,_r,e_,ZS,dE],iy=e=>Px.find(Ax(e));class Nx extends ff{constructor(t,n,r,o,a){super(t,n,r,o,a,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let f=t[d];if(typeof f=="string"&&(f=f.trim(),Kh(f))){const p=jx(f,n.current);p!==void 0&&(t[d]=p),d===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!ax.has(r)||t.length!==2)return;const[o,a]=t,l=iy(o),c=iy(a);if(l!==c)if(ny(l)&&ny(c))for(let d=0;d<t.length;d++){const f=t[d];typeof f=="string"&&(t[d]=parseFloat(f))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let o=0;o<t.length;o++)$_(t[o])&&r.push(o);r.length&&sE(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ii[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:o}=this;if(!n||!n.current)return;const a=n.getValue(r);a&&a.jump(this.measuredOrigin,!1);const l=o.length-1,c=o[l];o[l]=ii[r](n.measureViewportBox(),window.getComputedStyle(n.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([d,f])=>{n.getValue(d).set(f)}),this.resolveNoneKeyframes()}}const oy=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ar.test(e)||e==="0")&&!e.startsWith("url("));function hE(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function fE(e,t,n,r){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const a=e[e.length-1],l=oy(o,t),c=oy(a,t);return!l||!c?!1:hE(e)||(n==="spring"||tf(n))&&r}const pE=e=>e!==null;function Xl(e,{repeat:t,repeatType:n="loop"},r){const o=e.filter(pE),a=t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||r===void 0?o[a]:r}const mE=40;class Rx{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:l="loop",...c}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Dn.now(),this.options={autoplay:t,delay:n,type:r,repeat:o,repeatDelay:a,repeatType:l,...c},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>mE?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&lE(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Dn.now(),this.hasAttemptedResolve=!0;const{name:r,type:o,velocity:a,delay:l,onComplete:c,onUpdate:d,isGenerator:f}=this.options;if(!f&&!fE(t,r,o,a))if(l)this.options.duration=0;else{d&&d(Xl(t,this.options,n)),c&&c(),this.resolveFinishedPromise();return}const p=this.initPlayback(t,n);p!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...p},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Ze=(e,t,n)=>e+(t-e)*n;function sd(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function gE({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let o=0,a=0,l=0;if(!t)o=a=l=n;else{const c=n<.5?n*(1+t):n+t-n*t,d=2*n-c;o=sd(d,c,e+1/3),a=sd(d,c,e),l=sd(d,c,e-1/3)}return{red:Math.round(o*255),green:Math.round(a*255),blue:Math.round(l*255),alpha:r}}function Ol(e,t){return n=>n>0?t:e}const id=(e,t,n)=>{const r=e*e,o=n*(t*t-r)+r;return o<0?0:Math.sqrt(o)},yE=[Gd,es,Gs],vE=e=>yE.find(t=>t.test(e));function ay(e){const t=vE(e);if(!t)return!1;let n=t.parse(e);return t===Gs&&(n=gE(n)),n}const ly=(e,t)=>{const n=ay(e),r=ay(t);if(!n||!r)return Ol(e,t);const o={...n};return a=>(o.red=id(n.red,r.red,a),o.green=id(n.green,r.green,a),o.blue=id(n.blue,r.blue,a),o.alpha=Ze(n.alpha,r.alpha,a),es.transform(o))},xE=(e,t)=>n=>t(e(n)),Fo=(...e)=>e.reduce(xE),Qd=new Set(["none","hidden"]);function wE(e,t){return Qd.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function bE(e,t){return n=>Ze(e,t,n)}function pf(e){return typeof e=="number"?bE:typeof e=="string"?Kh(e)?Ol:Ct.test(e)?ly:_E:Array.isArray(e)?Ox:typeof e=="object"?Ct.test(e)?ly:kE:Ol}function Ox(e,t){const n=[...e],r=n.length,o=e.map((a,l)=>pf(a)(a,t[l]));return a=>{for(let l=0;l<r;l++)n[l]=o[l](a);return n}}function kE(e,t){const n={...e,...t},r={};for(const o in n)e[o]!==void 0&&t[o]!==void 0&&(r[o]=pf(e[o])(e[o],t[o]));return o=>{for(const a in r)n[a]=r[a](o);return n}}function SE(e,t){var n;const r=[],o={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const l=t.types[a],c=e.indexes[l][o[l]],d=(n=e.values[c])!==null&&n!==void 0?n:0;r[a]=d,o[l]++}return r}const _E=(e,t)=>{const n=Ar.createTransformer(t),r=Co(e),o=Co(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Qd.has(e)&&!o.values.length||Qd.has(t)&&!r.values.length?wE(e,t):Fo(Ox(SE(r,o),o.values),n):Ol(e,t)};function Ix(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ze(e,t,n):pf(e)(e,t)}const EE=5;function Lx(e,t,n){const r=Math.max(t-EE,0);return lx(n-e(r),t-r)}const nt={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},od=.001;function TE({duration:e=nt.duration,bounce:t=nt.bounce,velocity:n=nt.velocity,mass:r=nt.mass}){let o,a,l=1-t;l=Qn(nt.minDamping,nt.maxDamping,l),e=Qn(nt.minDuration,nt.maxDuration,Xn(e)),l<1?(o=f=>{const p=f*l,y=p*e,v=p-n,w=Zd(f,l),b=Math.exp(-y);return od-v/w*b},a=f=>{const y=f*l*e,v=y*n+n,w=Math.pow(l,2)*Math.pow(f,2)*e,b=Math.exp(-y),S=Zd(Math.pow(f,2),l);return(-o(f)+od>0?-1:1)*((v-w)*b)/S}):(o=f=>{const p=Math.exp(-f*e),y=(f-n)*e+1;return-od+p*y},a=f=>{const p=Math.exp(-f*e),y=(n-f)*(e*e);return p*y});const c=5/e,d=jE(o,a,c);if(e=Yn(e),isNaN(d))return{stiffness:nt.stiffness,damping:nt.damping,duration:e};{const f=Math.pow(d,2)*r;return{stiffness:f,damping:l*2*Math.sqrt(r*f),duration:e}}}const CE=12;function jE(e,t,n){let r=n;for(let o=1;o<CE;o++)r=r-e(r)/t(r);return r}function Zd(e,t){return e*Math.sqrt(1-t*t)}const AE=["duration","bounce"],PE=["stiffness","damping","mass"];function uy(e,t){return t.some(n=>e[n]!==void 0)}function NE(e){let t={velocity:nt.velocity,stiffness:nt.stiffness,damping:nt.damping,mass:nt.mass,isResolvedFromDuration:!1,...e};if(!uy(e,PE)&&uy(e,AE))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,a=2*Qn(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:nt.mass,stiffness:o,damping:a}}else{const n=TE(e);t={...t,...n,mass:nt.mass},t.isResolvedFromDuration=!0}return t}function Dx(e=nt.visualDuration,t=nt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=n;const a=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],c={done:!1,value:a},{stiffness:d,damping:f,mass:p,duration:y,velocity:v,isResolvedFromDuration:w}=NE({...n,velocity:-Xn(n.velocity||0)}),b=v||0,S=f/(2*Math.sqrt(d*p)),_=l-a,E=Xn(Math.sqrt(d/p)),P=Math.abs(_)<5;r||(r=P?nt.restSpeed.granular:nt.restSpeed.default),o||(o=P?nt.restDelta.granular:nt.restDelta.default);let j;if(S<1){const $=Zd(E,S);j=O=>{const z=Math.exp(-S*E*O);return l-z*((b+S*E*_)/$*Math.sin($*O)+_*Math.cos($*O))}}else if(S===1)j=$=>l-Math.exp(-E*$)*(_+(b+E*_)*$);else{const $=E*Math.sqrt(S*S-1);j=O=>{const z=Math.exp(-S*E*O),q=Math.min($*O,300);return l-z*((b+S*E*_)*Math.sinh(q)+$*_*Math.cosh(q))/$}}const D={calculatedDuration:w&&y||null,next:$=>{const O=j($);if(w)c.done=$>=y;else{let z=0;S<1&&(z=$===0?Yn(b):Lx(j,$,O));const q=Math.abs(z)<=r,J=Math.abs(l-O)<=o;c.done=q&&J}return c.value=c.done?l:O,c},toString:()=>{const $=Math.min(ex(D),Hd),O=tx(z=>D.next($*z).value,$,30);return $+"ms "+O}};return D}function cy({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:a=500,modifyTarget:l,min:c,max:d,restDelta:f=.5,restSpeed:p}){const y=e[0],v={done:!1,value:y},w=q=>c!==void 0&&q<c||d!==void 0&&q>d,b=q=>c===void 0?d:d===void 0||Math.abs(c-q)<Math.abs(d-q)?c:d;let S=n*t;const _=y+S,E=l===void 0?_:l(_);E!==_&&(S=E-y);const P=q=>-S*Math.exp(-q/r),j=q=>E+P(q),D=q=>{const J=P(q),ie=j(q);v.done=Math.abs(J)<=f,v.value=v.done?E:ie};let $,O;const z=q=>{w(v.value)&&($=q,O=Dx({keyframes:[v.value,b(v.value)],velocity:Lx(j,q,v.value),damping:o,stiffness:a,restDelta:f,restSpeed:p}))};return z(0),{calculatedDuration:null,next:q=>{let J=!1;return!O&&$===void 0&&(J=!0,D(q),z(q)),$!==void 0&&q>=$?O.next(q-$):(!J&&D(q),v)}}}const RE=zo(.42,0,1,1),OE=zo(0,0,.58,1),Mx=zo(.42,0,.58,1),IE=e=>Array.isArray(e)&&typeof e[0]!="number",LE={linear:en,easeIn:RE,easeInOut:Mx,easeOut:OE,circIn:uf,circInOut:yx,circOut:gx,backIn:lf,backInOut:px,backOut:fx,anticipate:mx},dy=e=>{if(nf(e)){Iv(e.length===4);const[t,n,r,o]=e;return zo(t,n,r,o)}else if(typeof e=="string")return LE[e];return e};function DE(e,t,n){const r=[],o=n||Ix,a=e.length-1;for(let l=0;l<a;l++){let c=o(e[l],e[l+1]);if(t){const d=Array.isArray(t)?t[l]||en:t;c=Fo(d,c)}r.push(c)}return r}function ME(e,t,{clamp:n=!0,ease:r,mixer:o}={}){const a=e.length;if(Iv(a===t.length),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=DE(t,r,o),d=c.length,f=p=>{if(l&&p<e[0])return t[0];let y=0;if(d>1)for(;y<e.length-2&&!(p<e[y+1]);y++);const v=ri(e[y],e[y+1],p);return c[y](v)};return n?p=>f(Qn(e[0],e[a-1],p)):f}function UE(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const o=ri(0,t,r);e.push(Ze(n,1,o))}}function zE(e){const t=[0];return UE(t,e.length-1),t}function FE(e,t){return e.map(n=>n*t)}function $E(e,t){return e.map(()=>t||Mx).splice(0,e.length-1)}function Il({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const o=IE(r)?r.map(dy):dy(r),a={done:!1,value:t[0]},l=FE(n&&n.length===t.length?n:zE(t),e),c=ME(l,t,{ease:Array.isArray(o)?o:$E(t,o)});return{calculatedDuration:e,next:d=>(a.value=c(d),a.done=d>=e,a)}}const BE=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Ge.update(t,!0),stop:()=>jr(t),now:()=>kt.isProcessing?kt.timestamp:Dn.now()}},VE={decay:cy,inertia:cy,tween:Il,keyframes:Il,spring:Dx},qE=e=>e/100;class mf extends Rx{constructor(t){super(t),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:d}=this.options;d&&d()};const{name:n,motionValue:r,element:o,keyframes:a}=this.options,l=o?.KeyframeResolver||ff,c=(d,f)=>this.onKeyframesResolved(d,f);this.resolver=new l(a,c,n,r,o),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:a,velocity:l=0}=this.options,c=tf(n)?n:VE[n]||Il;let d,f;c!==Il&&typeof t[0]!="number"&&(d=Fo(qE,Ix(t[0],t[1])),t=[0,100]);const p=c({...this.options,keyframes:t});a==="mirror"&&(f=c({...this.options,keyframes:[...t].reverse(),velocity:-l})),p.calculatedDuration===null&&(p.calculatedDuration=ex(p));const{calculatedDuration:y}=p,v=y+o,w=v*(r+1)-o;return{generator:p,mirroredGenerator:f,mapPercentToKeyframes:d,calculatedDuration:y,resolvedDuration:v,totalDuration:w}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:q}=this.options;return{done:!0,value:q[q.length-1]}}const{finalKeyframe:o,generator:a,mirroredGenerator:l,mapPercentToKeyframes:c,keyframes:d,calculatedDuration:f,totalDuration:p,resolvedDuration:y}=r;if(this.startTime===null)return a.next(0);const{delay:v,repeat:w,repeatType:b,repeatDelay:S,onUpdate:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-p/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const E=this.currentTime-v*(this.speed>=0?1:-1),P=this.speed>=0?E<0:E>p;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=p);let j=this.currentTime,D=a;if(w){const q=Math.min(this.currentTime,p)/y;let J=Math.floor(q),ie=q%1;!ie&&q>=1&&(ie=1),ie===1&&J--,J=Math.min(J,w+1),J%2&&(b==="reverse"?(ie=1-ie,S&&(ie-=S/y)):b==="mirror"&&(D=l)),j=Qn(0,1,ie)*y}const $=P?{done:!1,value:d[0]}:D.next(j);c&&($.value=c($.value));let{done:O}=$;!P&&f!==null&&(O=this.speed>=0?this.currentTime>=p:this.currentTime<=0);const z=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return z&&o!==void 0&&($.value=Xl(d,this.options,o)),_&&_($.value),z&&this.finish(),$}get duration(){const{resolved:t}=this;return t?Xn(t.calculatedDuration):0}get time(){return Xn(this.currentTime)}set time(t){t=Yn(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Xn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=BE,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),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=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}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(t){return this.startTime=0,this.tick(t,!0)}}const HE=new Set(["opacity","clipPath","filter","transform"]);function WE(e,t,n,{delay:r=0,duration:o=300,repeat:a=0,repeatType:l="loop",ease:c="easeInOut",times:d}={}){const f={[t]:n};d&&(f.offset=d);const p=rx(c,o);return Array.isArray(p)&&(f.easing=p),e.animate(f,{delay:r,duration:o,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:a+1,direction:l==="reverse"?"alternate":"normal"})}const KE=Fh(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Ll=10,GE=2e4;function JE(e){return tf(e.type)||e.type==="spring"||!nx(e.ease)}function YE(e,t){const n=new mf({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const o=[];let a=0;for(;!r.done&&a<GE;)r=n.sample(a),o.push(r.value),a+=Ll;return{times:void 0,keyframes:o,duration:a-Ll,ease:"linear"}}const Ux={anticipate:mx,backInOut:px,circInOut:yx};function XE(e){return e in Ux}class hy extends Rx{constructor(t){super(t);const{name:n,motionValue:r,element:o,keyframes:a}=this.options;this.resolver=new Nx(a,(l,c)=>this.onKeyframesResolved(l,c),n,r,o),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:o,ease:a,type:l,motionValue:c,name:d,startTime:f}=this.options;if(!c.owner||!c.owner.current)return!1;if(typeof a=="string"&&Rl()&&XE(a)&&(a=Ux[a]),JE(this.options)){const{onComplete:y,onUpdate:v,motionValue:w,element:b,...S}=this.options,_=YE(t,S);t=_.keyframes,t.length===1&&(t[1]=t[0]),r=_.duration,o=_.times,a=_.ease,l="keyframes"}const p=WE(c.owner.current,d,t,{...this.options,duration:r,times:o,ease:a});return p.startTime=f??this.calcStartTime(),this.pendingTimeline?(Yg(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:y}=this.options;c.set(Xl(t,this.options,n)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:r,times:o,type:l,ease:a,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Xn(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Xn(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Yn(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return en;const{animation:r}=n;Yg(r,t)}return en}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:o,type:a,ease:l,times:c}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:f,onUpdate:p,onComplete:y,element:v,...w}=this.options,b=new mf({...w,keyframes:r,duration:o,type:a,ease:l,times:c,isGenerator:!0}),S=Yn(this.time);f.setWithVelocity(b.sample(S-Ll).value,b.sample(S).value,Ll)}const{onStop:d}=this.options;d&&d(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:o,repeatType:a,damping:l,type:c}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:f}=n.owner.getProps();return KE()&&r&&HE.has(r)&&!d&&!f&&!o&&a!=="mirror"&&l!==0&&c!=="inertia"}}const QE={type:"spring",stiffness:500,damping:25,restSpeed:10},ZE=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),eT={type:"keyframes",duration:.8},tT={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},nT=(e,{keyframes:t})=>t.length>2?eT:as.has(e)?e.startsWith("scale")?ZE(t[1]):QE:tT;function rT({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:a,repeatType:l,repeatDelay:c,from:d,elapsed:f,...p}){return!!Object.keys(p).length}const gf=(e,t,n,r={},o,a)=>l=>{const c=ef(r,e)||{},d=c.delay||r.delay||0;let{elapsed:f=0}=r;f=f-Yn(d);let p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-f,onUpdate:v=>{t.set(v),c.onUpdate&&c.onUpdate(v)},onComplete:()=>{l(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:a?void 0:o};rT(c)||(p={...p,...nT(e,p)}),p.duration&&(p.duration=Yn(p.duration)),p.repeatDelay&&(p.repeatDelay=Yn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let y=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(p.duration=0,p.delay===0&&(y=!0)),y&&!a&&t.get()!==void 0){const v=Xl(p.keyframes,c);if(v!==void 0)return Ge.update(()=>{p.onUpdate(v),p.onComplete()}),new k_([])}return!a&&hy.supports(p)?new hy(p):new mf(p)};function sT({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function zx(e,t,{delay:n=0,transitionOverride:r,type:o}={}){var a;let{transition:l=e.getDefaultTransition(),transitionEnd:c,...d}=t;r&&(l=r);const f=[],p=o&&e.animationState&&e.animationState.getState()[o];for(const y in d){const v=e.getValue(y,(a=e.latestValues[y])!==null&&a!==void 0?a:null),w=d[y];if(w===void 0||p&&sT(p,y))continue;const b={delay:n,...ef(l||{},y)};let S=!1;if(window.MotionHandoffAnimation){const E=ux(e);if(E){const P=window.MotionHandoffAnimation(E,y,Ge);P!==null&&(b.startTime=P,S=!0)}}Kd(e,y),v.start(gf(y,v,w,e.shouldReduceMotion&&ax.has(y)?{type:!1}:b,e,S));const _=v.animation;_&&f.push(_)}return c&&Promise.all(f).then(()=>{Ge.update(()=>{c&&D_(e,c)})}),f}function eh(e,t,n={}){var r;const o=Yl(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(a=n.transitionOverride);const l=o?()=>Promise.all(zx(e,o,n)):()=>Promise.resolve(),c=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:p=0,staggerChildren:y,staggerDirection:v}=a;return iT(e,t,p+f,y,v,n)}:()=>Promise.resolve(),{when:d}=a;if(d){const[f,p]=d==="beforeChildren"?[l,c]:[c,l];return f().then(()=>p())}else return Promise.all([l(),c(n.delay)])}function iT(e,t,n=0,r=0,o=1,a){const l=[],c=(e.variantChildren.size-1)*r,d=o===1?(f=0)=>f*r:(f=0)=>c-f*r;return Array.from(e.variantChildren).sort(oT).forEach((f,p)=>{f.notify("AnimationStart",t),l.push(eh(f,t,{...a,delay:n+d(p)}).then(()=>f.notify("AnimationComplete",t)))}),Promise.all(l)}function oT(e,t){return e.sortNodePosition(t)}function aT(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const o=t.map(a=>eh(e,a,n));r=Promise.all(o)}else if(typeof t=="string")r=eh(e,t,n);else{const o=typeof t=="function"?Yl(e,t,n.custom):t;r=Promise.all(zx(e,o,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const lT=Bh.length;function Fx(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Fx(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<lT;n++){const r=Bh[n],o=e.props[r];(_o(o)||o===!1)&&(t[r]=o)}return t}const uT=[...$h].reverse(),cT=$h.length;function dT(e){return t=>Promise.all(t.map(({animation:n,options:r})=>aT(e,n,r)))}function hT(e){let t=dT(e),n=fy(),r=!0;const o=d=>(f,p)=>{var y;const v=Yl(e,p,d==="exit"?(y=e.presenceContext)===null||y===void 0?void 0:y.custom:void 0);if(v){const{transition:w,transitionEnd:b,...S}=v;f={...f,...S,...b}}return f};function a(d){t=d(e)}function l(d){const{props:f}=e,p=Fx(e.parent)||{},y=[],v=new Set;let w={},b=1/0;for(let _=0;_<cT;_++){const E=uT[_],P=n[E],j=f[E]!==void 0?f[E]:p[E],D=_o(j),$=E===d?P.isActive:null;$===!1&&(b=_);let O=j===p[E]&&j!==f[E]&&D;if(O&&r&&e.manuallyAnimateOnMount&&(O=!1),P.protectedKeys={...w},!P.isActive&&$===null||!j&&!P.prevProp||Gl(j)||typeof j=="boolean")continue;const z=fT(P.prevProp,j);let q=z||E===d&&P.isActive&&!O&&D||_>b&&D,J=!1;const ie=Array.isArray(j)?j:[j];let re=ie.reduce(o(E),{});$===!1&&(re={});const{prevResolvedValues:Q={}}=P,ye={...Q,...re},ne=le=>{q=!0,v.has(le)&&(J=!0,v.delete(le)),P.needsAnimating[le]=!0;const H=e.getValue(le);H&&(H.liveStyle=!1)};for(const le in ye){const H=re[le],oe=Q[le];if(w.hasOwnProperty(le))continue;let T=!1;qd(H)&&qd(oe)?T=!Zv(H,oe):T=H!==oe,T?H!=null?ne(le):v.add(le):H!==void 0&&v.has(le)?ne(le):P.protectedKeys[le]=!0}P.prevProp=j,P.prevResolvedValues=re,P.isActive&&(w={...w,...re}),r&&e.blockInitialAnimation&&(q=!1),q&&(!(O&&z)||J)&&y.push(...ie.map(le=>({animation:le,options:{type:E}})))}if(v.size){const _={};v.forEach(E=>{const P=e.getBaseTarget(E),j=e.getValue(E);j&&(j.liveStyle=!0),_[E]=P??null}),y.push({animation:_})}let S=!!y.length;return r&&(f.initial===!1||f.initial===f.animate)&&!e.manuallyAnimateOnMount&&(S=!1),r=!1,S?t(y):Promise.resolve()}function c(d,f){var p;if(n[d].isActive===f)return Promise.resolve();(p=e.variantChildren)===null||p===void 0||p.forEach(v=>{var w;return(w=v.animationState)===null||w===void 0?void 0:w.setActive(d,f)}),n[d].isActive=f;const y=l(d);for(const v in n)n[v].protectedKeys={};return y}return{animateChanges:l,setActive:c,setAnimateFunction:a,getState:()=>n,reset:()=>{n=fy(),r=!0}}}function fT(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Zv(t,e):!1}function Wr(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fy(){return{animate:Wr(!0),whileInView:Wr(),whileHover:Wr(),whileTap:Wr(),whileDrag:Wr(),whileFocus:Wr(),exit:Wr()}}class Pr{constructor(t){this.isMounted=!1,this.node=t}update(){}}class pT extends Pr{constructor(t){super(t),t.animationState||(t.animationState=hT(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Gl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let mT=0;class gT extends Pr{constructor(){super(...arguments),this.id=mT++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const yT={animation:{Feature:pT},exit:{Feature:gT}};function jo(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function $o(e){return{point:{x:e.pageX,y:e.pageY}}}const vT=e=>t=>rf(t)&&e(t,$o(t));function fo(e,t,n,r){return jo(e,t,vT(n),r)}const py=(e,t)=>Math.abs(e-t);function xT(e,t){const n=py(e.x,t.x),r=py(e.y,t.y);return Math.sqrt(n**2+r**2)}class $x{constructor(t,n,{transformPagePoint:r,contextWindow:o,dragSnapToOrigin:a=!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 y=ld(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,w=xT(y.offset,{x:0,y:0})>=3;if(!v&&!w)return;const{point:b}=y,{timestamp:S}=kt;this.history.push({...b,timestamp:S});const{onStart:_,onMove:E}=this.handlers;v||(_&&_(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,y)},this.handlePointerMove=(y,v)=>{this.lastMoveEvent=y,this.lastMoveEventInfo=ad(v,this.transformPagePoint),Ge.update(this.updatePoint,!0)},this.handlePointerUp=(y,v)=>{this.end();const{onEnd:w,onSessionEnd:b,resumeAnimation:S}=this.handlers;if(this.dragSnapToOrigin&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=ld(y.type==="pointercancel"?this.lastMoveEventInfo:ad(v,this.transformPagePoint),this.history);this.startEvent&&w&&w(y,_),b&&b(y,_)},!rf(t))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.contextWindow=o||window;const l=$o(t),c=ad(l,this.transformPagePoint),{point:d}=c,{timestamp:f}=kt;this.history=[{...d,timestamp:f}];const{onSessionStart:p}=n;p&&p(t,ld(c,this.history)),this.removeListeners=Fo(fo(this.contextWindow,"pointermove",this.handlePointerMove),fo(this.contextWindow,"pointerup",this.handlePointerUp),fo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),jr(this.updatePoint)}}function ad(e,t){return t?{point:t(e.point)}:e}function my(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ld({point:e},t){return{point:e,delta:my(e,Bx(t)),offset:my(e,wT(t)),velocity:bT(t,.1)}}function wT(e){return e[0]}function Bx(e){return e[e.length-1]}function bT(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=Bx(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>Yn(t)));)n--;if(!r)return{x:0,y:0};const a=Xn(o.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const l={x:(o.x-r.x)/a,y:(o.y-r.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}const Vx=1e-4,kT=1-Vx,ST=1+Vx,qx=.01,_T=0-qx,ET=0+qx;function tn(e){return e.max-e.min}function TT(e,t,n){return Math.abs(e-t)<=n}function gy(e,t,n,r=.5){e.origin=r,e.originPoint=Ze(t.min,t.max,e.origin),e.scale=tn(n)/tn(t),e.translate=Ze(n.min,n.max,e.origin)-e.originPoint,(e.scale>=kT&&e.scale<=ST||isNaN(e.scale))&&(e.scale=1),(e.translate>=_T&&e.translate<=ET||isNaN(e.translate))&&(e.translate=0)}function po(e,t,n,r){gy(e.x,t.x,n.x,r?r.originX:void 0),gy(e.y,t.y,n.y,r?r.originY:void 0)}function yy(e,t,n){e.min=n.min+t.min,e.max=e.min+tn(t)}function CT(e,t,n){yy(e.x,t.x,n.x),yy(e.y,t.y,n.y)}function vy(e,t,n){e.min=t.min-n.min,e.max=e.min+tn(t)}function mo(e,t,n){vy(e.x,t.x,n.x),vy(e.y,t.y,n.y)}function jT(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Ze(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Ze(n,e,r.max):Math.min(e,n)),e}function xy(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function AT(e,{top:t,left:n,bottom:r,right:o}){return{x:xy(e.x,n,o),y:xy(e.y,t,r)}}function wy(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function PT(e,t){return{x:wy(e.x,t.x),y:wy(e.y,t.y)}}function NT(e,t){let n=.5;const r=tn(e),o=tn(t);return o>r?n=ri(t.min,t.max-r,e.min):r>o&&(n=ri(e.min,e.max-o,t.min)),Qn(0,1,n)}function RT(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const th=.35;function OT(e=th){return e===!1?e=0:e===!0&&(e=th),{x:by(e,"left","right"),y:by(e,"top","bottom")}}function by(e,t,n){return{min:ky(e,t),max:ky(e,n)}}function ky(e,t){return typeof e=="number"?e:e[t]||0}const Sy=()=>({translate:0,scale:1,origin:0,originPoint:0}),Js=()=>({x:Sy(),y:Sy()}),_y=()=>({min:0,max:0}),it=()=>({x:_y(),y:_y()});function dn(e){return[e("x"),e("y")]}function Hx({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function IT({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function LT(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function ud(e){return e===void 0||e===1}function nh({scale:e,scaleX:t,scaleY:n}){return!ud(e)||!ud(t)||!ud(n)}function Jr(e){return nh(e)||Wx(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Wx(e){return Ey(e.x)||Ey(e.y)}function Ey(e){return e&&e!=="0%"}function Dl(e,t,n){const r=e-n,o=t*r;return n+o}function Ty(e,t,n,r,o){return o!==void 0&&(e=Dl(e,o,r)),Dl(e,n,r)+t}function rh(e,t=0,n=1,r,o){e.min=Ty(e.min,t,n,r,o),e.max=Ty(e.max,t,n,r,o)}function Kx(e,{x:t,y:n}){rh(e.x,t.translate,t.scale,t.originPoint),rh(e.y,n.translate,n.scale,n.originPoint)}const Cy=.999999999999,jy=1.0000000000001;function DT(e,t,n,r=!1){const o=n.length;if(!o)return;t.x=t.y=1;let a,l;for(let c=0;c<o;c++){a=n[c],l=a.projectionDelta;const{visualElement:d}=a.options;d&&d.props.style&&d.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&Xs(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),l&&(t.x*=l.x.scale,t.y*=l.y.scale,Kx(e,l)),r&&Jr(a.latestValues)&&Xs(e,a.latestValues))}t.x<jy&&t.x>Cy&&(t.x=1),t.y<jy&&t.y>Cy&&(t.y=1)}function Ys(e,t){e.min=e.min+t,e.max=e.max+t}function Ay(e,t,n,r,o=.5){const a=Ze(e.min,e.max,o);rh(e,t,n,a,r)}function Xs(e,t){Ay(e.x,t.x,t.scaleX,t.scale,t.originX),Ay(e.y,t.y,t.scaleY,t.scale,t.originY)}function Gx(e,t){return Hx(LT(e.getBoundingClientRect(),t))}function MT(e,t,n){const r=Gx(e,n),{scroll:o}=t;return o&&(Ys(r.x,o.offset.x),Ys(r.y,o.offset.y)),r}const Jx=({current:e})=>e?e.ownerDocument.defaultView:null,UT=new WeakMap;class zT{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=it(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const o=p=>{const{dragSnapToOrigin:y}=this.getProps();y?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor($o(p).point)},a=(p,y)=>{const{drag:v,dragPropagation:w,onDragStart:b}=this.getProps();if(v&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=N_(v),!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),dn(_=>{let E=this.getAxisMotionValue(_).get()||0;if(Ln.test(E)){const{projection:P}=this.visualElement;if(P&&P.layout){const j=P.layout.layoutBox[_];j&&(E=tn(j)*(parseFloat(E)/100))}}this.originPoint[_]=E}),b&&Ge.postRender(()=>b(p,y)),Kd(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},l=(p,y)=>{const{dragPropagation:v,dragDirectionLock:w,onDirectionLock:b,onDrag:S}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:_}=y;if(w&&this.currentDirection===null){this.currentDirection=FT(_),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",y.point,_),this.updateAxis("y",y.point,_),this.visualElement.render(),S&&S(p,y)},c=(p,y)=>this.stop(p,y),d=()=>dn(p=>{var y;return this.getAnimationState(p)==="paused"&&((y=this.getAxisMotionValue(p).animation)===null||y===void 0?void 0:y.play())}),{dragSnapToOrigin:f}=this.getProps();this.panSession=new $x(t,{onSessionStart:o,onStart:a,onMove:l,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,contextWindow:Jx(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&Ge.postRender(()=>a(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:o}=this.getProps();if(!r||!dl(t,o,this.currentDirection))return;const a=this.getAxisMotionValue(t);let l=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(l=jT(l,this.constraints[t],this.elastic[t])),a.set(l)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,a=this.constraints;n&&Ks(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&o?this.constraints=AT(o.layoutBox,n):this.constraints=!1,this.elastic=OT(r),a!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&dn(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=RT(o.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Ks(t))return!1;const r=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const a=MT(r,o.root,this.visualElement.getTransformPagePoint());let l=PT(o.layout.layoutBox,a);if(n){const c=n(IT(l));this.hasMutatedConstraints=!!c,c&&(l=Hx(c))}return l}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:a,dragSnapToOrigin:l,onDragTransitionEnd:c}=this.getProps(),d=this.constraints||{},f=dn(p=>{if(!dl(p,n,this.currentDirection))return;let y=d&&d[p]||{};l&&(y={min:0,max:0});const v=o?200:1e6,w=o?40:1e7,b={type:"inertia",velocity:r?t[p]:0,bounceStiffness:v,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...a,...y};return this.startAxisValueAnimation(p,b)});return Promise.all(f).then(c)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Kd(this.visualElement,t),r.start(gf(t,r,0,n,this.visualElement,!1))}stopAnimation(){dn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){dn(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){dn(n=>{const{drag:r}=this.getProps();if(!dl(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,a=this.getAxisMotionValue(n);if(o&&o.layout){const{min:l,max:c}=o.layout.layoutBox[n];a.set(t[n]-Ze(l,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ks(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};dn(l=>{const c=this.getAxisMotionValue(l);if(c&&this.constraints!==!1){const d=c.get();o[l]=NT({min:d,max:d},this.constraints[l])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),dn(l=>{if(!dl(l,t,null))return;const c=this.getAxisMotionValue(l),{min:d,max:f}=this.constraints[l];c.set(Ze(d,f,o[l]))})}addListeners(){if(!this.visualElement.current)return;UT.set(this.visualElement,this);const t=this.visualElement.current,n=fo(t,"pointerdown",d=>{const{drag:f,dragListener:p=!0}=this.getProps();f&&p&&this.start(d)}),r=()=>{const{dragConstraints:d}=this.getProps();Ks(d)&&d.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,a=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Ge.read(r);const l=jo(window,"resize",()=>this.scalePositionWithinConstraints()),c=o.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:f})=>{this.isDragging&&f&&(dn(p=>{const y=this.getAxisMotionValue(p);y&&(this.originPoint[p]+=d[p].translate,y.set(y.get()+d[p].translate))}),this.visualElement.render())}));return()=>{l(),n(),a(),c&&c()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:a=!1,dragElastic:l=th,dragMomentum:c=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:a,dragElastic:l,dragMomentum:c}}}function dl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function FT(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class $T extends Pr{constructor(t){super(t),this.removeGroupControls=en,this.removeListeners=en,this.controls=new zT(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||en}unmount(){this.removeGroupControls(),this.removeListeners()}}const Py=e=>(t,n)=>{e&&Ge.postRender(()=>e(t,n))};class BT extends Pr{constructor(){super(...arguments),this.removePointerDownListener=en}onPointerDown(t){this.session=new $x(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Jx(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:Py(t),onStart:Py(n),onMove:r,onEnd:(a,l)=>{delete this.session,o&&Ge.postRender(()=>o(a,l))}}}mount(){this.removePointerDownListener=fo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Sl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ny(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const eo={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ke.test(e))e=parseFloat(e);else return e;const n=Ny(e,t.target.x),r=Ny(e,t.target.y);return`${n}% ${r}%`}},VT={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,o=Ar.parse(e);if(o.length>5)return r;const a=Ar.createTransformer(e),l=typeof o[0]!="number"?1:0,c=n.x.scale*t.x,d=n.y.scale*t.y;o[0+l]/=c,o[1+l]/=d;const f=Ze(c,d,.5);return typeof o[2+l]=="number"&&(o[2+l]/=f),typeof o[3+l]=="number"&&(o[3+l]/=f),a(o)}};class qT extends L.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:a}=t;c_(HT),a&&(n.group&&n.group.add(a),r&&r.register&&o&&r.register(a),a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),Sl.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:o,isPresent:a}=this.props,l=r.projection;return l&&(l.isPresent=a,o||t.layoutDependency!==n||n===void 0?l.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?l.promote():l.relegate()||Ge.postRender(()=>{const c=l.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),qh.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=t;o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Yx(e){const[t,n]=Rv(),r=L.useContext(Dh);return g.jsx(qT,{...e,layoutGroup:r,switchLayoutGroup:L.useContext(Fv),isPresent:t,safeToRemove:n})}const HT={borderRadius:{...eo,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:eo,borderTopRightRadius:eo,borderBottomLeftRadius:eo,borderBottomRightRadius:eo,boxShadow:VT};function WT(e,t,n){const r=At(e)?e:To(e);return r.start(gf("",r,t,n)),r.animation}function KT(e){return e instanceof SVGElement&&e.tagName!=="svg"}const GT=(e,t)=>e.depth-t.depth;class JT{constructor(){this.children=[],this.isDirty=!1}add(t){sf(this.children,t),this.isDirty=!0}remove(t){of(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(GT),this.isDirty=!1,this.children.forEach(t)}}function YT(e,t){const n=Dn.now(),r=({timestamp:o})=>{const a=o-n;a>=t&&(jr(r),e(a-t))};return Ge.read(r,!0),()=>jr(r)}const Xx=["TopLeft","TopRight","BottomLeft","BottomRight"],XT=Xx.length,Ry=e=>typeof e=="string"?parseFloat(e):e,Oy=e=>typeof e=="number"||ke.test(e);function QT(e,t,n,r,o,a){o?(e.opacity=Ze(0,n.opacity!==void 0?n.opacity:1,ZT(r)),e.opacityExit=Ze(t.opacity!==void 0?t.opacity:1,0,eC(r))):a&&(e.opacity=Ze(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let l=0;l<XT;l++){const c=`border${Xx[l]}Radius`;let d=Iy(t,c),f=Iy(n,c);if(d===void 0&&f===void 0)continue;d||(d=0),f||(f=0),d===0||f===0||Oy(d)===Oy(f)?(e[c]=Math.max(Ze(Ry(d),Ry(f),r),0),(Ln.test(f)||Ln.test(d))&&(e[c]+="%")):e[c]=f}(t.rotate||n.rotate)&&(e.rotate=Ze(t.rotate||0,n.rotate||0,r))}function Iy(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const ZT=Qx(0,.5,gx),eC=Qx(.5,.95,en);function Qx(e,t,n){return r=>r<e?0:r>t?1:n(ri(e,t,r))}function Ly(e,t){e.min=t.min,e.max=t.max}function cn(e,t){Ly(e.x,t.x),Ly(e.y,t.y)}function Dy(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function My(e,t,n,r,o){return e-=t,e=Dl(e,1/n,r),o!==void 0&&(e=Dl(e,1/o,r)),e}function tC(e,t=0,n=1,r=.5,o,a=e,l=e){if(Ln.test(t)&&(t=parseFloat(t),t=Ze(l.min,l.max,t/100)-l.min),typeof t!="number")return;let c=Ze(a.min,a.max,r);e===a&&(c-=t),e.min=My(e.min,t,n,c,o),e.max=My(e.max,t,n,c,o)}function Uy(e,t,[n,r,o],a,l){tC(e,t[n],t[r],t[o],t.scale,a,l)}const nC=["x","scaleX","originX"],rC=["y","scaleY","originY"];function zy(e,t,n,r){Uy(e.x,t,nC,n?n.x:void 0,r?r.x:void 0),Uy(e.y,t,rC,n?n.y:void 0,r?r.y:void 0)}function Fy(e){return e.translate===0&&e.scale===1}function Zx(e){return Fy(e.x)&&Fy(e.y)}function $y(e,t){return e.min===t.min&&e.max===t.max}function sC(e,t){return $y(e.x,t.x)&&$y(e.y,t.y)}function By(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ew(e,t){return By(e.x,t.x)&&By(e.y,t.y)}function Vy(e){return tn(e.x)/tn(e.y)}function qy(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class iC{constructor(){this.members=[]}add(t){sf(this.members,t),t.scheduleRender()}remove(t){if(of(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(o=>t===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const a=this.members[o];if(a.isPresent!==!1){r=a;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:o}=t.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function oC(e,t,n){let r="";const o=e.x.translate/t.x,a=e.y.translate/t.y,l=n?.z||0;if((o||a||l)&&(r=`translate3d(${o}px, ${a}px, ${l}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:f,rotate:p,rotateX:y,rotateY:v,skewX:w,skewY:b}=n;f&&(r=`perspective(${f}px) ${r}`),p&&(r+=`rotate(${p}deg) `),y&&(r+=`rotateX(${y}deg) `),v&&(r+=`rotateY(${v}deg) `),w&&(r+=`skewX(${w}deg) `),b&&(r+=`skewY(${b}deg) `)}const c=e.x.scale*t.x,d=e.y.scale*t.y;return(c!==1||d!==1)&&(r+=`scale(${c}, ${d})`),r||"none"}const Yr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},uo=typeof window<"u"&&window.MotionDebug!==void 0,cd=["","X","Y","Z"],aC={visibility:"hidden"},Hy=1e3;let lC=0;function dd(e,t,n,r){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function tw(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=ux(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ge,!(o||a))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&tw(r)}function nw({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(l={},c=t?.()){this.id=lC++,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,uo&&(Yr.totalNodes=Yr.resolvedTargetDeltas=Yr.recalculatedProjection=0),this.nodes.forEach(dC),this.nodes.forEach(gC),this.nodes.forEach(yC),this.nodes.forEach(hC),uo&&window.MotionDebug.record(Yr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new JT)}addEventListener(l,c){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new af),this.eventHandlers.get(l).add(c)}notifyListeners(l,...c){const d=this.eventHandlers.get(l);d&&d.notify(...c)}hasListeners(l){return this.eventHandlers.has(l)}mount(l,c=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=KT(l),this.instance=l;const{layoutId:d,layout:f,visualElement:p}=this.options;if(p&&!p.current&&p.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),c&&(f||d)&&(this.isLayoutDirty=!0),e){let y;const v=()=>this.root.updateBlockedByResize=!1;e(l,()=>{this.root.updateBlockedByResize=!0,y&&y(),y=YT(v,250),Sl.hasAnimatedSinceResize&&(Sl.hasAnimatedSinceResize=!1,this.nodes.forEach(Ky))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||f)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:v,hasRelativeTargetChanged:w,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||p.getDefaultTransition()||kC,{onLayoutAnimationStart:_,onLayoutAnimationComplete:E}=p.getProps(),P=!this.targetLayout||!ew(this.targetLayout,b)||w,j=!v&&w;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||j||v&&(P||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(y,j);const D={...ef(S,"layout"),onPlay:_,onComplete:E};(p.shouldReduceMotion||this.options.layoutRoot)&&(D.delay=0,D.type=!1),this.startAnimation(D)}else v||Ky(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,jr(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(vC),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&tw(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const y=this.path[p];y.shouldResetTransform=!0,y.updateScroll("snapshot"),y.options.layoutRoot&&y.willUpdate(!1)}const{layoutId:c,layout:d}=this.options;if(c===void 0&&!d)return;const f=this.getTransformTemplate();this.prevTransformTemplateValue=f?f(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Wy);return}this.isUpdating||this.nodes.forEach(pC),this.isUpdating=!1,this.nodes.forEach(mC),this.nodes.forEach(uC),this.nodes.forEach(cC),this.clearAllSnapshots();const c=Dn.now();kt.delta=Qn(0,1e3/60,c-kt.timestamp),kt.timestamp=c,kt.isProcessing=!0,td.update.process(kt),td.preRender.process(kt),td.render.process(kt),kt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,qh.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(fC),this.sharedNodes.forEach(xC)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ge.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ge.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 d=0;d<this.path.length;d++)this.path[d].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutCorrected=it(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(c=!1),c){const d=r(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:d,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!o)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!Zx(this.projectionDelta),d=this.getTransformTemplate(),f=d?d(this.latestValues,""):void 0,p=f!==this.prevTransformTemplateValue;l&&(c||Jr(this.latestValues)||p)&&(o(this.instance,f),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const c=this.measurePageBox();let d=this.removeElementScroll(c);return l&&(d=this.removeTransform(d)),SC(d),{animationId:this.root.animationId,measuredBox:c,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){var l;const{visualElement:c}=this.options;if(!c)return it();const d=c.measureViewportBox();if(!(((l=this.scroll)===null||l===void 0?void 0:l.wasRoot)||this.path.some(_C))){const{scroll:p}=this.root;p&&(Ys(d.x,p.offset.x),Ys(d.y,p.offset.y))}return d}removeElementScroll(l){var c;const d=it();if(cn(d,l),!((c=this.scroll)===null||c===void 0)&&c.wasRoot)return d;for(let f=0;f<this.path.length;f++){const p=this.path[f],{scroll:y,options:v}=p;p!==this.root&&y&&v.layoutScroll&&(y.wasRoot&&cn(d,l),Ys(d.x,y.offset.x),Ys(d.y,y.offset.y))}return d}applyTransform(l,c=!1){const d=it();cn(d,l);for(let f=0;f<this.path.length;f++){const p=this.path[f];!c&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Xs(d,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Jr(p.latestValues)&&Xs(d,p.latestValues)}return Jr(this.latestValues)&&Xs(d,this.latestValues),d}removeTransform(l){const c=it();cn(c,l);for(let d=0;d<this.path.length;d++){const f=this.path[d];if(!f.instance||!Jr(f.latestValues))continue;nh(f.latestValues)&&f.updateSnapshot();const p=it(),y=f.measurePageBox();cn(p,y),zy(c,f.latestValues,f.snapshot?f.snapshot.layoutBox:void 0,p)}return Jr(this.latestValues)&&zy(c,this.latestValues),c}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.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!==kt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){var c;const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const f=!!this.resumingFrom||this!==d;if(!(l||f&&this.isSharedProjectionDirty||this.isProjectionDirty||!((c=this.parent)===null||c===void 0)&&c.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:v}=this.options;if(!(!this.layout||!(y||v))){if(this.resolvedRelativeTargetAt=kt.timestamp,!this.targetDelta&&!this.relativeTarget){const w=this.getClosestProjectingParent();w&&w.layout&&this.animationProgress!==1?(this.relativeParent=w,this.forceRelativeParentToResolveTarget(),this.relativeTarget=it(),this.relativeTargetOrigin=it(),mo(this.relativeTargetOrigin,this.layout.layoutBox,w.layout.layoutBox),cn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=it(),this.targetWithTransforms=it()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),CT(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):cn(this.target,this.layout.layoutBox),Kx(this.target,this.targetDelta)):cn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const w=this.getClosestProjectingParent();w&&!!w.resumingFrom==!!this.resumingFrom&&!w.options.layoutScroll&&w.target&&this.animationProgress!==1?(this.relativeParent=w,this.forceRelativeParentToResolveTarget(),this.relativeTarget=it(),this.relativeTargetOrigin=it(),mo(this.relativeTargetOrigin,this.target,w.target),cn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}uo&&Yr.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||nh(this.parent.latestValues)||Wx(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 l;const c=this.getLead(),d=!!this.resumingFrom||this!==c;let f=!0;if((this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty)&&(f=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===kt.timestamp&&(f=!1),f)return;const{layout:p,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||y))return;cn(this.layoutCorrected,this.layout.layoutBox);const v=this.treeScale.x,w=this.treeScale.y;DT(this.layoutCorrected,this.treeScale,this.path,d),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=it());const{target:b}=c;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Dy(this.prevProjectionDelta.x,this.projectionDelta.x),Dy(this.prevProjectionDelta.y,this.projectionDelta.y)),po(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==v||this.treeScale.y!==w||!qy(this.projectionDelta.x,this.prevProjectionDelta.x)||!qy(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b)),uo&&Yr.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){var c;if((c=this.options.visualElement)===null||c===void 0||c.scheduleRender(),l){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Js(),this.projectionDelta=Js(),this.projectionDeltaWithTransform=Js()}setAnimationOrigin(l,c=!1){const d=this.snapshot,f=d?d.latestValues:{},p={...this.latestValues},y=Js();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const v=it(),w=d?d.source:void 0,b=this.layout?this.layout.source:void 0,S=w!==b,_=this.getStack(),E=!_||_.members.length<=1,P=!!(S&&!E&&this.options.crossfade===!0&&!this.path.some(bC));this.animationProgress=0;let j;this.mixTargetDelta=D=>{const $=D/1e3;Gy(y.x,l.x,$),Gy(y.y,l.y,$),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(mo(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox),wC(this.relativeTarget,this.relativeTargetOrigin,v,$),j&&sC(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=it()),cn(j,this.relativeTarget)),S&&(this.animationValues=p,QT(p,f,this.latestValues,$,P,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=$},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(jr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ge.update(()=>{Sl.hasAnimatedSinceResize=!0,this.currentAnimation=WT(0,Hy,{...l,onUpdate:c=>{this.mixTargetDelta(c),l.onUpdate&&l.onUpdate(c)},onComplete:()=>{l.onComplete&&l.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 l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Hy),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:c,target:d,layout:f,latestValues:p}=l;if(!(!c||!d||!f)){if(this!==l&&this.layout&&f&&rw(this.options.animationType,this.layout.layoutBox,f.layoutBox)){d=this.target||it();const y=tn(this.layout.layoutBox.x);d.x.min=l.target.x.min,d.x.max=d.x.min+y;const v=tn(this.layout.layoutBox.y);d.y.min=l.target.y.min,d.y.max=d.y.min+v}cn(c,d),Xs(c,p),po(this.projectionDeltaWithTransform,this.layoutCorrected,c,p)}}registerSharedNode(l,c){this.sharedNodes.has(l)||this.sharedNodes.set(l,new iC),this.sharedNodes.get(l).add(c);const f=c.options.initialPromotionConfig;c.promote({transition:f?f.transition:void 0,preserveFollowOpacity:f&&f.shouldPreserveFollowOpacity?f.shouldPreserveFollowOpacity(c):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){var l;const{layoutId:c}=this.options;return c?((l=this.getStack())===null||l===void 0?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:c}=this.options;return c?(l=this.getStack())===null||l===void 0?void 0:l.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:c,preserveFollowOpacity:d}={}){const f=this.getStack();f&&f.promote(this,d),l&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let c=!1;const{latestValues:d}=l;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(c=!0),!c)return;const f={};d.z&&dd("z",l,f,this.animationValues);for(let p=0;p<cd.length;p++)dd(`rotate${cd[p]}`,l,f,this.animationValues),dd(`skew${cd[p]}`,l,f,this.animationValues);l.render();for(const p in f)l.setStaticValue(p,f[p]),this.animationValues&&(this.animationValues[p]=f[p]);l.scheduleRender()}getProjectionStyles(l){var c,d;if(!this.instance||this.isSVG)return;if(!this.isVisible)return aC;const f={visibility:""},p=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,f.opacity="",f.pointerEvents=bl(l?.pointerEvents)||"",f.transform=p?p(this.latestValues,""):"none",f;const y=this.getLead();if(!this.projectionDelta||!this.layout||!y.target){const S={};return this.options.layoutId&&(S.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,S.pointerEvents=bl(l?.pointerEvents)||""),this.hasProjected&&!Jr(this.latestValues)&&(S.transform=p?p({},""):"none",this.hasProjected=!1),S}const v=y.animationValues||y.latestValues;this.applyTransformsToTarget(),f.transform=oC(this.projectionDeltaWithTransform,this.treeScale,v),p&&(f.transform=p(v,f.transform));const{x:w,y:b}=this.projectionDelta;f.transformOrigin=`${w.origin*100}% ${b.origin*100}% 0`,y.animationValues?f.opacity=y===this?(d=(c=v.opacity)!==null&&c!==void 0?c:this.latestValues.opacity)!==null&&d!==void 0?d:1:this.preserveOpacity?this.latestValues.opacity:v.opacityExit:f.opacity=y===this?v.opacity!==void 0?v.opacity:"":v.opacityExit!==void 0?v.opacityExit:0;for(const S in Nl){if(v[S]===void 0)continue;const{correct:_,applyTo:E}=Nl[S],P=f.transform==="none"?v[S]:_(v[S],y);if(E){const j=E.length;for(let D=0;D<j;D++)f[E[D]]=P}else f[S]=P}return this.options.layoutId&&(f.pointerEvents=y===this?bl(l?.pointerEvents)||"":"none"),f}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>{var c;return(c=l.currentAnimation)===null||c===void 0?void 0:c.stop()}),this.root.nodes.forEach(Wy),this.root.sharedNodes.clear()}}}function uC(e){e.updateLayout()}function cC(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:o}=e.layout,{animationType:a}=e.options,l=n.source!==e.layout.source;a==="size"?dn(y=>{const v=l?n.measuredBox[y]:n.layoutBox[y],w=tn(v);v.min=r[y].min,v.max=v.min+w}):rw(a,n.layoutBox,r)&&dn(y=>{const v=l?n.measuredBox[y]:n.layoutBox[y],w=tn(r[y]);v.max=v.min+w,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[y].max=e.relativeTarget[y].min+w)});const c=Js();po(c,r,n.layoutBox);const d=Js();l?po(d,e.applyTransform(o,!0),n.measuredBox):po(d,r,n.layoutBox);const f=!Zx(c);let p=!1;if(!e.resumeFrom){const y=e.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:v,layout:w}=y;if(v&&w){const b=it();mo(b,n.layoutBox,v.layoutBox);const S=it();mo(S,r,w.layoutBox),ew(b,S)||(p=!0),y.options.layoutRoot&&(e.relativeTarget=S,e.relativeTargetOrigin=b,e.relativeParent=y)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:d,layoutDelta:c,hasLayoutChanged:f,hasRelativeTargetChanged:p})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function dC(e){uo&&Yr.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function hC(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function fC(e){e.clearSnapshot()}function Wy(e){e.clearMeasurements()}function pC(e){e.isLayoutDirty=!1}function mC(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ky(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function gC(e){e.resolveTargetDelta()}function yC(e){e.calcProjection()}function vC(e){e.resetSkewAndRotation()}function xC(e){e.removeLeadSnapshot()}function Gy(e,t,n){e.translate=Ze(t.translate,0,n),e.scale=Ze(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Jy(e,t,n,r){e.min=Ze(t.min,n.min,r),e.max=Ze(t.max,n.max,r)}function wC(e,t,n,r){Jy(e.x,t.x,n.x,r),Jy(e.y,t.y,n.y,r)}function bC(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const kC={duration:.45,ease:[.4,0,.1,1]},Yy=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Xy=Yy("applewebkit/")&&!Yy("chrome/")?Math.round:en;function Qy(e){e.min=Xy(e.min),e.max=Xy(e.max)}function SC(e){Qy(e.x),Qy(e.y)}function rw(e,t,n){return e==="position"||e==="preserve-aspect"&&!TT(Vy(t),Vy(n),.2)}function _C(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const EC=nw({attachResizeListener:(e,t)=>jo(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),hd={current:void 0},sw=nw({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!hd.current){const e=new EC({});e.mount(window),e.setOptions({layoutScroll:!0}),hd.current=e}return hd.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),TC={pan:{Feature:BT},drag:{Feature:$T,ProjectionNode:sw,MeasureLayout:Yx}};function Zy(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,a=r[o];a&&Ge.postRender(()=>a(t,$o(t)))}class CC extends Pr{mount(){const{current:t}=this.node;t&&(this.unmount=T_(t,n=>(Zy(this.node,n,"Start"),r=>Zy(this.node,r,"End"))))}unmount(){}}class jC extends Pr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Fo(jo(this.node.current,"focus",()=>this.onFocus()),jo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function e0(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),a=r[o];a&&Ge.postRender(()=>a(t,$o(t)))}class AC extends Pr{mount(){const{current:t}=this.node;t&&(this.unmount=P_(t,n=>(e0(this.node,n,"Start"),(r,{success:o})=>e0(this.node,r,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const sh=new WeakMap,fd=new WeakMap,PC=e=>{const t=sh.get(e.target);t&&t(e)},NC=e=>{e.forEach(PC)};function RC({root:e,...t}){const n=e||document;fd.has(n)||fd.set(n,{});const r=fd.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(NC,{root:e,...t})),r[o]}function OC(e,t,n){const r=RC(t);return sh.set(e,n),r.observe(e),()=>{sh.delete(e),r.unobserve(e)}}const IC={some:0,all:1};class LC extends Pr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:a}=t,l={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:IC[o]},c=d=>{const{isIntersecting:f}=d;if(this.isInView===f||(this.isInView=f,a&&!f&&this.hasEnteredView))return;f&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",f);const{onViewportEnter:p,onViewportLeave:y}=this.node.getProps(),v=f?p:y;v&&v(d)};return OC(this.node.current,l,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(DC(t,n))&&this.startObserver()}unmount(){}}function DC({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const MC={inView:{Feature:LC},tap:{Feature:AC},focus:{Feature:jC},hover:{Feature:CC}},UC={layout:{ProjectionNode:sw,MeasureLayout:Yx}},ih={current:null},iw={current:!1};function zC(){if(iw.current=!0,!!zh)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>ih.current=e.matches;e.addListener(t),t()}else ih.current=!1}const FC=[...Px,Ct,Ar],$C=e=>FC.find(Ax(e)),t0=new WeakMap;function BC(e,t,n){for(const r in t){const o=t[r],a=n[r];if(At(o))e.addValue(r,o);else if(At(a))e.addValue(r,To(o,{owner:e}));else if(a!==o)if(e.hasValue(r)){const l=e.getValue(r);l.liveStyle===!0?l.jump(o):l.hasAnimated||l.set(o)}else{const l=e.getStaticValue(r);e.addValue(r,To(l!==void 0?l:o,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const n0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class VC{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:a,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ff,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 w=Dn.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,Ge.render(this.render,!1,!0))};const{latestValues:d,renderState:f,onUpdate:p}=l;this.onUpdate=p,this.latestValues=d,this.baseTarget={...d},this.initialValues=n.initial?{...d}:{},this.renderState=f,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.options=c,this.blockInitialAnimation=!!a,this.isControllingVariants=Jl(n),this.isVariantNode=Uv(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:y,...v}=this.scrapeMotionValuesFromProps(n,{},this);for(const w in v){const b=v[w];d[w]!==void 0&&At(b)&&b.set(d[w],!1)}}mount(t){this.current=t,t0.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),iw.current||zC(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:ih.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){t0.delete(this.current),this.projection&&this.projection.unmount(),jr(this.notifyUpdate),jr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=as.has(t),o=n.on("change",c=>{this.latestValues[t]=c,this.props.onUpdate&&Ge.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),a=n.on("renderRequest",this.scheduleRender);let l;window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{o(),a(),l&&l(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in si){const n=si[t];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[t]&&o&&r(this.props)&&(this.features[t]=new o(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):it()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<n0.length;r++){const o=n0[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const a="on"+o,l=t[a];l&&(this.propEventSubscriptions[o]=this.on(o,l))}this.prevMotionValues=BC(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]: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(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=To(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let o=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return o!=null&&(typeof o=="string"&&(Cx(o)||vx(o))?o=parseFloat(o):!$C(o)&&Ar.test(n)&&(o=_x(t,n)),this.setBaseTarget(t,At(o)?o.get():o)),At(o)?o.get():o}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let o;if(typeof r=="string"||typeof r=="object"){const l=Wh(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);l&&(o=l[t])}if(r&&o!==void 0)return o;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!At(a)?a:this.initialValues[t]!==void 0&&o===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new af),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class ow extends VC{constructor(){super(...arguments),this.KeyframeResolver=Nx}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;At(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function qC(e){return window.getComputedStyle(e)}class HC extends ow{constructor(){super(...arguments),this.type="html",this.renderInstance=Kv}readValueFromInstance(t,n){if(as.has(n)){const r=hf(n);return r&&r.default||0}else{const r=qC(t),o=(qv(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Gx(t,n)}build(t,n,r){Jh(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Zh(t,n,r)}}class WC extends ow{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=it}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(as.has(n)){const r=hf(n);return r&&r.default||0}return n=Gv.has(n)?n:Vh(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Xv(t,n,r)}build(t,n,r){Yh(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,o){Jv(t,n,r,o)}mount(t){this.isSVGTag=Qh(t.tagName),super.mount(t)}}const KC=(e,t)=>Hh(e)?new WC(t):new HC(t,{allowProjection:e!==L.Fragment}),GC=x_({...yT,...MC,...TC,...UC},KC),ze=IS(GC);function aw(e,t){return function(){return e.apply(t,arguments)}}const{toString:JC}=Object.prototype,{getPrototypeOf:yf}=Object,{iterator:Ql,toStringTag:lw}=Symbol,Zl=(e=>t=>{const n=JC.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),En=e=>(e=e.toLowerCase(),t=>Zl(t)===e),eu=e=>t=>typeof t===e,{isArray:ui}=Array,oi=eu("undefined");function Bo(e){return e!==null&&!oi(e)&&e.constructor!==null&&!oi(e.constructor)&&Ft(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const uw=En("ArrayBuffer");function YC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&uw(e.buffer),t}const XC=eu("string"),Ft=eu("function"),cw=eu("number"),Vo=e=>e!==null&&typeof e=="object",QC=e=>e===!0||e===!1,_l=e=>{if(Zl(e)!=="object")return!1;const t=yf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(lw in e)&&!(Ql in e)},ZC=e=>{if(!Vo(e)||Bo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},e2=En("Date"),t2=En("File"),n2=En("Blob"),r2=En("FileList"),s2=e=>Vo(e)&&Ft(e.pipe),i2=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ft(e.append)&&((t=Zl(e))==="formdata"||t==="object"&&Ft(e.toString)&&e.toString()==="[object FormData]"))},o2=En("URLSearchParams"),[a2,l2,u2,c2]=["ReadableStream","Request","Response","Headers"].map(En),d2=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qo(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!="object"&&(e=[e]),ui(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Bo(e))return;const a=n?Object.getOwnPropertyNames(e):Object.keys(e),l=a.length;let c;for(r=0;r<l;r++)c=a[r],t.call(null,e[c],c,e)}}function dw(e,t){if(Bo(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,o;for(;r-- >0;)if(o=n[r],t===o.toLowerCase())return o;return null}const ts=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,hw=e=>!oi(e)&&e!==ts;function oh(){const{caseless:e,skipUndefined:t}=hw(this)&&this||{},n={},r=(o,a)=>{const l=e&&dw(n,a)||a;_l(n[l])&&_l(o)?n[l]=oh(n[l],o):_l(o)?n[l]=oh({},o):ui(o)?n[l]=o.slice():(!t||!oi(o))&&(n[l]=o)};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&qo(arguments[o],r);return n}const h2=(e,t,n,{allOwnKeys:r}={})=>(qo(t,(o,a)=>{n&&Ft(o)?e[a]=aw(o,n):e[a]=o},{allOwnKeys:r}),e),f2=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),p2=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},m2=(e,t,n,r)=>{let o,a,l;const c={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)l=o[a],(!r||r(l,e,t))&&!c[l]&&(t[l]=e[l],c[l]=!0);e=n!==!1&&yf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},g2=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},y2=e=>{if(!e)return null;if(ui(e))return e;let t=e.length;if(!cw(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},v2=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&yf(Uint8Array)),x2=(e,t)=>{const r=(e&&e[Ql]).call(e);let o;for(;(o=r.next())&&!o.done;){const a=o.value;t.call(e,a[0],a[1])}},w2=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},b2=En("HTMLFormElement"),k2=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),r0=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),S2=En("RegExp"),fw=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};qo(n,(o,a)=>{let l;(l=t(o,a,e))!==!1&&(r[a]=l||o)}),Object.defineProperties(e,r)},_2=e=>{fw(e,(t,n)=>{if(Ft(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Ft(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},E2=(e,t)=>{const n={},r=o=>{o.forEach(a=>{n[a]=!0})};return ui(e)?r(e):r(String(e).split(t)),n},T2=()=>{},C2=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function j2(e){return!!(e&&Ft(e.append)&&e[lw]==="FormData"&&e[Ql])}const A2=e=>{const t=new Array(10),n=(r,o)=>{if(Vo(r)){if(t.indexOf(r)>=0)return;if(Bo(r))return r;if(!("toJSON"in r)){t[o]=r;const a=ui(r)?[]:{};return qo(r,(l,c)=>{const d=n(l,o+1);!oi(d)&&(a[c]=d)}),t[o]=void 0,a}}return r};return n(e,0)},P2=En("AsyncFunction"),N2=e=>e&&(Vo(e)||Ft(e))&&Ft(e.then)&&Ft(e.catch),pw=((e,t)=>e?setImmediate:t?((n,r)=>(ts.addEventListener("message",({source:o,data:a})=>{o===ts&&a===n&&r.length&&r.shift()()},!1),o=>{r.push(o),ts.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ft(ts.postMessage)),R2=typeof queueMicrotask<"u"?queueMicrotask.bind(ts):typeof process<"u"&&process.nextTick||pw,O2=e=>e!=null&&Ft(e[Ql]),B={isArray:ui,isArrayBuffer:uw,isBuffer:Bo,isFormData:i2,isArrayBufferView:YC,isString:XC,isNumber:cw,isBoolean:QC,isObject:Vo,isPlainObject:_l,isEmptyObject:ZC,isReadableStream:a2,isRequest:l2,isResponse:u2,isHeaders:c2,isUndefined:oi,isDate:e2,isFile:t2,isBlob:n2,isRegExp:S2,isFunction:Ft,isStream:s2,isURLSearchParams:o2,isTypedArray:v2,isFileList:r2,forEach:qo,merge:oh,extend:h2,trim:d2,stripBOM:f2,inherits:p2,toFlatObject:m2,kindOf:Zl,kindOfTest:En,endsWith:g2,toArray:y2,forEachEntry:x2,matchAll:w2,isHTMLForm:b2,hasOwnProperty:r0,hasOwnProp:r0,reduceDescriptors:fw,freezeMethods:_2,toObjectSet:E2,toCamelCase:k2,noop:T2,toFiniteNumber:C2,findKey:dw,global:ts,isContextDefined:hw,isSpecCompliantForm:j2,toJSONObject:A2,isAsyncFn:P2,isThenable:N2,setImmediate:pw,asap:R2,isIterable:O2};function Pe(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}B.inherits(Pe,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:B.toJSONObject(this.config),code:this.code,status:this.status}}});const mw=Pe.prototype,gw={};["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(e=>{gw[e]={value:e}});Object.defineProperties(Pe,gw);Object.defineProperty(mw,"isAxiosError",{value:!0});Pe.from=(e,t,n,r,o,a)=>{const l=Object.create(mw);B.toFlatObject(e,l,function(p){return p!==Error.prototype},f=>f!=="isAxiosError");const c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return Pe.call(l,c,d,n,r,o),e&&l.cause==null&&Object.defineProperty(l,"cause",{value:e,configurable:!0}),l.name=e&&e.name||"Error",a&&Object.assign(l,a),l};const I2=null;function ah(e){return B.isPlainObject(e)||B.isArray(e)}function yw(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function s0(e,t,n){return e?e.concat(t).map(function(o,a){return o=yw(o),!n&&a?"["+o+"]":o}).join(n?".":""):t}function L2(e){return B.isArray(e)&&!e.some(ah)}const D2=B.toFlatObject(B,{},null,function(t){return/^is[A-Z]/.test(t)});function tu(e,t,n){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=B.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,_){return!B.isUndefined(_[S])});const r=n.metaTokens,o=n.visitor||p,a=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(o))throw new TypeError("visitor must be a function");function f(b){if(b===null)return"";if(B.isDate(b))return b.toISOString();if(B.isBoolean(b))return b.toString();if(!d&&B.isBlob(b))throw new Pe("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(b)||B.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function p(b,S,_){let E=b;if(b&&!_&&typeof b=="object"){if(B.endsWith(S,"{}"))S=r?S:S.slice(0,-2),b=JSON.stringify(b);else if(B.isArray(b)&&L2(b)||(B.isFileList(b)||B.endsWith(S,"[]"))&&(E=B.toArray(b)))return S=yw(S),E.forEach(function(j,D){!(B.isUndefined(j)||j===null)&&t.append(l===!0?s0([S],D,a):l===null?S:S+"[]",f(j))}),!1}return ah(b)?!0:(t.append(s0(_,S,a),f(b)),!1)}const y=[],v=Object.assign(D2,{defaultVisitor:p,convertValue:f,isVisitable:ah});function w(b,S){if(!B.isUndefined(b)){if(y.indexOf(b)!==-1)throw Error("Circular reference detected in "+S.join("."));y.push(b),B.forEach(b,function(E,P){(!(B.isUndefined(E)||E===null)&&o.call(t,E,B.isString(P)?P.trim():P,S,v))===!0&&w(E,S?S.concat(P):[P])}),y.pop()}}if(!B.isObject(e))throw new TypeError("data must be an object");return w(e),t}function i0(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function vf(e,t){this._pairs=[],e&&tu(e,this,t)}const vw=vf.prototype;vw.append=function(t,n){this._pairs.push([t,n])};vw.toString=function(t){const n=t?function(r){return t.call(this,r,i0)}:i0;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function M2(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xw(e,t,n){if(!t)return e;const r=n&&n.encode||M2;B.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let a;if(o?a=o(t,n):a=B.isURLSearchParams(t)?t.toString():new vf(t,n).toString(r),a){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}class o0{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){B.forEach(this.handlers,function(r){r!==null&&t(r)})}}const ww={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},U2=typeof URLSearchParams<"u"?URLSearchParams:vf,z2=typeof FormData<"u"?FormData:null,F2=typeof Blob<"u"?Blob:null,$2={isBrowser:!0,classes:{URLSearchParams:U2,FormData:z2,Blob:F2},protocols:["http","https","file","blob","url","data"]},xf=typeof window<"u"&&typeof document<"u",lh=typeof navigator=="object"&&navigator||void 0,B2=xf&&(!lh||["ReactNative","NativeScript","NS"].indexOf(lh.product)<0),V2=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",q2=xf&&window.location.href||"http://localhost",H2=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:xf,hasStandardBrowserEnv:B2,hasStandardBrowserWebWorkerEnv:V2,navigator:lh,origin:q2},Symbol.toStringTag,{value:"Module"})),jt={...H2,...$2};function W2(e,t){return tu(e,new jt.classes.URLSearchParams,{visitor:function(n,r,o,a){return jt.isNode&&B.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function K2(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function G2(e){const t={},n=Object.keys(e);let r;const o=n.length;let a;for(r=0;r<o;r++)a=n[r],t[a]=e[a];return t}function bw(e){function t(n,r,o,a){let l=n[a++];if(l==="__proto__")return!0;const c=Number.isFinite(+l),d=a>=n.length;return l=!l&&B.isArray(o)?o.length:l,d?(B.hasOwnProp(o,l)?o[l]=[o[l],r]:o[l]=r,!c):((!o[l]||!B.isObject(o[l]))&&(o[l]=[]),t(n,r,o[l],a)&&B.isArray(o[l])&&(o[l]=G2(o[l])),!c)}if(B.isFormData(e)&&B.isFunction(e.entries)){const n={};return B.forEachEntry(e,(r,o)=>{t(K2(r),o,n,0)}),n}return null}function J2(e,t,n){if(B.isString(e))try{return(t||JSON.parse)(e),B.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ho={transitional:ww,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,a=B.isObject(t);if(a&&B.isHTMLForm(t)&&(t=new FormData(t)),B.isFormData(t))return o?JSON.stringify(bw(t)):t;if(B.isArrayBuffer(t)||B.isBuffer(t)||B.isStream(t)||B.isFile(t)||B.isBlob(t)||B.isReadableStream(t))return t;if(B.isArrayBufferView(t))return t.buffer;if(B.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return W2(t,this.formSerializer).toString();if((c=B.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return tu(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||o?(n.setContentType("application/json",!1),J2(t)):t}],transformResponse:[function(t){const n=this.transitional||Ho.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(B.isResponse(t)||B.isReadableStream(t))return t;if(t&&B.isString(t)&&(r&&!this.responseType||o)){const l=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?Pe.from(c,Pe.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jt.classes.FormData,Blob:jt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],e=>{Ho.headers[e]={}});const Y2=B.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"]),X2=e=>{const t={};let n,r,o;return e&&e.split(`
|
|
17
|
+
`).forEach(function(l){o=l.indexOf(":"),n=l.substring(0,o).trim().toLowerCase(),r=l.substring(o+1).trim(),!(!n||t[n]&&Y2[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},a0=Symbol("internals");function to(e){return e&&String(e).trim().toLowerCase()}function El(e){return e===!1||e==null?e:B.isArray(e)?e.map(El):String(e)}function Q2(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Z2=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function pd(e,t,n,r,o){if(B.isFunction(r))return r.call(this,t,n);if(o&&(t=n),!!B.isString(t)){if(B.isString(r))return t.indexOf(r)!==-1;if(B.isRegExp(r))return r.test(t)}}function ej(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function tj(e,t){const n=B.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(o,a,l){return this[r].call(this,t,o,a,l)},configurable:!0})})}let $t=class{constructor(t){t&&this.set(t)}set(t,n,r){const o=this;function a(c,d,f){const p=to(d);if(!p)throw new Error("header name must be a non-empty string");const y=B.findKey(o,p);(!y||o[y]===void 0||f===!0||f===void 0&&o[y]!==!1)&&(o[y||d]=El(c))}const l=(c,d)=>B.forEach(c,(f,p)=>a(f,p,d));if(B.isPlainObject(t)||t instanceof this.constructor)l(t,n);else if(B.isString(t)&&(t=t.trim())&&!Z2(t))l(X2(t),n);else if(B.isObject(t)&&B.isIterable(t)){let c={},d,f;for(const p of t){if(!B.isArray(p))throw TypeError("Object iterator must return a key-value pair");c[f=p[0]]=(d=c[f])?B.isArray(d)?[...d,p[1]]:[d,p[1]]:p[1]}l(c,n)}else t!=null&&a(n,t,r);return this}get(t,n){if(t=to(t),t){const r=B.findKey(this,t);if(r){const o=this[r];if(!n)return o;if(n===!0)return Q2(o);if(B.isFunction(n))return n.call(this,o,r);if(B.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=to(t),t){const r=B.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||pd(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let o=!1;function a(l){if(l=to(l),l){const c=B.findKey(r,l);c&&(!n||pd(r,r[c],c,n))&&(delete r[c],o=!0)}}return B.isArray(t)?t.forEach(a):a(t),o}clear(t){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const a=n[r];(!t||pd(this,this[a],a,t,!0))&&(delete this[a],o=!0)}return o}normalize(t){const n=this,r={};return B.forEach(this,(o,a)=>{const l=B.findKey(r,a);if(l){n[l]=El(o),delete n[a];return}const c=t?ej(a):String(a).trim();c!==a&&delete n[a],n[c]=El(o),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return B.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=t&&B.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
18
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[a0]=this[a0]={accessors:{}}).accessors,o=this.prototype;function a(l){const c=to(l);r[c]||(tj(o,l),r[c]=!0)}return B.isArray(t)?t.forEach(a):a(t),this}};$t.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);B.reduceDescriptors($t.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});B.freezeMethods($t);function md(e,t){const n=this||Ho,r=t||n,o=$t.from(r.headers);let a=r.data;return B.forEach(e,function(c){a=c.call(n,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function kw(e){return!!(e&&e.__CANCEL__)}function ci(e,t,n){Pe.call(this,e??"canceled",Pe.ERR_CANCELED,t,n),this.name="CanceledError"}B.inherits(ci,Pe,{__CANCEL__:!0});function Sw(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Pe("Request failed with status code "+n.status,[Pe.ERR_BAD_REQUEST,Pe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function nj(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function rj(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,a=0,l;return t=t!==void 0?t:1e3,function(d){const f=Date.now(),p=r[a];l||(l=f),n[o]=d,r[o]=f;let y=a,v=0;for(;y!==o;)v+=n[y++],y=y%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),f-l<t)return;const w=p&&f-p;return w?Math.round(v*1e3/w):void 0}}function sj(e,t){let n=0,r=1e3/t,o,a;const l=(f,p=Date.now())=>{n=p,o=null,a&&(clearTimeout(a),a=null),e(...f)};return[(...f)=>{const p=Date.now(),y=p-n;y>=r?l(f,p):(o=f,a||(a=setTimeout(()=>{a=null,l(o)},r-y)))},()=>o&&l(o)]}const Ml=(e,t,n=3)=>{let r=0;const o=rj(50,250);return sj(a=>{const l=a.loaded,c=a.lengthComputable?a.total:void 0,d=l-r,f=o(d),p=l<=c;r=l;const y={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:f||void 0,estimated:f&&c&&p?(c-l)/f:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(y)},n)},l0=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},u0=e=>(...t)=>B.asap(()=>e(...t)),ij=jt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,jt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(jt.origin),jt.navigator&&/(msie|trident)/i.test(jt.navigator.userAgent)):()=>!0,oj=jt.hasStandardBrowserEnv?{write(e,t,n,r,o,a,l){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];B.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),B.isString(r)&&c.push(`path=${r}`),B.isString(o)&&c.push(`domain=${o}`),a===!0&&c.push("secure"),B.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function aj(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lj(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function _w(e,t,n){let r=!aj(t);return e&&(r||n==!1)?lj(e,t):t}const c0=e=>e instanceof $t?{...e}:e;function os(e,t){t=t||{};const n={};function r(f,p,y,v){return B.isPlainObject(f)&&B.isPlainObject(p)?B.merge.call({caseless:v},f,p):B.isPlainObject(p)?B.merge({},p):B.isArray(p)?p.slice():p}function o(f,p,y,v){if(B.isUndefined(p)){if(!B.isUndefined(f))return r(void 0,f,y,v)}else return r(f,p,y,v)}function a(f,p){if(!B.isUndefined(p))return r(void 0,p)}function l(f,p){if(B.isUndefined(p)){if(!B.isUndefined(f))return r(void 0,f)}else return r(void 0,p)}function c(f,p,y){if(y in t)return r(f,p);if(y in e)return r(void 0,f)}const d={url:a,method:a,data:a,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(f,p,y)=>o(c0(f),c0(p),y,!0)};return B.forEach(Object.keys({...e,...t}),function(p){const y=d[p]||o,v=y(e[p],t[p],p);B.isUndefined(v)&&y!==c||(n[p]=v)}),n}const Ew=e=>{const t=os({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:a,headers:l,auth:c}=t;if(t.headers=l=$t.from(l),t.url=xw(_w(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),B.isFormData(n)){if(jt.hasStandardBrowserEnv||jt.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(B.isFunction(n.getHeaders)){const d=n.getHeaders(),f=["content-type","content-length"];Object.entries(d).forEach(([p,y])=>{f.includes(p.toLowerCase())&&l.set(p,y)})}}if(jt.hasStandardBrowserEnv&&(r&&B.isFunction(r)&&(r=r(t)),r||r!==!1&&ij(t.url))){const d=o&&a&&oj.read(a);d&&l.set(o,d)}return t},uj=typeof XMLHttpRequest<"u",cj=uj&&function(e){return new Promise(function(n,r){const o=Ew(e);let a=o.data;const l=$t.from(o.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:f}=o,p,y,v,w,b;function S(){w&&w(),b&&b(),o.cancelToken&&o.cancelToken.unsubscribe(p),o.signal&&o.signal.removeEventListener("abort",p)}let _=new XMLHttpRequest;_.open(o.method.toUpperCase(),o.url,!0),_.timeout=o.timeout;function E(){if(!_)return;const j=$t.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),$={data:!c||c==="text"||c==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:j,config:e,request:_};Sw(function(z){n(z),S()},function(z){r(z),S()},$),_=null}"onloadend"in _?_.onloadend=E:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0)||setTimeout(E)},_.onabort=function(){_&&(r(new Pe("Request aborted",Pe.ECONNABORTED,e,_)),_=null)},_.onerror=function(D){const $=D&&D.message?D.message:"Network Error",O=new Pe($,Pe.ERR_NETWORK,e,_);O.event=D||null,r(O),_=null},_.ontimeout=function(){let D=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const $=o.transitional||ww;o.timeoutErrorMessage&&(D=o.timeoutErrorMessage),r(new Pe(D,$.clarifyTimeoutError?Pe.ETIMEDOUT:Pe.ECONNABORTED,e,_)),_=null},a===void 0&&l.setContentType(null),"setRequestHeader"in _&&B.forEach(l.toJSON(),function(D,$){_.setRequestHeader($,D)}),B.isUndefined(o.withCredentials)||(_.withCredentials=!!o.withCredentials),c&&c!=="json"&&(_.responseType=o.responseType),f&&([v,b]=Ml(f,!0),_.addEventListener("progress",v)),d&&_.upload&&([y,w]=Ml(d),_.upload.addEventListener("progress",y),_.upload.addEventListener("loadend",w)),(o.cancelToken||o.signal)&&(p=j=>{_&&(r(!j||j.type?new ci(null,e,_):j),_.abort(),_=null)},o.cancelToken&&o.cancelToken.subscribe(p),o.signal&&(o.signal.aborted?p():o.signal.addEventListener("abort",p)));const P=nj(o.url);if(P&&jt.protocols.indexOf(P)===-1){r(new Pe("Unsupported protocol "+P+":",Pe.ERR_BAD_REQUEST,e));return}_.send(a||null)})},dj=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const a=function(f){if(!o){o=!0,c();const p=f instanceof Error?f:this.reason;r.abort(p instanceof Pe?p:new ci(p instanceof Error?p.message:p))}};let l=t&&setTimeout(()=>{l=null,a(new Pe(`timeout ${t} of ms exceeded`,Pe.ETIMEDOUT))},t);const c=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(a):f.removeEventListener("abort",a)}),e=null)};e.forEach(f=>f.addEventListener("abort",a));const{signal:d}=r;return d.unsubscribe=()=>B.asap(c),d}},hj=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},fj=async function*(e,t){for await(const n of pj(e))yield*hj(n,t)},pj=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},d0=(e,t,n,r)=>{const o=fj(e,t);let a=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:f,value:p}=await o.next();if(f){c(),d.close();return}let y=p.byteLength;if(n){let v=a+=y;n(v)}d.enqueue(new Uint8Array(p))}catch(f){throw c(f),f}},cancel(d){return c(d),o.return()}},{highWaterMark:2})},h0=64*1024,{isFunction:hl}=B,mj=(({Request:e,Response:t})=>({Request:e,Response:t}))(B.global),{ReadableStream:f0,TextEncoder:p0}=B.global,m0=(e,...t)=>{try{return!!e(...t)}catch{return!1}},gj=e=>{e=B.merge.call({skipUndefined:!0},mj,e);const{fetch:t,Request:n,Response:r}=e,o=t?hl(t):typeof fetch=="function",a=hl(n),l=hl(r);if(!o)return!1;const c=o&&hl(f0),d=o&&(typeof p0=="function"?(b=>S=>b.encode(S))(new p0):async b=>new Uint8Array(await new n(b).arrayBuffer())),f=a&&c&&m0(()=>{let b=!1;const S=new n(jt.origin,{body:new f0,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!S}),p=l&&c&&m0(()=>B.isReadableStream(new r("").body)),y={stream:p&&(b=>b.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!y[b]&&(y[b]=(S,_)=>{let E=S&&S[b];if(E)return E.call(S);throw new Pe(`Response type '${b}' is not supported`,Pe.ERR_NOT_SUPPORT,_)})});const v=async b=>{if(b==null)return 0;if(B.isBlob(b))return b.size;if(B.isSpecCompliantForm(b))return(await new n(jt.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(B.isArrayBufferView(b)||B.isArrayBuffer(b))return b.byteLength;if(B.isURLSearchParams(b)&&(b=b+""),B.isString(b))return(await d(b)).byteLength},w=async(b,S)=>{const _=B.toFiniteNumber(b.getContentLength());return _??v(S)};return async b=>{let{url:S,method:_,data:E,signal:P,cancelToken:j,timeout:D,onDownloadProgress:$,onUploadProgress:O,responseType:z,headers:q,withCredentials:J="same-origin",fetchOptions:ie}=Ew(b),re=t||fetch;z=z?(z+"").toLowerCase():"text";let Q=dj([P,j&&j.toAbortSignal()],D),ye=null;const ne=Q&&Q.unsubscribe&&(()=>{Q.unsubscribe()});let Z;try{if(O&&f&&_!=="get"&&_!=="head"&&(Z=await w(q,E))!==0){let N=new n(S,{method:"POST",body:E,duplex:"half"}),V;if(B.isFormData(E)&&(V=N.headers.get("content-type"))&&q.setContentType(V),N.body){const[C,X]=l0(Z,Ml(u0(O)));E=d0(N.body,h0,C,X)}}B.isString(J)||(J=J?"include":"omit");const fe=a&&"credentials"in n.prototype,le={...ie,signal:Q,method:_.toUpperCase(),headers:q.normalize().toJSON(),body:E,duplex:"half",credentials:fe?J:void 0};ye=a&&new n(S,le);let H=await(a?re(ye,ie):re(S,le));const oe=p&&(z==="stream"||z==="response");if(p&&($||oe&&ne)){const N={};["status","statusText","headers"].forEach(ve=>{N[ve]=H[ve]});const V=B.toFiniteNumber(H.headers.get("content-length")),[C,X]=$&&l0(V,Ml(u0($),!0))||[];H=new r(d0(H.body,h0,C,()=>{X&&X(),ne&&ne()}),N)}z=z||"text";let T=await y[B.findKey(y,z)||"text"](H,b);return!oe&&ne&&ne(),await new Promise((N,V)=>{Sw(N,V,{data:T,headers:$t.from(H.headers),status:H.status,statusText:H.statusText,config:b,request:ye})})}catch(fe){throw ne&&ne(),fe&&fe.name==="TypeError"&&/Load failed|fetch/i.test(fe.message)?Object.assign(new Pe("Network Error",Pe.ERR_NETWORK,b,ye),{cause:fe.cause||fe}):Pe.from(fe,fe&&fe.code,b,ye)}}},yj=new Map,Tw=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,a=[r,o,n];let l=a.length,c=l,d,f,p=yj;for(;c--;)d=a[c],f=p.get(d),f===void 0&&p.set(d,f=c?new Map:gj(t)),p=f;return f};Tw();const wf={http:I2,xhr:cj,fetch:{get:Tw}};B.forEach(wf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const g0=e=>`- ${e}`,vj=e=>B.isFunction(e)||e===null||e===!1;function xj(e,t){e=B.isArray(e)?e:[e];const{length:n}=e;let r,o;const a={};for(let l=0;l<n;l++){r=e[l];let c;if(o=r,!vj(r)&&(o=wf[(c=String(r)).toLowerCase()],o===void 0))throw new Pe(`Unknown adapter '${c}'`);if(o&&(B.isFunction(o)||(o=o.get(t))))break;a[c||"#"+l]=o}if(!o){const l=Object.entries(a).map(([d,f])=>`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since :
|
|
19
|
+
`+l.map(g0).join(`
|
|
20
|
+
`):" "+g0(l[0]):"as no adapter specified";throw new Pe("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return o}const Cw={getAdapter:xj,adapters:wf};function gd(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ci(null,e)}function y0(e){return gd(e),e.headers=$t.from(e.headers),e.data=md.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Cw.getAdapter(e.adapter||Ho.adapter,e)(e).then(function(r){return gd(e),r.data=md.call(e,e.transformResponse,r),r.headers=$t.from(r.headers),r},function(r){return kw(r)||(gd(e),r&&r.response&&(r.response.data=md.call(e,e.transformResponse,r.response),r.response.headers=$t.from(r.response.headers))),Promise.reject(r)})}const jw="1.13.2",nu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{nu[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const v0={};nu.transitional=function(t,n,r){function o(a,l){return"[Axios v"+jw+"] Transitional option '"+a+"'"+l+(r?". "+r:"")}return(a,l,c)=>{if(t===!1)throw new Pe(o(l," has been removed"+(n?" in "+n:"")),Pe.ERR_DEPRECATED);return n&&!v0[l]&&(v0[l]=!0,console.warn(o(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,l,c):!0}};nu.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function wj(e,t,n){if(typeof e!="object")throw new Pe("options must be an object",Pe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const a=r[o],l=t[a];if(l){const c=e[a],d=c===void 0||l(c,a,e);if(d!==!0)throw new Pe("option "+a+" must be "+d,Pe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Pe("Unknown option "+a,Pe.ERR_BAD_OPTION)}}const Tl={assertOptions:wj,validators:nu},Rn=Tl.validators;let ss=class{constructor(t){this.defaults=t||{},this.interceptors={request:new o0,response:new o0}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const a=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
21
|
+
`+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=os(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&Tl.assertOptions(r,{silentJSONParsing:Rn.transitional(Rn.boolean),forcedJSONParsing:Rn.transitional(Rn.boolean),clarifyTimeoutError:Rn.transitional(Rn.boolean)},!1),o!=null&&(B.isFunction(o)?n.paramsSerializer={serialize:o}:Tl.assertOptions(o,{encode:Rn.function,serialize:Rn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Tl.assertOptions(n,{baseUrl:Rn.spelling("baseURL"),withXsrfToken:Rn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=a&&B.merge(a.common,a[n.method]);a&&B.forEach(["delete","get","head","post","put","patch","common"],b=>{delete a[b]}),n.headers=$t.concat(l,a);const c=[];let d=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(n)===!1||(d=d&&S.synchronous,c.unshift(S.fulfilled,S.rejected))});const f=[];this.interceptors.response.forEach(function(S){f.push(S.fulfilled,S.rejected)});let p,y=0,v;if(!d){const b=[y0.bind(this),void 0];for(b.unshift(...c),b.push(...f),v=b.length,p=Promise.resolve(n);y<v;)p=p.then(b[y++],b[y++]);return p}v=c.length;let w=n;for(;y<v;){const b=c[y++],S=c[y++];try{w=b(w)}catch(_){S.call(this,_);break}}try{p=y0.call(this,w)}catch(b){return Promise.reject(b)}for(y=0,v=f.length;y<v;)p=p.then(f[y++],f[y++]);return p}getUri(t){t=os(this.defaults,t);const n=_w(t.baseURL,t.url,t.allowAbsoluteUrls);return xw(n,t.params,t.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(t){ss.prototype[t]=function(n,r){return this.request(os(r||{},{method:t,url:n,data:(r||{}).data}))}});B.forEach(["post","put","patch"],function(t){function n(r){return function(a,l,c){return this.request(os(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:l}))}}ss.prototype[t]=n(),ss.prototype[t+"Form"]=n(!0)});let bj=class Aw{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const l=new Promise(c=>{r.subscribe(c),a=c}).then(o);return l.cancel=function(){r.unsubscribe(a)},l},t(function(a,l,c){r.reason||(r.reason=new ci(a,l,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Aw(function(o){t=o}),cancel:t}}};function kj(e){return function(n){return e.apply(null,n)}}function Sj(e){return B.isObject(e)&&e.isAxiosError===!0}const uh={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(uh).forEach(([e,t])=>{uh[t]=e});function Pw(e){const t=new ss(e),n=aw(ss.prototype.request,t);return B.extend(n,ss.prototype,t,{allOwnKeys:!0}),B.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Pw(os(e,o))},n}const He=Pw(Ho);He.Axios=ss;He.CanceledError=ci;He.CancelToken=bj;He.isCancel=kw;He.VERSION=jw;He.toFormData=tu;He.AxiosError=Pe;He.Cancel=He.CanceledError;He.all=function(t){return Promise.all(t)};He.spread=kj;He.isAxiosError=Sj;He.mergeConfig=os;He.AxiosHeaders=$t;He.formToJSON=e=>bw(B.isHTMLForm(e)?new FormData(e):e);He.getAdapter=Cw.getAdapter;He.HttpStatusCode=uh;He.default=He;const{Axios:dL,AxiosError:hL,CanceledError:fL,isCancel:pL,CancelToken:mL,VERSION:gL,all:yL,Cancel:vL,isAxiosError:xL,spread:wL,toFormData:bL,AxiosHeaders:kL,HttpStatusCode:SL,formToJSON:_L,getAdapter:EL,mergeConfig:TL}=He;function ru(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function _j(e,t,n,r){function o(a){return a instanceof n?a:new n(function(l){l(a)})}return new(n||(n=Promise))(function(a,l){function c(p){try{f(r.next(p))}catch(y){l(y)}}function d(p){try{f(r.throw(p))}catch(y){l(y)}}function f(p){p.done?a(p.value):o(p.value).then(c,d)}f((r=r.apply(e,t||[])).next())})}const Ej=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class bf extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class Tj extends bf{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class x0 extends bf{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class w0 extends bf{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var ch;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(ch||(ch={}));class Cj{constructor(t,{headers:n={},customFetch:r,region:o=ch.Any}={}){this.url=t,this.headers=n,this.region=o,this.fetch=Ej(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return _j(this,arguments,void 0,function*(n,r={}){var o;let a,l;try{const{headers:c,method:d,body:f,signal:p,timeout:y}=r;let v={},{region:w}=r;w||(w=this.region);const b=new URL(`${this.url}/${n}`);w&&w!=="any"&&(v["x-region"]=w,b.searchParams.set("forceFunctionRegion",w));let S;f&&(c&&!Object.prototype.hasOwnProperty.call(c,"Content-Type")||!c)?typeof Blob<"u"&&f instanceof Blob||f instanceof ArrayBuffer?(v["Content-Type"]="application/octet-stream",S=f):typeof f=="string"?(v["Content-Type"]="text/plain",S=f):typeof FormData<"u"&&f instanceof FormData?S=f:(v["Content-Type"]="application/json",S=JSON.stringify(f)):f&&typeof f!="string"&&!(typeof Blob<"u"&&f instanceof Blob)&&!(f instanceof ArrayBuffer)&&!(typeof FormData<"u"&&f instanceof FormData)?S=JSON.stringify(f):S=f;let _=p;y&&(l=new AbortController,a=setTimeout(()=>l.abort(),y),p?(_=l.signal,p.addEventListener("abort",()=>l.abort())):_=l.signal);const E=yield this.fetch(b.toString(),{method:d||"POST",headers:Object.assign(Object.assign(Object.assign({},v),this.headers),c),body:S,signal:_}).catch($=>{throw new Tj($)}),P=E.headers.get("x-relay-error");if(P&&P==="true")throw new x0(E);if(!E.ok)throw new w0(E);let j=((o=E.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),D;return j==="application/json"?D=yield E.json():j==="application/octet-stream"||j==="application/pdf"?D=yield E.blob():j==="text/event-stream"?D=E:j==="multipart/form-data"?D=yield E.formData():D=yield E.text(),{data:D,error:null,response:E}}catch(c){return{data:null,error:c,response:c instanceof w0||c instanceof x0?c.context:void 0}}finally{a&&clearTimeout(a)}})}}var jj=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},Aj=class{constructor(e){var t,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var n=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const r=this.fetch;let o=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async a=>{let l=null,c=null,d=null,f=a.status,p=a.statusText;if(a.ok){var y,v;if(n.method!=="HEAD"){var w;const E=await a.text();E===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((w=n.headers.get("Accept"))===null||w===void 0)&&w.includes("application/vnd.pgrst.plan+text"))?c=E:c=JSON.parse(E))}const S=(y=n.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),_=(v=a.headers.get("content-range"))===null||v===void 0?void 0:v.split("/");S&&_&&_.length>1&&(d=parseInt(_[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(c)&&(c.length>1?(l={code:"PGRST116",details:`Results contain ${c.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},c=null,d=null,f=406,p="Not Acceptable"):c.length===1?c=c[0]:c=null)}else{var b;const S=await a.text();try{l=JSON.parse(S),Array.isArray(l)&&a.status===404&&(c=[],l=null,f=200,p="OK")}catch{a.status===404&&S===""?(f=204,p="No Content"):l={message:S}}if(l&&n.isMaybeSingle&&(!(l==null||(b=l.details)===null||b===void 0)&&b.includes("0 rows"))&&(l=null,f=200,p="OK"),l&&n.shouldThrowOnError)throw new jj(l)}return{error:l,data:c,count:d,status:f,statusText:p}});return this.shouldThrowOnError||(o=o.catch(a=>{var l;let c="";const d=a?.cause;if(d){var f,p,y,v;const b=(f=d?.message)!==null&&f!==void 0?f:"",S=(p=d?.code)!==null&&p!==void 0?p:"";c=`${(y=a?.name)!==null&&y!==void 0?y:"FetchError"}: ${a?.message}`,c+=`
|
|
22
|
+
|
|
23
|
+
Caused by: ${(v=d?.name)!==null&&v!==void 0?v:"Error"}: ${b}`,S&&(c+=` (${S})`),d?.stack&&(c+=`
|
|
24
|
+
${d.stack}`)}else{var w;c=(w=a?.stack)!==null&&w!==void 0?w:""}return{error:{message:`${(l=a?.name)!==null&&l!==void 0?l:"FetchError"}: ${a?.message}`,details:c,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(e,t)}returns(){return this}overrideTypes(){return this}},Pj=class extends Aj{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:o=r}={}){const a=o?`${o}.order`:"order",l=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const o=typeof r>"u"?"offset":`${r}.offset`,a=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(a,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:o=!1,format:a="text"}={}){var l;const c=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,o?"wal":null].filter(Boolean).join("|"),d=(l=this.headers.get("Accept"))!==null&&l!==void 0?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${d}"; options=${c};`),a==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const b0=new RegExp("[,()]");var qs=class extends Pj{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&b0.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&b0.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let o="";r==="plain"?o="pl":r==="phrase"?o="ph":r==="websearch"&&(o="w");const a=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${o}fts${a}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},Nj=class{constructor(e,{headers:t={},schema:n,fetch:r}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},o=n?"HEAD":"GET";let a=!1;const l=(e??"*").split("").map(f=>/\s/.test(f)&&!a?"":(f==='"'&&(a=!a),f)).join(""),{url:c,headers:d}=this.cloneRequestState();return c.searchParams.set("select",l),r&&d.append("Prefer",`count=${r}`),new qs({method:o,url:c,headers:d,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(t&&l.append("Prefer",`count=${t}`),n||l.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((d,f)=>d.concat(Object.keys(f)),[]);if(c.length>0){const d=[...new Set(c)].map(f=>`"${f}"`);a.searchParams.set("columns",d.join(","))}}return new qs({method:o,url:a,headers:l,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:o=!0}={}){var a;const l="POST",{url:c,headers:d}=this.cloneRequestState();if(d.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&c.searchParams.set("on_conflict",t),r&&d.append("Prefer",`count=${r}`),o||d.append("Prefer","missing=default"),Array.isArray(e)){const f=e.reduce((p,y)=>p.concat(Object.keys(y)),[]);if(f.length>0){const p=[...new Set(f)].map(y=>`"${y}"`);c.searchParams.set("columns",p.join(","))}}return new qs({method:l,url:c,headers:d,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}update(e,{count:t}={}){var n;const r="PATCH",{url:o,headers:a}=this.cloneRequestState();return t&&a.append("Prefer",`count=${t}`),new qs({method:r,url:o,headers:a,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:o}=this.cloneRequestState();return e&&o.append("Prefer",`count=${e}`),new qs({method:n,url:r,headers:o,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}},Rj=class Nw{constructor(t,{headers:n={},schema:r,fetch:o}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.fetch=o}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Nj(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new Nw(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:r=!1,get:o=!1,count:a}={}){var l;let c;const d=new URL(`${this.url}/rpc/${t}`);let f;const p=w=>w!==null&&typeof w=="object"&&(!Array.isArray(w)||w.some(p)),y=r&&Object.values(n).some(p);y?(c="POST",f=n):r||o?(c=r?"HEAD":"GET",Object.entries(n).filter(([w,b])=>b!==void 0).map(([w,b])=>[w,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([w,b])=>{d.searchParams.append(w,b)})):(c="POST",f=n);const v=new Headers(this.headers);return y?v.set("Prefer",a?`count=${a},return=minimal`:"return=minimal"):a&&v.set("Prefer",`count=${a}`),new qs({method:c,url:d,headers:v,schema:this.schemaName,body:f,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}};class Oj{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const o=r.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
25
|
+
import ws from "ws"
|
|
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 t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
|
|
27
|
+
|
|
28
|
+
Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const r=this.getWebSocketConstructor();return new r(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Ij="2.91.0",Lj=`realtime-js/${Ij}`,Dj="1.0.0",Rw="2.0.0",k0=Rw,dh=1e4,Mj=1e3,Uj=100;var Er;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Er||(Er={}));var ht;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(ht||(ht={}));var Sn;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(Sn||(Sn={}));var hh;(function(e){e.websocket="websocket"})(hh||(hh={}));var Qr;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Qr||(Qr={}));class zj{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const o=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,r;const o=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},l=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,l)}_encodeUserBroadcastPush(t,n,r){var o,a;const l=t.topic,c=(o=t.ref)!==null&&o!==void 0?o:"",d=(a=t.join_ref)!==null&&a!==void 0?a:"",f=t.payload.event,p=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},y=Object.keys(p).length===0?"":JSON.stringify(p);if(d.length>255)throw new Error(`joinRef length ${d.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`ref length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(y.length>255)throw new Error(`metadata length ${y.length} exceeds maximum of 255`);const v=this.USER_BROADCAST_PUSH_META_LENGTH+d.length+c.length+l.length+f.length+y.length,w=new ArrayBuffer(this.HEADER_LENGTH+v);let b=new DataView(w),S=0;b.setUint8(S++,this.KINDS.userBroadcastPush),b.setUint8(S++,d.length),b.setUint8(S++,c.length),b.setUint8(S++,l.length),b.setUint8(S++,f.length),b.setUint8(S++,y.length),b.setUint8(S++,n),Array.from(d,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(c,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(l,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(f,E=>b.setUint8(S++,E.charCodeAt(0))),Array.from(y,E=>b.setUint8(S++,E.charCodeAt(0)));var _=new Uint8Array(w.byteLength+r.byteLength);return _.set(new Uint8Array(w),0),_.set(new Uint8Array(r),w.byteLength),_.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[o,a,l,c,d]=r;return n({join_ref:o,ref:a,topic:l,event:c,payload:d})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),o=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,r){const o=n.getUint8(1),a=n.getUint8(2),l=n.getUint8(3),c=n.getUint8(4);let d=this.HEADER_LENGTH+4;const f=r.decode(t.slice(d,d+o));d=d+o;const p=r.decode(t.slice(d,d+a));d=d+a;const y=r.decode(t.slice(d,d+l));d=d+l;const v=t.slice(d,t.byteLength),w=c===this.JSON_ENCODING?JSON.parse(r.decode(v)):v,b={type:this.BROADCAST_EVENT,event:p,payload:w};return l>0&&(b.meta=JSON.parse(y)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}class Ow{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Be;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Be||(Be={}));const S0=(e,t,n={})=>{var r;const o=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((a,l)=>(a[l]=Fj(l,e,t,o),a),{}):{}},Fj=(e,t,n,r)=>{const o=t.find(c=>c.name===e),a=o?.type,l=n[e];return a&&!r.includes(a)?Iw(a,l):fh(l)},Iw=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return qj(t,n)}switch(e){case Be.bool:return $j(t);case Be.float4:case Be.float8:case Be.int2:case Be.int4:case Be.int8:case Be.numeric:case Be.oid:return Bj(t);case Be.json:case Be.jsonb:return Vj(t);case Be.timestamp:return Hj(t);case Be.abstime:case Be.date:case Be.daterange:case Be.int4range:case Be.int8range:case Be.money:case Be.reltime:case Be.text:case Be.time:case Be.timestamptz:case Be.timetz:case Be.tsrange:case Be.tstzrange:return fh(t);default:return fh(t)}},fh=e=>e,$j=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Bj=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Vj=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},qj=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let a;const l=e.slice(1,n);try{a=JSON.parse("["+l+"]")}catch{a=l?l.split(","):[]}return a.map(c=>Iw(t,c))}return e},Hj=e=>typeof e=="string"?e.replace(" ","T"):e,Lw=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class yd{constructor(t,n,r={},o=dh){this.channel=t,this.event=n,this.payload=r,this.timeout=o,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var _0;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(_0||(_0={}));class go{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},o=>{const{onJoin:a,onLeave:l,onSync:c}=this.caller;this.joinRef=this.channel._joinRef(),this.state=go.syncState(this.state,o,a,l),this.pendingDiffs.forEach(d=>{this.state=go.syncDiff(this.state,d,a,l)}),this.pendingDiffs=[],c()}),this.channel._on(r.diff,{},o=>{const{onJoin:a,onLeave:l,onSync:c}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=go.syncDiff(this.state,o,a,l),c())}),this.onJoin((o,a,l)=>{this.channel._trigger("presence",{event:"join",key:o,currentPresences:a,newPresences:l})}),this.onLeave((o,a,l)=>{this.channel._trigger("presence",{event:"leave",key:o,currentPresences:a,leftPresences:l})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,o){const a=this.cloneDeep(t),l=this.transformState(n),c={},d={};return this.map(a,(f,p)=>{l[f]||(d[f]=p)}),this.map(l,(f,p)=>{const y=a[f];if(y){const v=p.map(_=>_.presence_ref),w=y.map(_=>_.presence_ref),b=p.filter(_=>w.indexOf(_.presence_ref)<0),S=y.filter(_=>v.indexOf(_.presence_ref)<0);b.length>0&&(c[f]=b),S.length>0&&(d[f]=S)}else c[f]=p}),this.syncDiff(a,{joins:c,leaves:d},r,o)}static syncDiff(t,n,r,o){const{joins:a,leaves:l}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),o||(o=()=>{}),this.map(a,(c,d)=>{var f;const p=(f=t[c])!==null&&f!==void 0?f:[];if(t[c]=this.cloneDeep(d),p.length>0){const y=t[c].map(w=>w.presence_ref),v=p.filter(w=>y.indexOf(w.presence_ref)<0);t[c].unshift(...v)}r(c,p,d)}),this.map(l,(c,d)=>{let f=t[c];if(!f)return;const p=d.map(y=>y.presence_ref);f=f.filter(y=>p.indexOf(y.presence_ref)<0),t[c]=f,o(c,f,d),f.length===0&&delete t[c]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const o=t[r];return"metas"in o?n[r]=o.metas.map(a=>(a.presence_ref=a.phx_ref,delete a.phx_ref,delete a.phx_ref_prev,a)):n[r]=o,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var E0;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(E0||(E0={}));var yo;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(yo||(yo={}));var Gn;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Gn||(Gn={}));class Qs{constructor(t,n={config:{}},r){var o,a;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=ht.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new yd(this,Sn.join,this.params,this.timeout),this.rejoinTimer=new Ow(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ht.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(l=>l.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=ht.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Sn.reply,{},(l,c)=>{this._trigger(this._replyEventName(c),l)}),this.presence=new go(this),this.broadcastEndpointURL=Lw(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((a=(o=this.params.config)===null||o===void 0?void 0:o.broadcast)===null||a===void 0)&&a.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var r,o,a;if(this.socket.isConnected()||this.socket.connect(),this.state==ht.closed){const{config:{broadcast:l,presence:c,private:d}}=this.params,f=(o=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(w=>w.filter))!==null&&o!==void 0?o:[],p=!!this.bindings[yo.PRESENCE]&&this.bindings[yo.PRESENCE].length>0||((a=this.params.config.presence)===null||a===void 0?void 0:a.enabled)===!0,y={},v={broadcast:l,presence:Object.assign(Object.assign({},c),{enabled:p}),postgres_changes:f,private:d};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(w=>t?.(Gn.CHANNEL_ERROR,w)),this._onClose(()=>t?.(Gn.CLOSED)),this.updateJoinPayload(Object.assign({config:v},y)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:w})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),w===void 0){t?.(Gn.SUBSCRIBED);return}else{const S=this.bindings.postgres_changes,_=(b=S?.length)!==null&&b!==void 0?b:0,E=[];for(let P=0;P<_;P++){const j=S[P],{filter:{event:D,schema:$,table:O,filter:z}}=j,q=w&&w[P];if(q&&q.event===D&&Qs.isFilterValueEqual(q.schema,$)&&Qs.isFilterValueEqual(q.table,O)&&Qs.isFilterValueEqual(q.filter,z))E.push(Object.assign(Object.assign({},j),{id:q.id}));else{this.unsubscribe(),this.state=ht.errored,t?.(Gn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,t&&t(Gn.SUBSCRIBED);return}}).receive("error",w=>{this.state=ht.errored,t?.(Gn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(w).join(", ")||"error")))}).receive("timeout",()=>{t?.(Gn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){return this.state===ht.joined&&t===yo.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,n,r)}async httpSend(t,n,r={}){var o;if(n==null)return Promise.reject("Payload is required for httpSend()");const a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(o=r.timeout)!==null&&o!==void 0?o:this.timeout);if(c.status===202)return{success:!0};let d=c.statusText;try{const f=await c.json();d=f.error||f.message||d}catch{}return Promise.reject(new Error(d))}async send(t,n={}){var r,o;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:a,payload:l}=t,c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const d={method:"POST",headers:c,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:l,private:this.private}]})};try{const f=await this._fetchWithTimeout(this.broadcastEndpointURL,d,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((o=f.body)===null||o===void 0?void 0:o.cancel()),f.ok?"ok":"error"}catch(f){return f.name==="AbortError"?"timed out":"error"}}else return new Promise(a=>{var l,c,d;const f=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((d=(c=(l=this.params)===null||l===void 0?void 0:l.config)===null||c===void 0?void 0:c.broadcast)===null||d===void 0)&&d.ack)&&a("ok"),f.receive("ok",()=>a("ok")),f.receive("error",()=>a("error")),f.receive("timeout",()=>a("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=ht.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Sn.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(o=>{r=new yd(this,Sn.leave,{},t),r.receive("ok",()=>{n(),o("ok")}).receive("timeout",()=>{n(),o("timed out")}).receive("error",()=>{o("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ht.closed,this.bindings={}}async _fetchWithTimeout(t,n,r){const o=new AbortController,a=setTimeout(()=>o.abort(),r),l=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:o.signal}));return clearTimeout(a),l}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let o=new yd(this,t,n,r);return this._canPush()?o.send():this._addToPushBuffer(o),o}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>Uj){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var o,a;const l=t.toLocaleLowerCase(),{close:c,error:d,leave:f,join:p}=Sn;if(r&&[c,d,f,p].indexOf(l)>=0&&r!==this._joinRef())return;let v=this._onMessage(l,n,r);if(n&&!v)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(l)?(o=this.bindings.postgres_changes)===null||o===void 0||o.filter(w=>{var b,S,_;return((b=w.filter)===null||b===void 0?void 0:b.event)==="*"||((_=(S=w.filter)===null||S===void 0?void 0:S.event)===null||_===void 0?void 0:_.toLocaleLowerCase())===l}).map(w=>w.callback(v,r)):(a=this.bindings[l])===null||a===void 0||a.filter(w=>{var b,S,_,E,P,j,D,$;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in w){const O=w.id,z=(b=w.filter)===null||b===void 0?void 0:b.event;return O&&((S=n.ids)===null||S===void 0?void 0:S.includes(O))&&(z==="*"||z?.toLocaleLowerCase()===((_=n.data)===null||_===void 0?void 0:_.type.toLocaleLowerCase()))&&(!(!((E=w.filter)===null||E===void 0)&&E.table)||w.filter.table===((P=n.data)===null||P===void 0?void 0:P.table))}else{const O=(D=(j=w?.filter)===null||j===void 0?void 0:j.event)===null||D===void 0?void 0:D.toLocaleLowerCase();return O==="*"||O===(($=n?.event)===null||$===void 0?void 0:$.toLocaleLowerCase())}else return w.type.toLocaleLowerCase()===l}).map(w=>{if(typeof v=="object"&&"ids"in v){const b=v.data,{schema:S,table:_,commit_timestamp:E,type:P,errors:j}=b;v=Object.assign(Object.assign({},{schema:S,table:_,commit_timestamp:E,eventType:P,new:{},old:{},errors:j}),this._getPayloadRecords(b))}w.callback(v,r)})}_isClosed(){return this.state===ht.closed}_isJoined(){return this.state===ht.joined}_isJoining(){return this.state===ht.joining}_isLeaving(){return this.state===ht.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const o=t.toLocaleLowerCase(),a={type:o,filter:n,callback:r};return this.bindings[o]?this.bindings[o].push(a):this.bindings[o]=[a],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(o=>{var a;return!(((a=o.type)===null||a===void 0?void 0:a.toLocaleLowerCase())===r&&Qs.isEqual(o.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(Sn.close,{},t)}_onError(t){this._on(Sn.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ht.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=S0(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=S0(t.columns,t.old_record)),n}}const vd=()=>{},fl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Wj=[1e3,2e3,5e3,1e4],Kj=1e4,Gj=`
|
|
29
|
+
addEventListener("message", (e) => {
|
|
30
|
+
if (e.data.event === "start") {
|
|
31
|
+
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
32
|
+
}
|
|
33
|
+
});`;class Jj{constructor(t,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=dh,this.transport=null,this.heartbeatIntervalMs=fl.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=vd,this.ref=0,this.reconnectTimer=null,this.vsn=k0,this.logger=vd,this.conn=null,this.sendBuffer=[],this.serializer=new zj,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?(...a)=>o(...a):(...a)=>fetch(...a),!(!((r=n?.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${hh.websocket}`,this.httpEndpoint=Lw(t),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=Oj.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n}
|
|
34
|
+
|
|
35
|
+
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
36
|
+
|
|
37
|
+
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
38
|
+
Option 2: Install and provide the "ws" package:
|
|
39
|
+
|
|
40
|
+
npm install ws
|
|
41
|
+
|
|
42
|
+
import ws from "ws"
|
|
43
|
+
const client = new RealtimeClient(url, {
|
|
44
|
+
...options,
|
|
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(t,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(t?this.conn.close(t,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,r){this.logger(t,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case Er.connecting:return Qr.Connecting;case Er.open:return Qr.Open;case Er.closing:return Qr.Closing;default:return Qr.Closed}}isConnected(){return this.connectionState()===Qr.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const r=`realtime:${t}`,o=this.getChannels().find(a=>a.topic===r);if(o)return o;{const a=new Qs(`realtime:${t}`,n,this);return this.channels.push(a),a}}push(t){const{topic:n,event:r,payload:o,ref:a}=t,l=()=>{this.encode(t,c=>{var d;(d=this.conn)===null||d===void 0||d.send(c)})};this.log("push",`${n} ${r} (${a})`,o),this.isConnected()?l():this.sendBuffer.push(l)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(Mj,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},fl.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(r=>r.topic===t&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const f=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",f)}catch(p){this.log("error","error in heartbeat callback",p)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:o,payload:a,ref:l}=n,c=l?`(${l})`:"",d=a.status||"";this.log("receive",`${d} ${r} ${o} ${c}`.trim(),a),this.channels.filter(f=>f._isMember(r)).forEach(f=>f._trigger(o,a,l)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t),this.conn.readyState===Er.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Er.open||this.conn.readyState===Er.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger(Sn.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",o=new URLSearchParams(n);return`${t}${r}${o}`}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([Gj],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(o=>{const a={access_token:n,version:Lj};n&&o.updateJoinPayload(a),o.joinedOnce&&o._isJoined()&&o._push(Sn.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(r=>{try{r(n)}catch(o){this.log("error",`error in ${t} callback`,o)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Ow(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},fl.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,r,o,a,l,c,d,f,p,y,v,w;switch(this.transport=(n=t?.transport)!==null&&n!==void 0?n:null,this.timeout=(r=t?.timeout)!==null&&r!==void 0?r:dh,this.heartbeatIntervalMs=(o=t?.heartbeatIntervalMs)!==null&&o!==void 0?o:fl.HEARTBEAT_INTERVAL,this.worker=(a=t?.worker)!==null&&a!==void 0?a:!1,this.accessToken=(l=t?.accessToken)!==null&&l!==void 0?l:null,this.heartbeatCallback=(c=t?.heartbeatCallback)!==null&&c!==void 0?c:vd,this.vsn=(d=t?.vsn)!==null&&d!==void 0?d:k0,t?.params&&(this.params=t.params),t?.logger&&(this.logger=t.logger),(t?.logLevel||t?.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(f=t?.reconnectAfterMs)!==null&&f!==void 0?f:(b=>Wj[b-1]||Kj),this.vsn){case Dj:this.encode=(p=t?.encode)!==null&&p!==void 0?p:((b,S)=>S(JSON.stringify(b))),this.decode=(y=t?.decode)!==null&&y!==void 0?y:((b,S)=>S(JSON.parse(b)));break;case Rw:this.encode=(v=t?.encode)!==null&&v!==void 0?v:this.serializer.encode.bind(this.serializer),this.decode=(w=t?.decode)!==null&&w!==void 0?w:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t?.workerUrl}}}var Ao=class extends Error{constructor(e,t){super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&t.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Yj(e,t,n){const r=new URL(t,e);if(n)for(const[o,a]of Object.entries(n))a!==void 0&&r.searchParams.set(o,a);return r.toString()}async function Xj(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function Qj(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:o,body:a,headers:l}){const c=Yj(e.baseUrl,r,o),d=await Xj(e.auth),f=await t(c,{method:n,headers:{...a?{"Content-Type":"application/json"}:{},...d,...l},body:a?JSON.stringify(a):void 0}),p=await f.text(),y=(f.headers.get("content-type")||"").includes("application/json"),v=y&&p?JSON.parse(p):p;if(!f.ok){const w=y?v:void 0,b=w?.error;throw new Ao(b?.message??`Request failed with status ${f.status}`,{status:f.status,icebergType:b?.type,icebergCode:b?.code,details:w})}return{status:f.status,headers:f.headers,data:v}}}}function pl(e){return e.join("")}var Zj=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:pl(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${pl(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${pl(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${pl(e.namespace)}`}),!0}catch(t){if(t instanceof Ao&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof Ao&&n.status===409)return;throw n}}};function Ds(e){return e.join("")}var eA=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ds(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ds(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Ds(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ds(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ds(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ds(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof Ao&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof Ao&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},tA=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Qj({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new Zj(this.client,t),this.tableOps=new eA(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},su=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function Qe(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var nA=class extends su{constructor(e,t,n){super(e),this.name="StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},ph=class extends su{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};const kf=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),rA=()=>Response,mh=e=>{if(Array.isArray(e))return e.map(n=>mh(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const o=n.replace(/([-_][a-z])/gi,a=>a.toUpperCase().replace(/[-_]/g,""));t[o]=mh(r)}),t},sA=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},iA=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function Po(e){"@babel/helpers - typeof";return Po=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Po(e)}function oA(e,t){if(Po(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Po(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function aA(e){var t=oA(e,"string");return Po(t)=="symbol"?t:t+""}function lA(e,t,n){return(t=aA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Se(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?T0(Object(n),!0).forEach(function(r){lA(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const xd=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},uA=async(e,t,n)=>{e instanceof await rA()&&!n?.noResolveJson?e.json().then(r=>{const o=e.status||500,a=r?.statusCode||o+"";t(new nA(xd(r),o,a))}).catch(r=>{t(new ph(xd(r),r))}):t(new ph(xd(e),e))},cA=(e,t,n,r)=>{const o={method:e,headers:t?.headers||{}};return e==="GET"||!r?o:(sA(r)?(o.headers=Se({"Content-Type":"application/json"},t?.headers),o.body=JSON.stringify(r)):o.body=r,t?.duplex&&(o.duplex=t.duplex),Se(Se({},o),n))};async function Wo(e,t,n,r,o,a){return new Promise((l,c)=>{e(n,cA(t,r,o,a)).then(d=>{if(!d.ok)throw d;return r?.noResolveJson?d:d.json()}).then(d=>l(d)).catch(d=>uA(d,c,r))})}async function No(e,t,n,r){return Wo(e,"GET",t,n,r)}async function kn(e,t,n,r,o){return Wo(e,"POST",t,r,o,n)}async function gh(e,t,n,r,o){return Wo(e,"PUT",t,r,o,n)}async function dA(e,t,n,r){return Wo(e,"HEAD",t,Se(Se({},n),{},{noResolveJson:!0}),r)}async function Sf(e,t,n,r,o){return Wo(e,"DELETE",t,r,o,n)}var hA=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Qe(t))return{data:null,error:t};throw t}}};let Dw;Dw=Symbol.toStringTag;var fA=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Dw]="BlobDownloadBuilder",this.promise=null}asStream(){return new hA(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Qe(t))return{data:null,error:t};throw t}}};const pA={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},C0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var mA=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=n,this.fetch=kf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(e,t,n,r){var o=this;try{let a;const l=Se(Se({},C0),r);let c=Se(Se({},o.headers),e==="POST"&&{"x-upsert":String(l.upsert)});const d=l.metadata;typeof Blob<"u"&&n instanceof Blob?(a=new FormData,a.append("cacheControl",l.cacheControl),d&&a.append("metadata",o.encodeMetadata(d)),a.append("",n)):typeof FormData<"u"&&n instanceof FormData?(a=n,a.has("cacheControl")||a.append("cacheControl",l.cacheControl),d&&!a.has("metadata")&&a.append("metadata",o.encodeMetadata(d))):(a=n,c["cache-control"]=`max-age=${l.cacheControl}`,c["content-type"]=l.contentType,d&&(c["x-metadata"]=o.toBase64(o.encodeMetadata(d))),(typeof ReadableStream<"u"&&a instanceof ReadableStream||a&&typeof a=="object"&&"pipe"in a&&typeof a.pipe=="function")&&!l.duplex&&(l.duplex="half")),r?.headers&&(c=Se(Se({},c),r.headers));const f=o._removeEmptyFolders(t),p=o._getFinalPath(f),y=await(e=="PUT"?gh:kn)(o.fetch,`${o.url}/object/${p}`,a,Se({headers:c},l?.duplex?{duplex:l.duplex}:{}));return{data:{path:f,id:y.Id,fullPath:y.Key},error:null}}catch(a){if(o.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var o=this;const a=o._removeEmptyFolders(e),l=o._getFinalPath(a),c=new URL(o.url+`/object/upload/sign/${l}`);c.searchParams.set("token",t);try{let d;const f=Se({upsert:C0.upsert},r),p=Se(Se({},o.headers),{"x-upsert":String(f.upsert)});return typeof Blob<"u"&&n instanceof Blob?(d=new FormData,d.append("cacheControl",f.cacheControl),d.append("",n)):typeof FormData<"u"&&n instanceof FormData?(d=n,d.append("cacheControl",f.cacheControl)):(d=n,p["cache-control"]=`max-age=${f.cacheControl}`,p["content-type"]=f.contentType),{data:{path:a,fullPath:(await gh(o.fetch,c.toString(),d,{headers:p})).Key},error:null}}catch(d){if(o.shouldThrowOnError)throw d;if(Qe(d))return{data:null,error:d};throw d}}async createSignedUploadUrl(e,t){var n=this;try{let r=n._getFinalPath(e);const o=Se({},n.headers);t?.upsert&&(o["x-upsert"]="true");const a=await kn(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:o}),l=new URL(n.url+a.url),c=l.searchParams.get("token");if(!c)throw new su("No token returned by API");return{data:{signedUrl:l.toString(),path:e,token:c},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;try{return{data:await kn(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers}),error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(Qe(o))return{data:null,error:o};throw o}}async copy(e,t,n){var r=this;try{return{data:{path:(await kn(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers})).Key},error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(Qe(o))return{data:null,error:o};throw o}}async createSignedUrl(e,t,n){var r=this;try{let o=r._getFinalPath(e),a=await kn(r.fetch,`${r.url}/object/sign/${o}`,Se({expiresIn:t},n?.transform?{transform:n.transform}:{}),{headers:r.headers});const l=n?.download?`&download=${n.download===!0?"":n.download}`:"";return a={signedUrl:encodeURI(`${r.url}${a.signedURL}${l}`)},{data:a,error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(Qe(o))return{data:null,error:o};throw o}}async createSignedUrls(e,t,n){var r=this;try{const o=await kn(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(l=>Se(Se({},l),{},{signedUrl:l.signedURL?encodeURI(`${r.url}${l.signedURL}${a}`):null})),error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(Qe(o))return{data:null,error:o};throw o}}download(e,t){const n=typeof t?.transform<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString(t?.transform||{}),o=r?`?${r}`:"",a=this._getFinalPath(e),l=()=>No(this.fetch,`${this.url}/${n}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new fA(l,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);try{return{data:mh(await No(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await dA(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Qe(r)&&r instanceof ph){const o=r.originalError;if([400,404].includes(o?.status))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=[],o=t?.download?`download=${t.download===!0?"":t.download}`:"";o!==""&&r.push(o);const a=typeof t?.transform<"u"?"render/image":"object",l=this.transformOptsToQueryString(t?.transform||{});l!==""&&r.push(l);let c=r.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}${c}`)}}}async remove(e){var t=this;try{return{data:await Sf(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Qe(n))return{data:null,error:n};throw n}}async list(e,t,n){var r=this;try{const o=Se(Se(Se({},pA),t),{},{prefix:e||""});return{data:await kn(r.fetch,`${r.url}/object/list/${r.bucketId}`,o,{headers:r.headers},n),error:null}}catch(o){if(r.shouldThrowOnError)throw o;if(Qe(o))return{data:null,error:o};throw o}}async listV2(e,t){var n=this;try{const r=Se({},e);return{data:await kn(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const Mw="2.91.0",Uw={"X-Client-Info":`storage-js/${Mw}`};var gA=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1;const o=new URL(e);r?.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=Se(Se({},Uw),t),this.fetch=kf(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(e){var t=this;try{const n=t.listBucketOptionsToQueryString(e);return{data:await No(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Qe(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await No(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Qe(n))return{data:null,error:n};throw n}}async createBucket(e,t={public:!1}){var n=this;try{return{data:await kn(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async updateBucket(e,t){var n=this;try{return{data:await gh(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async emptyBucket(e){var t=this;try{return{data:await kn(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Qe(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Sf(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Qe(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},yA=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Se(Se({},Uw),t),this.fetch=kf(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await kn(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Qe(n))return{data:null,error:n};throw n}}async listBuckets(e){var t=this;try{const n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",e.limit.toString()),e?.offset!==void 0&&n.set("offset",e.offset.toString()),e?.sortColumn&&n.set("sortColumn",e.sortColumn),e?.sortOrder&&n.set("sortOrder",e.sortOrder),e?.search&&n.set("search",e.search);const r=n.toString(),o=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return{data:await No(t.fetch,o,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Qe(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Sf(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Qe(n))return{data:null,error:n};throw n}}from(e){var t=this;if(!iA(e))throw new su("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 tA({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(o,a){const l=o[a];return typeof l!="function"?l:async(...c)=>{try{return{data:await l.apply(o,c),error:null}}catch(d){if(r)throw d;return{data:null,error:d}}}}})}};const _f={"X-Client-Info":`storage-js/${Mw}`,"Content-Type":"application/json"};var zw=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Xt(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}var wd=class extends zw{constructor(e,t,n){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},vA=class extends zw{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}};const Ef=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),xA=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},j0=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),wA=async(e,t,n)=>{if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!n?.noResolveJson){const r=e.status||500,o=e;if(typeof o.json=="function")o.json().then(a=>{const l=a?.statusCode||a?.code||r+"";t(new wd(j0(a),r,l))}).catch(()=>{const a=r+"";t(new wd(o.statusText||`HTTP ${r} error`,r,a))});else{const a=r+"";t(new wd(o.statusText||`HTTP ${r} error`,r,a))}}else t(new vA(j0(e),e))},bA=(e,t,n,r)=>{const o={method:e,headers:t?.headers||{}};return r?(xA(r)?(o.headers=Se({"Content-Type":"application/json"},t?.headers),o.body=JSON.stringify(r)):o.body=r,Se(Se({},o),n)):o};async function kA(e,t,n,r,o,a){return new Promise((l,c)=>{e(n,bA(t,r,o,a)).then(d=>{if(!d.ok)throw d;if(r?.noResolveJson)return d;const f=d.headers.get("content-type");return!f||!f.includes("application/json")?{}:d.json()}).then(d=>l(d)).catch(d=>wA(d,c,r))})}async function Qt(e,t,n,r,o){return kA(e,"POST",t,r,o,n)}var SA=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Se(Se({},_f),t),this.fetch=Ef(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(e){var t=this;try{return{data:await Qt(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async getIndex(e,t){var n=this;try{return{data:await Qt(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listIndexes(e){var t=this;try{return{data:await Qt(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async deleteIndex(e,t){var n=this;try{return{data:await Qt(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},_A=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Se(Se({},_f),t),this.fetch=Ef(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(e){var t=this;try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Qt(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async getVectors(e){var t=this;try{return{data:await Qt(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async listVectors(e){var t=this;try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:await Qt(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async queryVectors(e){var t=this;try{return{data:await Qt(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async deleteVectors(e){var t=this;try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Qt(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}},EA=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Se(Se({},_f),t),this.fetch=Ef(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await Qt(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await Qt(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async listBuckets(e={}){var t=this;try{return{data:await Qt(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await Qt(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Xt(n))return{data:null,error:n};throw n}}},TA=class extends EA{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new CA(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},CA=class extends SA{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,Se(Se({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,Se(Se({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new jA(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},jA=class extends _A{constructor(e,t,n,r,o){super(e,t,o),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,Se(Se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,Se(Se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,Se(Se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,Se(Se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,Se(Se({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},AA=class extends gA{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new mA(this.url,this.headers,e,this.fetch)}get vectors(){return new TA(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new yA(this.url+"/iceberg",this.headers,this.fetch)}};const Fw="2.91.0",Hs=30*1e3,yh=3,bd=yh*Hs,PA="http://localhost:9999",NA="supabase.auth.token",RA={"X-Client-Info":`gotrue-js/${Fw}`},vh="X-Supabase-Api-Version",$w={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},OA=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,IA=600*1e3;class Ro extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function ge(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class LA extends Ro{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function DA(e){return ge(e)&&e.name==="AuthApiError"}class Zr extends Ro{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Zn extends Ro{constructor(t,n,r,o){super(t,r,o),this.name=n,this.status=r}}class Jt extends Zn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function MA(e){return ge(e)&&e.name==="AuthSessionMissingError"}class Ms extends Zn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ml extends Zn{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class gl extends Zn{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function UA(e){return ge(e)&&e.name==="AuthImplicitGrantRedirectError"}class A0 extends Zn{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class zA extends Zn{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 xh extends Zn{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function kd(e){return ge(e)&&e.name==="AuthRetryableFetchError"}class P0 extends Zn{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class wh extends Zn{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ul="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),N0=`
|
|
47
|
+
\r=`.split(""),FA=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<N0.length;t+=1)e[N0[t].charCodeAt(0)]=-2;for(let t=0;t<Ul.length;t+=1)e[Ul[t].charCodeAt(0)]=t;return e})();function R0(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Ul[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Ul[r]),t.queuedBits-=6}}function Bw(e,t,n){const r=FA[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function O0(e){const t=[],n=l=>{t.push(String.fromCodePoint(l))},r={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},a=l=>{VA(l,r,n)};for(let l=0;l<e.length;l+=1)Bw(e.charCodeAt(l),o,a);return t.join("")}function $A(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function BA(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const o=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|o)+65536,n+=1}$A(r,t)}}function VA(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if((e>>7-r&1)===0){t.utf8seq=r;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Zs(e){const t=[],n={queue:0,queuedBits:0},r=o=>{t.push(o)};for(let o=0;o<e.length;o+=1)Bw(e.charCodeAt(o),n,r);return new Uint8Array(t)}function qA(e){const t=[];return BA(e,n=>t.push(n)),new Uint8Array(t)}function ns(e){const t=[],n={queue:0,queuedBits:0},r=o=>{t.push(o)};return e.forEach(o=>R0(o,n,r)),R0(null,n,r),t.join("")}function HA(e){return Math.round(Date.now()/1e3)+e}function WA(){return Symbol("auth-callback")}const bt=()=>typeof window<"u"&&typeof document<"u",Kr={tested:!1,writable:!1},Vw=()=>{if(!bt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Kr.tested)return Kr.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Kr.tested=!0,Kr.writable=!0}catch{Kr.tested=!0,Kr.writable=!1}return Kr.writable};function KA(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((o,a)=>{t[a]=o})}catch{}return n.searchParams.forEach((r,o)=>{t[o]=r}),t}const qw=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),GA=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Ws=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Gr=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},wt=async(e,t)=>{await e.removeItem(t)};class iu{constructor(){this.promise=new iu.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}iu.promiseConstructor=Promise;function Sd(e){const t=e.split(".");if(t.length!==3)throw new wh("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!OA.test(t[r]))throw new wh("JWT not in base64url format");return{header:JSON.parse(O0(t[0])),payload:JSON.parse(O0(t[1])),signature:Zs(t[2]),raw:{header:t[0],payload:t[1]}}}async function JA(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function YA(e,t){return new Promise((r,o)=>{(async()=>{for(let a=0;a<1/0;a++)try{const l=await e(a);if(!t(a,null,l)){r(l);return}}catch(l){if(!t(a,l)){o(l);return}}})()})}function XA(e){return("0"+e.toString(16)).substr(-2)}function QA(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let o="";for(let a=0;a<56;a++)o+=n.charAt(Math.floor(Math.random()*r));return o}return crypto.getRandomValues(t),Array.from(t,XA).join("")}async function ZA(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),o=new Uint8Array(r);return Array.from(o).map(a=>String.fromCharCode(a)).join("")}async function eP(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await ZA(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Us(e,t,n=!1){const r=QA();let o=r;n&&(o+="/PASSWORD_RECOVERY"),await Ws(e,`${t}-code-verifier`,o);const a=await eP(r);return[a,r===a?"plain":"s256"]}const tP=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function nP(e){const t=e.headers.get(vh);if(!t||!t.match(tP))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function rP(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function sP(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const iP=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function zs(e){if(!iP.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function _d(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function oP(e,t){return new Proxy(e,{get:(n,r,o)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const a=r.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)"||a==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,o)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,o)}})}function I0(e){return JSON.parse(JSON.stringify(e))}const Xr=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),aP=[502,503,504];async function L0(e){var t;if(!GA(e))throw new xh(Xr(e),0);if(aP.includes(e.status))throw new xh(Xr(e),e.status);let n;try{n=await e.json()}catch(a){throw new Zr(Xr(a),a)}let r;const o=nP(e);if(o&&o.getTime()>=$w["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new P0(Xr(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new Jt}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((a,l)=>a&&typeof l=="string",!0))throw new P0(Xr(n),e.status,n.weak_password.reasons);throw new LA(Xr(n),e.status||500,r)}const lP=(e,t,n,r)=>{const o={method:e,headers:t?.headers||{}};return e==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),o.body=JSON.stringify(r),Object.assign(Object.assign({},o),n))};async function be(e,t,n,r){var o;const a=Object.assign({},r?.headers);a[vh]||(a[vh]=$w["2024-01-01"].name),r?.jwt&&(a.Authorization=`Bearer ${r.jwt}`);const l=(o=r?.query)!==null&&o!==void 0?o:{};r?.redirectTo&&(l.redirect_to=r.redirectTo);const c=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",d=await uP(e,t,n+c,{headers:a,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(d):{data:Object.assign({},d),error:null}}async function uP(e,t,n,r,o,a){const l=lP(t,r,o,a);let c;try{c=await e(n,Object.assign({},l))}catch(d){throw console.error(d),new xh(Xr(d),0)}if(c.ok||await L0(c),r?.noResolveJson)return c;try{return await c.json()}catch(d){await L0(d)}}function wn(e){var t;let n=null;hP(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=HA(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function D0(e){const t=wn(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function Tr(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function cP(e){return{data:e,error:null}}function dP(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:o,verification_type:a}=e,l=ru(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:t,email_otp:n,hashed_token:r,redirect_to:o,verification_type:a},d=Object.assign({},l);return{data:{properties:c,user:d},error:null}}function M0(e){return e}function hP(e){return e.access_token&&e.refresh_token&&e.expires_in}const Ed=["global","local","others"];class fP{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=qw(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(t,n=Ed[0]){if(Ed.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ed.join(", ")}`);try{return await be(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ge(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await be(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Tr})}catch(r){if(ge(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=ru(t,["options"]),o=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(o.new_email=r?.newEmail,delete o.newEmail),await be(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:dP,redirectTo:n?.redirectTo})}catch(n){if(ge(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await be(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Tr})}catch(n){if(ge(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,o,a,l,c,d;try{const f={nextPage:null,lastPage:0,total:0},p=await be(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(a=(o=t?.perPage)===null||o===void 0?void 0:o.toString())!==null&&a!==void 0?a:""},xform:M0});if(p.error)throw p.error;const y=await p.json(),v=(l=p.headers.get("x-total-count"))!==null&&l!==void 0?l:0,w=(d=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&d!==void 0?d:[];return w.length>0&&(w.forEach(b=>{const S=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),_=JSON.parse(b.split(";")[1].split("=")[1]);f[`${_}Page`]=S}),f.total=parseInt(v)),{data:Object.assign(Object.assign({},y),f),error:null}}catch(f){if(ge(f))return{data:{users:[]},error:f};throw f}}async getUserById(t){zs(t);try{return await be(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Tr})}catch(n){if(ge(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){zs(t);try{return await be(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:Tr})}catch(r){if(ge(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){zs(t);try{return await be(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:Tr})}catch(r){if(ge(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){zs(t.userId);try{const{data:n,error:r}=await be(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:n,error:r}}catch(n){if(ge(n))return{data:null,error:n};throw n}}async _deleteFactor(t){zs(t.userId),zs(t.id);try{return{data:await be(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(ge(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,o,a,l,c,d;try{const f={nextPage:null,lastPage:0,total:0},p=await be(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(a=(o=t?.perPage)===null||o===void 0?void 0:o.toString())!==null&&a!==void 0?a:""},xform:M0});if(p.error)throw p.error;const y=await p.json(),v=(l=p.headers.get("x-total-count"))!==null&&l!==void 0?l:0,w=(d=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&d!==void 0?d:[];return w.length>0&&(w.forEach(b=>{const S=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),_=JSON.parse(b.split(";")[1].split("=")[1]);f[`${_}Page`]=S}),f.total=parseInt(v)),{data:Object.assign(Object.assign({},y),f),error:null}}catch(f){if(ge(f))return{data:{clients:[]},error:f};throw f}}async _createOAuthClient(t){try{return await be(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ge(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await be(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ge(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await be(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ge(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await be(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ge(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await be(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ge(n))return{data:null,error:n};throw n}}}function U0(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const Fs={debug:!!(globalThis&&Vw()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Hw extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class pP extends Hw{}async function mP(e,t,n){Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout(()=>{r.abort(),Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async o=>{if(o){Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,o.name);try{return await n()}finally{Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,o.name)}}else{if(t===0)throw Fs.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new pP(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Fs.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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 gP(){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 Ww(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function yP(e){return parseInt(e,16)}function vP(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function xP(e){var t;const{chainId:n,domain:r,expirationTime:o,issuedAt:a=new Date,nonce:l,notBefore:c,requestId:d,resources:f,scheme:p,uri:y,version:v}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(l&&l.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${l}`);if(!y)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(v!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${v}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
|
|
48
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const w=Ww(e.address),b=p?`${p}://${r}`:r,S=e.statement?`${e.statement}
|
|
49
|
+
`:"",_=`${b} wants you to sign in with your Ethereum account:
|
|
50
|
+
${w}
|
|
51
|
+
|
|
52
|
+
${S}`;let E=`URI: ${y}
|
|
53
|
+
Version: ${v}
|
|
54
|
+
Chain ID: ${n}${l?`
|
|
55
|
+
Nonce: ${l}`:""}
|
|
56
|
+
Issued At: ${a.toISOString()}`;if(o&&(E+=`
|
|
57
|
+
Expiration Time: ${o.toISOString()}`),c&&(E+=`
|
|
58
|
+
Not Before: ${c.toISOString()}`),d&&(E+=`
|
|
59
|
+
Request ID: ${d}`),f){let P=`
|
|
60
|
+
Resources:`;for(const j of f){if(!j||typeof j!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${j}`);P+=`
|
|
61
|
+
- ${j}`}E+=P}return`${_}
|
|
62
|
+
${E}`}class ut extends Error{constructor({message:t,code:n,cause:r,name:o}){var a;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(a=o??(r instanceof Error?r.name:void 0))!==null&&a!==void 0?a:"Unknown Error",this.code=n}}class zl extends ut{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function wP({error:e,options:t}){var n,r,o;const{publicKey:a}=t;if(!a)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ut({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=a.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new ut({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=a.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new ut({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((o=a.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new ut({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new ut({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new ut({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return a.pubKeyCredParams.filter(c=>c.type==="public-key").length===0?new ut({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new ut({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const l=window.location.hostname;if(Kw(l)){if(a.rp.id!==l)return new ut({message:`The RP ID "${a.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ut({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new ut({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new ut({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new ut({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function bP({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ut({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new ut({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Kw(r)){if(n.rpId!==r)return new ut({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ut({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new ut({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new ut({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class kP{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const SP=new kP;function _P(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,o=ru(e,["challenge","user","excludeCredentials"]),a=Zs(t).buffer,l=Object.assign(Object.assign({},n),{id:Zs(n.id).buffer}),c=Object.assign(Object.assign({},o),{challenge:a,user:l});if(r&&r.length>0){c.excludeCredentials=new Array(r.length);for(let d=0;d<r.length;d++){const f=r[d];c.excludeCredentials[d]=Object.assign(Object.assign({},f),{id:Zs(f.id).buffer,type:f.type||"public-key",transports:f.transports})}}return c}function EP(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=ru(e,["challenge","allowCredentials"]),o=Zs(t).buffer,a=Object.assign(Object.assign({},r),{challenge:o});if(n&&n.length>0){a.allowCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];a.allowCredentials[l]=Object.assign(Object.assign({},c),{id:Zs(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function TP(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:ns(new Uint8Array(e.response.attestationObject)),clientDataJSON:ns(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function CP(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),o=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:ns(new Uint8Array(o.authenticatorData)),clientDataJSON:ns(new Uint8Array(o.clientDataJSON)),signature:ns(new Uint8Array(o.signature)),userHandle:o.userHandle?ns(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Kw(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function z0(){var e,t;return!!(bt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.get)=="function")}async function jP(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new zl("Browser returned unexpected credential type",t)}:{data:null,error:new zl("Empty credential response",t)}}catch(t){return{data:null,error:wP({error:t,options:e})}}}async function AP(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new zl("Browser returned unexpected credential type",t)}:{data:null,error:new zl("Empty credential response",t)}}catch(t){return{data:null,error:bP({error:t,options:e})}}}const PP={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},NP={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Fl(...e){const t=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),n=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),r={};for(const o of e)if(o)for(const a in o){const l=o[a];if(l!==void 0)if(Array.isArray(l))r[a]=l;else if(n(l))r[a]=l;else if(t(l)){const c=r[a];t(c)?r[a]=Fl(c,l):r[a]=Fl(l)}else r[a]=l}return r}function RP(e,t){return Fl(PP,e,t||{})}function OP(e,t){return Fl(NP,e,t||{})}class IP{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:o},a){try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!l)return{data:null,error:c};const d=o??SP.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:f}=l.webauthn.credential_options.publicKey;f.name||(f.name=`${f.id}:${r}`),f.displayName||(f.displayName=f.name)}switch(l.webauthn.type){case"create":{const f=RP(l.webauthn.credential_options.publicKey,a?.create),{data:p,error:y}=await jP({publicKey:f,signal:d});return p?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:p}},error:null}:{data:null,error:y}}case"request":{const f=OP(l.webauthn.credential_options.publicKey,a?.request),{data:p,error:y}=await AP(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:f,signal:d}));return p?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:p}},error:null}:{data:null,error:y}}}}catch(l){return ge(l)?{data:null,error:l}:{data:null,error:new Zr("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},a){if(!n)return{data:null,error:new Ro("rpId is required for WebAuthn authentication")};try{if(!z0())return{data:null,error:new Zr("Browser does not support WebAuthn",null)};const{data:l,error:c}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:o},{request:a});if(!l)return{data:null,error:c};const{webauthn:d}=l;return this._verify({factorId:t,challengeId:l.challengeId,webauthn:{type:d.type,rpId:n,rpOrigins:r,credential_response:d.credential_response}})}catch(l){return ge(l)?{data:null,error:l}:{data:null,error:new Zr("Unexpected error in authenticate",l)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},a){if(!n)return{data:null,error:new Ro("rpId is required for WebAuthn registration")};try{if(!z0())return{data:null,error:new Zr("Browser does not support WebAuthn",null)};const{data:l,error:c}=await this._enroll({friendlyName:t});if(!l)return await this.client.mfa.listFactors().then(p=>{var y;return(y=p.data)===null||y===void 0?void 0:y.all.find(v=>v.factor_type==="webauthn"&&v.friendly_name===t&&v.status!=="unverified")}).then(p=>p?this.client.mfa.unenroll({factorId:p?.id}):void 0),{data:null,error:c};const{data:d,error:f}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:o},{create:a});return d?this._verify({factorId:l.id,challengeId:d.challengeId,webauthn:{rpId:n,rpOrigins:r,type:d.webauthn.type,credential_response:d.webauthn.credential_response}}):{data:null,error:f}}catch(l){return ge(l)?{data:null,error:l}:{data:null,error:new Zr("Unexpected error in register",l)}}}}gP();const LP={url:PA,storageKey:NA,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:RA,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function F0(e,t,n){return await n()}const $s={};class Oo{get jwks(){var t,n;return(n=(t=$s[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){$s[this.storageKey]=Object.assign(Object.assign({},$s[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=$s[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){$s[this.storageKey]=Object.assign(Object.assign({},$s[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,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 a=Object.assign(Object.assign({},LP),t);if(this.storageKey=a.storageKey,this.instanceID=(n=Oo.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Oo.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&bt()){const l=`${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(l),this.logDebugMessages&&console.trace(l)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.admin=new fP({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=qw(a.fetch),this.lock=a.lock||F0,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock?this.lock=a.lock:this.persistSession&&bt()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=mP:this.lock=F0,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 IP(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?(a.storage?this.storage=a.storage:Vw()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=U0(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=U0(this.memoryStorage)),bt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(l){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",l)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async l=>{this._debug("received broadcast notification from other tab or client",l),await this._notifyAllSubscribers(l.data.event,l.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Fw}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},r="none";if(bt()&&(n=KA(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),bt()&&this.detectSessionInUrl&&r!=="none"){const{data:o,error:a}=await this._getSessionFromURL(n,r);if(a){if(this._debug("#_initialize()","error detecting session from URL",a),UA(a)){const d=(t=a.details)===null||t===void 0?void 0:t.code;if(d==="identity_already_exists"||d==="identity_not_found"||d==="single_identity_not_deletable")return{error:a}}return{error:a}}const{session:l,redirectType:c}=o;return this._debug("#_initialize()","detected session in URL",l,"redirect type",c),await this._saveSession(l),setTimeout(async()=>{c==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",l):await this._notifyAllSubscribers("SIGNED_IN",l)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return ge(n)?this._returnResult({error:n}):this._returnResult({error:new Zr("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,o;try{const a=await be(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t?.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(o=t?.options)===null||o===void 0?void 0:o.captchaToken}},xform:wn}),{data:l,error:c}=a;if(c||!l)return this._returnResult({data:{user:null,session:null},error:c});const d=l.session,f=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",d)),this._returnResult({data:{user:f,session:d},error:null})}catch(a){if(ge(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signUp(t){var n,r,o;try{let a;if("email"in t){const{email:p,password:y,options:v}=t;let w=null,b=null;this.flowType==="pkce"&&([w,b]=await Us(this.storage,this.storageKey)),a=await be(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:v?.emailRedirectTo,body:{email:p,password:y,data:(n=v?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:v?.captchaToken},code_challenge:w,code_challenge_method:b},xform:wn})}else if("phone"in t){const{phone:p,password:y,options:v}=t;a=await be(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:p,password:y,data:(r=v?.data)!==null&&r!==void 0?r:{},channel:(o=v?.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:v?.captchaToken}},xform:wn})}else throw new ml("You must provide either an email or phone number and a password");const{data:l,error:c}=a;if(c||!l)return await wt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:c});const d=l.session,f=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",d)),this._returnResult({data:{user:f,session:d},error:null})}catch(a){if(await wt(this.storage,`${this.storageKey}-code-verifier`),ge(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithPassword(t){try{let n;if("email"in t){const{email:a,password:l,options:c}=t;n=await be(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:l,gotrue_meta_security:{captcha_token:c?.captchaToken}},xform:D0})}else if("phone"in t){const{phone:a,password:l,options:c}=t;n=await be(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:l,gotrue_meta_security:{captcha_token:c?.captchaToken}},xform:D0})}else throw new ml("You must provide either an email or phone number and a password");const{data:r,error:o}=n;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!r||!r.session||!r.user){const a=new Ms;return this._returnResult({data:{user:null,session:null},error:a})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:o})}catch(n){if(ge(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,o,a;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(o=t.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(a=t.options)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,o,a,l,c,d,f,p,y,v;let w,b;if("message"in t)w=t.message,b=t.signature;else{const{chain:S,wallet:_,statement:E,options:P}=t;let j;if(bt())if(typeof _=="object")j=_;else{const J=window;if("ethereum"in J&&typeof J.ethereum=="object"&&"request"in J.ethereum&&typeof J.ethereum.request=="function")j=J.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 _!="object"||!P?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=_}const D=new URL((n=P?.url)!==null&&n!==void 0?n:window.location.href),$=await j.request({method:"eth_requestAccounts"}).then(J=>J).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!$||$.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const O=Ww($[0]);let z=(r=P?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!z){const J=await j.request({method:"eth_chainId"});z=yP(J)}const q={domain:D.host,address:O,statement:E,uri:D.href,version:"1",chainId:z,nonce:(o=P?.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(l=(a=P?.signInWithEthereum)===null||a===void 0?void 0:a.issuedAt)!==null&&l!==void 0?l:new Date,expirationTime:(c=P?.signInWithEthereum)===null||c===void 0?void 0:c.expirationTime,notBefore:(d=P?.signInWithEthereum)===null||d===void 0?void 0:d.notBefore,requestId:(f=P?.signInWithEthereum)===null||f===void 0?void 0:f.requestId,resources:(p=P?.signInWithEthereum)===null||p===void 0?void 0:p.resources};w=xP(q),b=await j.request({method:"personal_sign",params:[vP(w),O]})}try{const{data:S,error:_}=await be(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:w,signature:b},!((y=t.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(v=t.options)===null||v===void 0?void 0:v.captchaToken}}:null),xform:wn});if(_)throw _;if(!S||!S.session||!S.user){const E=new Ms;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:_})}catch(S){if(ge(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(t){var n,r,o,a,l,c,d,f,p,y,v,w;let b,S;if("message"in t)b=t.message,S=t.signature;else{const{chain:_,wallet:E,statement:P,options:j}=t;let D;if(bt())if(typeof E=="object")D=E;else{const O=window;if("solana"in O&&typeof O.solana=="object"&&("signIn"in O.solana&&typeof O.solana.signIn=="function"||"signMessage"in O.solana&&typeof O.solana.signMessage=="function"))D=O.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"||!j?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=E}const $=new URL((n=j?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in D&&D.signIn){const O=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},j?.signInWithSolana),{version:"1",domain:$.host,uri:$.href}),P?{statement:P}:null));let z;if(Array.isArray(O)&&O[0]&&typeof O[0]=="object")z=O[0];else if(O&&typeof O=="object"&&"signedMessage"in O&&"signature"in O)z=O;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in z&&"signature"in z&&(typeof z.signedMessage=="string"||z.signedMessage instanceof Uint8Array)&&z.signature instanceof Uint8Array)b=typeof z.signedMessage=="string"?z.signedMessage:new TextDecoder().decode(z.signedMessage),S=z.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in D)||typeof D.signMessage!="function"||!("publicKey"in D)||typeof D!="object"||!D.publicKey||!("toBase58"in D.publicKey)||typeof D.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${$.host} wants you to sign in with your Solana account:`,D.publicKey.toBase58(),...P?["",P,""]:[""],"Version: 1",`URI: ${$.href}`,`Issued At: ${(o=(r=j?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((a=j?.signInWithSolana)===null||a===void 0)&&a.notBefore?[`Not Before: ${j.signInWithSolana.notBefore}`]:[],...!((l=j?.signInWithSolana)===null||l===void 0)&&l.expirationTime?[`Expiration Time: ${j.signInWithSolana.expirationTime}`]:[],...!((c=j?.signInWithSolana)===null||c===void 0)&&c.chainId?[`Chain ID: ${j.signInWithSolana.chainId}`]:[],...!((d=j?.signInWithSolana)===null||d===void 0)&&d.nonce?[`Nonce: ${j.signInWithSolana.nonce}`]:[],...!((f=j?.signInWithSolana)===null||f===void 0)&&f.requestId?[`Request ID: ${j.signInWithSolana.requestId}`]:[],...!((y=(p=j?.signInWithSolana)===null||p===void 0?void 0:p.resources)===null||y===void 0)&&y.length?["Resources",...j.signInWithSolana.resources.map(z=>`- ${z}`)]:[]].join(`
|
|
63
|
+
`);const O=await D.signMessage(new TextEncoder().encode(b),"utf8");if(!O||!(O instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=O}}try{const{data:_,error:E}=await be(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:ns(S)},!((v=t.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(w=t.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:wn});if(E)throw E;if(!_||!_.session||!_.user){const P=new Ms;return this._returnResult({data:{user:null,session:null},error:P})}return _.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("SIGNED_IN",_.session)),this._returnResult({data:Object.assign({},_),error:E})}catch(_){if(ge(_))return this._returnResult({data:{user:null,session:null},error:_});throw _}}async _exchangeCodeForSession(t){const n=await Gr(this.storage,`${this.storageKey}-code-verifier`),[r,o]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new zA;const{data:a,error:l}=await be(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:wn});if(await wt(this.storage,`${this.storageKey}-code-verifier`),l)throw l;if(!a||!a.session||!a.user){const c=new Ms;return this._returnResult({data:{user:null,session:null,redirectType:null},error:c})}return a.session&&(await this._saveSession(a.session),setTimeout(async()=>{await this._notifyAllSubscribers("SIGNED_IN",a.session)},0)),this._returnResult({data:Object.assign(Object.assign({},a),{redirectType:o??null}),error:l})}catch(a){if(await wt(this.storage,`${this.storageKey}-code-verifier`),ge(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(t){try{const{options:n,provider:r,token:o,access_token:a,nonce:l}=t,c=await be(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:o,access_token:a,nonce:l,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:wn}),{data:d,error:f}=c;if(f)return this._returnResult({data:{user:null,session:null},error:f});if(!d||!d.session||!d.user){const p=new Ms;return this._returnResult({data:{user:null,session:null},error:p})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",d.session)),this._returnResult({data:d,error:f})}catch(n){if(ge(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,o,a,l;try{if("email"in t){const{email:c,options:d}=t;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await Us(this.storage,this.storageKey));const{error:y}=await be(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:c,data:(n=d?.data)!==null&&n!==void 0?n:{},create_user:(r=d?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:p},redirectTo:d?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:y})}if("phone"in t){const{phone:c,options:d}=t,{data:f,error:p}=await be(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:c,data:(o=d?.data)!==null&&o!==void 0?o:{},create_user:(a=d?.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:d?.captchaToken},channel:(l=d?.channel)!==null&&l!==void 0?l:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:f?.message_id},error:p})}throw new ml("You must provide either an email or phone number.")}catch(c){if(await wt(this.storage,`${this.storageKey}-code-verifier`),ge(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async verifyOtp(t){var n,r;try{let o,a;"options"in t&&(o=(n=t.options)===null||n===void 0?void 0:n.redirectTo,a=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:l,error:c}=await be(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:a}}),redirectTo:o,xform:wn});if(c)throw c;if(!l)throw new Error("An error occurred on token verification.");const d=l.session,f=l.user;return d?.access_token&&(await this._saveSession(d),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",d)),this._returnResult({data:{user:f,session:d},error:null})}catch(o){if(ge(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(t){var n,r,o,a,l;try{let c=null,d=null;this.flowType==="pkce"&&([c,d]=await Us(this.storage,this.storageKey));const f=await be(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((o=t?.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:c,code_challenge_method:d}),headers:this.headers,xform:cP});return!((a=f.data)===null||a===void 0)&&a.url&&bt()&&!(!((l=t.options)===null||l===void 0)&&l.skipBrowserRedirect)&&window.location.assign(f.data.url),this._returnResult(f)}catch(c){if(await wt(this.storage,`${this.storageKey}-code-verifier`),ge(c))return this._returnResult({data:null,error:c});throw c}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new Jt;const{error:o}=await be(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(t){if(ge(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:o,options:a}=t,{error:l}=await be(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},redirectTo:a?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:l})}else if("phone"in t){const{phone:r,type:o,options:a}=t,{data:l,error:c}=await be(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:o,gotrue_meta_security:{captcha_token:a?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:l?.message_id},error:c})}throw new ml("You must provide either an email or phone number and a type")}catch(n){if(ge(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await Gr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<bd:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const l=await Gr(this.userStorage,this.storageKey+"-user");l?.user?t.user=l.user:t.user=_d()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const l={value:this.suppressGetSessionWarning};t.user=oP(t.user,l),l.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:o,error:a}=await this._callRefreshToken(t.refresh_token);return a?this._returnResult({data:{session:null},error:a}):this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await be(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Tr}):await this._useSession(async n=>{var r,o,a;const{data:l,error:c}=n;if(c)throw c;return!(!((r=l.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Jt}:await be(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(o=l.session)===null||o===void 0?void 0:o.access_token)!==null&&a!==void 0?a:void 0,xform:Tr})})}catch(n){if(ge(n))return MA(n)&&(await this._removeSession(),await wt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:o,error:a}=r;if(a)throw a;if(!o.session)throw new Jt;const l=o.session;let c=null,d=null;this.flowType==="pkce"&&t.email!=null&&([c,d]=await Us(this.storage,this.storageKey));const{data:f,error:p}=await be(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:c,code_challenge_method:d}),jwt:l.access_token,xform:Tr});if(p)throw p;return l.user=f.user,await this._saveSession(l),await this._notifyAllSubscribers("USER_UPDATED",l),this._returnResult({data:{user:l.user},error:null})})}catch(r){if(await wt(this.storage,`${this.storageKey}-code-verifier`),ge(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Jt;const n=Date.now()/1e3;let r=n,o=!0,a=null;const{payload:l}=Sd(t.access_token);if(l.exp&&(r=l.exp,o=r<=n),o){const{data:c,error:d}=await this._callRefreshToken(t.refresh_token);if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!c)return{data:{user:null,session:null},error:null};a=c}else{const{data:c,error:d}=await this._getUser(t.access_token);if(d)throw d;a={access_token:t.access_token,refresh_token:t.refresh_token,user:c.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(n){if(ge(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:l,error:c}=n;if(c)throw c;t=(r=l.session)!==null&&r!==void 0?r:void 0}if(!t?.refresh_token)throw new Jt;const{data:o,error:a}=await this._callRefreshToken(t.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(ge(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){try{if(!bt())throw new gl("No browser detected.");if(t.error||t.error_description||t.error_code)throw new gl(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new A0("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new gl("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new A0("No code detected.");const{data:P,error:j}=await this._exchangeCodeForSession(t.code);if(j)throw j;const D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:P.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:o,access_token:a,refresh_token:l,expires_in:c,expires_at:d,token_type:f}=t;if(!a||!c||!l||!f)throw new gl("No session defined in URL");const p=Math.round(Date.now()/1e3),y=parseInt(c);let v=p+y;d&&(v=parseInt(d));const w=v-p;w*1e3<=Hs&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${w}s, should have been closer to ${y}s`);const b=v-y;p-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,v,p):p-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,v,p);const{data:S,error:_}=await this._getUser(a);if(_)throw _;const E={provider_token:r,provider_refresh_token:o,access_token:a,expires_in:y,expires_at:v,refresh_token:l,token_type:f,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:E,redirectType:t.type},error:null})}catch(r){if(ge(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await Gr(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:o,error:a}=n;if(a)return this._returnResult({error:a});const l=(r=o.session)===null||r===void 0?void 0:r.access_token;if(l){const{error:c}=await this.admin.signOut(l,t);if(c&&!(DA(c)&&(c.status===404||c.status===401||c.status===403)))return this._returnResult({error:c})}return t!=="others"&&(await this._removeSession(),await wt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=WA(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,o;try{const{data:{session:a},error:l}=n;if(l)throw l;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",t,"session",a)}catch(a){await((o=this.stateChangeEmitters.get(t))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",a),console.error(a)}})}async resetPasswordForEmail(t,n={}){let r=null,o=null;this.flowType==="pkce"&&([r,o]=await Us(this.storage,this.storageKey,!0));try{return await be(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:o,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(a){if(await wt(this.storage,`${this.storageKey}-code-verifier`),ge(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(ge(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:o}=await this._useSession(async a=>{var l,c,d,f,p;const{data:y,error:v}=a;if(v)throw v;const w=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(l=t.options)===null||l===void 0?void 0:l.redirectTo,scopes:(c=t.options)===null||c===void 0?void 0:c.scopes,queryParams:(d=t.options)===null||d===void 0?void 0:d.queryParams,skipBrowserRedirect:!0});return await be(this.fetch,"GET",w,{headers:this.headers,jwt:(p=(f=y.session)===null||f===void 0?void 0:f.access_token)!==null&&p!==void 0?p:void 0})});if(o)throw o;return bt()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r?.url),this._returnResult({data:{provider:t.provider,url:r?.url},error:null})}catch(r){if(ge(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:o,data:{session:a}}=n;if(o)throw o;const{options:l,provider:c,token:d,access_token:f,nonce:p}=t,y=await be(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=a?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:c,id_token:d,access_token:f,nonce:p,link_identity:!0,gotrue_meta_security:{captcha_token:l?.captchaToken}},xform:wn}),{data:v,error:w}=y;return w?this._returnResult({data:{user:null,session:null},error:w}):!v||!v.session||!v.user?this._returnResult({data:{user:null,session:null},error:new Ms}):(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("USER_UPDATED",v.session)),this._returnResult({data:v,error:w}))}catch(o){if(await wt(this.storage,`${this.storageKey}-code-verifier`),ge(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,o;const{data:a,error:l}=n;if(l)throw l;return await be(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(o=(r=a.session)===null||r===void 0?void 0:r.access_token)!==null&&o!==void 0?o:void 0})})}catch(n){if(ge(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await YA(async o=>(o>0&&await JA(200*Math.pow(2,o-1)),this._debug(n,"refreshing attempt",o),await be(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:wn})),(o,a)=>{const l=200*Math.pow(2,o);return a&&kd(a)&&Date.now()+l-r<Hs})}catch(r){if(this._debug(n,"error",r),ge(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),bt()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const o=await Gr(this.storage,this.storageKey);if(o&&this.userStorage){let l=await Gr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!l&&(l={user:o.user},await Ws(this.userStorage,this.storageKey+"-user",l)),o.user=(t=l?.user)!==null&&t!==void 0?t:_d()}else if(o&&!o.user&&!o.user){const l=await Gr(this.storage,this.storageKey+"-user");l&&l?.user?(o.user=l.user,await wt(this.storage,this.storageKey+"-user"),await Ws(this.storage,this.storageKey,o)):o.user=_d()}if(this._debug(r,"session from storage",o),!this._isValidSession(o)){this._debug(r,"session is not valid"),o!==null&&await this._removeSession();return}const a=((n=o.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<bd;if(this._debug(r,`session has${a?"":" not"} expired with margin of ${bd}s`),a){if(this.autoRefreshToken&&o.refresh_token){const{error:l}=await this._callRefreshToken(o.refresh_token);l&&(console.error(l),kd(l)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",l),await this._removeSession()))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{const{data:l,error:c}=await this._getUser(o.access_token);!c&&l?.user?(o.user=l.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(l){console.error("Error getting user data:",l),this._debug(r,"error getting user data, skipping SIGNED_IN notification",l)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(r,"error",o),console.error(o);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new Jt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const o=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new iu;const{data:a,error:l}=await this._refreshAccessToken(t);if(l)throw l;if(!a.session)throw new Jt;await this._saveSession(a.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",a.session);const c={data:a.session,error:null};return this.refreshingDeferred.resolve(c),c}catch(a){if(this._debug(o,"error",a),ge(a)){const l={data:null,error:a};return kd(a)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(l),l}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(a),a}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(t,n,r=!0){const o=`#_notifyAllSubscribers(${t})`;this._debug(o,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const a=[],l=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(t,n)}catch(d){a.push(d)}});if(await Promise.all(l),a.length>0){for(let c=0;c<a.length;c+=1)console.error(a[c]);throw a[0]}}finally{this._debug(o,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await wt(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Ws(this.userStorage,this.storageKey+"-user",{user:n.user});const o=Object.assign({},n);delete o.user;const a=I0(o);await Ws(this.storage,this.storageKey,a)}else{const o=I0(n);await Ws(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await wt(this.storage,this.storageKey),await wt(this.storage,this.storageKey+"-code-verifier"),await wt(this.storage,this.storageKey+"-user"),this.userStorage&&await wt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&bt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Hs);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((r.expires_at*1e3-t)/Hs);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${Hs}ms, refresh threshold is ${yh} ticks`),o<=yh&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof Hw)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!bt()||!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(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,r){const o=[`provider=${encodeURIComponent(n)}`];if(r?.redirectTo&&o.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&o.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[a,l]=await Us(this.storage,this.storageKey),c=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(l)}`});o.push(c.toString())}if(r?.queryParams){const a=new URLSearchParams(r.queryParams);o.push(a.toString())}return r?.skipBrowserRedirect&&o.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${o.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:o,error:a}=n;return a?this._returnResult({data:null,error:a}):await be(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=o?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(ge(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,o;const{data:a,error:l}=n;if(l)return this._returnResult({data:null,error:l});const c=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:d,error:f}=await be(this.fetch,"POST",`${this.url}/factors`,{body:c,headers:this.headers,jwt:(r=a?.session)===null||r===void 0?void 0:r.access_token});return f?this._returnResult({data:null,error:f}):(t.factorType==="totp"&&d.type==="totp"&&(!((o=d?.totp)===null||o===void 0)&&o.qr_code)&&(d.totp.qr_code=`data:image/svg+xml;utf-8,${d.totp.qr_code}`),this._returnResult({data:d,error:null}))})}catch(n){if(ge(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:o,error:a}=n;if(a)return this._returnResult({data:null,error:a});const l=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?TP(t.webauthn.credential_response):CP(t.webauthn.credential_response)})}:{code:t.code}),{data:c,error:d}=await be(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:l,headers:this.headers,jwt:(r=o?.session)===null||r===void 0?void 0:r.access_token});return d?this._returnResult({data:null,error:d}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+c.expires_in},c)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",c),this._returnResult({data:c,error:d}))})}catch(n){if(ge(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:o,error:a}=n;if(a)return this._returnResult({data:null,error:a});const l=await be(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=o?.session)===null||r===void 0?void 0:r.access_token});if(l.error)return l;const{data:c}=l;if(c.type!=="webauthn")return{data:c,error:null};switch(c.webauthn.type){case"create":return{data:Object.assign(Object.assign({},c),{webauthn:Object.assign(Object.assign({},c.webauthn),{credential_options:Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:_P(c.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},c),{webauthn:Object.assign(Object.assign({},c.webauthn),{credential_options:Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:EP(c.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(ge(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const o={all:[],phone:[],totp:[],webauthn:[]};for(const a of(t=n?.factors)!==null&&t!==void 0?t:[])o.all.push(a),a.status==="verified"&&o[a.factor_type].push(a);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:r},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:a}=Sd(r.access_token);let l=null;a.aal&&(l=a.aal);let c=l;((n=(t=r.user.factors)===null||t===void 0?void 0:t.filter(p=>p.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(c="aal2");const f=a.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:o}=n;return o?this._returnResult({data:null,error:o}):r?await be(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new Jt})})}catch(n){if(ge(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:o},error:a}=r;if(a)return this._returnResult({data:null,error:a});if(!o)return this._returnResult({data:null,error:new Jt});const l=await be(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:c=>({data:c,error:null})});return l.data&&l.data.redirect_url&&bt()&&!n?.skipBrowserRedirect&&window.location.assign(l.data.redirect_url),l})}catch(r){if(ge(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:o},error:a}=r;if(a)return this._returnResult({data:null,error:a});if(!o)return this._returnResult({data:null,error:new Jt});const l=await be(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:c=>({data:c,error:null})});return l.data&&l.data.redirect_url&&bt()&&!n?.skipBrowserRedirect&&window.location.assign(l.data.redirect_url),l})}catch(r){if(ge(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await be(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 Jt})})}catch(t){if(ge(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:o}=n;return o?this._returnResult({data:null,error:o}):r?(await be(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Jt})})}catch(n){if(ge(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(c=>c.kid===t);if(r)return r;const o=Date.now();if(r=this.jwks.keys.find(c=>c.kid===t),r&&this.jwks_cached_at+IA>o)return r;const{data:a,error:l}=await be(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(l)throw l;return!a.keys||a.keys.length===0||(this.jwks=a,this.jwks_cached_at=o,r=a.keys.find(c=>c.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:w,error:b}=await this.getSession();if(b||!w.session)return this._returnResult({data:null,error:b});r=w.session.access_token}const{header:o,payload:a,signature:l,raw:{header:c,payload:d}}=Sd(r);n?.allowExpired||rP(a.exp);const f=!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(!f){const{error:w}=await this.getUser(r);if(w)throw w;return{data:{claims:a,header:o,signature:l},error:null}}const p=sP(o.alg),y=await crypto.subtle.importKey("jwk",f,p,!0,["verify"]);if(!await crypto.subtle.verify(p,y,l,qA(`${c}.${d}`)))throw new wh("Invalid JWT signature");return{data:{claims:a,header:o,signature:l},error:null}}catch(r){if(ge(r))return this._returnResult({data:null,error:r});throw r}}}Oo.nextInstanceID={};const DP=Oo,MP="2.91.0";let co="";typeof Deno<"u"?co="deno":typeof document<"u"?co="web":typeof navigator<"u"&&navigator.product==="ReactNative"?co="react-native":co="node";const UP={"X-Client-Info":`supabase-js-${co}/${MP}`},zP={headers:UP},FP={schema:"public"},$P={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},BP={};function Io(e){"@babel/helpers - typeof";return Io=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Io(e)}function VP(e,t){if(Io(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Io(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qP(e){var t=VP(e,"string");return Io(t)=="symbol"?t:t+""}function HP(e,t,n){return(t=qP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$0(Object(n),!0).forEach(function(r){HP(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const WP=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),KP=()=>Headers,GP=(e,t,n)=>{const r=WP(n),o=KP();return async(a,l)=>{var c;const d=(c=await t())!==null&&c!==void 0?c:e;let f=new o(l?.headers);return f.has("apikey")||f.set("apikey",e),f.has("Authorization")||f.set("Authorization",`Bearer ${d}`),r(a,tt(tt({},l),{},{headers:f}))}};function JP(e){return e.endsWith("/")?e:e+"/"}function YP(e,t){var n,r;const{db:o,auth:a,realtime:l,global:c}=e,{db:d,auth:f,realtime:p,global:y}=t,v={db:tt(tt({},d),o),auth:tt(tt({},f),a),realtime:tt(tt({},p),l),storage:{},global:tt(tt(tt({},y),c),{},{headers:tt(tt({},(n=y?.headers)!==null&&n!==void 0?n:{}),(r=c?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?v.accessToken=e.accessToken:delete v.accessToken,v}function XP(e){const t=e?.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(JP(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var QP=class extends DP{constructor(e){super(e)}},ZP=class{constructor(e,t,n){var r,o;this.supabaseUrl=e,this.supabaseKey=t;const a=XP(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const l=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:FP,realtime:BP,auth:tt(tt({},$P),{},{storageKey:l}),global:zP},d=YP(n??{},c);if(this.storageKey=(r=d.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(o=d.global.headers)!==null&&o!==void 0?o:{},d.accessToken)this.accessToken=d.accessToken,this.auth=new Proxy({},{get:(p,y)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(y)} is not possible`)}});else{var f;this.auth=this._initSupabaseAuthClient((f=d.auth)!==null&&f!==void 0?f:{},this.headers,d.global.fetch)}this.fetch=GP(t,this._getAccessToken.bind(this),d.global.fetch),this.realtime=this._initRealtimeClient(tt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},d.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(p=>this.realtime.setAuth(p)).catch(p=>console.warn("Failed to set initial Realtime auth token:",p)),this.rest=new Rj(new URL("rest/v1",a).href,{headers:this.headers,schema:d.db.schema,fetch:this.fetch}),this.storage=new AA(this.storageUrl.href,this.headers,this.fetch,n?.storage),d.accessToken||this._listenForAuthEvents()}get functions(){return new Cj(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:o,storageKey:a,flowType:l,lock:c,debug:d,throwOnError:f},p,y){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new QP({url:this.authUrl.href,headers:tt(tt({},v),p),storageKey:a,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:o,flowType:l,lock:c,debug:d,throwOnError:f,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(w=>w.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Jj(this.realtimeUrl.href,tt(tt({},e),{},{params:tt(tt({},{apikey:this.supabaseKey}),e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t?.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const eN=(e,t,n)=>new ZP(e,t,n);function tN(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}tN()&&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 ou="alchemy_supabase_config";function Tf(){try{const e=localStorage.getItem(ou);if(e)return JSON.parse(e)}catch(e){console.error("Error reading Supabase config:",e)}return null}function nN(e){try{localStorage.setItem(ou,JSON.stringify(e))}catch(t){console.error("Error saving Supabase config:",t)}}function rN(){try{localStorage.removeItem(ou)}catch(e){console.error("Error clearing Supabase config:",e)}}async function sN(e,t){try{if(!e.startsWith("http://")&&!e.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const n=t.startsWith("eyJ"),r=t.startsWith("sb_publishable_");if(!n&&!r)return{valid:!1,error:"Invalid API key format"};if(r)return{valid:!0};const o=await fetch(`${e}/rest/v1/`,{method:"GET",headers:{apikey:t,Authorization:`Bearer ${t}`}});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 iN(){return localStorage.getItem(ou)?"ui":"none"}const Cf=Tf(),oN=Cf?.url||void 0||"https://placeholder.supabase.co",aN=Cf?.anonKey||void 0||"placeholder",Ee=eN(oN,aN,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),B0=!!Cf?.url;function lN({length:e=6,value:t,onChange:n,onComplete:r,disabled:o=!1,error:a=!1}){const l=L.useRef([]),[c,d]=L.useState(null),f=(v,w)=>{const b=w.replace(/[^0-9]/g,"");if(b.length===0){const E=t.split("");v<E.length&&E.splice(v,1);const P=E.join("");n(P),v>0&&l.current[v-1]?.focus();return}const S=[...t];S[v]=b[0];const _=S.join("");n(_),v<e-1&&b!==""&&l.current[v+1]?.focus(),_.length===e&&r&&r(_)},p=(v,w)=>{w.key==="Backspace"&&!t[v]&&v>0||w.key==="ArrowLeft"&&v>0?l.current[v-1]?.focus():w.key==="ArrowRight"&&v<e-1&&l.current[v+1]?.focus()},y=v=>{v.preventDefault();const b=v.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,e);n(b);const S=Math.min(b.length,e-1);l.current[S]?.focus(),b.length===e&&r&&r(b)};return g.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:e}).map((v,w)=>g.jsx("input",{ref:b=>{l.current[w]=b},type:"text",inputMode:"numeric",maxLength:1,value:t[w]||"",onChange:b=>f(w,b.target.value),onKeyDown:b=>p(w,b),onPaste:y,onFocus:()=>d(w),onBlur:()=>d(null),disabled:o,className:`
|
|
64
|
+
w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-black
|
|
65
|
+
bg-black/20 border border-border/50 rounded-xl outline-none transition-all
|
|
66
|
+
${a?"border-error/50 shadow-[0_0_15px_rgba(239,68,68,0.1)]":"focus:border-primary/50"}
|
|
67
|
+
${c===w?"border-primary/50 bg-black/40 scale-105":""}
|
|
68
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
69
|
+
`,"aria-label":`Digit ${w+1}`},w))})}function uN({onAuthSuccess:e,isInitialized:t=!0}){const[n,r]=L.useState(""),[o,a]=L.useState(""),[l,c]=L.useState(""),[d,f]=L.useState(""),[p,y]=L.useState(!1),[v,w]=L.useState(!t),[b,S]=L.useState(null),[_,E]=L.useState("password"),[P,j]=L.useState("email"),[D,$]=L.useState(""),O=async q=>{q.preventDefault(),y(!0),S(null);try{if(v){const{error:J}=await Ee.auth.signUp({email:n,password:o,options:{data:{first_name:l,last_name:d,full_name:`${l} ${d}`.trim()}}});if(J)throw J;e()}else if(_==="password"){const{error:J}=await Ee.auth.signInWithPassword({email:n,password:o});if(J)throw J;e()}else if(_==="otp")if(P==="email"){const{error:J}=await Ee.auth.signInWithOtp({email:n,options:{shouldCreateUser:!1}});if(J)throw J;j("verify")}else await z()}catch(J){S(J.message)}finally{y(!1)}},z=async()=>{y(!0),S(null);try{const{data:q,error:J}=await Ee.auth.verifyOtp({email:n,token:D,type:"magiclink"});if(J)throw J;if(!q.session)throw new Error("Failed to create session");e()}catch(q){S(q.message||"Invalid code")}finally{y(!1)}};return g.jsx("div",{className:"flex flex-col items-center justify-center p-8 h-full bg-gradient-to-t from-bg to-bg/50",children:g.jsxs(ze.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md glass p-8 space-y-8",children:[g.jsxs("div",{className:"text-center space-y-2",children:[g.jsx("h2",{className:"text-3xl font-black italic tracking-tighter",children:!t&&v?"INITIALIZE MASTER":v?"JOIN THE CIRCLE":_==="otp"?"MYSTIC ACCESS":"ALCHEMIST LOGIN"}),g.jsx("p",{className:"text-xs text-fg/40 font-mono tracking-widest uppercase",children:!t&&v?"Forge the prime alchemist account":_==="otp"?P==="email"?"Enter your essence email":"Transmute the sacred code":"Transmute your data into intelligence"})]}),g.jsx("form",{onSubmit:O,className:"space-y-4",children:g.jsxs(_n,{mode:"wait",children:[v&&g.jsxs(ze.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:[g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"First Name"}),g.jsx("input",{type:"text",value:l,onChange:q=>c(q.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})]}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Last Name"}),g.jsx("input",{type:"text",value:d,onChange:q=>f(q.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"),_==="otp"&&P==="verify"?g.jsxs(ze.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6 py-4",children:[g.jsx("div",{className:"flex justify-center",children:g.jsx(lN,{value:D,onChange:$,length:6,onComplete:q=>{$(q)},error:!!b})}),g.jsx("button",{type:"button",onClick:()=>j("email"),className:"w-full text-[10px] font-bold uppercase text-primary/40 hover:text-primary transition-colors tracking-widest",children:"Change email address"}),g.jsxs("button",{type:"button",disabled:p||D.length!==6,onClick:z,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:[p?g.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):g.jsx(Mg,{size:18}),"VERIFY CODE"]})]},"otp-verify"):g.jsxs(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"space-y-4",children:[g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address"}),g.jsxs("div",{className:"relative",children:[g.jsx(hS,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),g.jsx("input",{type:"email",value:n,onChange:q=>r(q.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})]})]}),(v||_==="password")&&g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Complexity Key"}),g.jsxs("div",{className:"relative",children:[g.jsx(dS,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg/20",size:16}),g.jsx("input",{type:"password",value:o,onChange:q=>a(q.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})]})]}),g.jsxs("button",{type:"submit",disabled:p,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:[p&&g.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),v?g.jsx(kS,{size:18}):g.jsx(Mg,{size:18}),v?"INITIALIZE ACCOUNT":_==="otp"?"SEND CODE":"UNSEAL ENGINE"]})]},"base-login")]})}),b&&_==="password"&&g.jsx(ze.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}),g.jsxs("div",{className:"space-y-4",children:[!v&&g.jsx("div",{className:"flex flex-col gap-2",children:_==="password"?g.jsxs("button",{type:"button",onClick:()=>{E("otp"),j("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:[g.jsx(aS,{size:16})," Sign in with Code"]}):g.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:[g.jsx(qk,{size:16})," Sign in with Password"]})}),g.jsxs("p",{className:"text-center text-xs text-fg/40",children:[v?"Already an Alchemist?":"New to Alchemy?"," "," ",g.jsx("button",{onClick:()=>{w(!v),E("password"),S(null)},className:"text-primary font-bold hover:underline",children:v?"Login instead":"Create an account"})]})]})]})})}function cN(e){const t=e.trim();return t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}.supabase.co`:""}function Gw({onComplete:e,open:t=!0,canClose:n=!1}){const[r,o]=L.useState("welcome"),[a,l]=L.useState(""),[c,d]=L.useState(""),[f,p]=L.useState(null),[y,v]=L.useState(!1);if(!t)return null;const w=async()=>{p(null),v(!0),o("validating");const b=cN(a),S=c.trim(),_=await sN(b,S);_.valid?(nN({url:b,anonKey:S}),o("success"),setTimeout(()=>{window.location.reload()},1500)):(p(_.error||"Connection failed"),o("credentials"),v(!1))};return g.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 bg-bg/80 backdrop-blur-sm",children:g.jsxs(ze.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:[g.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"}),g.jsxs(_n,{mode:"wait",children:[r==="welcome"&&g.jsxs(ze.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:g.jsx(So,{className:"w-6 h-6 text-primary"})}),g.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Assemble Your Engine"})]}),g.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Alchemy requires a Supabase essence to store signal fragments and intelligence patterns."})]}),g.jsxs("div",{className:"glass bg-white/5 border-white/10 p-4 rounded-xl space-y-3",children:[g.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-primary/70",children:"Requirements:"}),g.jsxs("ul",{className:"space-y-2",children:[g.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[g.jsx(ko,{className:"w-4 h-4 text-emerald-500"})," Supabase Project URL"]}),g.jsxs("li",{className:"flex items-center gap-2 text-sm text-fg/60",children:[g.jsx(ko,{className:"w-4 h-4 text-emerald-500"})," Anon Public API Key"]})]})]}),g.jsxs("div",{className:"flex flex-col gap-3",children:[g.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 ",g.jsx(Hl,{size:14})]}),g.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 ",g.jsx(Hk,{size:18})]})]})]},"welcome"),r==="credentials"&&g.jsxs(ze.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx("h2",{className:"text-2xl font-black italic tracking-tighter uppercase",children:"Essence Coordinates"}),g.jsx("p",{className:"text-sm text-fg/50 font-medium lowercase",children:"Link the alchemist engine to your cloud database"})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Project URL or ID"}),g.jsx("input",{type:"text",value:a,onChange:b=>l(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"})]}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Anon Public Key"}),g.jsx("input",{type:"password",value:c,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:"eyJ..."})]})]}),f&&g.jsxs("div",{className:"bg-error/10 border border-error/20 p-3 rounded-xl flex items-center gap-3",children:[g.jsx(Mo,{className:"w-5 h-5 text-error"}),g.jsx("p",{className:"text-xs text-error font-bold tracking-tight",children:f})]}),g.jsxs("div",{className:"flex gap-3",children:[g.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"}),g.jsxs("button",{onClick:w,disabled:!a||!c,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 ",g.jsx(is,{size:18})]})]})]},"credentials"),r==="validating"&&g.jsxs(ze.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 space-y-6",children:[g.jsxs("div",{className:"relative",children:[g.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-xl rounded-full"}),g.jsx(Jn,{className:"w-16 h-16 animate-spin text-primary relative z-10"})]}),g.jsxs("div",{className:"text-center space-y-2",children:[g.jsx("h3",{className:"text-xl font-bold italic uppercase tracking-tighter",children:"Validating Link"}),g.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase animate-pulse",children:"Synchronizing Resonance..."})]})]},"validating"),r==="success"&&g.jsxs(ze.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:[g.jsx("div",{className:"p-4 bg-emerald-500/20 rounded-full",children:g.jsx(Rh,{className:"w-16 h-16 text-emerald-500"})}),g.jsxs("div",{className:"text-center space-y-2",children:[g.jsx("h3",{className:"text-2xl font-black italic uppercase tracking-tighter",children:"Engine Aligned"}),g.jsx("p",{className:"text-sm text-fg/40 font-mono tracking-widest uppercase",children:"Restarting Alchemist Subsystems..."})]})]},"success")]})]})})}const kr={chrome:{icon:g.jsx(tS,{size:18}),name:"Google Chrome",color:"text-yellow-500"},firefox:{icon:g.jsx(ed,{size:18}),name:"Mozilla Firefox",color:"text-orange-500"},safari:{icon:g.jsx(ed,{size:18}),name:"Safari",color:"text-blue-500"},edge:{icon:g.jsx(ed,{size:18}),name:"Microsoft Edge",color:"text-cyan-500"},brave:{icon:g.jsx(is,{size:18}),name:"Brave",color:"text-orange-400"},arc:{icon:g.jsx(is,{size:18}),name:"Arc",color:"text-purple-500"}};function dN({sources:e,onChange:t}){const[n,r]=L.useState(!1),[o,a]=L.useState({}),[l,c]=L.useState(""),[d,f]=L.useState("chrome"),[p,y]=L.useState(!1),v=async()=>{r(!0);try{const{data:E}=await He.get("/api/browser-paths/detect");a(E)}catch(E){console.error("Detection failed:",E)}finally{r(!1)}},w=E=>{const P=o[E];if(!P||!P.found||!P.valid||e.find($=>$.browser===E&&$.path===P.path))return;const D={browser:E,path:P.path,enabled:!0,label:`${kr[E].name} (Auto-detected)`};t([...e,D])},b=async()=>{if(l.trim()){y(!0);try{const{data:E}=await He.post("/api/browser-paths/validate",{path:l});if(!E.valid){alert(`Invalid path: ${E.error||"Not a browser history database"}`),y(!1);return}const P={browser:d,path:l,enabled:!0,label:`${kr[d].name} (Custom)`};t([...e,P]),c("")}catch(E){console.error("Validation failed:",E),alert("Failed to validate path")}finally{y(!1)}}},S=E=>{const P=[...e];P[E].enabled=!P[E].enabled,t(P)},_=E=>{t(e.filter((P,j)=>j!==E))};return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[g.jsx($d,{size:14})," Auto-Detect Browsers"]}),g.jsxs("button",{onClick:v,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?g.jsx(Jn,{size:12,className:"animate-spin"}):g.jsx($d,{size:12}),n?"Scanning...":"Scan System"]})]}),Object.keys(o).length>0&&g.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.keys(kr).map(E=>{const P=o[E],j=kr[E],D=e.some($=>$.browser===E&&$.path===P?.path);return g.jsxs(ze.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:[g.jsxs("div",{className:"flex items-start justify-between mb-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("div",{className:j.color,children:j.icon}),g.jsx("span",{className:"text-sm font-bold",children:j.name})]}),P?.found&&P?.valid?g.jsx(ko,{size:16,className:"text-success"}):P?.found?g.jsx(Mo,{size:16,className:"text-error"}):g.jsx(Cr,{size:16,className:"text-fg/20"})]}),P?.found?g.jsxs(g.Fragment,{children:[g.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate mb-2",children:P.path}),P.valid?g.jsx("button",{onClick:()=>w(E),disabled:D,className:`w-full py-1.5 text-xs font-bold uppercase tracking-widest rounded-lg transition-all ${D?"bg-fg/5 text-fg/30 cursor-not-allowed":"bg-success/10 hover:bg-success/20 text-success"}`,children:D?"Already Added":"Add Source"}):g.jsx("p",{className:"text-[10px] text-error font-medium",children:P.error})]}):g.jsx("p",{className:"text-[10px] text-fg/30 italic",children:"Not found on this system"})]},E)})})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[g.jsx(sS,{size:14})," Add Custom Path"]}),g.jsxs("div",{className:"glass p-4 rounded-xl space-y-3",children:[g.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[g.jsx("select",{value:d,onChange:E=>f(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(kr).map(E=>g.jsx("option",{value:E,children:kr[E].name},E))}),g.jsx("input",{type:"text",value:l,onChange:E=>c(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"})]}),g.jsxs("button",{onClick:b,disabled:!l.trim()||p,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:[p?g.jsx(Jn,{size:16,className:"animate-spin"}):g.jsx(gS,{size:16}),p?"Validating...":"Add Custom Source"]})]})]}),e.length>0&&g.jsxs("div",{className:"space-y-3",children:[g.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:["Configured Sources (",e.length,")"]}),g.jsx("div",{className:"space-y-2",children:g.jsx(_n,{children:e.map((E,P)=>g.jsxs(ze.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:[g.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[g.jsx("div",{className:kr[E.browser].color,children:kr[E.browser].icon}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("p",{className:"text-sm font-bold",children:E.label}),g.jsx("p",{className:"text-[10px] font-mono text-fg/40 truncate",children:E.path})]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.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"}),g.jsx("button",{onClick:()=>_(P),className:"p-2 hover:bg-error/10 text-error rounded-lg transition-all",children:g.jsx(Cr,{size:16})})]})]},`${E.browser}-${E.path}`))})})]})]})}const Jw=L.createContext(void 0);function hN({children:e}){const[t,n]=L.useState([]),r=L.useCallback((o,a="info")=>{const l=Math.random().toString(36).substr(2,9),c={id:l,type:a,message:o};n(d=>[...d,c]),setTimeout(()=>{n(d=>d.filter(f=>f.id!==l))},3e3)},[]);return g.jsxs(Jw.Provider,{value:{showToast:r},children:[e,g.jsx(fN,{toasts:t})]})}function Yw(){const e=L.useContext(Jw);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function fN({toasts:e}){return g.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col gap-2 pointer-events-none",children:g.jsx(_n,{children:e.map(t=>g.jsx(pN,{toast:t},t.id))})})}function pN({toast:e}){const t={success:g.jsx(ko,{size:18,className:"text-success"}),error:g.jsx(Cr,{size:18,className:"text-error"}),warning:g.jsx(Mo,{size:18,className:"text-accent"}),info:g.jsx(Pv,{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 g.jsxs(ze.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[e.type]} flex items-center gap-3 min-w-[300px] max-w-md pointer-events-auto shadow-lg`,children:[t[e.type],g.jsx("span",{className:"text-sm font-medium flex-1",children:e.message})]})}function mN(){const{showToast:e}=Yw(),[t,n]=L.useState("http://localhost:11434"),[r,o]=L.useState("llama3"),[a,l]=L.useState(""),[c,d]=L.useState([]),[f,p]=L.useState(!1),[y,v]=L.useState(!1),[w,b]=L.useState(!1);L.useEffect(()=>{S()},[]);const S=async()=>{const{data:{user:j}}=await Ee.auth.getUser();if(!j)return;const{data:D}=await Ee.from("alchemy_settings").select("*").eq("user_id",j.id).maybeSingle();D&&(n(D.llm_base_url||D.ollama_host||"http://localhost:11434"),o(D.llm_model_name||"llama3"),l(D.llm_api_key||D.openai_api_key||D.anthropic_api_key||""),d(D.custom_browser_paths||[]))},_=async()=>{p(!0);try{const{data:{user:j}}=await Ee.auth.getUser();if(!j){e("Please log in to save settings","error"),p(!1);return}const{error:D}=await Ee.from("alchemy_settings").upsert({user_id:j.id,llm_base_url:t,llm_model_name:r,llm_api_key:a},{onConflict:"user_id"});D?(console.error("[AlchemistEngine] Save error:",D),e(`Failed to save: ${D.message}`,"error")):e("LLM settings saved successfully","success")}catch(j){console.error("[AlchemistEngine] Unexpected error:",j),e(`Unexpected error: ${j.message}`,"error")}finally{p(!1)}},E=async()=>{v(!0);try{const{data:{user:j}}=await Ee.auth.getUser();if(!j){e("Please log in to save settings","error"),v(!1);return}const{error:D}=await Ee.from("alchemy_settings").upsert({user_id:j.id,custom_browser_paths:c},{onConflict:"user_id"});D?(console.error("[AlchemistEngine] Save browser sources error:",D),e(`Failed to save: ${D.message}`,"error")):e("Browser sources saved successfully","success")}catch(j){console.error("[AlchemistEngine] Unexpected error:",j),e(`Unexpected error: ${j.message}`,"error")}finally{v(!1)}},P=async()=>{b(!0);try{const{data:j}=await He.post("/api/llm/test",{baseUrl:t,modelName:r,apiKey:a});j.success?e(`Connection successful! ${j.model?`Model: ${j.model}`:""}`,"success"):e(`Connection failed: ${j.message}`,"error")}catch(j){console.error("[AlchemistEngine] Test error:",j),e(`Test failed: ${j.message}`,"error")}finally{b(!1)}};return g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[g.jsxs("header",{className:"px-8 py-6 border-b border-border",children:[g.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Intelligence Engine"}),g.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Fine-tune the Alchemist's cognitive parameters and provider links."})]}),g.jsx("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:g.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[g.jsx("section",{className:"space-y-6",children:g.jsxs("div",{className:"space-y-4",children:[g.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[g.jsx(Oh,{size:14})," LLM Configuration"]}),g.jsxs("div",{className:"glass p-8 space-y-6",children:[g.jsx(Td,{label:"Provider URL (Base)",value:t,onChange:n,placeholder:"http://localhost:11434 or https://api.openai.com/v1"}),g.jsx(Td,{label:"Intelligence Model",value:r,onChange:o,placeholder:"llama3, gpt-4o, claude-3-5-sonnet..."}),g.jsx(Td,{label:"Secret Key (Optional)",type:"password",value:a,onChange:l,placeholder:"sk-..."}),g.jsx("div",{className:"p-4 bg-primary/5 rounded-2xl",children:g.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."})}),g.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[g.jsxs("button",{onClick:P,disabled:w||f,className:"px-6 py-3 bg-surface hover:bg-surface/80 border border-border text-fg font-bold rounded-xl shadow-sm hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[w?g.jsx(Jn,{size:18,className:"animate-spin"}):g.jsx(is,{size:18,className:"text-accent"}),"Test Connection"]}),g.jsxs("button",{onClick:_,disabled:f,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:[f?g.jsx(Jn,{size:18,className:"animate-spin"}):g.jsx(Al,{size:18}),"Save"]})]})]})]})}),g.jsx("section",{className:"space-y-6",children:g.jsxs("div",{className:"space-y-4",children:[g.jsxs("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40 flex items-center gap-2",children:[g.jsx(So,{size:14})," Browser History Sources"]}),g.jsxs("div",{className:"glass p-8 space-y-6",children:[g.jsx(dN,{sources:c,onChange:d}),g.jsx("div",{className:"flex justify-end pt-2",children:g.jsxs("button",{onClick:E,disabled:y,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:[y?g.jsx(Jn,{size:18,className:"animate-spin"}):g.jsx(Al,{size:18}),"Save Browser Sources"]})})]})]})})]})})]})}function Td({label:e,value:t,onChange:n,placeholder:r,type:o="text"}){return g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e}),g.jsx("input",{type:o,value:t,onChange:a=>n(a.target.value),className:"w-full bg-surface border border-border rounded-xl py-3 px-4 text-sm text-fg placeholder:text-fg/40 focus:border-[var(--border-hover)] outline-none transition-all autofill:bg-surface autofill:text-fg",placeholder:r})]})}const Xw=L.createContext(null);function gN({children:e}){const[t,n]=L.useState(!1),r=()=>n(!0),o=()=>n(!1);return g.jsx(Xw.Provider,{value:{isExpanded:t,setIsExpanded:n,openTerminal:r,closeTerminal:o},children:e})}function yN(){const e=L.useContext(Xw);if(!e)throw new Error("useTerminal must be used within a TerminalProvider");return e}function vN({isExpanded:e,onToggle:t}={}){const[n,r]=L.useState([]),{isExpanded:o,setIsExpanded:a}=yN(),[l,c]=L.useState({}),d=e!==void 0?e:o,f=t||(()=>a(!o));L.useEffect(()=>{p();const w=Ee.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},b=>{const S=b.new;S.event_type==="error"&&c(_=>({..._,[S.id]:!0})),r(_=>{const E=[S,..._];return E.length>50?E.slice(0,50):E})}).subscribe();return()=>{Ee.removeChannel(w)}},[]);const p=async()=>{const{data:w}=await Ee.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);w&&r(w)},y=w=>{c(b=>({...b,[w]:!b[w]}))},v=(w,b)=>{if(b==="debug")return g.jsx(Yk,{size:14,className:"text-fg/40"});switch(w){case"analysis":return g.jsx(Cv,{size:14,className:"text-primary"});case"action":return g.jsx(is,{size:14,className:"text-accent"});case"error":return g.jsx(Bk,{size:14,className:"text-error"});case"system":return g.jsx(Ih,{size:14,className:"text-success"});default:return g.jsx(Pv,{size:14,className:"text-fg/40"})}};return d?g.jsxs(ze.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:[g.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Vd,{size:18,className:"text-primary"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:"Alchemist Engine"}),g.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:[g.jsx($k,{size:10})," LIVE"]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("button",{onClick:()=>r([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:"Clear"}),g.jsx("button",{onClick:f,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:g.jsx(pS,{size:18})})]})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[n.length===0&&g.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:"Idle. Awaiting signal mining events..."}),n.map(w=>g.jsxs("div",{className:"relative flex items-start gap-3 group",children:[g.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:v(w.event_type,w.level)}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(w.created_at||Date.now()).toLocaleTimeString()}),g.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${w.level==="error"?"text-error":w.level==="warn"?"text-orange-400":w.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:w.agent_state}),w.duration_ms&&g.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:[g.jsx(ni,{size:10}),w.duration_ms,"ms"]})]}),g.jsx("p",{className:`text-sm break-words leading-relaxed ${w.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:w.message}),(w.details||w.metadata)&&g.jsxs("div",{className:"mt-2 text-xs",children:[g.jsxs("button",{onClick:()=>y(w.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[l[w.id]?g.jsx(jv,{size:12}):g.jsx(jl,{size:12}),l[w.id]?"Hide Details":"View Details"]}),g.jsx(_n,{children:l[w.id]&&g.jsx(ze.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:g.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({...w.details,...w.metadata},null,2)})})})]})]})]},w.id))]})]}):g.jsxs("button",{onClick:f,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:[g.jsxs("div",{className:"relative",children:[g.jsx(Vd,{size:20,className:"text-primary"}),n.length>0&&g.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[g.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),g.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),g.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 Qw="1.0.0",xN="20260125000004";async function wN(e){try{const{data:t,error:n}=await e.rpc("get_latest_migration_timestamp");return n?n.code==="42883"?{version:null,latestMigrationTimestamp:"0"}:{version:null,latestMigrationTimestamp:null}:{version:Qw,latestMigrationTimestamp:t||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function bN(e){const t=Qw,n=xN,r=await wN(e);if(r.latestMigrationTimestamp&&r.latestMigrationTimestamp.trim()!==""){const o=n,a=r.latestMigrationTimestamp;return o>a?{needsMigration:!0,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:a,message:`New migrations available. Database is at ${a}, app has ${o}.`}:{needsMigration:!1,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:a,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:t,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function kN(){const[e,t]=L.useState("profile"),[n,r]=L.useState(!1);return g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[g.jsxs("header",{className:"px-8 py-6 border-b border-border",children:[g.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Account Configuration"}),g.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Manage your Alchemist profile and essence links."})]}),g.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[g.jsxs("aside",{className:"w-64 border-r border-border p-4 space-y-1",children:[g.jsx(Cd,{active:e==="profile",onClick:()=>t("profile"),icon:g.jsx(Lh,{size:18}),label:"Profile"}),g.jsx(Cd,{active:e==="security",onClick:()=>t("security"),icon:g.jsx(Nv,{size:18}),label:"Security"}),g.jsx(Cd,{active:e==="supabase",onClick:()=>t("supabase"),icon:g.jsx(So,{size:18}),label:"Supabase"})]}),g.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[e==="profile"&&g.jsx(SN,{}),e==="security"&&g.jsx(_N,{}),e==="supabase"&&g.jsx(EN,{})]})]})]})}function SN(){const[e,t]=L.useState(""),[n,r]=L.useState(""),[o,a]=L.useState(""),[l,c]=L.useState(!1),[d,f]=L.useState(!1),[p,y]=L.useState(null),[v,w]=L.useState(!0);L.useEffect(()=>{b()},[]);const b=async()=>{const{data:{user:E}}=await Ee.auth.getUser();if(!E)return;a(E.email||"");const{data:P}=await Ee.from("profiles").select("*").eq("id",E.id).maybeSingle();P&&(t(P.first_name||""),r(P.last_name||""),y(P.avatar_url));const{data:j}=await Ee.from("alchemy_settings").select("sound_enabled").eq("user_id",E.id).maybeSingle();j&&w(j.sound_enabled??!0)},S=async()=>{c(!0);const{data:{user:E}}=await Ee.auth.getUser();E&&(await Ee.from("profiles").upsert({id:E.id,first_name:e,last_name:n,full_name:e&&n?`${e} ${n}`:e||n||null}),await Ee.from("alchemy_settings").update({sound_enabled:v}).eq("user_id",E.id),c(!1))},_=async E=>{const P=E.target.files?.[0];if(P){f(!0);try{const{data:{user:j}}=await Ee.auth.getUser();if(!j)return;const D=P.name.split(".").pop(),$=`${j.id}/avatar-${Date.now()}.${D}`,{error:O}=await Ee.storage.from("avatars").upload($,P,{upsert:!0});if(O)throw O;const{data:{publicUrl:z}}=Ee.storage.from("avatars").getPublicUrl($);await Ee.from("profiles").update({avatar_url:z}).eq("id",j.id),y(z)}catch(j){console.error("Avatar upload failed:",j)}finally{f(!1)}}};return g.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[g.jsxs("section",{className:"flex items-start gap-8",children:[g.jsxs("div",{className:"relative group",children:[g.jsx("div",{className:"w-32 h-32 rounded-3xl bg-surface border border-border flex items-center justify-center overflow-hidden shadow-xl",children:p?g.jsx("img",{src:p,alt:"Avatar",className:"w-full h-full object-cover"}):g.jsx(Lh,{size:48,className:"text-fg/20"})}),g.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:[g.jsx(Qk,{size:24,className:"text-white"}),g.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:_,disabled:d})]}),d&&g.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:g.jsx(Jn,{size:24,className:"text-primary animate-spin"})})]}),g.jsxs("div",{className:"flex-1 space-y-4",children:[g.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[g.jsx($l,{label:"First Name",value:e,onChange:t,placeholder:"Zosimos"}),g.jsx($l,{label:"Last Name",value:n,onChange:r,placeholder:"of Panopolis"})]}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address (Locked)"}),g.jsx("input",{type:"email",value:o,readOnly:!0,className:"w-full bg-surface/50 border border-border rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),g.jsxs("section",{className:"glass p-6 space-y-4",children:[g.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[v?g.jsx(zg,{size:20,className:"text-primary"}):g.jsx(Fg,{size:20,className:"text-fg/40"}),"Sound Effects"]}),g.jsx("p",{className:"text-xs text-fg/40",children:"Enable audio feedback for sync events and signal discoveries."}),g.jsx("button",{onClick:()=>w(!v),className:`w-full p-4 rounded-xl border-2 transition-all ${v?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border text-fg/40"}`,children:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"font-semibold text-sm",children:v?"Enabled":"Disabled"}),v?g.jsx(zg,{size:18}):g.jsx(Fg,{size:18})]})})]}),g.jsxs("section",{className:"glass p-6 space-y-4",children:[g.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[g.jsx(Ug,{size:20,className:"text-error"}),"Sign Out"]}),g.jsx("p",{className:"text-xs text-fg/40",children:"End your current session and return to the login screen."}),g.jsx("button",{onClick:()=>Ee.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:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"font-semibold text-sm",children:"Logout"}),g.jsx(Ug,{size:18})]})})]}),g.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:g.jsxs("button",{onClick:S,disabled:l,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:[l?g.jsx(Jn,{size:18,className:"animate-spin"}):g.jsx(Al,{size:18}),"Preserve Profile"]})})]})}function _N(){const[e,t]=L.useState(""),[n,r]=L.useState(""),[o,a]=L.useState(!1),[l,c]=L.useState(null),[d,f]=L.useState(!1),p=async()=>{if(!e||e!==n){c("Complexity keys do not match.");return}if(e.length<8){c("Entropy too low. Minimum 8 characters.");return}a(!0),c(null),f(!1);const{error:y}=await Ee.auth.updateUser({password:e});y?c(y.message):(f(!0),t(""),r("")),a(!1)};return g.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:g.jsxs("div",{className:"glass p-6 space-y-6",children:[g.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[g.jsx(lS,{size:20,className:"text-error"})," Update Entropy Key"]}),g.jsxs("div",{className:"space-y-4",children:[g.jsx($l,{label:"New Password",type:"password",value:e,onChange:t,placeholder:"••••••••"}),g.jsx($l,{label:"Confirm Password",type:"password",value:n,onChange:r,placeholder:"••••••••"})]}),l&&g.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:l}),d&&g.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:"Key rotation successful."}),g.jsx("div",{className:"flex justify-end pt-2",children:g.jsxs("button",{onClick:p,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?g.jsx(Jn,{size:18,className:"animate-spin"}):g.jsx(Nv,{size:18}),"Rotate Key"]})})]})})}function EN(){const[e,t]=L.useState(!1),[n,r]=L.useState(null),o=Tf(),a=iN();L.useEffect(()=>{o&&bN(Ee).then(r)},[]);const l=()=>{confirm("Sever connection to this essence? This will reset local resonance.")&&(rN(),window.location.reload())};return g.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[g.jsxs("section",{className:"space-y-6",children:[g.jsx("div",{className:"flex items-center justify-between",children:g.jsxs("div",{children:[g.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[g.jsx(So,{size:20,className:"text-primary"})," Essence Resonance"]}),g.jsx("p",{className:"text-xs text-fg/40 font-medium",children:"Bring Your Own Keys (BYOK) for intelligence persistence."})]})}),g.jsx("div",{className:"glass p-8 space-y-8",children:o?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[g.jsx(Rh,{className:"w-6 h-6 text-emerald-500 mt-1"}),g.jsxs("div",{className:"flex-1 space-y-1",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:"Established Link"}),n?.latestMigrationTimestamp&&g.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]})]}),g.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:o.url})]})]}),a==="env"&&g.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[g.jsx(Mo,{size:16,className:"text-amber-500"}),g.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:"Active from environment variables. UI override enabled."})]}),g.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[g.jsxs("button",{onClick:()=>t(!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:[g.jsx(Ih,{size:14})," Realign Link"]}),a==="ui"&&g.jsxs("button",{onClick:l,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:[g.jsx(bS,{size:14})," Sever Link"]})]}),g.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[g.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:"Anon Secret Fragment"}),g.jsxs("div",{className:"p-3 bg-surface/50 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-border",children:[o.anonKey.substring(0,32),"..."]})]})]}):g.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[g.jsx(So,{size:48,className:"text-fg/10"}),g.jsxs("div",{className:"space-y-2",children:[g.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:"No Essence Resonance"}),g.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:"The Alchemist requires a cloud core to store intelligence fragments."})]}),g.jsx("button",{onClick:()=>t(!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"})]})})]}),g.jsx(Gw,{open:e,onComplete:()=>t(!1),canClose:!0})]})}function Cd({active:e,icon:t,label:n,onClick:r}){return g.jsxs("button",{onClick:r,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${e?"glass bg-primary/10 text-primary border-primary/20 shadow-sm":"text-fg/40 hover:bg-surface hover:text-fg"}`,children:[e?bo.cloneElement(t,{className:"text-primary"}):t,g.jsx("span",{className:"font-semibold text-sm",children:n})]})}function $l({label:e,value:t,onChange:n,placeholder:r,type:o="text"}){return g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e}),g.jsx("input",{type:o,value:t,onChange:a=>n(a.target.value),className:"w-full bg-surface border border-border rounded-xl py-3 px-4 text-sm text-fg placeholder:text-fg/40 focus:border-[var(--border-hover)] outline-none transition-all",placeholder:r})]})}function TN({signal:e,onClose:t}){const[n,r]=bo.useState(!1);if(!e)return null;const o=()=>{const c=`# ${e.title}
|
|
70
|
+
|
|
71
|
+
**Category**: ${e.category||"Research"}
|
|
72
|
+
**Intelligence Score**: ${e.score}/100
|
|
73
|
+
**Discovered**: ${new Date(e.date).toLocaleDateString()}
|
|
74
|
+
**Source**: ${e.url||"N/A"}
|
|
75
|
+
|
|
76
|
+
## Summary
|
|
77
|
+
${e.summary}
|
|
78
|
+
|
|
79
|
+
${e.entities&&e.entities.length>0?`## Entities
|
|
80
|
+
${e.entities.map(d=>`- ${d}`).join(`
|
|
81
|
+
`)}
|
|
82
|
+
`:""}
|
|
83
|
+
${e.content?`
|
|
84
|
+
## Full Content
|
|
85
|
+
${e.content}`:""}`;navigator.clipboard.writeText(c),r(!0),setTimeout(()=>r(!1),2e3)},a=()=>{const c=`# ${e.title}
|
|
86
|
+
|
|
87
|
+
**Category**: ${e.category||"Research"}
|
|
88
|
+
**Intelligence Score**: ${e.score}/100
|
|
89
|
+
**Discovered**: ${new Date(e.date).toLocaleDateString()}
|
|
90
|
+
**Source**: ${e.url||"N/A"}
|
|
91
|
+
|
|
92
|
+
## Summary
|
|
93
|
+
${e.summary}
|
|
94
|
+
|
|
95
|
+
${e.entities&&e.entities.length>0?`## Entities
|
|
96
|
+
${e.entities.map(y=>`- ${y}`).join(`
|
|
97
|
+
`)}
|
|
98
|
+
`:""}
|
|
99
|
+
${e.content?`
|
|
100
|
+
## Full Content
|
|
101
|
+
${e.content}`:""}`,d=new Blob([c],{type:"text/markdown"}),f=URL.createObjectURL(d),p=document.createElement("a");p.href=f,p.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,p.click(),URL.revokeObjectURL(f)},l=()=>{const c=JSON.stringify(e,null,2),d=new Blob([c],{type:"application/json"}),f=URL.createObjectURL(d),p=document.createElement("a");p.href=f,p.download=`signal_${e.id}.json`,p.click(),URL.revokeObjectURL(f)};return g.jsx(_n,{children:g.jsx(ze.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:t,children:g.jsxs(ze.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:c=>c.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[g.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[g.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[g.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:e.category||"Research"}),g.jsx("span",{className:`text-3xl font-black ${e.score>=80?"text-accent":"text-fg/40"}`,children:e.score})]}),g.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:e.title}),g.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(e.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:g.jsx(Cr,{size:24})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[e.url&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),g.jsxs("a",{href:e.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:[g.jsx(Hl,{size:16,className:"flex-shrink-0"}),g.jsx("span",{className:"truncate",children:e.url}),g.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),e.entities&&e.entities.length>0&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),g.jsx("div",{className:"flex flex-wrap gap-2",children:e.entities.map(c=>g.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:c},c))})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),g.jsx("div",{className:"p-4 glass rounded-xl",children:g.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:e.summary})})]}),e.content&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),g.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:g.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:e.content})})]})]}),g.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[g.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?g.jsx(ko,{size:16,className:"text-success"}):g.jsx(Av,{size:16}),n?"Copied!":"Copy"]}),g.jsxs("button",{onClick:a,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:[g.jsx(Dg,{size:16}),"Markdown"]}),g.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:[g.jsx(Dg,{size:16}),"JSON"]})]})]})})})}function CN({isOpen:e,onClose:t}){const{showToast:n}=Yw(),[r,o]=L.useState(""),[a,l]=L.useState(50),[c,d]=L.useState(!1),[f,p]=L.useState(!1);L.useEffect(()=>{e&&y()},[e]);const y=async()=>{const{data:{user:b}}=await Ee.auth.getUser();if(!b)return;const{data:S}=await Ee.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(S)if(l(S.max_urls_per_sync||50),S.sync_start_date){const _=new Date(S.sync_start_date),E=j=>j<10?"0"+j:j,P=_.getFullYear()+"-"+E(_.getMonth()+1)+"-"+E(_.getDate())+"T"+E(_.getHours())+":"+E(_.getMinutes());o(P)}else o("")},v=async()=>{d(!0);try{const{data:{user:b}}=await Ee.auth.getUser();if(!b){n("Please log in to save settings","error"),d(!1);return}const{error:S}=await Ee.from("alchemy_settings").update({max_urls_per_sync:a,sync_start_date:r?new Date(r).toISOString():null}).eq("user_id",b.id);S?n(`Failed to save: ${S.message}`,"error"):(n("Sync settings saved successfully","success"),t())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{d(!1)}},w=async()=>{p(!0);try{const{data:{user:b}}=await Ee.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),p(!1);return}const{error:S}=await Ee.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{p(!1)}};return e?g.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:g.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:[g.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[g.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:g.jsx(Cr,{className:"w-5 h-5"})})]}),g.jsxs("div",{className:"p-6 space-y-6",children:[g.jsxs("div",{className:"space-y-3",children:[g.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[g.jsx(Xk,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),g.jsx("input",{type:"datetime-local",value:r,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"}),g.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."})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[g.jsx(iS,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),g.jsx("span",{className:"text-sm font-mono text-primary",children:a})]}),g.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:a,onChange:b=>l(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),g.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[g.jsx("span",{children:"Quick (5)"}),g.jsx("span",{children:"Balanced (50)"}),g.jsx("span",{children:"Thorough (200)"})]})]}),g.jsxs("div",{className:"pt-4 border-t border-border/10",children:[g.jsxs("button",{onClick:w,disabled:f,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:[g.jsx(yS,{size:16,className:f?"animate-spin":""}),f?"Resetting...":"Reset Checkpoint"]}),g.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'})]}),g.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:g.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.'})})]}),g.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[g.jsx("button",{onClick:t,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"}),g.jsxs("button",{onClick:v,disabled:c,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:[g.jsx(Al,{size:18,className:c?"animate-spin":""}),c?"Saving...":"Save Settings"]})]})]})}):null}function jN(){const[e,t]=L.useState([]),[n,r]=L.useState(!0),[o,a]=L.useState(null),[l,c]=L.useState(null),[d,f]=L.useState([]),[p,y]=L.useState([]),[v,w]=L.useState([]),[b,S]=L.useState(!1);L.useEffect(()=>{_()},[]);const _=async()=>{r(!0);try{const{data:{user:z}}=await Ee.auth.getUser();if(!z)return;const{data:q,error:J}=await Ee.from("processing_events").select("*").eq("user_id",z.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(J){console.error("Error fetching sync runs:",J);return}const ie=(q||[]).map(re=>{const Q=re.metadata||{},ye=Q.errors||0,ne=Q.signals_found||0,Z=Q.skipped||0;return{id:re.id,started_at:re.created_at,completed_at:re.created_at,duration_ms:re.duration_ms||0,signals_found:ne,urls_processed:Q.total_urls||0,skipped:Z,errors:ye,status:ye>0?"partial":ne>0?"success":"failed"}});t(ie)}catch(z){console.error("Failed to fetch sync runs:",z)}finally{r(!1)}},E=async z=>{S(!0);try{const{data:{user:q}}=await Ee.auth.getUser();if(!q)return;const J=e.find(H=>H.id===z);if(!J)return;const ie=new Date(new Date(J.started_at).getTime()-J.duration_ms),re=new Date(J.completed_at),{data:Q,error:ye}=await Ee.from("processing_events").select("*").eq("user_id",q.id).gte("created_at",ie.toISOString()).lte("created_at",re.toISOString()).order("created_at",{ascending:!0});if(ye){console.error("Error fetching run events:",ye);return}f(Q||[]);const ne=[],Z=(Q||[]).filter(H=>H.agent_state==="Mining"&&H.message.includes("Mining source:"));for(const H of Z){const oe=H.message.match(/Mining source: (.+) \((.+)\)/);if(oe){const T=oe[1],N=oe[2],V=(Q||[]).find(ve=>ve.agent_state==="Mining"&&ve.message.includes("Found")&&ve.message.includes(T)&&ve.created_at>H.created_at),C=V?.message.match(/Found (\d+) URLs/),X=C?parseInt(C[1]):0;ne.push({label:T,browser:N,urls_found:X,duration_ms:V?.duration_ms||0,status:H.event_type==="error"?"error":"success"})}}y(ne);const fe=[],le=(Q||[]).filter(H=>H.agent_state==="Reading");for(const H of le){const oe=H.message.match(/Reading content from: (.+)/);if(!oe)continue;const T=oe[1];let N=ne.length>0?ne[0].label:"Unknown";const V=ne.filter(ae=>ae.urls_found>0);(V.length===1||V.length>1)&&(N=V[0].label),console.log(`[SystemLogs] URL ${T} assigned to source: ${N}`);const C=(Q||[]).find(ae=>ae.agent_state==="Signal"&&ae.created_at>H.created_at&&ae.message.includes("Found signal")),X=(Q||[]).find(ae=>ae.agent_state==="Skipped"&&ae.created_at>H.created_at&&ae.message.includes("Irrelevant content")),ve=(Q||[]).find(ae=>ae.event_type==="error"&&ae.created_at>H.created_at);if(C){const ae=C.message.match(/\((\d+)%\)/),je=ae?parseInt(ae[1]):0;fe.push({url:T,result:"signal",score:je,category:C.details?.category||"Unknown",duration_ms:C.duration_ms,source_label:N})}else if(X){const ae=X.message.match(/\((\d+)%\): (.+)/),je=ae?parseInt(ae[1]):0,Ae=ae?ae[2]:"Irrelevant";fe.push({url:T,result:"skipped",score:je,reason:Ae,duration_ms:X.duration_ms,source_label:N})}else ve&&fe.push({url:T,result:"error",reason:ve.message,source_label:N})}w(fe)}catch(q){console.error("Failed to fetch run details:",q)}finally{S(!1)}},P=z=>{o===z?(a(null),c(null),y([]),w([])):(a(z),c(null),E(z))},j=z=>{c(l===z?null:z)},D=z=>{if(z<1e3)return`${z}ms`;const q=Math.floor(z/1e3);if(q<60)return`${q}s`;const J=Math.floor(q/60),ie=q%60;return`${J}m ${ie}s`},$=z=>{switch(z){case"success":return g.jsx(Rh,{className:"w-5 h-5 text-success"});case"failed":return g.jsx($g,{className:"w-5 h-5 text-error"});case"partial":return g.jsx(Mo,{className:"w-5 h-5 text-warning"});default:return g.jsx(ni,{className:"w-5 h-5 text-fg/40"})}},O=z=>{switch(z){case"signal":return g.jsx(is,{className:"w-4 h-4 text-primary"});case"skipped":return g.jsx(xS,{className:"w-4 h-4 text-fg/40"});case"error":return g.jsx($g,{className:"w-4 h-4 text-error"});default:return null}};return n?g.jsx("div",{className:"flex items-center justify-center h-full",children:g.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),g.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"})]}),g.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:e.length===0?g.jsxs("div",{className:"text-center py-12 text-fg/40",children:[g.jsx(ni,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),g.jsx("p",{children:"No sync runs yet"})]}):g.jsx("div",{className:"space-y-2",children:e.map(z=>g.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[g.jsxs("button",{onClick:()=>P(z.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[o===z.id?g.jsx(jl,{className:"w-5 h-5 text-primary shrink-0"}):g.jsx(Lg,{className:"w-5 h-5 text-fg/40 shrink-0"}),$(z.status),g.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),g.jsx("div",{className:"text-sm font-mono",children:new Date(z.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),g.jsx("div",{className:"text-sm font-mono",children:D(z.duration_ms)})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),g.jsx("div",{className:"text-sm font-semibold text-primary",children:z.signals_found})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),g.jsx("div",{className:"text-sm font-semibold text-fg/60",children:z.skipped})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),g.jsx("div",{className:"text-sm font-semibold",children:z.urls_processed})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),g.jsx("div",{className:`text-sm font-semibold ${z.errors>0?"text-error":"text-fg/40"}`,children:z.errors})]})]})]}),g.jsx(_n,{children:o===z.id&&g.jsx(ze.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:g.jsx("div",{className:"p-4 bg-black/10 space-y-2",children:b?g.jsx("div",{className:"flex items-center justify-center py-8",children:g.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):p.length===0?g.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):p.map((q,J)=>g.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[g.jsxs("button",{onClick:()=>j(q.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[l===q.label?g.jsx(jl,{className:"w-4 h-4 text-primary shrink-0"}):g.jsx(Lg,{className:"w-4 h-4 text-fg/40 shrink-0"}),g.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[g.jsxs("div",{className:"flex-1",children:[g.jsx("div",{className:"text-sm font-semibold",children:q.label}),g.jsx("div",{className:"text-xs text-fg/40",children:q.browser})]}),g.jsxs("div",{className:"text-right",children:[g.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),g.jsx("div",{className:"text-sm font-semibold",children:q.urls_found})]}),g.jsxs("div",{className:"text-right",children:[g.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),g.jsx("div",{className:"text-sm font-mono",children:D(q.duration_ms)})]})]})]}),g.jsx(_n,{children:l===q.label&&g.jsx(ze.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:g.jsx("div",{className:"p-3 bg-black/20 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:v.filter(ie=>ie.source_label===q.label).length===0?g.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):v.filter(ie=>ie.source_label===q.label).map((ie,re)=>g.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[O(ie.result),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:ie.url}),ie.result==="signal"&&g.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",ie.score,"%) - ",ie.category]}),ie.result==="skipped"&&g.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",ie.score,"%) - ",ie.reason]}),ie.result==="error"&&g.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",ie.reason]})]}),g.jsx("a",{href:ie.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:Q=>Q.stopPropagation(),children:g.jsx(Hl,{className:"w-3 h-3 text-fg/40"})})]},re))})})})]},J))})})})]},z.id))})})]})}function AN({signals:e,limit:t=10,onSignalClick:n}){const r=e.slice(0,t),[o,a]=L.useState(()=>{const d=localStorage.getItem("newSignalsFeedExpanded");return d!==null?d==="true":!0});L.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const l=d=>d>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":d>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",c=d=>{const f=new Date(d),y=new Date().getTime()-f.getTime(),v=Math.floor(y/6e4),w=Math.floor(y/36e5);return v<1?"Just now":v<60?`${v}m ago`:w<24?`${w}h ago`:f.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return r.length===0?null:g.jsxs("div",{className:"mb-3",children:[g.jsxs("button",{onClick:()=>a(!o),className:"w-full flex items-center justify-between mb-2 px-1 py-1 hover:bg-surface/30 rounded-lg transition-colors",children:[g.jsx("div",{className:"flex items-center gap-2",children:g.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:["New Signals (",r.length,")"]})}),o?g.jsx(jv,{size:16,className:"text-fg/40"}):g.jsx(jl,{size:16,className:"text-fg/40"})]}),g.jsx(_n,{children:o&&g.jsx(ze.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:g.jsx("div",{className:"overflow-x-auto pb-3 -mx-4 px-4 custom-scrollbar",children:g.jsx("div",{className:"flex gap-3 min-w-max",children:r.map(d=>g.jsxs(ze.button,{onClick:()=>n(d.id),whileHover:{scale:1.05,y:-2},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-3 hover:border-[var(--border-hover)] transition-all duration-300 text-left group",children:[g.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${l(d.score)}`,children:g.jsx("span",{className:"text-xl font-bold",children:d.score})}),g.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:d.title}),g.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[g.jsx(ni,{size:10}),g.jsx("span",{children:c(d.created_at)})]})]},d.id))})})})})]})}const Lo=[{id:"ai",name:"AI & ML",icon:Cv,color:"blue",priority:1},{id:"business",name:"Business",icon:Jk,color:"purple",priority:1},{id:"politics",name:"Politics",icon:uS,color:"red",priority:1},{id:"technology",name:"Technology",icon:Oh,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:nS,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:Wk,color:"orange",priority:1},{id:"science",name:"Science",icon:fS,color:"teal",priority:1}],jf={id:"other",name:"Other",icon:Bd,color:"gray",priority:3},PN=[...Lo,jf];function NN(e){const t={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 t[e]||t.gray}function Zw(e,t){if(t){const n=Lo.find(r=>r.id===t.toLowerCase());if(n)return n.id}for(const n of e){const r=n.toLowerCase(),o=Lo.find(a=>r.includes(a.id)||r.includes(a.name.toLowerCase()));if(o)return o.id}return null}function RN({category:e,signalCount:t,latestTimestamp:n,onClick:r}){const o=l=>{const c=new Date(l),f=new Date().getTime()-c.getTime(),p=Math.floor(f/6e4),y=Math.floor(f/36e5),v=Math.floor(f/864e5);return p<60?`${p}m ago`:y<24?`${y}h ago`:v<7?`${v}d ago`:c.toLocaleDateString("en-US",{month:"short",day:"numeric"})},a=e.icon;return g.jsxs(ze.button,{whileHover:{scale:1.05,y:-4},whileTap:{scale:.98},onClick:r,className:"bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-6 cursor-pointer hover:border-[var(--border-hover)] transition-all duration-300 text-left w-full",children:[g.jsx("div",{className:"mb-4",children:g.jsx(a,{size:40,className:"text-current opacity-80"})}),g.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:e.name}),g.jsxs("div",{className:"flex items-center justify-between text-sm",children:[g.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${NN(e.color)}`,children:[t," ",t===1?"signal":"signals"]}),g.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[g.jsx(ni,{size:12}),o(n)]})]})]})}const ON=3;function IN({signals:e,onCategoryClick:t}){const{categories:n,categoryCounts:r}=L.useMemo(()=>{const o=new Map,a=new Map;e.forEach(f=>{const p=f.tags||[],y=Zw(p,f.category);if(y){const v=o.get(y)||{count:0,latest:f.created_at};o.set(y,{count:v.count+1,latest:f.created_at>v.latest?f.created_at:v.latest})}else p.forEach(v=>{const w=v.toLowerCase().trim();if(w){a.set(w,(a.get(w)||0)+1);const b=o.get(w)||{count:0,latest:f.created_at};o.set(w,{count:b.count+1,latest:f.created_at>b.latest?f.created_at:b.latest})}})});const l=Array.from(a.entries()).filter(([f,p])=>p>=ON).map(([f,p])=>({id:f,name:f.charAt(0).toUpperCase()+f.slice(1),icon:oS,color:"gray",priority:2}));return{categories:[...Lo,...l,jf].filter(f=>{const p=o.get(f.id);return p&&p.count>0}).sort((f,p)=>f.priority-p.priority),categoryCounts:o}},[e]);return n.length===0?g.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[g.jsx("p",{className:"font-medium italic",children:"No categories yet."}),g.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):g.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:n.map(o=>{const a=r.get(o.id);return g.jsx(RN,{category:o,signalCount:a.count,latestTimestamp:a.latest,onClick:()=>t(o.id)},o.id)})})}function LN({signal:e,onOpen:t,onCopy:n,onArchive:r,onBookmark:o}){const[a,l]=L.useState(!1),c=y=>y>=80?"text-yellow-400 border-yellow-400/30":y>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",d=y=>y>=80?"HIGH":y>=50?"MEDIUM":"LOW",f=(y,v)=>{const w=Zw(v||[],y);if(w){const b=Lo.find(S=>S.id===w);if(b)return b}return jf},p=y=>{const v=new Date(y),b=new Date().getTime()-v.getTime(),S=Math.floor(b/6e4),_=Math.floor(b/36e5),E=Math.floor(b/864e5);return S<60?`${S}m ago`:_<24?`${_}h ago`:E<7?`${E}d ago`:v.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return g.jsxs(ze.div,{whileHover:{scale:1.02,boxShadow:"0 8px 24px rgba(59, 130, 246, 0.3)"},onHoverStart:()=>l(!0),onHoverEnd:()=>l(!1),className:"bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-6 flex flex-col gap-4 transition-all duration-300",children:[g.jsxs("div",{className:"flex items-start justify-between",children:[g.jsx("div",{className:"flex items-center gap-3",children:g.jsxs("div",{className:`flex flex-col items-center justify-center w-16 h-16 rounded-full border-2 ${c(e.score)}`,children:[g.jsx("span",{className:"text-2xl font-bold",children:e.score}),g.jsx("span",{className:"text-[10px] font-medium opacity-70",children:d(e.score)})]})}),g.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const y=f(e.category,e.tags),v=y.icon;return g.jsxs("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs font-medium rounded border border-blue-500/30 flex items-center gap-1.5",children:[g.jsx(v,{size:14}),y.name]})})(),g.jsxs("span",{className:"text-xs text-fg/50 flex items-center gap-1",children:[g.jsx(ni,{size:12}),p(e.created_at)]})]})]}),g.jsxs("div",{className:"flex-1",children:[g.jsx("a",{href:e.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:y=>{y.preventDefault(),t?.(e.url)},children:e.title}),g.jsx("p",{className:"text-sm text-fg/70 line-clamp-3",children:e.summary})]}),e.entities&&e.entities.length>0&&g.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.entities.slice(0,4).map((y,v)=>g.jsx("span",{className:"px-2 py-1 bg-white/5 text-fg/60 text-xs rounded border border-border",children:y},v)),e.entities.length>4&&g.jsxs("span",{className:"px-2 py-1 text-fg/40 text-xs",children:["+",e.entities.length-4," more"]})]}),g.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-white/5",children:[g.jsxs("button",{onClick:()=>t?.(e.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:[g.jsx(Hl,{size:14}),g.jsx("span",{children:"Open"})]}),g.jsxs("button",{onClick:()=>n?.(e.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:[g.jsx(Av,{size:14}),g.jsx("span",{children:"Copy"})]}),g.jsxs("button",{onClick:()=>r?.(e.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:[g.jsx(Vk,{size:14}),g.jsx("span",{children:"Archive"})]}),o&&g.jsx("button",{onClick:()=>o(e.id),className:"px-3 py-2 bg-white/5 hover:bg-yellow-500/20 hover:text-yellow-400 rounded transition-colors",title:"Bookmark",children:g.jsx(Gk,{size:14})})]})]})}function DN({isOpen:e,onClose:t,categoryId:n,signals:r,onOpenUrl:o,onCopyText:a,onArchive:l}){const c=PN.find(v=>v.id===n),d=r.filter(v=>{const w=v.tags||[],b=v.category?.toLowerCase()===n,S=w.some(_=>_.toLowerCase().includes(n));return b||S}),f=v=>{o?o(v):window.open(v,"_blank","noopener,noreferrer")},p=v=>{a?a(v):navigator.clipboard.writeText(v)},y=async v=>{l&&await l(v)};return g.jsx(_n,{children:e&&g.jsxs(g.Fragment,{children:[g.jsx(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),g.jsx(ze.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-border z-50 overflow-y-auto custom-scrollbar",children:g.jsxs("div",{className:"p-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-6 sticky top-0 bg-bg pb-4 border-b border-border",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[c?.icon&&g.jsx("div",{className:"w-10 h-10 flex items-center justify-center",children:g.jsx(c.icon,{size:40,className:"text-current opacity-80"})}),g.jsxs("div",{children:[g.jsx("h2",{className:"text-2xl font-bold",children:c?.name}),g.jsxs("p",{className:"text-sm text-fg/50",children:[d.length," ",d.length===1?"signal":"signals"]})]})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-white/10 rounded transition-colors","aria-label":"Close drawer",children:g.jsx(Cr,{size:24})})]}),g.jsx("div",{className:"space-y-4",children:d.length===0?g.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:g.jsx("p",{className:"italic",children:"No signals in this category yet."})}):d.map(v=>g.jsx(LN,{signal:v,onOpen:f,onCopy:p,onArchive:y},v.id))})]})})]})})}function MN({onOpenUrl:e,onCopyText:t}){const[n,r]=L.useState([]),[o,a]=L.useState(!0),[l,c]=L.useState(null),[d,f]=L.useState(""),[p,y]=L.useState(null);L.useEffect(()=>{(async()=>{a(!0);let E=Ee.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);p&&(E=E.ilike("category",p)),d&&(E=E.or(`title.ilike.%${d}%,summary.ilike.%${d}%,url.ilike.%${d}%`));const{data:P,error:j}=await E;j?console.error("Error fetching signals:",j):r(P||[]),a(!1)})();const _=Ee.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{r(P=>[E.new,...P])}).subscribe();return()=>{_.unsubscribe()}},[d,p]);const v=S=>{e?e(S):window.open(S,"_blank","noopener,noreferrer")},w=S=>{t?t(S):navigator.clipboard.writeText(S)},b=async S=>{await Ee.from("signals").delete().eq("id",S),r(_=>_.filter(E=>E.id!==S))};return g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[g.jsx("div",{className:"px-4 pt-3",children:g.jsx(AN,{signals:n,limit:10,onSignalClick:S=>{const _=n.find(E=>E.id===S);_&&_.category&&c(_.category.toLowerCase())}})}),g.jsxs("div",{className:"px-4 pt-2 pb-2 space-y-3",children:[g.jsxs("div",{className:"relative",children:[g.jsx($d,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),g.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:d,onChange:S=>f(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"}),d&&g.jsx("button",{onClick:()=>f(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:g.jsx(Cr,{size:16})})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx(rS,{className:"w-3.5 h-3.5 text-fg/40"}),g.jsx("button",{onClick:()=>y(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${p===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=>g.jsx("button",{onClick:()=>y(S),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${p===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))]})]}),g.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 custom-scrollbar",children:o?g.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:g.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):g.jsx(IN,{signals:n,onCategoryClick:S=>c(S)})}),g.jsx(DN,{isOpen:!!l,onClose:()=>c(null),categoryId:l||"",signals:n,onOpenUrl:v,onCopyText:w,onArchive:b})]})}function UN(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const zN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$N={};function V0(e,t){return($N.jsx?FN:zN).test(e)}const BN=/[ \t\n\f\r]/g;function VN(e){return typeof e=="object"?e.type==="text"?q0(e.value):!1:q0(e)}function q0(e){return e.replace(BN,"")===""}class Ko{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ko.prototype.normal={};Ko.prototype.property={};Ko.prototype.space=void 0;function e1(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Ko(n,r,t)}function bh(e){return e.toLowerCase()}class Vt{constructor(t,n){this.attribute=n,this.property=t}}Vt.prototype.attribute="";Vt.prototype.booleanish=!1;Vt.prototype.boolean=!1;Vt.prototype.commaOrSpaceSeparated=!1;Vt.prototype.commaSeparated=!1;Vt.prototype.defined=!1;Vt.prototype.mustUseProperty=!1;Vt.prototype.number=!1;Vt.prototype.overloadedBoolean=!1;Vt.prototype.property="";Vt.prototype.spaceSeparated=!1;Vt.prototype.space=void 0;let qN=0;const Ne=ls(),lt=ls(),kh=ls(),ee=ls(),Ve=ls(),ei=ls(),Yt=ls();function ls(){return 2**++qN}const Sh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ne,booleanish:lt,commaOrSpaceSeparated:Yt,commaSeparated:ei,number:ee,overloadedBoolean:kh,spaceSeparated:Ve},Symbol.toStringTag,{value:"Module"})),jd=Object.keys(Sh);class Af extends Vt{constructor(t,n,r,o){let a=-1;if(super(t,n),H0(this,"space",o),typeof r=="number")for(;++a<jd.length;){const l=jd[a];H0(this,jd[a],(r&Sh[l])===Sh[l])}}}Af.prototype.defined=!0;function H0(e,t,n){n&&(e[t]=n)}function di(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const a=new Af(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[bh(r)]=r,n[bh(a.attribute)]=r}return new Ko(t,n,e.space)}const t1=di({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ee,ariaColIndex:ee,ariaColSpan:ee,ariaControls:Ve,ariaCurrent:null,ariaDescribedBy:Ve,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ve,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ve,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ve,ariaLevel:ee,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ve,ariaPlaceholder:null,ariaPosInSet:ee,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ve,ariaRowCount:ee,ariaRowIndex:ee,ariaRowSpan:ee,ariaSelected:lt,ariaSetSize:ee,ariaSort:null,ariaValueMax:ee,ariaValueMin:ee,ariaValueNow:ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function n1(e,t){return t in e?e[t]:t}function r1(e,t){return n1(e,t.toLowerCase())}const HN=di({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ei,acceptCharset:Ve,accessKey:Ve,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:Ve,autoFocus:Ne,autoPlay:Ne,blocking:Ve,capture:null,charSet:null,checked:Ne,cite:null,className:Ve,cols:ee,colSpan:null,content:null,contentEditable:lt,controls:Ne,controlsList:Ve,coords:ee|ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:kh,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:Ve,height:ee,hidden:kh,high:ee,href:null,hrefLang:null,htmlFor:Ve,httpEquiv:Ve,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:Ve,itemRef:Ve,itemScope:Ne,itemType:Ve,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:ee,manifest:null,max:null,maxLength:ee,media:null,method:null,min:null,minLength:ee,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ne,optimum:ee,pattern:null,ping:Ve,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:Ve,required:Ne,reversed:Ne,rows:ee,rowSpan:ee,sandbox:Ve,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shape:null,size:ee,sizes:null,slot:null,span:ee,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ee,step:null,style:null,tabIndex:ee,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:lt,width:ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ve,axis:null,background:null,bgColor:null,border:ee,borderColor:null,bottomMargin:ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:ee,leftMargin:ee,link:null,longDesc:null,lowSrc:null,marginHeight:ee,marginWidth:ee,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:ee,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ne,disableRemotePlayback:Ne,prefix:null,property:null,results:ee,security:null,unselectable:null},space:"html",transform:r1}),WN=di({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Yt,accentHeight:ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ee,amplitude:ee,arabicForm:null,ascent:ee,attributeName:null,attributeType:null,azimuth:ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ee,by:null,calcMode:null,capHeight:ee,className:Ve,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ee,diffuseConstant:ee,direction:null,display:null,dur:null,divisor:ee,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:ee,enableBackground:null,end:null,event:null,exponent:ee,externalResourcesRequired:null,fill:null,fillOpacity:ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ei,g2:ei,glyphName:ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ee,horizOriginX:ee,horizOriginY:ee,id:null,ideographic:ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ee,k:ee,k1:ee,k2:ee,k3:ee,k4:ee,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ee,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ee,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ee,overlineThickness:ee,paintOrder:null,panose1:null,path:null,pathLength:ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ve,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ee,pointsAtY:ee,pointsAtZ:ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ee,specularExponent:ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ee,strikethroughThickness:ee,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ee,strokeOpacity:ee,strokeWidth:null,style:null,surfaceScale:ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:ee,tableValues:null,target:null,targetX:ee,targetY:ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ee,underlineThickness:ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ee,values:null,vAlphabetic:ee,vMathematical:ee,vectorEffect:null,vHanging:ee,vIdeographic:ee,version:null,vertAdvY:ee,vertOriginX:ee,vertOriginY:ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:n1}),s1=di({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),i1=di({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:r1}),o1=di({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),KN={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},GN=/[A-Z]/g,W0=/-[a-z]/g,JN=/^data[-\w.:]+$/i;function YN(e,t){const n=bh(t);let r=t,o=Vt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&JN.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(W0,QN);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!W0.test(a)){let l=a.replace(GN,XN);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=Af}return new o(r,t)}function XN(e){return"-"+e.toLowerCase()}function QN(e){return e.charAt(1).toUpperCase()}const ZN=e1([t1,HN,s1,i1,o1],"html"),Pf=e1([t1,WN,s1,i1,o1],"svg");function eR(e){return e.join(" ").trim()}var Bs={},Ad,K0;function tR(){if(K0)return Ad;K0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
102
|
+
`,f="/",p="*",y="",v="comment",w="declaration";function b(_,E){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];E=E||{};var P=1,j=1;function D(ne){var Z=ne.match(t);Z&&(P+=Z.length);var fe=ne.lastIndexOf(d);j=~fe?ne.length-fe:j+ne.length}function $(){var ne={line:P,column:j};return function(Z){return Z.position=new O(ne),J(),Z}}function O(ne){this.start=ne,this.end={line:P,column:j},this.source=E.source}O.prototype.content=_;function z(ne){var Z=new Error(E.source+":"+P+":"+j+": "+ne);if(Z.reason=ne,Z.filename=E.source,Z.line=P,Z.column=j,Z.source=_,!E.silent)throw Z}function q(ne){var Z=ne.exec(_);if(Z){var fe=Z[0];return D(fe),_=_.slice(fe.length),Z}}function J(){q(n)}function ie(ne){var Z;for(ne=ne||[];Z=re();)Z!==!1&&ne.push(Z);return ne}function re(){var ne=$();if(!(f!=_.charAt(0)||p!=_.charAt(1))){for(var Z=2;y!=_.charAt(Z)&&(p!=_.charAt(Z)||f!=_.charAt(Z+1));)++Z;if(Z+=2,y===_.charAt(Z-1))return z("End of comment missing");var fe=_.slice(2,Z-2);return j+=2,D(fe),_=_.slice(Z),j+=2,ne({type:v,comment:fe})}}function Q(){var ne=$(),Z=q(r);if(Z){if(re(),!q(o))return z("property missing ':'");var fe=q(a),le=ne({type:w,property:S(Z[0].replace(e,y)),value:fe?S(fe[0].replace(e,y)):y});return q(l),le}}function ye(){var ne=[];ie(ne);for(var Z;Z=Q();)Z!==!1&&(ne.push(Z),ie(ne));return ne}return J(),ye()}function S(_){return _?_.replace(c,y):y}return Ad=b,Ad}var G0;function nR(){if(G0)return Bs;G0=1;var e=Bs&&Bs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.default=n;const t=e(tR());function n(r,o){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),c=typeof o=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;c?o(f,p,d):p&&(a=a||{},a[f]=p)}),a}return Bs}var no={},J0;function rR(){if(J0)return no;J0=1,Object.defineProperty(no,"__esModule",{value:!0}),no.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,a=function(f){return!f||n.test(f)||e.test(f)},l=function(f,p){return p.toUpperCase()},c=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),a(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(o,c):f=f.replace(r,c),f.replace(t,l))};return no.camelCase=d,no}var ro,Y0;function sR(){if(Y0)return ro;Y0=1;var e=ro&&ro.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(nR()),n=rR();function r(o,a){var l={};return!o||typeof o!="string"||(0,t.default)(o,function(c,d){c&&d&&(l[(0,n.camelCase)(c,a)]=d)}),l}return r.default=r,ro=r,ro}var iR=sR();const oR=ql(iR),a1=l1("end"),Nf=l1("start");function l1(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function aR(e){const t=Nf(e),n=a1(e);if(t&&n)return{start:t,end:n}}function vo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?X0(e.position):"start"in e||"end"in e?X0(e):"line"in e||"column"in e?_h(e):""}function _h(e){return Q0(e&&e.line)+":"+Q0(e&&e.column)}function X0(e){return _h(e&&e.start)+"-"+_h(e&&e.end)}function Q0(e){return e&&typeof e=="number"?e:1}class Pt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?o=t:!a.cause&&t&&(l=!0,o=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?a.ruleId=r:(a.source=r.slice(0,d),a.ruleId=r.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){const d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}const c=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=c?c.line:void 0,this.name=vo(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Pt.prototype.file="";Pt.prototype.name="";Pt.prototype.reason="";Pt.prototype.message="";Pt.prototype.stack="";Pt.prototype.column=void 0;Pt.prototype.line=void 0;Pt.prototype.ancestors=void 0;Pt.prototype.cause=void 0;Pt.prototype.fatal=void 0;Pt.prototype.place=void 0;Pt.prototype.ruleId=void 0;Pt.prototype.source=void 0;const Rf={}.hasOwnProperty,lR=new Map,uR=/[A-Z]/g,cR=new Set(["table","tbody","thead","tfoot","tr"]),dR=new Set(["td","th"]),u1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hR(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=wR(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=xR(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Pf:ZN,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=c1(o,e,void 0);return a&&typeof a!="string"?a:o.create(e,o.Fragment,{children:a||void 0},void 0)}function c1(e,t,n){if(t.type==="element")return fR(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return pR(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return gR(e,t,n);if(t.type==="mdxjsEsm")return mR(e,t);if(t.type==="root")return yR(e,t,n);if(t.type==="text")return vR(e,t)}function fR(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Pf,e.schema=o),e.ancestors.push(t);const a=h1(e,t.tagName,!1),l=bR(e,t);let c=If(e,t);return cR.has(t.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!VN(d):!0})),d1(e,l,a,t),Of(l,c),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function pR(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Do(e,t.position)}function mR(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Do(e,t.position)}function gR(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Pf,e.schema=o),e.ancestors.push(t);const a=t.name===null?e.Fragment:h1(e,t.name,!0),l=kR(e,t),c=If(e,t);return d1(e,l,a,t),Of(l,c),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function yR(e,t,n){const r={};return Of(r,If(e,t)),e.create(t,e.Fragment,r,n)}function vR(e,t){return t.value}function d1(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Of(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function xR(e,t,n){return r;function r(o,a,l,c){const f=Array.isArray(l.children)?n:t;return c?f(a,l,c):f(a,l)}}function wR(e,t){return n;function n(r,o,a,l){const c=Array.isArray(a.children),d=Nf(r);return t(o,a,l,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function bR(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&Rf.call(t.properties,o)){const a=SR(e,o,t.properties[o]);if(a){const[l,c]=a;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&dR.has(t.tagName)?r=c:n[l]=c}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function kR(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else Do(e,t.position);else{const o=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,a=e.evaluater.evaluateExpression(c.expression)}else Do(e,t.position);else a=r.value===null?!0:r.value;n[o]=a}return n}function If(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:lR;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const d=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(d){const f=o.get(d)||0;l=d+"-"+f,o.set(d,f+1)}}const c=c1(e,a,l);c!==void 0&&n.push(c)}return n}function SR(e,t,n){const r=YN(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?UN(n):eR(n)),r.property==="style"){let o=typeof n=="object"?n:_R(e,String(n));return e.stylePropertyNameCase==="css"&&(o=ER(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?KN[r.property]||r.property:r.attribute,n]}}function _R(e,t){try{return oR(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new Pt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=u1+"#cannot-parse-style-attribute",o}}function h1(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let a=-1,l;for(;++a<o.length;){const c=V0(o[a])?{type:"Identifier",name:o[a]}:{type:"Literal",value:o[a]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(a&&c.type==="Literal"),optional:!1}:c}r=l}else r=V0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return Rf.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Do(e)}function Do(e,t){const n=new Pt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=u1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ER(e){const t={};let n;for(n in e)Rf.call(e,n)&&(t[TR(n)]=e[n]);return t}function TR(e){let t=e.replace(uR,CR);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function CR(e){return"-"+e.toLowerCase()}const Pd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},jR={};function AR(e,t){const n=jR,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return f1(e,r,o)}function f1(e,t,n){if(PR(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Z0(e.children,t,n)}return Array.isArray(e)?Z0(e,t,n):""}function Z0(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=f1(e[o],t,n);return r.join("")}function PR(e){return!!(e&&typeof e=="object")}const ev=document.createElement("i");function Lf(e){const t="&"+e+";";ev.innerHTML=t;const n=ev.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Mn(e,t,n,r){const o=e.length;let a=0,l;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function hn(e,t){return e.length>0?(Mn(e,e.length,0,t),e):t}const tv={}.hasOwnProperty;function NR(e){const t={};let n=-1;for(;++n<e.length;)RR(t,e[n]);return t}function RR(e,t){let n;for(n in t){const o=(tv.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){tv.call(o,l)||(o[l]=[]);const c=a[l];OR(o[l],Array.isArray(c)?c:c?[c]:[])}}}function OR(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Mn(e,0,0,r)}function p1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ti(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const In=Nr(/[A-Za-z]/),Zt=Nr(/[\dA-Za-z]/),IR=Nr(/[#-'*+\--9=?A-Z^-~]/);function Eh(e){return e!==null&&(e<32||e===127)}const Th=Nr(/\d/),LR=Nr(/[\dA-Fa-f]/),DR=Nr(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function Bt(e){return e!==null&&(e<0||e===32)}function Ue(e){return e===-2||e===-1||e===32}const MR=Nr(new RegExp("\\p{P}|\\p{S}","u")),UR=Nr(/\s/);function Nr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hi(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&Zt(e.charCodeAt(n+1))&&Zt(e.charCodeAt(n+2)))o=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const c=e.charCodeAt(n+1);a<56320&&c>56319&&c<57344?(l=String.fromCharCode(a,c),o=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+o+1,l=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function qe(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(d){return Ue(d)?(e.enter(n),c(d)):t(d)}function c(d){return Ue(d)&&a++<o?(e.consume(d),c):(e.exit(n),t(d))}}const zR={tokenize:FR};function FR(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),qe(e,t,"linePrefix")}function o(c){return e.enter("paragraph"),a(c)}function a(c){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Ce(c)?(e.consume(c),e.exit("chunkText"),a):(e.consume(c),l)}}const $R={tokenize:BR},nv={tokenize:VR};function BR(e){const t=this,n=[];let r=0,o,a,l;return c;function c(j){if(r<n.length){const D=n[r];return t.containerState=D[1],e.attempt(D[0].continuation,d,f)(j)}return f(j)}function d(j){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&P();const D=t.events.length;let $=D,O;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){O=t.events[$][1].end;break}E(r);let z=D;for(;z<t.events.length;)t.events[z][1].end={...O},z++;return Mn(t.events,$+1,0,t.events.slice(D)),t.events.length=z,f(j)}return c(j)}function f(j){if(r===n.length){if(!o)return v(j);if(o.currentConstruct&&o.currentConstruct.concrete)return b(j);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(nv,p,y)(j)}function p(j){return o&&P(),E(r),v(j)}function y(j){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,b(j)}function v(j){return t.containerState={},e.attempt(nv,w,b)(j)}function w(j){return r++,n.push([t.currentConstruct,t.containerState]),v(j)}function b(j){if(j===null){o&&P(),E(0),e.consume(j);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:a}),S(j)}function S(j){if(j===null){_(e.exit("chunkFlow"),!0),E(0),e.consume(j);return}return Ce(j)?(e.consume(j),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(j),S)}function _(j,D){const $=t.sliceStream(j);if(D&&$.push(null),j.previous=a,a&&(a.next=j),a=j,o.defineSkip(j.start),o.write($),t.parser.lazy[j.start.line]){let O=o.events.length;for(;O--;)if(o.events[O][1].start.offset<l&&(!o.events[O][1].end||o.events[O][1].end.offset>l))return;const z=t.events.length;let q=z,J,ie;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(J){ie=t.events[q][1].end;break}J=!0}for(E(r),O=z;O<t.events.length;)t.events[O][1].end={...ie},O++;Mn(t.events,q+1,0,t.events.slice(z)),t.events.length=O}}function E(j){let D=n.length;for(;D-- >j;){const $=n[D];t.containerState=$[1],$[0].exit.call(t,e)}n.length=j}function P(){o.write([null]),a=void 0,o=void 0,t.containerState._closeFlow=void 0}}function VR(e,t,n){return qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rv(e){if(e===null||Bt(e)||UR(e))return 1;if(MR(e))return 2}function Df(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const a=e[o].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Ch={name:"attention",resolveAll:qR,tokenize:HR};function qR(e,t){let n=-1,r,o,a,l,c,d,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const y={...e[r][1].end},v={...e[n][1].start};sv(y,-d),sv(v,d),l={type:d>1?"strongSequence":"emphasisSequence",start:y,end:{...e[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},a={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[r][1].end={...l.start},e[n][1].start={...c.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=hn(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=hn(f,[["enter",o,t],["enter",l,t],["exit",l,t],["enter",a,t]]),f=hn(f,Df(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=hn(f,[["exit",a,t],["enter",c,t],["exit",c,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=hn(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Mn(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HR(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=rv(r);let a;return l;function l(d){return a=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===a)return e.consume(d),c;const f=e.exit("attentionSequence"),p=rv(d),y=!p||p===2&&o||n.includes(d),v=!o||o===2&&p||n.includes(r);return f._open=!!(a===42?y:y&&(o||!v)),f._close=!!(a===42?v:v&&(p||!y)),t(d)}}function sv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const WR={name:"autolink",tokenize:KR};function KR(e,t,n){let r=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(w){return In(w)?(e.consume(w),l):w===64?n(w):f(w)}function l(w){return w===43||w===45||w===46||Zt(w)?(r=1,c(w)):f(w)}function c(w){return w===58?(e.consume(w),r=0,d):(w===43||w===45||w===46||Zt(w))&&r++<32?(e.consume(w),c):(r=0,f(w))}function d(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Eh(w)?n(w):(e.consume(w),d)}function f(w){return w===64?(e.consume(w),p):IR(w)?(e.consume(w),f):n(w)}function p(w){return Zt(w)?y(w):n(w)}function y(w){return w===46?(e.consume(w),r=0,p):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):v(w)}function v(w){if((w===45||Zt(w))&&r++<63){const b=w===45?v:y;return e.consume(w),b}return n(w)}}const au={partial:!0,tokenize:GR};function GR(e,t,n){return r;function r(a){return Ue(a)?qe(e,o,"linePrefix")(a):o(a)}function o(a){return a===null||Ce(a)?t(a):n(a)}}const m1={continuation:{tokenize:YR},exit:XR,name:"blockQuote",tokenize:JR};function JR(e,t,n){const r=this;return o;function o(l){if(l===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return Ue(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function YR(e,t,n){const r=this;return o;function o(l){return Ue(l)?qe(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(m1,t,n)(l)}}function XR(e){e.exit("blockQuote")}const g1={name:"characterEscape",tokenize:QR};function QR(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),o}function o(a){return DR(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const y1={name:"characterReference",tokenize:ZR};function ZR(e,t,n){const r=this;let o=0,a,l;return c;function c(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),d}function d(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),a=31,l=Zt,p(y))}function f(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=LR,p):(e.enter("characterReferenceValue"),a=7,l=Th,p(y))}function p(y){if(y===59&&o){const v=e.exit("characterReferenceValue");return l===Zt&&!Lf(r.sliceSerialize(v))?n(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(y)&&o++<a?(e.consume(y),p):n(y)}}const iv={partial:!0,tokenize:tO},ov={concrete:!0,name:"codeFenced",tokenize:eO};function eO(e,t,n){const r=this,o={partial:!0,tokenize:$};let a=0,l=0,c;return d;function d(O){return f(O)}function f(O){const z=r.events[r.events.length-1];return a=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,c=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(O)}function p(O){return O===c?(l++,e.consume(O),p):l<3?n(O):(e.exit("codeFencedFenceSequence"),Ue(O)?qe(e,y,"whitespace")(O):y(O))}function y(O){return O===null||Ce(O)?(e.exit("codeFencedFence"),r.interrupt?t(O):e.check(iv,S,D)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(O))}function v(O){return O===null||Ce(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(O)):Ue(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qe(e,w,"whitespace")(O)):O===96&&O===c?n(O):(e.consume(O),v)}function w(O){return O===null||Ce(O)?y(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Ce(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(O)):O===96&&O===c?n(O):(e.consume(O),b)}function S(O){return e.attempt(o,D,_)(O)}function _(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),E}function E(O){return a>0&&Ue(O)?qe(e,P,"linePrefix",a+1)(O):P(O)}function P(O){return O===null||Ce(O)?e.check(iv,S,D)(O):(e.enter("codeFlowValue"),j(O))}function j(O){return O===null||Ce(O)?(e.exit("codeFlowValue"),P(O)):(e.consume(O),j)}function D(O){return e.exit("codeFenced"),t(O)}function $(O,z,q){let J=0;return ie;function ie(Z){return O.enter("lineEnding"),O.consume(Z),O.exit("lineEnding"),re}function re(Z){return O.enter("codeFencedFence"),Ue(Z)?qe(O,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Z):Q(Z)}function Q(Z){return Z===c?(O.enter("codeFencedFenceSequence"),ye(Z)):q(Z)}function ye(Z){return Z===c?(J++,O.consume(Z),ye):J>=l?(O.exit("codeFencedFenceSequence"),Ue(Z)?qe(O,ne,"whitespace")(Z):ne(Z)):q(Z)}function ne(Z){return Z===null||Ce(Z)?(O.exit("codeFencedFence"),z(Z)):q(Z)}}}function tO(e,t,n){const r=this;return o;function o(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Nd={name:"codeIndented",tokenize:rO},nO={partial:!0,tokenize:sO};function rO(e,t,n){const r=this;return o;function o(f){return e.enter("codeIndented"),qe(e,a,"linePrefix",5)(f)}function a(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?l(f):n(f)}function l(f){return f===null?d(f):Ce(f)?e.attempt(nO,l,d)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Ce(f)?(e.exit("codeFlowValue"),l(f)):(e.consume(f),c)}function d(f){return e.exit("codeIndented"),t(f)}}function sO(e,t,n){const r=this;return o;function o(l){return r.parser.lazy[r.now().line]?n(l):Ce(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):qe(e,a,"linePrefix",5)(l)}function a(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):Ce(l)?o(l):n(l)}}const iO={name:"codeText",previous:aO,resolve:oO,tokenize:lO};function oO(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function aO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lO(e,t,n){let r=0,o,a;return l;function l(y){return e.enter("codeText"),e.enter("codeTextSequence"),c(y)}function c(y){return y===96?(e.consume(y),r++,c):(e.exit("codeTextSequence"),d(y))}function d(y){return y===null?n(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),d):y===96?(a=e.enter("codeTextSequence"),o=0,p(y)):Ce(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(y))}function f(y){return y===null||y===32||y===96||Ce(y)?(e.exit("codeTextData"),d(y)):(e.consume(y),f)}function p(y){return y===96?(e.consume(y),o++,p):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(y)):(a.type="codeTextData",f(y))}}class uO{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&so(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),so(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),so(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);so(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);so(this.left,n.reverse())}}}function so(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function v1(e){const t={};let n=-1,r,o,a,l,c,d,f;const p=new uO(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,a=0,a<d.length&&d[a][1].type==="lineEndingBlank"&&(a+=2),a<d.length&&d[a][1].type==="content"))for(;++a<d.length&&d[a][1].type!=="content";)d[a][1].type==="chunkText"&&(d[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,cO(p,n)),n=t[n],f=!0);else if(r[1]._container){for(a=n,o=void 0;a--;)if(l=p.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(o&&(p.get(o)[1].type="lineEndingBlank"),l[1].type="lineEnding",o=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;o&&(r[1].end={...p.get(o)[1].start},c=p.slice(o,n),c.unshift(r),p.splice(o,n-o+1,c))}}return Mn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function cO(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,d=[],f={};let p,y,v=-1,w=n,b=0,S=0;const _=[S];for(;w;){for(;e.get(++o)[1]!==w;);a.push(o),w._tokenizer||(p=r.sliceStream(w),w.next||p.push(null),y&&l.defineSkip(w.start),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),y=w,w=w.next}for(w=n;++v<c.length;)c[v][0]==="exit"&&c[v-1][0]==="enter"&&c[v][1].type===c[v-1][1].type&&c[v][1].start.line!==c[v][1].end.line&&(S=v+1,_.push(S),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(l.events=[],w?(w._tokenizer=void 0,w.previous=void 0):_.pop(),v=_.length;v--;){const E=c.slice(_[v],_[v+1]),P=a.pop();d.push([P,P+E.length-1]),e.splice(P,2,E)}for(d.reverse(),v=-1;++v<d.length;)f[b+d[v][0]]=b+d[v][1],b+=d[v][1]-d[v][0]-1;return f}const dO={resolve:fO,tokenize:pO},hO={partial:!0,tokenize:mO};function fO(e){return v1(e),e}function pO(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(c)}function o(c){return c===null?a(c):Ce(c)?e.check(hO,l,a)(c):(e.consume(c),o)}function a(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function mO(e,t,n){const r=this;return o;function o(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),qe(e,a,"linePrefix")}function a(l){if(l===null||Ce(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function x1(e,t,n,r,o,a,l,c,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return y;function y(E){return E===60?(e.enter(r),e.enter(o),e.enter(a),e.consume(E),e.exit(a),v):E===null||E===32||E===41||Eh(E)?n(E):(e.enter(r),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(E))}function v(E){return E===62?(e.enter(a),e.consume(E),e.exit(a),e.exit(o),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),w(E))}function w(E){return E===62?(e.exit("chunkString"),e.exit(c),v(E)):E===null||E===60||Ce(E)?n(E):(e.consume(E),E===92?b:w)}function b(E){return E===60||E===62||E===92?(e.consume(E),w):w(E)}function S(E){return!p&&(E===null||E===41||Bt(E))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(r),t(E)):p<f&&E===40?(e.consume(E),p++,S):E===41?(e.consume(E),p--,S):E===null||E===32||E===40||Eh(E)?n(E):(e.consume(E),E===92?_:S)}function _(E){return E===40||E===41||E===92?(e.consume(E),S):S(E)}}function w1(e,t,n,r,o,a){const l=this;let c=0,d;return f;function f(w){return e.enter(r),e.enter(o),e.consume(w),e.exit(o),e.enter(a),p}function p(w){return c>999||w===null||w===91||w===93&&!d||w===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(w):w===93?(e.exit(a),e.enter(o),e.consume(w),e.exit(o),e.exit(r),t):Ce(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||Ce(w)||c++>999?(e.exit("chunkString"),p(w)):(e.consume(w),d||(d=!Ue(w)),w===92?v:y)}function v(w){return w===91||w===92||w===93?(e.consume(w),c++,y):y(w)}}function b1(e,t,n,r,o,a){let l;return c;function c(v){return v===34||v===39||v===40?(e.enter(r),e.enter(o),e.consume(v),e.exit(o),l=v===40?41:v,d):n(v)}function d(v){return v===l?(e.enter(o),e.consume(v),e.exit(o),e.exit(r),t):(e.enter(a),f(v))}function f(v){return v===l?(e.exit(a),d(l)):v===null?n(v):Ce(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),qe(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===l||v===null||Ce(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?y:p)}function y(v){return v===l||v===92?(e.consume(v),p):p(v)}}function xo(e,t){let n;return r;function r(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Ue(o)?qe(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const gO={name:"definition",tokenize:vO},yO={partial:!0,tokenize:xO};function vO(e,t,n){const r=this;let o;return a;function a(w){return e.enter("definition"),l(w)}function l(w){return w1.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function c(w){return o=ti(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),d):n(w)}function d(w){return Bt(w)?xo(e,f)(w):f(w)}function f(w){return x1(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function p(w){return e.attempt(yO,y,y)(w)}function y(w){return Ue(w)?qe(e,v,"whitespace")(w):v(w)}function v(w){return w===null||Ce(w)?(e.exit("definition"),r.parser.defined.push(o),t(w)):n(w)}}function xO(e,t,n){return r;function r(c){return Bt(c)?xo(e,o)(c):n(c)}function o(c){return b1(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function a(c){return Ue(c)?qe(e,l,"whitespace")(c):l(c)}function l(c){return c===null||Ce(c)?t(c):n(c)}}const wO={name:"hardBreakEscape",tokenize:bO};function bO(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),o}function o(a){return Ce(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const kO={name:"headingAtx",resolve:SO,tokenize:_O};function SO(e,t){let n=e.length-2,r=3,o,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Mn(e,r,n-r+1,[["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t]])),e}function _O(e,t,n){let r=0;return o;function o(p){return e.enter("atxHeading"),a(p)}function a(p){return e.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(e.consume(p),l):p===null||Bt(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||Ce(p)?(e.exit("atxHeading"),t(p)):Ue(p)?qe(e,c,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),c(p))}function f(p){return p===null||p===35||Bt(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),f)}}const EO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],av=["pre","script","style","textarea"],TO={concrete:!0,name:"htmlFlow",resolveTo:AO,tokenize:PO},CO={partial:!0,tokenize:RO},jO={partial:!0,tokenize:NO};function AO(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function PO(e,t,n){const r=this;let o,a,l,c,d;return f;function f(C){return p(C)}function p(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),y}function y(C){return C===33?(e.consume(C),v):C===47?(e.consume(C),a=!0,S):C===63?(e.consume(C),o=3,r.interrupt?t:T):In(C)?(e.consume(C),l=String.fromCharCode(C),_):n(C)}function v(C){return C===45?(e.consume(C),o=2,w):C===91?(e.consume(C),o=5,c=0,b):In(C)?(e.consume(C),o=4,r.interrupt?t:T):n(C)}function w(C){return C===45?(e.consume(C),r.interrupt?t:T):n(C)}function b(C){const X="CDATA[";return C===X.charCodeAt(c++)?(e.consume(C),c===X.length?r.interrupt?t:Q:b):n(C)}function S(C){return In(C)?(e.consume(C),l=String.fromCharCode(C),_):n(C)}function _(C){if(C===null||C===47||C===62||Bt(C)){const X=C===47,ve=l.toLowerCase();return!X&&!a&&av.includes(ve)?(o=1,r.interrupt?t(C):Q(C)):EO.includes(l.toLowerCase())?(o=6,X?(e.consume(C),E):r.interrupt?t(C):Q(C)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(C):a?P(C):j(C))}return C===45||Zt(C)?(e.consume(C),l+=String.fromCharCode(C),_):n(C)}function E(C){return C===62?(e.consume(C),r.interrupt?t:Q):n(C)}function P(C){return Ue(C)?(e.consume(C),P):ie(C)}function j(C){return C===47?(e.consume(C),ie):C===58||C===95||In(C)?(e.consume(C),D):Ue(C)?(e.consume(C),j):ie(C)}function D(C){return C===45||C===46||C===58||C===95||Zt(C)?(e.consume(C),D):$(C)}function $(C){return C===61?(e.consume(C),O):Ue(C)?(e.consume(C),$):j(C)}function O(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),d=C,z):Ue(C)?(e.consume(C),O):q(C)}function z(C){return C===d?(e.consume(C),d=null,J):C===null||Ce(C)?n(C):(e.consume(C),z)}function q(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Bt(C)?$(C):(e.consume(C),q)}function J(C){return C===47||C===62||Ue(C)?j(C):n(C)}function ie(C){return C===62?(e.consume(C),re):n(C)}function re(C){return C===null||Ce(C)?Q(C):Ue(C)?(e.consume(C),re):n(C)}function Q(C){return C===45&&o===2?(e.consume(C),fe):C===60&&o===1?(e.consume(C),le):C===62&&o===4?(e.consume(C),N):C===63&&o===3?(e.consume(C),T):C===93&&o===5?(e.consume(C),oe):Ce(C)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(CO,V,ye)(C)):C===null||Ce(C)?(e.exit("htmlFlowData"),ye(C)):(e.consume(C),Q)}function ye(C){return e.check(jO,ne,V)(C)}function ne(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),Z}function Z(C){return C===null||Ce(C)?ye(C):(e.enter("htmlFlowData"),Q(C))}function fe(C){return C===45?(e.consume(C),T):Q(C)}function le(C){return C===47?(e.consume(C),l="",H):Q(C)}function H(C){if(C===62){const X=l.toLowerCase();return av.includes(X)?(e.consume(C),N):Q(C)}return In(C)&&l.length<8?(e.consume(C),l+=String.fromCharCode(C),H):Q(C)}function oe(C){return C===93?(e.consume(C),T):Q(C)}function T(C){return C===62?(e.consume(C),N):C===45&&o===2?(e.consume(C),T):Q(C)}function N(C){return C===null||Ce(C)?(e.exit("htmlFlowData"),V(C)):(e.consume(C),N)}function V(C){return e.exit("htmlFlow"),t(C)}}function NO(e,t,n){const r=this;return o;function o(l){return Ce(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function RO(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(au,t,n)}}const OO={name:"htmlText",tokenize:IO};function IO(e,t,n){const r=this;let o,a,l;return c;function c(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),d}function d(T){return T===33?(e.consume(T),f):T===47?(e.consume(T),$):T===63?(e.consume(T),j):In(T)?(e.consume(T),q):n(T)}function f(T){return T===45?(e.consume(T),p):T===91?(e.consume(T),a=0,b):In(T)?(e.consume(T),P):n(T)}function p(T){return T===45?(e.consume(T),w):n(T)}function y(T){return T===null?n(T):T===45?(e.consume(T),v):Ce(T)?(l=y,le(T)):(e.consume(T),y)}function v(T){return T===45?(e.consume(T),w):y(T)}function w(T){return T===62?fe(T):T===45?v(T):y(T)}function b(T){const N="CDATA[";return T===N.charCodeAt(a++)?(e.consume(T),a===N.length?S:b):n(T)}function S(T){return T===null?n(T):T===93?(e.consume(T),_):Ce(T)?(l=S,le(T)):(e.consume(T),S)}function _(T){return T===93?(e.consume(T),E):S(T)}function E(T){return T===62?fe(T):T===93?(e.consume(T),E):S(T)}function P(T){return T===null||T===62?fe(T):Ce(T)?(l=P,le(T)):(e.consume(T),P)}function j(T){return T===null?n(T):T===63?(e.consume(T),D):Ce(T)?(l=j,le(T)):(e.consume(T),j)}function D(T){return T===62?fe(T):j(T)}function $(T){return In(T)?(e.consume(T),O):n(T)}function O(T){return T===45||Zt(T)?(e.consume(T),O):z(T)}function z(T){return Ce(T)?(l=z,le(T)):Ue(T)?(e.consume(T),z):fe(T)}function q(T){return T===45||Zt(T)?(e.consume(T),q):T===47||T===62||Bt(T)?J(T):n(T)}function J(T){return T===47?(e.consume(T),fe):T===58||T===95||In(T)?(e.consume(T),ie):Ce(T)?(l=J,le(T)):Ue(T)?(e.consume(T),J):fe(T)}function ie(T){return T===45||T===46||T===58||T===95||Zt(T)?(e.consume(T),ie):re(T)}function re(T){return T===61?(e.consume(T),Q):Ce(T)?(l=re,le(T)):Ue(T)?(e.consume(T),re):J(T)}function Q(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),o=T,ye):Ce(T)?(l=Q,le(T)):Ue(T)?(e.consume(T),Q):(e.consume(T),ne)}function ye(T){return T===o?(e.consume(T),o=void 0,Z):T===null?n(T):Ce(T)?(l=ye,le(T)):(e.consume(T),ye)}function ne(T){return T===null||T===34||T===39||T===60||T===61||T===96?n(T):T===47||T===62||Bt(T)?J(T):(e.consume(T),ne)}function Z(T){return T===47||T===62||Bt(T)?J(T):n(T)}function fe(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):n(T)}function le(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),H}function H(T){return Ue(T)?qe(e,oe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):oe(T)}function oe(T){return e.enter("htmlTextData"),l(T)}}const Mf={name:"labelEnd",resolveAll:UO,resolveTo:zO,tokenize:FO},LO={tokenize:$O},DO={tokenize:BO},MO={tokenize:VO};function UO(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Mn(e,0,e.length,n),e}function zO(e,t){let n=e.length,r=0,o,a,l,c;for(;n--;)if(o=e[n][1],a){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(a=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(l=n);const d={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},p={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",d,t],["enter",f,t]],c=hn(c,e.slice(a+1,a+r+3)),c=hn(c,[["enter",p,t]]),c=hn(c,Df(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),c=hn(c,[["exit",p,t],e[l-2],e[l-1],["exit",f,t]]),c=hn(c,e.slice(l+1)),c=hn(c,[["exit",d,t]]),Mn(e,a,e.length,c),e}function FO(e,t,n){const r=this;let o=r.events.length,a,l;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){a=r.events[o][1];break}return c;function c(v){return a?a._inactive?y(v):(l=r.parser.defined.includes(ti(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):n(v)}function d(v){return v===40?e.attempt(LO,p,l?p:y)(v):v===91?e.attempt(DO,p,l?f:y)(v):l?p(v):y(v)}function f(v){return e.attempt(MO,p,y)(v)}function p(v){return t(v)}function y(v){return a._balanced=!0,n(v)}}function $O(e,t,n){return r;function r(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return Bt(y)?xo(e,a)(y):a(y)}function a(y){return y===41?p(y):x1(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function l(y){return Bt(y)?xo(e,d)(y):p(y)}function c(y){return n(y)}function d(y){return y===34||y===39||y===40?b1(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):p(y)}function f(y){return Bt(y)?xo(e,p)(y):p(y)}function p(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),t):n(y)}}function BO(e,t,n){const r=this;return o;function o(c){return w1.call(r,e,a,l,"reference","referenceMarker","referenceString")(c)}function a(c){return r.parser.defined.includes(ti(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function VO(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),o}function o(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const qO={name:"labelStartImage",resolveAll:Mf.resolveAll,tokenize:HO};function HO(e,t,n){const r=this;return o;function o(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),a}function a(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const WO={name:"labelStartLink",resolveAll:Mf.resolveAll,tokenize:KO};function KO(e,t,n){const r=this;return o;function o(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Rd={name:"lineEnding",tokenize:GO};function GO(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),qe(e,t,"linePrefix")}}const Cl={name:"thematicBreak",tokenize:JO};function JO(e,t,n){let r=0,o;return a;function a(f){return e.enter("thematicBreak"),l(f)}function l(f){return o=f,c(f)}function c(f){return f===o?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||Ce(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===o?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),Ue(f)?qe(e,c,"whitespace")(f):c(f))}}const zt={continuation:{tokenize:ZO},exit:tI,name:"list",tokenize:QO},YO={partial:!0,tokenize:nI},XO={partial:!0,tokenize:eI};function QO(e,t,n){const r=this,o=r.events[r.events.length-1];let a=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,l=0;return c;function c(w){const b=r.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||w===r.containerState.marker:Th(w)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Cl,n,f)(w):f(w);if(!r.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(w)}return n(w)}function d(w){return Th(w)&&++l<10?(e.consume(w),d):(!r.interrupt||l<2)&&(r.containerState.marker?w===r.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),f(w)):n(w)}function f(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||w,e.check(au,r.interrupt?n:p,e.attempt(YO,v,y))}function p(w){return r.containerState.initialBlankLine=!0,a++,v(w)}function y(w){return Ue(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),v):n(w)}function v(w){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function ZO(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(au,o,a);function o(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qe(e,t,"listItemIndent",r.containerState.size+1)(c)}function a(c){return r.containerState.furtherBlankLines||!Ue(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(XO,t,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,qe(e,e.attempt(zt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function eI(e,t,n){const r=this;return qe(e,o,"listItemIndent",r.containerState.size+1);function o(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function tI(e){e.exit(this.containerState.type)}function nI(e,t,n){const r=this;return qe(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(a){const l=r.events[r.events.length-1];return!Ue(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const lv={name:"setextUnderline",resolveTo:rI,tokenize:sI};function rI(e,t){let n=e.length,r,o,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",a?(e.splice(o,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function sI(e,t,n){const r=this;let o;return a;function a(f){let p=r.events.length,y;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){y=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||y)?(e.enter("setextHeadingLine"),o=f,l(f)):n(f)}function l(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===o?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),Ue(f)?qe(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Ce(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const iI={tokenize:oI};function oI(e){const t=this,n=e.attempt(au,r,e.attempt(this.parser.constructs.flowInitial,o,qe(e,e.attempt(this.parser.constructs.flow,o,e.attempt(dO,o)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const aI={resolveAll:S1()},lI=k1("string"),uI=k1("text");function k1(e){return{resolveAll:S1(e==="text"?cI:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],a=n.attempt(o,l,c);return l;function l(p){return f(p)?a(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return f(p)?(n.exit("data"),a(p)):(n.consume(p),d)}function f(p){if(p===null)return!0;const y=o[p];let v=-1;if(y)for(;++v<y.length;){const w=y[v];if(!w.previous||w.previous.call(r,r.previous))return!0}return!1}}}function S1(e){return t;function t(n,r){let o=-1,a;for(;++o<=n.length;)a===void 0?n[o]&&n[o][1].type==="data"&&(a=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==a+2&&(n[a][1].end=n[o-1][1].end,n.splice(a+2,o-a-2),o=a+2),a=void 0);return e?e(n,r):n}}function cI(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let a=o.length,l=-1,c=0,d;for(;a--;){const f=o[a];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(f===-2)d=!0,c++;else if(f!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const f={type:n===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const dI={42:zt,43:zt,45:zt,48:zt,49:zt,50:zt,51:zt,52:zt,53:zt,54:zt,55:zt,56:zt,57:zt,62:m1},hI={91:gO},fI={[-2]:Nd,[-1]:Nd,32:Nd},pI={35:kO,42:Cl,45:[lv,Cl],60:TO,61:lv,95:Cl,96:ov,126:ov},mI={38:y1,92:g1},gI={[-5]:Rd,[-4]:Rd,[-3]:Rd,33:qO,38:y1,42:Ch,60:[WR,OO],91:WO,92:[wO,g1],93:Mf,95:Ch,96:iO},yI={null:[Ch,aI]},vI={null:[42,95]},xI={null:[]},wI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vI,contentInitial:hI,disable:xI,document:dI,flow:pI,flowInitial:fI,insideSpan:yI,string:mI,text:gI},Symbol.toStringTag,{value:"Module"}));function bI(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},a=[];let l=[],c=[];const d={attempt:z($),check:z(O),consume:P,enter:j,exit:D,interrupt:z(O,{interrupt:!0})},f={code:null,containerState:{},defineSkip:S,events:[],now:b,parser:e,previous:null,sliceSerialize:v,sliceStream:w,write:y};let p=t.tokenize.call(f,d);return t.resolveAll&&a.push(t),f;function y(re){return l=hn(l,re),_(),l[l.length-1]!==null?[]:(q(t,0),f.events=Df(a,f.events,f),f.events)}function v(re,Q){return SI(w(re),Q)}function w(re){return kI(l,re)}function b(){const{_bufferIndex:re,_index:Q,line:ye,column:ne,offset:Z}=r;return{_bufferIndex:re,_index:Q,line:ye,column:ne,offset:Z}}function S(re){o[re.line]=re.column,ie()}function _(){let re;for(;r._index<l.length;){const Q=l[r._index];if(typeof Q=="string")for(re=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===re&&r._bufferIndex<Q.length;)E(Q.charCodeAt(r._bufferIndex));else E(Q)}}function E(re){p=p(re)}function P(re){Ce(re)?(r.line++,r.column=1,r.offset+=re===-3?2:1,ie()):re!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=re}function j(re,Q){const ye=Q||{};return ye.type=re,ye.start=b(),f.events.push(["enter",ye,f]),c.push(ye),ye}function D(re){const Q=c.pop();return Q.end=b(),f.events.push(["exit",Q,f]),Q}function $(re,Q){q(re,Q.from)}function O(re,Q){Q.restore()}function z(re,Q){return ye;function ye(ne,Z,fe){let le,H,oe,T;return Array.isArray(ne)?V(ne):"tokenize"in ne?V([ne]):N(ne);function N(ae){return je;function je(Ae){const Me=Ae!==null&&ae[Ae],ot=Ae!==null&&ae.null,Un=[...Array.isArray(Me)?Me:Me?[Me]:[],...Array.isArray(ot)?ot:ot?[ot]:[]];return V(Un)(Ae)}}function V(ae){return le=ae,H=0,ae.length===0?fe:C(ae[H])}function C(ae){return je;function je(Ae){return T=J(),oe=ae,ae.partial||(f.currentConstruct=ae),ae.name&&f.parser.constructs.disable.null.includes(ae.name)?ve():ae.tokenize.call(Q?Object.assign(Object.create(f),Q):f,d,X,ve)(Ae)}}function X(ae){return re(oe,T),Z}function ve(ae){return T.restore(),++H<le.length?C(le[H]):fe}}}function q(re,Q){re.resolveAll&&!a.includes(re)&&a.push(re),re.resolve&&Mn(f.events,Q,f.events.length-Q,re.resolve(f.events.slice(Q),f)),re.resolveTo&&(f.events=re.resolveTo(f.events,f))}function J(){const re=b(),Q=f.previous,ye=f.currentConstruct,ne=f.events.length,Z=Array.from(c);return{from:ne,restore:fe};function fe(){r=re,f.previous=Q,f.currentConstruct=ye,f.events.length=ne,c=Z,ie()}}function ie(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function kI(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,a=t.end._bufferIndex;let l;if(n===o)l=[e[n].slice(r,a)];else{if(l=e.slice(n,o),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}a>0&&l.push(e[o].slice(0,a))}return l}function SI(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
|
|
103
|
+
`;break}case-3:{l=`\r
|
|
104
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&o)continue;l=" ";break}default:l=String.fromCharCode(a)}o=a===-2,r.push(l)}return r.join("")}function _I(e){const r={constructs:NR([wI,...(e||{}).extensions||[]]),content:o(zR),defined:[],document:o($R),flow:o(iI),lazy:{},string:o(lI),text:o(uI)};return r;function o(a){return l;function l(c){return bI(r,a,c)}}}function EI(e){for(;!v1(e););return e}const uv=/[\0\t\n\r]/g;function TI(){let e=1,t="",n=!0,r;return o;function o(a,l,c){const d=[];let f,p,y,v,w;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),y=0,t="",n&&(a.charCodeAt(0)===65279&&y++,n=void 0);y<a.length;){if(uv.lastIndex=y,f=uv.exec(a),v=f&&f.index!==void 0?f.index:a.length,w=a.charCodeAt(v),!f){t=a.slice(y);break}if(w===10&&y===v&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),y<v&&(d.push(a.slice(y,v)),e+=v-y),w){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}y=v+1}return c&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const CI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jI(e){return e.replace(CI,AI)}function AI(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),a=o===120||o===88;return p1(n.slice(a?2:1),a?16:10)}return Lf(n)||e}const _1={}.hasOwnProperty;function PI(e,t,n){return typeof t!="string"&&(n=t,t=void 0),NI(n)(EI(_I(n).document().write(TI()(e,t,!0))))}function NI(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ds),autolinkProtocol:J,autolinkEmail:J,atxHeading:a(pi),blockQuote:a(ot),characterEscape:J,characterReference:J,codeFenced:a(Un),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Un,l),codeText:a(Jo,l),codeTextData:J,data:J,codeFlowValue:J,definition:a(us),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(fi),hardBreakEscape:a(mi),hardBreakTrailing:a(mi),htmlFlow:a(cs,l),htmlFlowData:J,htmlText:a(cs,l),htmlTextData:J,image:a(Yo),label:l,link:a(ds),listItem:a(tr),listItemValue:v,listOrdered:a(er,y),listUnordered:a(er),paragraph:a(gi),reference:C,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(pi),strong:a(Xo),thematicBreak:a(Zo)},exit:{atxHeading:d(),atxHeadingSequence:$,autolink:d(),autolinkEmail:Me,autolinkProtocol:Ae,blockQuote:d(),characterEscapeValue:ie,characterReferenceMarkerHexadecimal:ve,characterReferenceMarkerNumeric:ve,characterReferenceValue:ae,characterReference:je,codeFenced:d(_),codeFencedFence:S,codeFencedFenceInfo:w,codeFencedFenceMeta:b,codeFlowValue:ie,codeIndented:d(E),codeText:d(Z),codeTextData:ie,data:ie,definition:d(),definitionDestinationString:D,definitionLabelString:P,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(Q),hardBreakTrailing:d(Q),htmlFlow:d(ye),htmlFlowData:ie,htmlText:d(ne),htmlTextData:ie,image:d(le),label:oe,labelText:H,lineEnding:re,link:d(fe),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:X,resourceDestinationString:T,resourceTitleString:N,resource:V,setextHeading:d(q),setextHeadingLineSequence:z,setextHeadingText:O,strong:d(),thematicBreak:d()}};E1(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let se={type:"root",children:[]};const _e={stack:[se],tokenStack:[],config:t,enter:c,exit:f,buffer:l,resume:p,data:n},Re=[];let Ie=-1;for(;++Ie<W.length;)if(W[Ie][1].type==="listOrdered"||W[Ie][1].type==="listUnordered")if(W[Ie][0]==="enter")Re.push(Ie);else{const gt=Re.pop();Ie=o(W,gt,Ie)}for(Ie=-1;++Ie<W.length;){const gt=t[W[Ie][0]];_1.call(gt,W[Ie][1].type)&>[W[Ie][1].type].call(Object.assign({sliceSerialize:W[Ie][2].sliceSerialize},_e),W[Ie][1])}if(_e.tokenStack.length>0){const gt=_e.tokenStack[_e.tokenStack.length-1];(gt[1]||cv).call(_e,void 0,gt[0])}for(se.position={start:Sr(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Sr(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Ie=-1;++Ie<t.transforms.length;)se=t.transforms[Ie](se)||se;return se}function o(W,se,_e){let Re=se-1,Ie=-1,gt=!1,zn,nn,nr,Rr;for(;++Re<=_e;){const yt=W[Re];switch(yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{yt[0]==="enter"?Ie++:Ie--,Rr=void 0;break}case"lineEndingBlank":{yt[0]==="enter"&&(zn&&!Rr&&!Ie&&!nr&&(nr=Re),Rr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Rr=void 0}if(!Ie&&yt[0]==="enter"&&yt[1].type==="listItemPrefix"||Ie===-1&&yt[0]==="exit"&&(yt[1].type==="listUnordered"||yt[1].type==="listOrdered")){if(zn){let Tn=Re;for(nn=void 0;Tn--;){const qt=W[Tn];if(qt[1].type==="lineEnding"||qt[1].type==="lineEndingBlank"){if(qt[0]==="exit")continue;nn&&(W[nn][1].type="lineEndingBlank",gt=!0),qt[1].type="lineEnding",nn=Tn}else if(!(qt[1].type==="linePrefix"||qt[1].type==="blockQuotePrefix"||qt[1].type==="blockQuotePrefixWhitespace"||qt[1].type==="blockQuoteMarker"||qt[1].type==="listItemIndent"))break}nr&&(!nn||nr<nn)&&(zn._spread=!0),zn.end=Object.assign({},nn?W[nn][1].start:yt[1].end),W.splice(nn||Re,0,["exit",zn,yt[2]]),Re++,_e++}if(yt[1].type==="listItemPrefix"){const Tn={type:"listItem",_spread:!1,start:Object.assign({},yt[1].start),end:void 0};zn=Tn,W.splice(Re,0,["enter",Tn,yt[2]]),Re++,_e++,nr=void 0,Rr=!0}}}return W[se][1]._spread=gt,_e}function a(W,se){return _e;function _e(Re){c.call(this,W(Re),Re),se&&se.call(this,Re)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(W,se,_e){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([se,_e||void 0]),W.position={start:Sr(se.start),end:void 0}}function d(W){return se;function se(_e){W&&W.call(this,_e),f.call(this,_e)}}function f(W,se){const _e=this.stack.pop(),Re=this.tokenStack.pop();if(Re)Re[0].type!==W.type&&(se?se.call(this,W,Re[0]):(Re[1]||cv).call(this,W,Re[0]));else throw new Error("Cannot close `"+W.type+"` ("+vo({start:W.start,end:W.end})+"): it’s not open");_e.position.end=Sr(W.end)}function p(){return AR(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function v(W){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function w(){const W=this.resume(),se=this.stack[this.stack.length-1];se.lang=W}function b(){const W=this.resume(),se=this.stack[this.stack.length-1];se.meta=W}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W.replace(/(\r?\n|\r)$/g,"")}function P(W){const se=this.resume(),_e=this.stack[this.stack.length-1];_e.label=se,_e.identifier=ti(this.sliceSerialize(W)).toLowerCase()}function j(){const W=this.resume(),se=this.stack[this.stack.length-1];se.title=W}function D(){const W=this.resume(),se=this.stack[this.stack.length-1];se.url=W}function $(W){const se=this.stack[this.stack.length-1];if(!se.depth){const _e=this.sliceSerialize(W).length;se.depth=_e}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function z(W){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function J(W){const _e=this.stack[this.stack.length-1].children;let Re=_e[_e.length-1];(!Re||Re.type!=="text")&&(Re=Qo(),Re.position={start:Sr(W.start),end:void 0},_e.push(Re)),this.stack.push(Re)}function ie(W){const se=this.stack.pop();se.value+=this.sliceSerialize(W),se.position.end=Sr(W.end)}function re(W){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _e=se.children[se.children.length-1];_e.position.end=Sr(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(J.call(this,W),ie.call(this,W))}function Q(){this.data.atHardBreak=!0}function ye(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W}function ne(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W}function Z(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W}function fe(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=se,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function le(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=se,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function H(W){const se=this.sliceSerialize(W),_e=this.stack[this.stack.length-2];_e.label=jI(se),_e.identifier=ti(se).toLowerCase()}function oe(){const W=this.stack[this.stack.length-1],se=this.resume(),_e=this.stack[this.stack.length-1];if(this.data.inReference=!0,_e.type==="link"){const Re=W.children;_e.children=Re}else _e.alt=se}function T(){const W=this.resume(),se=this.stack[this.stack.length-1];se.url=W}function N(){const W=this.resume(),se=this.stack[this.stack.length-1];se.title=W}function V(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function X(W){const se=this.resume(),_e=this.stack[this.stack.length-1];_e.label=se,_e.identifier=ti(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function ve(W){this.data.characterReferenceType=W.type}function ae(W){const se=this.sliceSerialize(W),_e=this.data.characterReferenceType;let Re;_e?(Re=p1(se,_e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=Lf(se);const Ie=this.stack[this.stack.length-1];Ie.value+=Re}function je(W){const se=this.stack.pop();se.position.end=Sr(W.end)}function Ae(W){ie.call(this,W);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(W)}function Me(W){ie.call(this,W);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(W)}function ot(){return{type:"blockquote",children:[]}}function Un(){return{type:"code",lang:null,meta:null,value:""}}function Jo(){return{type:"inlineCode",value:""}}function us(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function fi(){return{type:"emphasis",children:[]}}function pi(){return{type:"heading",depth:0,children:[]}}function mi(){return{type:"break"}}function cs(){return{type:"html",value:""}}function Yo(){return{type:"image",title:null,url:"",alt:null}}function ds(){return{type:"link",title:null,url:"",children:[]}}function er(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function tr(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function gi(){return{type:"paragraph",children:[]}}function Xo(){return{type:"strong",children:[]}}function Qo(){return{type:"text",value:""}}function Zo(){return{type:"thematicBreak"}}}function Sr(e){return{line:e.line,column:e.column,offset:e.offset}}function E1(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?E1(e,r):RI(e,r)}}function RI(e,t){let n;for(n in t)if(_1.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function cv(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+vo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+vo({start:t.start,end:t.end})+") is still open")}function OI(e){const t=this;t.parser=n;function n(r){return PI(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function II(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function LI(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
105
|
+
`}]}function DI(e,t){const n=t.value?t.value+`
|
|
106
|
+
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function MI(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function UI(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zI(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=hi(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let l,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=a+1,c+=1,e.footnoteCounts.set(r,c);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function FI(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $I(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function T1(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),a=o[0];a&&a.type==="text"?a.value="["+a.value:o.unshift({type:"text",value:"["});const l=o[o.length-1];return l&&l.type==="text"?l.value+=r:o.push({type:"text",value:r}),o}function BI(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return T1(e,t);const o={src:hi(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const a={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,a),e.applyData(t,a)}function VI(e,t){const n={src:hi(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function qI(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function HI(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return T1(e,t);const o={href:hi(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const a={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function WI(e,t){const n={href:hi(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function KI(e,t,n){const r=e.all(t),o=n?GI(n):C1(t),a={},l=[];if(typeof t.checked=="boolean"){const p=r[0];let y;p&&p.type==="element"&&p.tagName==="p"?y=p:(y={type:"element",tagName:"p",properties:{},children:[]},r.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(o||c!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
|
|
107
|
+
`}),p.type==="element"&&p.tagName==="p"&&!o?l.push(...p.children):l.push(p)}const d=r[r.length-1];d&&(o||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
|
|
108
|
+
`});const f={type:"element",tagName:"li",properties:a,children:l};return e.patch(t,f),e.applyData(t,f)}function GI(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=C1(n[r])}return t}function C1(e){const t=e.spread;return t??e.children.length>1}function JI(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const l=r[o];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function YI(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XI(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function QI(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZI(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),o.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=Nf(t.children[1]),d=a1(t.children[t.children.length-1]);c&&d&&(l.position={start:c,end:d}),o.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,a),e.applyData(t,a)}function e4(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:t.children.length;let d=-1;const f=[];for(;++d<c;){const y=t.children[d],v={},w=l?l[d]:void 0;w&&(v.align=w);let b={type:"element",tagName:a,properties:v,children:[]};y&&(b.children=e.all(y),e.patch(y,b),b=e.applyData(y,b)),f.push(b)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function t4(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const dv=9,hv=32;function n4(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const a=[];for(;r;)a.push(fv(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return a.push(fv(t.slice(o),o>0,!1)),a.join("")}function fv(e,t,n){let r=0,o=e.length;if(t){let a=e.codePointAt(r);for(;a===dv||a===hv;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(o-1);for(;a===dv||a===hv;)o--,a=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function r4(e,t){const n={type:"text",value:n4(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function s4(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const i4={blockquote:II,break:LI,code:DI,delete:MI,emphasis:UI,footnoteReference:zI,heading:FI,html:$I,imageReference:BI,image:VI,inlineCode:qI,linkReference:HI,link:WI,listItem:KI,list:JI,paragraph:YI,root:XI,strong:QI,table:ZI,tableCell:t4,tableRow:e4,text:r4,thematicBreak:s4,toml:yl,yaml:yl,definition:yl,footnoteDefinition:yl};function yl(){}const j1=-1,lu=0,wo=1,Bl=2,Uf=3,zf=4,Ff=5,$f=6,A1=7,P1=8,pv=typeof self=="object"?self:globalThis,o4=(e,t)=>{const n=(o,a)=>(e.set(a,o),o),r=o=>{if(e.has(o))return e.get(o);const[a,l]=t[o];switch(a){case lu:case j1:return n(l,o);case wo:{const c=n([],o);for(const d of l)c.push(r(d));return c}case Bl:{const c=n({},o);for(const[d,f]of l)c[r(d)]=r(f);return c}case Uf:return n(new Date(l),o);case zf:{const{source:c,flags:d}=l;return n(new RegExp(c,d),o)}case Ff:{const c=n(new Map,o);for(const[d,f]of l)c.set(r(d),r(f));return c}case $f:{const c=n(new Set,o);for(const d of l)c.add(r(d));return c}case A1:{const{name:c,message:d}=l;return n(new pv[c](d),o)}case P1:return n(BigInt(l),o);case"BigInt":return n(Object(BigInt(l)),o);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new pv[a](l),o)};return r},mv=e=>o4(new Map,e)(0),Vs="",{toString:a4}={},{keys:l4}=Object,io=e=>{const t=typeof e;if(t!=="object"||!e)return[lu,t];const n=a4.call(e).slice(8,-1);switch(n){case"Array":return[wo,Vs];case"Object":return[Bl,Vs];case"Date":return[Uf,Vs];case"RegExp":return[zf,Vs];case"Map":return[Ff,Vs];case"Set":return[$f,Vs];case"DataView":return[wo,n]}return n.includes("Array")?[wo,n]:n.includes("Error")?[A1,n]:[Bl,n]},vl=([e,t])=>e===lu&&(t==="function"||t==="symbol"),u4=(e,t,n,r)=>{const o=(l,c)=>{const d=r.push(l)-1;return n.set(c,d),d},a=l=>{if(n.has(l))return n.get(l);let[c,d]=io(l);switch(c){case lu:{let p=l;switch(d){case"bigint":c=P1,p=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return o([j1],l)}return o([c,p],l)}case wo:{if(d){let v=l;return d==="DataView"?v=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(v=new Uint8Array(l)),o([d,[...v]],l)}const p=[],y=o([c,p],l);for(const v of l)p.push(a(v));return y}case Bl:{if(d)switch(d){case"BigInt":return o([d,l.toString()],l);case"Boolean":case"Number":case"String":return o([d,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const p=[],y=o([c,p],l);for(const v of l4(l))(e||!vl(io(l[v])))&&p.push([a(v),a(l[v])]);return y}case Uf:return o([c,l.toISOString()],l);case zf:{const{source:p,flags:y}=l;return o([c,{source:p,flags:y}],l)}case Ff:{const p=[],y=o([c,p],l);for(const[v,w]of l)(e||!(vl(io(v))||vl(io(w))))&&p.push([a(v),a(w)]);return y}case $f:{const p=[],y=o([c,p],l);for(const v of l)(e||!vl(io(v)))&&p.push(a(v));return y}}const{message:f}=l;return o([c,{name:d,message:f}],l)};return a},gv=(e,{json:t,lossy:n}={})=>{const r=[];return u4(!(t||n),!!t,new Map,r)(e),r},Vl=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?mv(gv(e,t)):structuredClone(e):(e,t)=>mv(gv(e,t));function c4(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function d4(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function h4(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||c4,r=e.options.footnoteBackLabel||d4,o=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const p=e.all(f),y=String(f.identifier).toUpperCase(),v=hi(y.toLowerCase());let w=0;const b=[],S=e.footnoteCounts.get(y);for(;S!==void 0&&++w<=S;){b.length>0&&b.push({type:"text",value:" "});let P=typeof n=="string"?n:n(d,w);typeof P=="string"&&(P={type:"text",value:P}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,w),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const _=p[p.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const P=_.children[_.children.length-1];P&&P.type==="text"?P.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...b)}else p.push(...b);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(p,!0)};e.patch(f,E),c.push(E)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Vl(l),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
109
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
|
|
110
|
+
`}]}}const N1=(function(e){if(e==null)return g4;if(typeof e=="function")return uu(e);if(typeof e=="object")return Array.isArray(e)?f4(e):p4(e);if(typeof e=="string")return m4(e);throw new Error("Expected function, string, or object as test")});function f4(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=N1(e[n]);return uu(r);function r(...o){let a=-1;for(;++a<t.length;)if(t[a].apply(this,o))return!0;return!1}}function p4(e){const t=e;return uu(n);function n(r){const o=r;let a;for(a in e)if(o[a]!==t[a])return!1;return!0}}function m4(e){return uu(t);function t(n){return n&&n.type===e}}function uu(e){return t;function t(n,r,o){return!!(y4(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function g4(){return!0}function y4(e){return e!==null&&typeof e=="object"&&"type"in e}const R1=[],v4=!0,yv=!1,x4="skip";function w4(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const a=N1(o),l=r?-1:1;c(e,void 0,[])();function c(d,f,p){const y=d&&typeof d=="object"?d:{};if(typeof y.type=="string"){const w=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(d.type+(w?"<"+w+">":""))+")"})}return v;function v(){let w=R1,b,S,_;if((!t||a(d,f,p[p.length-1]||void 0))&&(w=b4(n(d,p)),w[0]===yv))return w;if("children"in d&&d.children){const E=d;if(E.children&&w[0]!==x4)for(S=(r?E.children.length:-1)+l,_=p.concat(E);S>-1&&S<E.children.length;){const P=E.children[S];if(b=c(P,S,_)(),b[0]===yv)return b;S=typeof b[1]=="number"?b[1]:S+l}}return w}}}function b4(e){return Array.isArray(e)?e:typeof e=="number"?[v4,e]:e==null?R1:[e]}function O1(e,t,n,r){let o,a,l;typeof t=="function"&&typeof n!="function"?(a=void 0,l=t,o=n):(a=t,l=n,o=r),w4(e,a,c,o);function c(d,f){const p=f[f.length-1],y=p?p.children.indexOf(d):void 0;return l(d,y,p)}}const jh={}.hasOwnProperty,k4={};function S4(e,t){const n=t||k4,r=new Map,o=new Map,a=new Map,l={...i4,...n.handlers},c={all:f,applyData:E4,definitionById:r,footnoteById:o,footnoteCounts:a,footnoteOrder:[],handlers:l,one:d,options:n,patch:_4,wrap:C4};return O1(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const y=p.type==="definition"?r:o,v=String(p.identifier).toUpperCase();y.has(v)||y.set(v,p)}}),c;function d(p,y){const v=p.type,w=c.handlers[v];if(jh.call(c.handlers,v)&&w)return w(c,p,y);if(c.options.passThrough&&c.options.passThrough.includes(v)){if("children"in p){const{children:S,..._}=p,E=Vl(_);return E.children=c.all(p),E}return Vl(p)}return(c.options.unknownHandler||T4)(c,p,y)}function f(p){const y=[];if("children"in p){const v=p.children;let w=-1;for(;++w<v.length;){const b=c.one(v[w],p);if(b){if(w&&v[w-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=vv(b.value)),!Array.isArray(b)&&b.type==="element")){const S=b.children[0];S&&S.type==="text"&&(S.value=vv(S.value))}Array.isArray(b)?y.push(...b):y.push(b)}}}return y}}function _4(e,t){e.position&&(t.position=aR(e))}function E4(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,Vl(a)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function T4(e,t){const n=t.data||{},r="value"in t&&!(jh.call(n,"hProperties")||jh.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function C4(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
111
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
112
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
113
|
+
`}),n}function vv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function xv(e,t){const n=S4(e,t),r=n.one(e,void 0),o=h4(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&a.children.push({type:"text",value:`
|
|
114
|
+
`},o),a}function j4(e,t){return e&&"run"in e?async function(n,r){const o=xv(n,{file:r,...t});await e.run(o,r)}:function(n,r){return xv(n,{file:r,...e||t})}}function wv(e){if(e)throw e}var Od,bv;function A4(){if(bv)return Od;bv=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},a=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),y=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!y)return!1;var v;for(v in f);return typeof v>"u"||e.call(f,v)},l=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},c=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Od=function d(){var f,p,y,v,w,b,S=arguments[0],_=1,E=arguments.length,P=!1;for(typeof S=="boolean"&&(P=S,S=arguments[1]||{},_=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});_<E;++_)if(f=arguments[_],f!=null)for(p in f)y=c(S,p),v=c(f,p),S!==v&&(P&&v&&(a(v)||(w=o(v)))?(w?(w=!1,b=y&&o(y)?y:[]):b=y&&a(y)?y:{},l(S,{name:p,newValue:d(P,b,v)})):typeof v<"u"&&l(S,{name:p,newValue:v}));return S},Od}var P4=A4();const Id=ql(P4);function Ah(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function N4(){const e=[],t={run:n,use:r};return t;function n(...o){let a=-1;const l=o.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...o);function c(d,...f){const p=e[++a];let y=-1;if(d){l(d);return}for(;++y<o.length;)(f[y]===null||f[y]===void 0)&&(f[y]=o[y]);o=f,p?R4(p,c)(...f):l(null,...f)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function R4(e,t){let n;return r;function r(...l){const c=e.length>l.length;let d;c&&l.push(o);try{d=e.apply(this,l)}catch(f){const p=f;if(c&&n)throw p;return o(p)}c||(d&&d.then&&typeof d.then=="function"?d.then(a,o):d instanceof Error?o(d):a(d))}function o(l,...c){n||(n=!0,t(l,...c))}function a(l){o(null,l)}}const On={basename:O4,dirname:I4,extname:L4,join:D4,sep:"/"};function O4(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Go(e);let n=0,r=-1,o=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(a){n=o+1;break}}else r<0&&(a=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,c=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(a){n=o+1;break}}else l<0&&(a=!0,l=o+1),c>-1&&(e.codePointAt(o)===t.codePointAt(c--)?c<0&&(r=o):(c=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function I4(e){if(Go(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function L4(e){Go(e);let t=e.length,n=-1,r=0,o=-1,a=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?o<0?o=t:a!==1&&(a=1):o>-1&&(a=-1)}return o<0||n<0||a===0||a===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function D4(...e){let t=-1,n;for(;++t<e.length;)Go(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":M4(n)}function M4(e){Go(e);const t=e.codePointAt(0)===47;let n=U4(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function U4(e,t){let n="",r=0,o=-1,a=0,l=-1,c,d;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(o===l-1||a===1))if(o!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),o=l,a=0;continue}}else if(n.length>0){n="",r=0,o=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),r=l-o-1;o=l,a=0}else c===46&&a>-1?a++:a=-1}return n}function Go(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const z4={cwd:F4};function F4(){return"/"}function Ph(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $4(e){if(typeof e=="string")e=new URL(e);else if(!Ph(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return B4(e)}function B4(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Ld=["history","path","basename","stem","extname","dirname"];class I1{constructor(t){let n;t?Ph(t)?n={path:t}:typeof t=="string"||V4(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":z4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ld.length;){const a=Ld[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let o;for(o in n)Ld.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?On.basename(this.path):void 0}set basename(t){Md(t,"basename"),Dd(t,"basename"),this.path=On.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?On.dirname(this.path):void 0}set dirname(t){kv(this.basename,"dirname"),this.path=On.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?On.extname(this.path):void 0}set extname(t){if(Dd(t,"extname"),kv(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=On.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ph(t)&&(t=$4(t)),Md(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?On.basename(this.path,this.extname):void 0}set stem(t){Md(t,"stem"),Dd(t,"stem"),this.path=On.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new Pt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Dd(e,t){if(e&&e.includes(On.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+On.sep+"`")}function Md(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function kv(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function V4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const q4=(function(e){const r=this.constructor.prototype,o=r[e],a=function(){return o.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),H4={}.hasOwnProperty;class Bf extends q4{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=N4()}copy(){const t=new Bf;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Id(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Fd("data",this.frozen),this.namespace[t]=n,this):H4.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Fd("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=xl(t),r=this.parser||this.Parser;return Ud("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ud("process",this.parser||this.Parser),zd("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(a,l){const c=xl(t),d=r.parse(c);r.run(d,c,function(p,y,v){if(p||!y||!v)return f(p);const w=y,b=r.stringify(w,v);G4(b)?v.value=b:v.result=b,f(p,v)});function f(p,y){p||!y?l(p):a?a(y):n(void 0,y)}}}processSync(t){let n=!1,r;return this.freeze(),Ud("processSync",this.parser||this.Parser),zd("processSync",this.compiler||this.Compiler),this.process(t,o),_v("processSync","process",n),r;function o(a,l){n=!0,wv(a),r=l}}run(t,n,r){Sv(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,c){const d=xl(n);o.run(t,d,f);function f(p,y,v){const w=y||t;p?c(p):l?l(w):r(void 0,w,v)}}}runSync(t,n){let r=!1,o;return this.run(t,n,a),_v("runSync","run",r),o;function a(l,c){wv(l),o=c,r=!0}}stringify(t,n){this.freeze();const r=xl(n),o=this.compiler||this.Compiler;return zd("stringify",o),Sv(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Fd("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...y]=f;d(p,y)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(f.plugins),f.settings&&(o.settings=Id(!0,o.settings,f.settings))}function c(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const y=f[p];a(y)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,p){let y=-1,v=-1;for(;++y<r.length;)if(r[y][0]===f){v=y;break}if(v===-1)r.push([f,...p]);else if(p.length>0){let[w,...b]=p;const S=r[v][1];Ah(S)&&Ah(w)&&(w=Id(!0,S,w)),r[v]=[f,w,...b]}}}}const W4=new Bf().freeze();function Ud(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fd(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Sv(e){if(!Ah(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _v(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xl(e){return K4(e)?e:new I1(e)}function K4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function G4(e){return typeof e=="string"||J4(e)}function J4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Y4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ev=[],Tv={allowDangerousHtml:!0},X4=/^(https?|ircs?|mailto|xmpp)$/i,Q4=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Z4(e){const t=eL(e),n=tL(e);return nL(t.runSync(t.parse(n),n),e)}function eL(e){const t=e.rehypePlugins||Ev,n=e.remarkPlugins||Ev,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Tv}:Tv;return W4().use(OI).use(n).use(j4,r).use(t)}function tL(e){const t=e.children||"",n=new I1;return typeof t=="string"&&(n.value=t),n}function nL(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,a=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,d=t.urlTransform||rL;for(const p of Q4)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+Y4+p.id,void 0);return O1(e,f),hR(e,{Fragment:g.Fragment,components:o,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function f(p,y,v){if(p.type==="raw"&&v&&typeof y=="number")return l?v.children.splice(y,1):v.children[y]={type:"text",value:p.value},y;if(p.type==="element"){let w;for(w in Pd)if(Object.hasOwn(Pd,w)&&Object.hasOwn(p.properties,w)){const b=p.properties[w],S=Pd[w];(S===null||S.includes(p.tagName))&&(p.properties[w]=d(String(b||""),w,p))}}if(p.type==="element"){let w=n?!n.includes(p.tagName):a?a.includes(p.tagName):!1;if(!w&&r&&typeof y=="number"&&(w=!r(p,y,v)),w&&v&&typeof y=="number")return c&&p.children?v.children.splice(y,1,...p.children):v.children.splice(y,1),y}}}function rL(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||X4.test(e.slice(0,t))?e:""}function sL({isOpen:e,onClose:t}){const[n,r]=L.useState(""),[o,a]=L.useState(!0);L.useEffect(()=>{e&&l()},[e]);const l=async()=>{a(!0);try{const d=await(await fetch("/CHANGELOG.md")).text();r(d)}catch(c){console.error("Failed to load changelog:",c),r(`# Error
|
|
115
|
+
|
|
116
|
+
Failed to load changelog.`)}finally{a(!1)}};return g.jsx(_n,{children:e&&g.jsxs(g.Fragment,{children:[g.jsx(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50"}),g.jsx(ze.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",damping:25,stiffness:300},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:g.jsxs("div",{className:"glass w-full max-w-3xl max-h-[80vh] overflow-hidden pointer-events-auto shadow-2xl",children:[g.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Kk,{size:24,className:"text-primary"}),g.jsx("h2",{className:"text-xl font-bold",children:"Release Notes"})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors",children:g.jsx(Cr,{size:20,className:"text-fg/60"})})]}),g.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar max-h-[calc(80vh-88px)]",children:o?g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent"})}):g.jsx(Z4,{components:{h1:({children:c})=>g.jsx("h1",{className:"text-2xl font-bold text-fg mb-6 mt-0",children:c}),h2:({children:c})=>g.jsx("h2",{className:"text-xl font-bold text-fg mt-8 mb-3 pb-2 border-b border-border first:mt-0",children:c}),h3:({children:c})=>g.jsx("h3",{className:"text-lg font-bold text-primary mt-6 mb-2",children:c}),p:({children:c})=>g.jsx("p",{className:"text-sm text-fg/70 mb-3 leading-relaxed",children:c}),ul:({children:c})=>g.jsx("ul",{className:"list-none space-y-1 mb-4 ml-0",children:c}),li:({children:c})=>g.jsx("li",{className:"text-sm text-fg/80 ml-4 mb-1 before:content-['•'] before:mr-2 before:text-primary",children:c}),a:({href:c,children:d})=>g.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 underline transition-colors",children:d}),code:({children:c})=>g.jsx("code",{className:"bg-surface/50 text-accent px-1.5 py-0.5 rounded text-xs font-mono border border-border",children:c}),strong:({children:c})=>g.jsx("strong",{className:"font-bold text-fg",children:c})},children:n})})]})})]})})}class iL{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}playTone(t,n,r=.3){if(this.enabled)try{const o=this.getAudioContext(),a=o.createOscillator(),l=o.createGain();a.connect(l),l.connect(o.destination),a.frequency.value=t,a.type="sine",l.gain.setValueAtTime(r,o.currentTime),l.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),a.start(o.currentTime),a.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(t,n=.3){if(!this.enabled)return;let r=0;t.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},r),r+=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 oo=new iL;function oL(){const[e,t]=L.useState([]),[n,r]=L.useState([]),[o,a]=L.useState("discovery"),[l,c]=L.useState(!1),[d,f]=L.useState(null),[p,y]=L.useState(!0),[v,w]=L.useState(!B0),[b,S]=L.useState(!0),[_,E]=L.useState(!1),[P,j]=L.useState(!1),[D,$]=L.useState(null),[O,z]=L.useState(!1),[q,J]=L.useState(!1),[ie,re]=L.useState(!1),[Q,ye]=L.useState(!0),[ne,Z]=L.useState(()=>localStorage.getItem("theme")||"dark"),fe=L.useRef(null);L.useMemo(()=>{const N=n.length;let V=0,C=0,X=null;for(const je of n){V+=je.score,je.score>C&&(C=je.score);const Ae=new Date(je.date);(!X||Ae>new Date(X.date))&&(X=je)}const ve=N?Math.round(V/N):0,ae=X?new Date(X.date):null;return{total:N,average:ve,top:C,latestTimestamp:ae,latestTitle:X?.title??X?.category??null}},[n]),L.useEffect(()=>{(async()=>{if(!B0){w(!0),y(!1);return}try{const{data:C,error:X}=await Ee.from("init_state").select("is_initialized").single();X?(console.warn("[App] Init check error (might be fresh DB):",X),X.code==="42P01"&&S(!1)):S(C.is_initialized>0);const{data:{session:ve}}=await Ee.auth.getSession();f(ve?.user??null)}catch(C){console.error("[App] Status check failed:",C)}finally{y(!1)}})();const{data:{subscription:V}}=Ee.auth.onAuthStateChange((C,X)=>{f(X?.user??null)});return()=>V.unsubscribe()},[]),L.useEffect(()=>{document.documentElement.setAttribute("data-theme",ne),localStorage.setItem("theme",ne)},[ne]);const[le,H]=L.useState({});L.useEffect(()=>{const N=async()=>{if(!d)return;const{data:C}=await Ee.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",d.id).maybeSingle();C&&H(C)};N();const V=setInterval(N,2e3);return()=>clearInterval(V)},[d,O]),L.useEffect(()=>{if(!d)return;(async()=>{const{data:C}=await Ee.from("alchemy_settings").select("sound_enabled").eq("user_id",d.id).maybeSingle();if(C){const X=C.sound_enabled??!0;ye(X),oo.setEnabled(X)}})();const V=Ee.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${d.id}`},C=>{const X=C.new;X.agent_state==="Mining"&&!q&&(J(!0),re(!0),Q&&oo.syncStart()),X.agent_state==="Signal"&&Q&&oo.signalFound(),X.agent_state==="Completed"&&(J(!1),Q&&(X.metadata?.errors>0?oo.error():oo.syncComplete()),setTimeout(()=>{re(!1)},5e3),oe())}).subscribe();return()=>{Ee.removeChannel(V)}},[d,q,Q]),L.useEffect(()=>{const N=new EventSource("/events");return N.onmessage=V=>{const C=JSON.parse(V.data);C.type==="history"?t(X=>[...C.data,...X].slice(0,100)):t(X=>[C,...X].slice(0,100))},oe(),()=>N.close()},[d]),L.useEffect(()=>{fe.current&&fe.current.scrollIntoView({behavior:"smooth"})},[e]);const oe=async()=>{try{if(d){const{data:V,error:C}=await Ee.from("signals").select("*").order("created_at",{ascending:!1});if(!C&&V){r(V.map(X=>({id:X.id,title:X.title,score:X.score,summary:X.summary,date:X.created_at,category:X.category,entities:X.entities})));return}}const N=await He.get("/api/signals");r(N.data)}catch(N){console.error("Failed to fetch signals",N)}},T=async()=>{c(!0);try{await He.post("/api/mine"),oe()}catch(N){console.error("Mining failed:",N)}finally{c(!1)}};return p?g.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:g.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):v?g.jsx(Gw,{onComplete:()=>w(!1)}):d?g.jsx(hN,{children:g.jsx(gN,{children:g.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[g.jsxs(ze.aside,{animate:{width:_?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[g.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${_?"justify-center":""}`,children:[g.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:g.jsx(is,{className:"text-white fill-current",size:24})}),!_&&g.jsx(ze.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),g.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[g.jsx(wl,{active:o==="discovery",onClick:()=>a("discovery"),icon:g.jsx(cS,{size:20}),label:"Discovery",collapsed:_}),g.jsx(wl,{active:o==="engine",onClick:()=>a("engine"),icon:g.jsx(Oh,{size:20}),label:"Engine",collapsed:_}),g.jsx(wl,{active:o==="logs",onClick:()=>a("logs"),icon:g.jsx(Vd,{size:20}),label:"System Logs",collapsed:_}),g.jsx(wl,{active:o==="account",onClick:()=>a("account"),icon:g.jsx(Lh,{size:20}),label:"Account",collapsed:_})]}),g.jsx("div",{className:"px-3 pb-2",children:g.jsxs("button",{onClick:()=>Z(ne==="dark"?"light":"dark"),className:`w-full flex items-center ${_?"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:_?ne==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:ne==="dark"?g.jsx(wS,{size:18}):g.jsx(mS,{size:18})}),!_&&g.jsx(ze.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:ne==="dark"?"Light Mode":"Dark Mode"})]})}),g.jsxs("div",{className:"px-3 pb-3",children:[g.jsx("button",{onClick:()=>E(!_),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 ${_?"justify-center":"gap-3"}`,children:_?g.jsx(eS,{size:20}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:g.jsx(Zk,{size:20})}),g.jsx("span",{children:"Collapse"})]})}),g.jsxs("button",{onClick:()=>j(!0),className:"w-full flex items-center justify-center gap-2 px-3 py-2 mt-2 text-[10px] font-mono text-fg/30 hover:text-primary hover:bg-surface/30 rounded-lg transition-all group",title:"View Changelog",children:[!_&&g.jsxs(g.Fragment,{children:[g.jsx(Bd,{size:12,className:"group-hover:text-primary transition-colors"}),g.jsxs("span",{children:["v","1.0.16"]})]}),_&&g.jsx(Bd,{size:14,className:"group-hover:text-primary transition-colors"})]})]})]}),g.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[g.jsxs("div",{children:[g.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),g.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),g.jsxs("div",{className:"flex gap-2",children:[g.jsxs("button",{onClick:()=>z(!0),className:"px-6 py-3 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[g.jsx(vS,{size:16}),g.jsxs("div",{className:"flex flex-col items-start",children:[g.jsx("span",{children:"Sync Settings"}),(le.sync_start_date||le.last_sync_checkpoint)&&g.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:le.sync_start_date?`From: ${new Date(le.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:le.last_sync_checkpoint?`Checkpoint: ${new Date(le.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:""})]})]}),g.jsxs("button",{onClick:T,disabled:q,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-105 active:scale-95 transition-all flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",children:[g.jsx(Ih,{size:18,className:q?"animate-spin":""}),q?"Syncing...":"Sync History"]})]})]}),g.jsx(MN,{onOpenUrl:N=>window.open(N,"_blank","noopener,noreferrer"),onCopyText:N=>{navigator.clipboard.writeText(N)}})]}),o==="engine"&&g.jsx(mN,{}),o==="account"&&g.jsx(kN,{}),o==="logs"&&g.jsx(jN,{}),g.jsx(vN,{isExpanded:ie,onToggle:()=>re(!ie)})]}),g.jsx(TN,{signal:D,onClose:()=>$(null)}),g.jsx(CN,{isOpen:O,onClose:()=>z(!1)}),g.jsx(sL,{isOpen:P,onClose:()=>j(!1)})]})})}):g.jsx(uN,{onAuthSuccess:()=>oe(),isInitialized:b})}function wl({active:e,icon:t,label:n,onClick:r,collapsed:o}){return g.jsx("button",{onClick:r,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${e?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?bo.cloneElement(t,{className:e?"text-primary":""}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:bo.cloneElement(t,{className:e?"text-primary":""})}),g.jsx(ze.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function aL(){He.interceptors.request.use(async e=>{try{const{data:{session:t}}=await Ee.auth.getSession();t?.access_token&&(e.headers.Authorization=`Bearer ${t.access_token}`);const n=Tf();n&&(e.headers["x-supabase-url"]=n.url,e.headers["x-supabase-key"]=n.anonKey)}catch(t){console.error("[Axios] Error injecting headers:",t)}return e})}aL();Uk.createRoot(document.getElementById("root")).render(g.jsx(bo.StrictMode,{children:g.jsx(oL,{})}));
|